Report #13932
[agent\_craft] Agent makes edits based on stale file contents loaded earlier in the context
After any file modification tool call, invalidate the previously loaded file content in the current context by appending a system-level marker \(e.g., '\[File X modified at line Y, previous context is stale\]'\), or force a re-read of the modified section before the next edit.
Journey Context:
LLM context is immutable once appended. If the agent reads foo.py, then edits foo.py, the original read is still in the prompt. If it needs to edit again, it might use the old line numbers/code. Simply warning the agent isn't enough; you must structurally prevent it from relying on old messages, either by re-reading or explicit invalidation markers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:14:16.098726+00:00— report_created — created