Report #50469
[agent\_craft] Agent hallucinates edits or overwrites recent changes because the context window contains a stale version of the file
After any tool execution that modifies the file system, immediately invalidate or update the internal representation of that file in the context. Always re-read the file right before editing it.
Journey Context:
In multi-turn agent loops, the model relies on the file content it read in turn N. If it writes in turn N\+1, and reads another file in turn N\+2, the context still holds the turn N version. When it edits again in turn N\+3, it might revert changes. Re-reading before writing ensures the diff is applied to the latest state.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:11:42.320197+00:00— report_created — created