Repository navigation
fix(graph): invalidate cached context after atomic file replacement - #577
Frankie-Xu wants to merge 1 commit into
Conversation
🌱 graft blast radius1 area changed → 7 areas can be affected. 11 dependent symbols, depth 2. flowchart TB
A0(("CLI Initialization<br/>2 symbols"))
A1(("Corpus Loading<br/>2 symbols"))
A2(("Pull Request Review<br/>2 symbols"))
A3(("Workspace Graph Traversal<br/>2 symbols"))
A4(("MCP Tool Execution<br/>1 symbol"))
AX(("2 smaller areas<br/>2 symbols"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2,A3,A4 reached;
classDef tail fill:#EEF2F3,stroke:#9AA4A9,stroke-width:1px,color:#3A4247;
class AX tail;
Who knows this code — 2 people across 8 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 11 dependent symbols, grouped by areaCLI Initialization — 2 symbols in 1 file
Corpus Loading — 2 symbols in 1 file
Pull Request Review — 2 symbols in 2 files
Workspace Graph Traversal — 2 symbols in 2 files
MCP Tool Execution — 1 symbol in 1 file
Blast Search — 1 symbol in 1 file
Grep Search — 1 symbol in 1 file
Test signal per changed area — 1 ✗Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
3 test suites also reference this code3 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
When a long-lived process has cached the graph or ask sidecar, an external atomic replacement with the same file size and mtime leaves the old parsed value cached. Repairing malformed JSON by such a replacement can also keep returning cached null. Both uncached production readers already see the replacement bytes in the regressions.
Extend the existing file stamp with device, inode and ctime. The next load observes the replacement, while subsequent unchanged loads retain the shared parsed object. Public loader interfaces, null semantics, per-path isolation and explicit invalidation remain unchanged. This fixes stale Agent context after file replacement; it does not provide a content-hash guarantee for in-place writes whose entire observed stamp is unchanged.
Validation: the exact complete source closure on main
fe30ead39d5e6f0c921018d364da2bdbc9d4b3adis unchanged from the independently reviewed baseline. The observed baseline has 6 passes and 4 causal failures, and the same observed regression with the fix has 10/10 passes. The final upstream regression has 10/10 on both the original candidate and the actual main-based isolated checkout (macOS arm64, Node26.5.0, one worker). Tests use real production writers/readers and filesystem rename, including same-mtime/size replacement, malformed JSON repair, warm reuse, missing/removal/recreation, invalidation and root isolation. Linux/Windows replay entry points are prepared but have not run. No local full-suite, MCP end-to-end or performance result is claimed in this local validation.This is independent of #561 root routing and #399 ingestion. A read-only file-list review of all119 public open PRs at collection time found no change to the loader or this new test; this does not rule out unpublished work. Developed with AI assistance; patch, causal evidence and independent review are preserved locally.
Candidate commit:
3e3885ea430d77015bc676059ed63359b6cb7771; its two source/test files are the exact reviewed and locally validated patch.Hosted validation and shared CI blocker (2026-10-09):
The Ubuntu test job passed on this PR source: 1366 passed, 0 failed, 1 skipped. All 10 tests in the changed regression file appear as passing in the hosted log. Node 24 WASM regression also passed. This is hosted Ubuntu evidence; the separate finite platform replay entry has not run, and no local Windows or extra Git-version matrix is claimed.
CodeQL
analyzefails before scanning because initialization uses4.37.8 while analysis uses4.38.1 (Loaded a configuration file for version ...). The existing independent #562 tracks that workflow pin mismatch. No workflow patch, rerun or unrelated CI change is included here.Hosted Windows validation (2026-10-09): the Windows test job also passed: 1361 passed, 0 failed, 6 skipped. All 10 cases in this PR's changed regression file match passing TAP entries on Windows, including the actual filesystem/Git assertions. This adds hosted platform evidence; the separate baseline/candidate replay entry and extra Git-version matrix remain unexecuted.