feat(mcp): answer-by-union for homonym symbols in get_answer#772
Merged
Conversation
When a question names a symbol that has several definitions no qualifier can disambiguate (a helper duplicated across modules, an overloaded name), get_answer now runs an exact-name index scan and inlines the union of every definition body in symbol_bodies, instead of returning a low-confidence list of candidate files. The candidate-file list pushed agents to drill back in with get_symbol or fall back to grep; inlining the bodies answers the question in a single call. Bodies render under a char budget, Read-format, and any that overflow are listed as get_symbol pointers. A qualified name (Parent.method) that matches no indexed definition now returns not-found rather than synthesizing from a same-named symbol elsewhere, so a precise query never degrades to a confidently-wrong answer.
|
✅ Health: 7.7 (unchanged) 📋 At a glance Files & modules (2)
🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔎 More signals (3)🔥 Hotspots touched (4)
1 more
🔗 Hidden coupling (2 files)
💀 Dead code (1 finding)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-11 04:38 UTC |
swati510
approved these changes
Jul 11, 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.
What
When a
get_answerquestion names a symbol that has several definitions no qualifier can disambiguate (a helper duplicated across modules, an overloaded name), the tool now runs an exact-name index scan and inlines the union of every definition body insymbol_bodies, instead of returning a low-confidence list of candidate files.It also adds a guard: a qualified name (
Parent.method) that matches no indexed definition returns not-found rather than synthesizing from a same-named symbol in another file.Why
The low-confidence candidate-file list was the wrong shape for an agent: handed a list of files, it drills back in with
get_symbolon each one, or falls back to grep, to find the definition it asked about. For a name with N definitions that costs N follow-up calls. Inlining the bodies answers the question in a single call.The not-found guard means a precise query (
Foo.barwherebarexists only under other classes) never degrades into a confident answer built from the wrong definition.How it works
_anchor_symbol_hitsnow surfaces unresolvable homonyms and qualified-misses alongside the hits it injects.build_homonym_union_bodiesrenders the definition bodies greedily under a char budget in Read format (first always renders); any that overflow are listed asget_symbolpointers with a do-not-Read redirect.get_answerreturns the union (grounding: "exact_symbol",confidence: "high") or the not-found response before the synthesis gate, so neither path emits the candidate-file list.Validation
get_answercall.