Manuscript Offprint

arXiv:2609.00227

Don't Let the Model Write the YAML: Deterministic, Minimal-Diff GitOps Remediation from LLM-Proposed Field Changes

Pruthvi Davineni

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Pruthvi Davineni

Independent Researcher

pruthvi.davineni@gmail.com

Abstract—LLM agents increasingly diagnose production incidents and propose remediations. In a GitOps workflow, applying such a fix means editing a version-controlled configuration file. The obvious implementation, having the model author the edited file or a diff of it, is the one practitioners reach for first. We evaluate that choice on real Kubernetes manifests and find that which failure you get depends on how the model is asked and how capable it is, but that no text-generation strategy is suitable for unattended automation. Asking a model for a unified diff is unsafe: under strict patching almost none apply, but that is an artifact: a tolerant patch tool (GNU patch --fuzz) applies 96% of the same diffs, yet silently misapplies ~1 in 7 (14–20%), landing the change at the wrong place with no error signal. Asking a model to rewrite the whole file is capability-dependent: a small model reflows and corrupts the file, while a frontier model is usually correct, but is non-deterministic (the same request silently drops a field or edits a neighbor on a fraction of tasks) and must regenerate the entire file, so its cost is O(file size)O(\text{file size}) per edit no matter how small the change.

We present an alternative that separates the semantic decision (which resource, which field, which value) from the syntactic act of editing the file. The agent emits only a structured field-change intent; a deterministic pipeline indexes manifests by Kubernetes (kind, name), locates the target scalar's exact character span using the YAML parser's node position marks, and replaces only that span in the raw text. Because the file is never re-serialized, the diff is minimal by construction (a single scalar), formatting and comments are preserved, and the edit is correct and deterministic independent of the model: the same result whether driven by a small model or a frontier one, at O(1)O(1) generation cost (a fixed field-change intent, independent of file size) rather than the O(file size)O(\text{file size}) cost of regenerating the file. The contribution is not the span-edit primitive (structured editing is well known) but the pairing of an LLM-proposed intent with a deterministic, fail-closed application contract for GitOps. We implement it in KubeAstra (Apache-2.0) and release the benchmark (corpus, oracle, harness). Our claim is scoped to faithful application of a known change; whether the change is the right one is left to human PR review.

Index Terms—GitOps, LLM agents, configuration management, Kubernetes, automated program repair, deterministic editing, YAML.

1. Introduction

LLM agents now propose infrastructure fixes, and GitOps (Argo CD, Flux) [10, 11, 12] makes the Git repository the source of truth: to "apply the fix" is to edit a manifest and open a pull request. The naïve path, where the model writes

the new file or a diff, is the one everyone reaches for, and, as we show, the one that fails or hides a latent hazard.

This paper makes a narrow, testable claim about the application step, deliberately separated from the (harder, human-reviewed) question of whether the proposed fix is correct. Given a known, correct semantic change ("api-gateway needs spec.replicas: 5"), how should the system turn it into bytes on disk? We compare three text-generation strategies against a deterministic one, across a small and a frontier model, on real manifests.

References (11)