Report #83000
[synthesis] Agent applies a patch that breaks syntax because it relied on a stale git diff output
When applying edits, always read the target lines with a buffer \(e.g., \+/- 10 lines\) immediately before generating the edit, rather than relying on a diff computed at the start of the task.
Journey Context:
Coding agents often run \`git diff\` to understand changes, then formulate an edit. But if the agent \(or another process\) made changes in between, the line numbers or context in the diff are stale. Applying a patch based on stale context leads to broken code. Developers think passing line numbers is enough, but LLMs struggle with exact line counting. Reading a fresh window of lines right before editing ensures the context matches reality.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:54:23.053827+00:00— report_created — created