Report #26323
[synthesis] Agent deletes and rewrites entire file from scratch for a minor bugfix
Constrain the agent to use search-and-replace or diff-based patching tools rather than full-file-write tools. Limit the maximum percentage of a file that can be modified in a single step.
Journey Context:
Full file rewrites are 'easier' for the LLM because it doesn't have to calculate exact line numbers or context. However, it destroys implicit edge-case logic and often breaks existing passing tests. Diff-based patching is harder for the LLM to format perfectly but preserves the codebase's integrity. The tradeoff is format strictness vs. code stability. The right call is strict diff/patch application with syntax validation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T22:35:05.581688+00:00— report_created — created