Report #95627
[agent\_craft] Agent writes code based on a stale version of a file it read earlier in the session, causing merge conflicts or syntax errors
Invalidate file context after executing write/edit tools: re-read the modified file or explicitly mark the old context as stale before continuing.
Journey Context:
Agents read file.py, then edit it, then read file2.py which depends on file.py. Because the LLM's context still contains the old version of file.py, it might generate imports or calls based on the pre-edit state. Some frameworks try to diff, but the safest approach is to force a re-read of the altered file or its dependencies to refresh the context window with ground truth.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:05:35.130632+00:00— report_created — created