-
Notifications
You must be signed in to change notification settings - Fork 2.8k
MCP session serves a stale graph indefinitely after the background watcher re-indexes #1296
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgesGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memoryServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UXDisplay bugs, docs, adoption UX
Milestone
Description
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgesGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memoryServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UXDisplay bugs, docs, adoption UX
Summary
The background watcher correctly detects a change and re-indexes, and the database is updated within ~15 s. But the live MCP session that registered the watcher keeps serving the pre-change graph indefinitely. Only an
index_repositorycall issued from that same session refreshes its view.Effect: in a long-lived agent session the knowledge graph silently freezes at session start while the on-disk graph moves on.
Repro
auto_watchdefaulttrue).initialize, thentools/call index_repository.search_graph(label=Function)— baseline.index_repository.search_graphover the live MCP session and runcodebase-memory-mcp cli search_graphfrom a separate process.Observed
Server stderr during the run confirms the watcher did its job:
Then, in the same session:
Diagnosis
The session's read view appears to be invalidated only by writes originating in that session. Writes committed by the daemon-owned watcher do not invalidate it.
Impact
This is a silent-staleness failure, the most damaging class for an agent-facing tool. Over a normal working day the agent answers "who calls X" from a morning snapshot with no indication the answer is stale, and the watcher's work is invisible to the very session that registered it.
Notes
index_repositoryafter edits is a viable workaround.index_repositoryfrom a session whose cwd is elsewhere is never watched — the log showswatcher.watchfor the cwd project instead.Environment
climode (outputs byte-identical)