fix(mcp): serve tools on a fresh index and tolerate pre-handshake probes - #117
Closed
ViniciosLugli wants to merge 3 commits into
Closed
fix(mcp): serve tools on a fresh index and tolerate pre-handshake probes#117ViniciosLugli wants to merge 3 commits into
ViniciosLugli wants to merge 3 commits into
Conversation
rmcp requires initialize as the first stdio message and treats anything else as fatal, killing the server before it can serve. Antigravity opens with a non-standard server/discover request, so codanna never starts. Filter stdin until initialize arrives: answer unknown pre-handshake requests with JSON-RPC -32601 and drop pre-handshake notifications. After initialize every byte is forwarded untouched.
persistence.exists() is satisfied by a bare tantivy/meta.json, which serve writes on startup before anything is indexed. That directory has no index.meta, so there are no stored emission semantics to conflict with, yet the gate refused it: a server rejected the skeleton it had just created, disabling every tool until the workspace was indexed by hand. Gate only when index.meta exists. An index predating emission stamping still has index.meta without the field, so it keeps gating and healing.
Owner
|
Thanks for the report and fix. I migrated to rmcp 3.x, which completely replaces the code your PR modifies. If we merged this, it would be overwritten immediately.
Both updates will ship in the next release and include a |
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.
Two independent defects, both ending in a server that lists zero tools.
1. A metadata-less index directory is treated as stale
persistence.exists()is satisfied by a baretantivy/meta.json, whichservewrites on startup before anything is indexed. That directory has noindex.meta, so there are no stored emission semantics to conflict with, yet the gate refuses it. The server rejects the skeleton it just created itself.Any directory that resolves to a shared
~/.codannais affected permanently, since$HOMEis rarely indexed.Fix: gate only when
index.metaexists. An index predating emission stamping still hasindex.metawithout the field, so it keeps gating and healing.2. A pre-handshake client probe kills the server
rmcp requires
initializeas the first stdio message and treats anything else as fatal. Antigravity CLI opens withserver/discover, soserveexits before it can serve anyone:Fix: filter stdin until
initialize. Unknown pre-handshake requests get JSON-RPC-32601, pre-handshake notifications are dropped, and afterinitializeevery byte is forwarded untouched.Tests
cargo test: 1581 passed, 0 failed. The emission-gate tests that guard existing users are unchanged and still pass:read_path_refuses_stale_index_with_heal_command,index_heals_unstamped_index_with_full_rebuild,force_bypasses_gate_and_restamps,serve_stale_stdio_completes_degraded_handshake.Verified end-to-end against Claude Code, Codex, OpenCode and Antigravity.