Skip to content

fix(mcp): honesty signals for zero-exact search and filename-only get_symbol#770

Merged
RaghavChamadiya merged 1 commit into
mainfrom
fix/mcp-dogfood-honesty-signals
Jul 11, 2026
Merged

fix(mcp): honesty signals for zero-exact search and filename-only get_symbol#770
RaghavChamadiya merged 1 commit into
mainfrom
fix/mcp-dogfood-honesty-signals

Conversation

@RaghavChamadiya

Copy link
Copy Markdown
Member

What

Two MCP tool-surface fixes so an agent gets an honest signal instead of a confident-but-wrong answer it will read around.

search_codebase exact-match signal

An identifier-shaped query that matches no symbol exactly used to return fuzzy neighbours with nothing to distinguish them from a real hit. It now carries exact_match: true|false, plus a short note when there is no exact match, so the agent does not anchor on whatever ranked first. The score cliff already existed internally; this surfaces it.

get_symbol filename-only resolution

get_symbol("answer.py::get_answer") (a bare filename or partial path rather than the full indexed path) dead-ended on "not found". It now resolves via a suffix rung on the file path, matching any file whose path ends with that segment on the leaf name, mirroring get_context's basename ladder. A total miss returns suggestions (real path-qualified ids) the caller can retry with.

Tests

  • New TestExactMatchSignal (exact/fuzzy/mode routing) in test_search.py.
  • Two suffix-rescue cases in test_symbol_ambiguity_and_format.py (resolves via suffix; total miss returns suggestions).
  • Full search + symbol suites pass (60 tests). ruff clean.

…_symbol

search_codebase on an identifier query now reports exact_match (true/false)
with a note when no indexed symbol matches exactly, so the agent does not
anchor on a fuzzy neighbour that merely ranks first.

get_symbol resolves a filename-only or partial-path id (answer.py::get_answer)
via a suffix rung on the file path, mirroring get_context's basename ladder,
and returns path-qualified suggestions on a total miss instead of a bare
not-found.
@repowise-bot

repowise-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

✅ Health: 7.7 (unchanged)

📋 At a glance
3 files changed health · 4 hotspots touched · 4 new findings introduced · 5 co-change pairs left out · 3 files with recent fix history.

Files & modules (2)
  • packages (2 files)
    • .../mcp_server/tool_search.py
    • .../mcp_server/tool_symbol.py
  • tests (2 files)
    • .../mcp/test_symbol_ambiguity_and_format.py
    • .../mcp/test_search.py

⚠️ Change risk: moderate (riskier than 46% of this repo's commits · raw 8.8/10)
This change's risk is driven by:

  • more lines added than baseline
  • more scattered than baseline

🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)

File Score Δ Why
.../mcp_server/tool_search.py 2.9 → 1.7 ▼ -1.1 🔻 introduced brain method, complex method, complex conditional · ✅ resolved function hotspot, io in loop
.../mcp/test_symbol_ambiguity_and_format.py 10.0 → 9.8 ▼ -0.2 score drifted on re-parse — no PR-attributable biomarkers
.../mcp/test_search.py 8.4 → 8.6 ▲ +0.2 score drifted on re-parse — no PR-attributable biomarkers

💡 .../mcp_server/tool_search.py: Split this function. It carries high cyclomatic complexity and many dependents — extract cohesive responsibilities into helpers so each call site sees a smaller surface area.

🔎 More signals (2)

🔥 Hotspots touched (4)

  • .../mcp_server/tool_search.py — 12 commits/90d, 11 dependents · primary owner: Raghav Chamadiya (80%)
  • .../mcp/test_search.py — 5 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (75%)
  • .../mcp/test_symbol_ambiguity_and_format.py — 1 commits/90d, 2 dependents · primary owner: Raghav Chamadiya (100%)
1 more
  • .../mcp_server/tool_symbol.py — 10 commits/90d, 7 dependents · primary owner: Swati Ahuja (58%)

🔗 Hidden coupling (2 files)

  • .../mcp_server/tool_search.py co-changes with these files (not in this PR):
    • .../mcp_server/tool_overview.py (9× — 🟢 routine)
    • .../mcp_server/tool_why.py (6× — 🟢 routine)
    • .../mcp_server/tool_dead_code.py (5× — 🟢 routine)
    • .../templates/claude_md.j2 (5× — 🟢 routine)
  • .../mcp_server/tool_symbol.py co-changes with .../mcp_server/tool_overview.py (6× — 🟢 routine) — not in this PR.

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-11 02:42 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@RaghavChamadiya RaghavChamadiya merged commit 90457dd into main Jul 11, 2026
7 checks passed
@RaghavChamadiya RaghavChamadiya deleted the fix/mcp-dogfood-honesty-signals branch July 11, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants