|
| 1 | +# v3.19.2 — stale codebase-graph gate |
| 2 | + |
| 3 | +Follow-up to the 3.19.1 ingest deadlock fix. The deadlock guard stopped the |
| 4 | +hang; this stops the *stale graph* it could leave behind. |
| 5 | + |
| 6 | +## What it fixes |
| 7 | + |
| 8 | +`/cortex-visualize` (and `ingest_codebase`) could serve an **out-of-date AST**: |
| 9 | +the cached code-graph was reused as long as the graph directory merely *existed*, |
| 10 | +with no check that the codebase hadn't changed since it was built. A graph built |
| 11 | +before your last edits was reused indefinitely — the "graph shows an old version |
| 12 | +of the analysis" report. |
| 13 | + |
| 14 | +## The change |
| 15 | + |
| 16 | +New `graph_is_fresh(project_path, graph_path)`: compares the graph artefact's own |
| 17 | +build mtime against the newest source file under the project, via a bounded, |
| 18 | +ignore-pruned walk that early-exits on the first newer file (vendored/build dirs |
| 19 | +— `.git`, `node_modules`, `target`, `.venv`, `search_index`, … — are skipped so |
| 20 | +they can't trip false staleness). `find_cached_graph` now skips a stale (or |
| 21 | +non-materialised) graph, so ingestion falls through to a fresh `analyze_codebase`. |
| 22 | +It errs fresh on uncertainty (absent project root / unreadable graph) to avoid |
| 23 | +needless re-analysis. Scope: ingestion only — the visualizer's roster resolver is |
| 24 | +untouched. |
| 25 | + |
| 26 | +## Recovering an already-bad cache |
| 27 | + |
| 28 | +If a prior run left a *half-built* graph (recent, so the freshness gate treats it |
| 29 | +as current), force one clean rebuild: |
| 30 | + |
| 31 | +``` |
| 32 | +ingest_codebase(project_path="<repo>", force_reindex=true) |
| 33 | +# or: rm -rf ~/.cache/cortex/code-graphs/<project>-*/ |
| 34 | +``` |
| 35 | + |
| 36 | +With the 3.19.1 deadlock guard, that re-ingest completes instead of hanging. |
| 37 | + |
| 38 | +## Still in progress |
| 39 | + |
| 40 | +The deadlock guard is a safety net; the architectural root (the pooled MCP reader |
| 41 | +bound to a throwaway per-call event loop) and symbol-read producer/consumer |
| 42 | +overlap are tracked in `tasks/ingest-ecosystem-fix-plan.md`. |
0 commit comments