Skip to content

fix(mcp): don't warn 'gave no tools' for Tool Search-deferred servers - #18576

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/18349-defer-no-tools
Oct 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/18349-defer-no-tools

Conversation

@dodgeblaster

@dodgeblaster dodgeblaster commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Stop the "started but gave no tools" warning from firing for MCP servers whose tools are simply deferred by Tool Search.

On a default install, MCP Tool Search is on, which holds every MCP server's tools out of the session's /tools list until the model loads one. The zero-tool detector read "running server, not in /tools" as a tool-name clash, so at session start it flagged nearly every healthy server. A read-only probe against kiro-cli under default settings returned 9 of 10 running servers, including kirocrew-core and kirocrew-cron.

Why it matters

The false warning erodes trust in the real one, and worse: problem_summary() tells every subagent its named servers are unavailable and "do not go looking for them." On the default path that steers delegated work away from core tool servers that work fine.

Not a goal

  • Changing which server wins a genuine tool-name clash — that is the backend's tool table, not Crew's.
  • Reporting a clash while Tool Search is deferring — the evidence to tell a deferred server from a clash victim is not available then, so the detector stays silent rather than guess.

What changed (motivation → approach → change)

The detector saw a running, spec-granted server absent from /tools and called it a dropped-clash victim. Under Tool Search deferral that absence is the normal start-up state of a healthy server, so the signal was wrong by default.

Whether a given session defers cannot be read from configuration — kiro-cli defers only once its minPct/minTokens thresholds are crossed — so the fix reads the evidence the session itself produces. The tool_search loader tool is in /tools exactly when the session is deferring (the model needs it to load deferred MCP tools). servers_exposing_no_tools in acp/mcp_session_report.py now derives that signal from the /tools result it already reads: when the loader is present, a running granted server is reported only when /mcp proves it empty (toolCount == 0), staying silent on a positive or unreadable count; with no loader present, nothing is deferred, so absence from /tools remains the clash signal and the existing behaviour is untouched. providers/acp.py's start-time check calls it unchanged — the signal is backend-independent, which matters because that check runs on the kiro backend.

Backwards compatibility

Compatible: with no tool_search loader in /tools the detector behaves exactly as before; only the deferral case, which previously over-reported, changes.

Removes nothing: no path, record, validator, key or public function is removed or tightened.

Tests

  • test/test_mcp_zero_tool_warning.py: with the loader in /tools, a deferred server (positive toolCount) is not reported; under deferral only a toolCount==0 server is reported; an unreadable or missing count under deferral reports nothing; the same server shapes with no loader are still reported as a clash; an mcp-sourced tool merely named tool_search does not count as the loader; plus provider-level coverage that the loader-in-/tools case records nothing.

Reverting the new check turns the deferral tests red.

Manual verification

N/A — unit coverage sufficient; the change is a pure decision over /mcp//tools payloads with no I/O or UI.

Pattern harvest

Not generalizable: a single detector reading absence-from-a-list as evidence while a feature deliberately defers that list — specific to the Tool Search / /tools interaction.

Related Issues

Closes #18349

@dodgeblaster
dodgeblaster force-pushed the fix/18349-defer-no-tools branch from 4327e20 to a49bc9a Compare October 9, 2026 19:55
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Rebased: main moved +19 commits touching files this PR also imports since this head went green (096580e -> c34eca2); CI re-running. Also ran black (the one failing check, Backend Lint & Type Check 3.12 — formatting only, no logic change).

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 9ae51550a1481974ef2fa4d1c94a339d1eba7750 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 9ae5155

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 9ae51550a1481974ef2fa4d1c94a339d1eba7750: <one-sentence reason>

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 9ae51550a1481974ef2fa4d1c94a339d1eba7750 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of 9ae51550a1481974ef2fa4d1c94a339d1eba7750 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

Nobody has checked that the tool_search loader shows up in /tools only while the session is deferring. If it also shows up whenever it is granted, the clash detector goes silent on default installs.

Watch

  • The detector rests on an unchecked signal. The PR's premise is that "the tool_search loader is in /tools exactly when the session is deferring". But tool_search.py says deferral starts only once the specs cross minPct/minTokens. The loader, on the other hand, is granted by * or @builtin, which default specs carry. If kiro-cli lists the loader in /tools whenever it is granted, whether or not the thresholds are crossed, then deferring is true on almost every default session. The new branch if deferring and not _reports_zero_tools(server): continue would then hide every real clash, since a clash victim has a positive toolCount. The warning this PR is trying to make trustworthy would stop firing on the main path. It is reversible, but nothing would show the loss. The description's probe reports 9 of 10 servers flagged, but doesn't say whether the loader was in /tools in that run, or what /tools shows below the thresholds.
    Clears when: the description records a kiro-cli /tools capture with the loader granted but below the minPct/minTokens floor, showing tool_search absent (or deferral active); otherwise the deferral signal comes from something that actually tracks the thresholds.

  • Under deferral the warning reports a different fault. With the loader present, the only server still reported is one with toolCount == 0, which is an empty server, not a lost clash. The _note_zero_tool_servers docstring and the problem_summary() wording still explain the warning as a clash. So subagents would be told a misleading cause.
    Clears when: the message wording covers "advertised no tools" as well as the clash, or the docstring says the deferral branch reports emptiness and not clashes.

[DESIGN-REVIEWED] 9ae5155

Description read

[DESCRIPTION-READ] 033603db2ada80da19675e7bff8f5ed546fdc340cf0fe1ae81b3346ce58dd8c0

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 9ae51550a1481974ef2fa4d1c94a339d1eba7750 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The detector is fixed, but connections/tool_test.py still treats "not in /tools" as "no tools" under Tool Search deferral.

Not justified as shipped

  • Item 1 — symptom-level: a point patch with 1 unfixed sibling of the same root cause. The cause is reading a server's absence from /tools as proof it has no tools while Tool Search holds those tools back. I grepped source.*"mcp: / f"mcp:{alias}" across src/ and found 2 sites. This PR fixes one. The other is src/kiro_crew/connections/tool_test.py:103-107 (if exposed == 0: return _result(slug, "no_tools", "no_tools_exposed")), which reads the same /tools on the shared _MAIN_AGENT session. That is the session the description's probe found deferring 9 of 10 servers. So the Test button can report a healthy connection as no_tools. This is a deferred finding, not a demand.
    Clears when: someone shows that the test_connection_tools session never defers, or the description says the Test-button sibling is left unfixed.

What this change ships

Inventory (5 items) — 3 justified

Intent: stop the start-of-session warning, and the subagent "do not go looking for them" summary, from naming healthy MCP servers whose tools Tool Search has deferred. FIX (#18349).

  1. When the tool_search loader is in /tools, running servers missing from /tools are no longer warned about. — symptom-level: 1 unfixed sibling in tool_test.py
  2. While deferring, a server whose /mcp reports toolCount 0 is still warned about. — justified
  3. While deferring, a real clash victim with a positive or unreadable count goes unreported. — justified
  4. An MCP server's own tool named tool_search doesn't switch deferral handling on. — justified
  5. In the tests, report.payload()[...] calls are replaced by a _payload helper. — rides along, undeclared

[FIRST-PRINCIPLES-REVIEWED] 9ae5155

Description read

[DESCRIPTION-READ] af5669dc81a69380d47ae5b8e2b240d0c67a0a5d1fb2dac1441307578796c477

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 9ae51550a1481974ef2fa4d1c94a339d1eba7750 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 9ae5155

Verdict parsed from the review's SHA-scoped output markers for commit 9ae51550a1481974ef2fa4d1c94a339d1eba7750.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 9ae51550a1481974ef2fa4d1c94a339d1eba7750: <one-sentence reason>

@dodgeblaster
dodgeblaster force-pushed the fix/18349-defer-no-tools branch from a49bc9a to 356d7c7 Compare October 9, 2026 20:13
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Addressed the Design / First Principles BLOCK on head a49bc9a4 with a redesign, not a rebuttal — the concern was correct.

The reviewer's root point: _note_zero_tool_servers runs only under is_kiro_backend, but _tool_search_wire is filled only on the KAS client_meta_settings channel; the kiro backend reads Tool Search from the cli.json overlay. So the KAS-wire deferral flag was always False on the exact backend the check runs on — the warning stayed broken for the issue's own repro.

Fix (head 356d7c71): the deferral signal now comes from evidence kiro-cli actually produces per session, exactly as the reviewer's Suggestion named — the tool_search loader tool is present in /tools iff the session is deferring (the model needs it to load deferred MCP tools). servers_exposing_no_tools derives _tool_search_active from the /tools result it already reads; no per-backend wire plumbing, no reliance on the configured setting (which can't tell you whether a given session crossed its minPct/minTokens thresholds). The KAS-wire accessor and its plumbing are removed. New tests cover: loader present → deferred server not reported; loader present + toolCount 0 → reported; same server shapes with no loader → clash still reported; and an mcp-sourced tool merely named tool_search does not count as the loader.

@dodgeblaster
dodgeblaster force-pushed the fix/18349-defer-no-tools branch from 356d7c7 to 88214c6 Compare October 9, 2026 21:18
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in files this PR also imports (diagnostics.py) since this head went green; re-synced onto fresh main and re-ran the scoped + diagnostics tests (green). No logic change. CI re-running.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 15, 2026
@dodgeblaster
dodgeblaster force-pushed the fix/18349-defer-no-tools branch from 88214c6 to 75f2a83 Compare October 15, 2026 15:58
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Rebased onto current origin/main (75f2a835c2) to clear the DIRTY/conflicting merge state. The only conflict was in providers/acp.py, where main relocated _note_zero_tool_servers into providers/acp_runtime_start.py; resolved by taking main's refactor and re-applying the one-paragraph docstring addition in the method's new home. The real fix in acp/mcp_session_report.py and the tests merged cleanly. Local gates re-run green on the rebased head: black / isort / flake8 / mypy clean, 87 passed (5 pre-existing skips) across test_mcp_zero_tool_warning.py + test_acp_tool_search_wire.py. Still a draft.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 15, 2026
@dodgeblaster
dodgeblaster force-pushed the fix/18349-defer-no-tools branch from 75f2a83 to 21400a4 Compare October 15, 2026 16:33
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Repushed as 21400a442c: the rebase conflict resolution had accidentally dropped test/test_conductor_prompt_accept_batch_claim.py (an unrelated conductor/work-ledger test from the #20838 refactor). Restored it from origin/main so the diff is strictly the 3 intended files again (mcp_session_report.py / acp_runtime_start.py / test_mcp_zero_tool_warning.py). Local gates green on the corrected head.

Note on Backend Tests shard 5 (3.12 + Windows): the two reds there are test_acp_bindings.py::test_the_member_set_is_the_frozen_inventory (['approval_withdrawable'] == []) and ::test_each_member_keeps_its_kind_shape_and_owner[approve_tool] (approve_tool signature gained withdraw_if). Both are INHERITED from main — they reference provider-binding symbols my change never touches, and they fail identically with my 3 files reverted to origin/main. Not caused by this PR. Still a draft.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 15, 2026
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

CI settled on rebased head 21400a442c: green-or-inherited-only.

Passing: all 6 review lanes (GPT 6.1, Opus 5.5, Design, First Principles, UX, Security scope), Issue Gate, Decision Ledger Gate, and every CI lane except the items below.

The 3 remaining reds are all INHERITED from main, not from this PR:

  • Backend Tests (3.12, 5) and Backend Tests (Windows, 5) — both fail on test_acp_bindings.py::test_the_member_set_is_the_frozen_inventory (['approval_withdrawable'] == []) and ::test_each_member_keeps_its_kind_shape_and_owner[approve_tool] (approve_tool gained a withdraw_if param). These are from main's refactor(providers): bind AcpProvider members from five owner modules #20838 provider-binding refactor; the frozen-inventory test wasn't updated in lockstep. Proven inherited: they fail identically with this PR's 3 files reverted to origin/main, and this PR touches no provider bindings.
  • Coverage Gate — fails closed (backend-test=failure) purely because those two shards failed; it is a downstream cascade of the inherited reds, not a coverage shortfall from this change.

PR Readiness's '1 blocking readiness item' is the aggregate CI rollup catching the inherited reds above. This is a merge-judgment call for a maintainer (the base needs to fix test_acp_bindings), not a defect in this fix. The branch is rebased clean onto current main and remains a DRAFT.

@dodgeblaster
dodgeblaster force-pushed the fix/18349-defer-no-tools branch from 21400a4 to 250aad4 Compare October 16, 2026 05:20
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Rebased onto main (head 250aad484b) to pull in #20902's acp census fix (0694e63) — the frozen-inventory ratchet that #20838 broke is now updated in the base, so the test_acp_bindings shard-5 red clears. Clean rebase, no conflicts; diff is unchanged (3 files). Verified locally: test_acp_bindings.py 147 passed, affected tests 29 passed, black/isort/flake8/mypy (src scope) green. Stays draft.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 16, 2026
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

CI on head 250aad484b is green-or-inherited-only. The previously-blocking test_acp_bindings shard-5 red is cleared (base now contains #20902's census fix). Reviewer lanes GPT 6.1, Opus 5.5, Design, First Principles all PASS.

The remaining reds are inherited from main, not this PR:

  • Backend Tests (3.12, 6) + (Windows, 6): test_chat_fork_error_codes.py::test_the_ratchet_can_actually_fail — "scanner reached 27 coded sites, expected 26". Proven inherited: the ratchet and its scanner are byte-identical to origin/main on this branch, and it fails identically with this PR's 3 files reverted to origin/main. A main commit added a 27th error-code site without bumping the expected count.
  • Coverage Gate: fails closed purely because that backend shard failed (backend-test=failure -- failing closed, coverage-combine skipped) — not a coverage shortfall from this change.
  • PR Readiness: the aggregate reflecting the above + draft state.

A transient Backend Tests (3.12, 2) flake (test_responsive_chat_repairs, passes locally in isolation and under xdist) cleared on re-run. Stays draft for maintainer merge.

The zero-tool warning flagged any running, spec-granted MCP server missing
from /tools. With MCP Tool Search deferral on (the default), every server's
tools are held out of /tools until the model loads one, so at session start
nearly every healthy server looked like a tool-name clash victim -- and each
subagent was told its core tool servers were unavailable.

servers_exposing_no_tools now takes the session's deferral state: under
deferral it reports a running granted server only when /mcp proves emptiness
(toolCount == 0), staying silent on a positive or unreadable count. With
deferral off the existing clash detection is unchanged. The runtime exposes
tool_search_deferring() from the wire settings it sent, threaded through
_note_zero_tool_servers.

Closes #18349
@dodgeblaster
dodgeblaster force-pushed the fix/18349-defer-no-tools branch from 250aad4 to 9ae5155 Compare October 16, 2026 21:53
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (HEAD c1302956a1) to pick up #21075's ratchet fix (commit 4fd63b36e9, which bumps test_chat_fork_error_codes to assert 27 coded sites). The previously-inherited shard-6 ratchet red is now cleared in the base — new head 9ae51550a1, diff unchanged at the 3 files. Local gates green (black/isort/flake8/mypy on src scope); test_chat_fork_error_codes.py now passes locally. Still DRAFT.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 16, 2026
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

CI is green on head 9ae51550a1 (rebased onto main c1302956a1, which includes #21075's ratchet fix). All 82 checks pass: every Backend Test shard (both OSes, including the previously-inherited shard-5 test_acp_bindings and shard-6 test_chat_fork_error_codes ratchet, now cleared by the fix in the base), Coverage Gate, all four reviewer lanes (GPT 6.1, Opus 5.5, Design, First Principles), Issue Gate, and Decision Ledger Gate. No reds. Kept DRAFT for human review/merge.

@dodgeblaster
dodgeblaster marked this pull request as ready for review October 17, 2026 00:48
@dodgeblaster
dodgeblaster requested review from a team and KiroCrewCaptain as code owners October 17, 2026 00:48
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 17, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by a maintainer. Every review lane is clean, the change matches its description, and the automation held this on a category, path or size rule only.

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.

MCP 'gave no tools' warning fires for every Tool Search-deferred server

2 participants