fix(codegraph): name codegraph tools by their real MCP-prefixed names in steering#4125
Merged
Merged
Conversation
… in steering The system-prompt steering text documented the codegraph tools by short name (`codegraph_context`), but they register under the MCP namespace as `mcp__codegraph__context` (the daemon's raw `codegraph_` prefix is stripped via Spec.StripRawPrefix, then namespaced by plugin.ToolPrefix). A model that followed the steering verbatim called a name that doesn't exist and got "unknown tool"; the list was also missing `explore`, `node`, and `status`. Use the real registered names and cover all ten tools. The text stays a static constant so the cached system-prompt prefix is unchanged byte-for-byte across sessions with the same codegraph; a new TestSteerTextNamesMatchRegisteredTools fails if the names drift from ReadOnlyToolNames in either direction, so this can't silently rot again. Closes #4111
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.
Closes #4111.
The codegraph steering injected into the system prompt named the tools by short name (
codegraph_context), but they register under the MCP namespace asmcp__codegraph__context. A model that follows the steering verbatim calls a name that doesn't exist → "unknown tool". The list was also missingexplore,node, andstatus.Diagnosis (verified against current main-v2)
I reproduced the registration path in a test before changing anything: the codegraph daemon emits raw tool names
codegraph_*, the spec setsStripRawPrefix: "codegraph_", andLazyToolsetstrips it before namespacing — so the real registered name ismcp__codegraph__context(single prefix). The doubledmcp__codegraph__codegraph_contextin the report is stale (a build beforeStripRawPrefix, #3133); strip works on current main.Fix (option D — static + drift-guard)
mcp__codegraph__<tool>names and cover all ten tools.TestSteerTextNamesMatchRegisteredToolsasserts, in both directions, that the steering names exactly matchReadOnlyToolNames()mapped through the prefix/strip — so if a codegraph tool is added/renamed or the text drifts, CI fails instead of silently shipping a name the model can't call.go test ./internal/codegraph ./internal/bootgreen; gofmt/vet clean.