Repository navigation
feat(mcp): warn when project indexes need rebuilding - #1853
cbeaulieu-gt wants to merge 1 commit into
Conversation
a049860 to
cabf0d8
Compare
|
Rebased this branch onto current Current verification:
A full The PR is now conflict-free and mergeable; it still awaits review.
|
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>
|
Thanks @cbeaulieu-gt! This landed as #3122 with your authorship, which closes #1852. We left out the plan document, reworded the warning so indexing stays the user's call, and made the one-time check use the canonical project root. The session-owned state and the proxy failover handling are yours as written. |
Summary
codegraph_statusThe check is local, preserves the nonblocking initialize handshake, and never starts indexing automatically.
Verification
npm run buildnpx vitest run __tests__/mcp-index-version-warning.test.ts __tests__/mcp-staleness-banner.test.ts __tests__/upgrade.test.ts --maxWorkers=1 --minWorkers=1— 69 passedgit diff upstream/main...HEAD --checkHEADKnown upstream baseline
The broader upstream test suite is not currently zero-failure on this Windows host. Previously reproduced failures map to existing upstream issues/PRs, including daemon teardown
EPERMcleanup covered by #1717; the focused feature assertions above pass.Closes #1852