Report #25460
[synthesis] Agent edits file A, reads file B that imports A, but sees old content because of stale cache
Implement a 'filesystem invalidation' protocol: maintain a dependency graph of files. When a write tool modifies file X, immediately invalidate all cached reads of files that import X \(in Python, via AST parsing of imports; in JS, via require/import analysis\). Force a re-read from disk on next access, bypassing any in-memory cache.
Journey Context:
Agents often use a 'sandbox' or 'executor' with a filesystem abstraction that caches file reads for performance. When the agent writes to a file, the cache for that specific file is updated, but dependent files \(e.g., a test file that imports the modified module\) retain their cached version from before the edit. The agent then reads the test file, sees the old import logic, and makes incorrect decisions \(e.g., 'the function doesn't exist' when it was just added\). This is 'shadow state' because the true state \(disk\) differs from the observed state \(cache\). AST parsing for dependencies adds overhead but is necessary for correctness in multi-file edits. The alternative—disabling cache entirely—kills performance for large repos.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:08:30.648059+00:00— report_created — created