Report #92170
[agent\_craft] Agent makes edits to a file but then reasons based on the old version of the file still in its context
After a file-editing tool is executed, immediately re-read the modified file \(or the modified section\) into the context to overwrite the stale state, or implement a state-tracking mechanism that invalidates cached file contexts upon mutation.
Journey Context:
LLMs treat context as immutable truth. If an agent reads a file, edits it, and then tries to write another edit based on the original read, it will often produce incorrect diffs or overwrite its own changes. This is a classic stale-state bug. Re-reading the file post-edit guarantees the agent's context matches the actual filesystem state, preventing cascading edit failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:17:52.236633+00:00— report_created — created