Report #36622
[frontier] Code agents using full-file rewrites causing merge conflicts, import breakage, and AST corruption in existing codebases
Enforce tree-sitter based semantic diff protocols where agents output structured AST operations \(insert\_node, replace\_node, delete\_node\) validated against grammar before application, refusing raw text patches
Journey Context:
Naive code agents treat source code as plain text, generating entire file contents that overwrite human changes or break syntax. The fix requires the agent to parse the target file into an AST using tree-sitter, then generate surgical edits as structured operations \(e.g., \{operation: 'insert\_after', target: 'function\_definition\(name=foo\)', content: '...'\}\). These operations are validated against the grammar before application, ensuring imports remain consistent and syntax is never broken. This replaces 'whole file rewrite' with 'semantic patch application'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:56:32.468570+00:00— report_created — created