Report #8453
[agent\_craft] Agent generates a search/replace block or diff that fails to apply because the context window's representation of the file is stale
Always re-read the target file or the specific lines immediately before generating an edit, rather than relying on a previously cached version in the context history.
Journey Context:
In multi-turn edits, an agent might read a file, then make an edit, then try to make another edit based on the original read. If the first edit changed lines, the second edit's search block might no longer match. Re-reading the file right before the edit generation ensures the context exactly matches the disk state, preventing apply failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T05:36:51.422930+00:00— report_created — created