Repository navigation
feat(mcp): warn once when a project's index predates the running engine - #3122
Merged
Merged
Conversation
After an upgrade, an agent reading an index an older extraction engine built got no sign of it: only the `codegraph status` CLI said so, and the default MCP surface never showed that. The first successful tool response for such a project now opens with a one-time warning naming the version that built the index, the running engine and `codegraph index`, worded as the user's decision, since indexing is never the agent's. Each MCP client session tracks each project on its own, including projects reached with `projectPath`, and an error response doesn't use the warning up. The state lives on the session, not the handler, because one daemon serves many clients. The proxy notes a warning the daemon delivered so failing over in-process doesn't repeat it. `codegraph_status` always reports both versions and whether a rebuild is recommended. Detection is local, and nothing rebuilds by itself. Changes on top of the PR: its plan document is dropped, the wording now leaves indexing to the user, and one-time claims key on the canonical project root so the proxy and the handler agree on a project's spelling. Validation: 7 new unit cases plus 2 daemon cases. Turning the notice off fails 5 of 7, delivering it every time fails 5 of 7, and dropping the proxy's record fails the failover case. Real MCP sessions on express, flask, gin and excalidraw, main against this: tools/list identical. With a current index, both explore responses byte-identical. With a stale index, the first response is main's plus a 338-character warning, and the second is byte-identical. The check costs about 30 to 50 microseconds a call. Fixes #1852 Original PR #1853 by @cbeaulieu-gt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first successful tool response for a project whose index predates the running extraction engine now opens with a one-time warning, once per project per MCP session.
codegraph_statusalways reports the build version, the running version and whether a rebuild is recommended. Detection is local, and nothing rebuilds by itself.Root cause
Only the
codegraph statusCLI reported an index built by an older engine. An agent working over MCP had no sign that its answers could miss what a newer engine extracts.What came from the contributor, and what changed
The design is theirs: state on the session because one daemon serves many clients, a warning that an error response doesn't use up, independent tracking for each
projectPathproject, and the proxy noting a warning the daemon delivered so an in-process failover doesn't repeat it.Our changes:
docs/superpowers/.codegraph index"), the wording the not-indexed guidance uses. AGENTS.md: indexing is the user's call, never the agent's.[Unreleased], in house format.No automatic rebuild: that stays #1798.
Validation
mcp-index-version-warning.test.tsand 2 real proxy and daemon cases inmcp-daemon.test.ts.tools/listisIndexStale()costs 30 to 48 µs per tool call on those indexes.owning-package.test.ts, pinned to feat(cli): expose test-file classification #1960 and fixed in its commit.Fixes #1852
Lands #1853 by @cbeaulieu-gt
🤖 Generated with Claude Code