fix(mcp): suggest nearest symbols on node_not_found - #3076
Merged
ScriptedAlchemy merged 3 commits intoOct 5, 2026
Merged
Conversation
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
PrimitiveNotFoundV1 now carries up to five served symbols within a bounded edit distance of the requested id, simple name, or qualified name. Node, impact, and rename-preview misses share one suggester, and the CLI's nearest-tool lookup reuses the same bounded edit distance from tracedecay-domain. Fixes #3014 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Unbound edge targets have no extraction metadata or logical file, so symbol_location cannot render them; admitting one turned a not-found answer into a graph-corrupt error. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ScriptedAlchemy
force-pushed
the
devin/1791127158-node-not-found-suggestions
branch
from
October 5, 2026 21:50
6b6da45 to
a82c064
Compare
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
PrimitiveNotFoundV1has a newsuggestionsfield. The field is aPrimitiveSymbolLocationV1[]and is omitted when empty. It lists up to five served symbols within a bounded edit distance,clamp(len/3, 1, 3), of the requested ID, simple name, or qualified name. Results are ordered nearest first.tracedecay_node,tracedecay_impact, and rename preview now use the samenode_not_found_resultsuggester.tracedecay_domain::text::edit_distance_within. The CLI's nearest-tool lookup uses it instead of a separate implementation.Fixes #3014
Motivation
A miss returned only "Node not found." A caller who mistyped an ID or passed a name received no useful next step. See #3014.
Changes
crates/tracedecay-mcp/src/handlers/graph/mod.rs:node_not_found_result(graph, node_id, occurrence)makes one cancellation-aware pass over the catalog withfind_symbols. It keeps the five closest matches in aBTreeMapkeyed by(distance, id).navigation.rsandrename_preview.rscall it.crates/tracedecay-contracts/.../primitive_surface.rs: adds thesuggestionsfield.sdks/typescript/src/operations.tsandplugin/chatgpt-extension/embedded/server.mjsare regenerated withpnpm --dir dashboard run contracts:generateand the extension'spnpm run build. The embedded schema rejects unknown properties, so the bundle must be rebuilt.crates/tracedecay-domain/src/text.rs: addsedit_distance_withinand its unit tests.Test plan
bash scripts/require-exact-test.sh cargo test -p tracedecay --features test-transport --test mcp_suite mcp_handler_test::node_behavior_test::tracedecay_node_suggests_the_nearest_symbols_for_an_unknown_id -- --exactbash scripts/require-exact-test.sh cargo test -p tracedecay --features test-transport --test mcp_suite mcp_handler_test::impact_behavior_test::impact_reports_callers_by_depth_and_refuses_invalid_requests -- --exactgraph_query_test::test_node_not_found,graph_analysis_test::test_rename_preview_not_foundcargo fmt --all -- --check,python3 scripts/linux-test-partitions.py check,pnpm run check:embeddedcargo clippy -p <crate> --all-targets -- -D warningsfor tracedecay-domain, -contracts, -mcp, and -cliChecklist
CHANGELOG.mdupdated: not done; release-please generates it.envfiles includedLink to Devin session: https://app.devin.ai/sessions/cd07d7e34d024ed2aef8a0c58184660f
Open in Devin Desktop: https://app.devin.ai/desktop/session/cd07d7e34d024ed2aef8a0c58184660f?variant=devin
Requested by: @ScriptedAlchemy