Skip to content

fix(acp): let Crew's own MCP servers defer under Tool Search on 0.8 (release/0.8.0) - #17271

Merged
bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8-tool-search-defer
Oct 6, 2026
Merged

bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8-tool-search-defer

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On 0.8, Crew's own MCP servers defer under Tool Search like third-party servers, so a desktop chat no longer carries every Crew tool schema on every turn.

Backport of #16131, #16700 and #17250 to release/0.8.0. On this branch ASBX_KIRO_MANDATORY_MCPS keeps every Crew-owned server resident on every spawn (a desktop gateway's children carry arcc-governance,builder-mcp,creds-agent,kirocrew-aim,kirocrew-computer,kirocrew-core,...), and the bundled kiro-cli is 2.24.0, below the floor #16131 needs.

Why it matters

Those resident schemas are a large fixed share of every new 0.8 chat's context (#15899 measured about 27k tokens for kirocrew-core alone), paid again on every turn, on the channel most users run.

Not a goal

What changed (motivation → approach → change)

0.8 keeps Crew's tool schemas resident because the mandatory list is applied unconditionally and the bundled CLI is too old to defer them safely.

Piece From Effect on 0.8
Spawn env #16131 pin_mandatory_mcps_env drops the list only when the spawn runs the pinned kiro-cli (or its chat sibling) at >= 2.27.0; any other binary or version keeps every Crew server resident; an operator's ambient value still wins
Directive claims #16700 a deferred call's rawInput is {"tool_id", "arguments"}; event_input_digest hashes the arguments, so monitor_start, monitor_update and autonudge_stop claim their parked record instead of CLAIM MISS input-differs
Bundled CLI #17250 packaging/kiro-cli-version 2.24.0 -> 2.27.1 with the manifest sha256s, so the floor opens on desktop installs
kiro_cli.chat_sibling #14982 (helper only) #16131's gate calls it; without it the gate raises NameError, swallows it, and deferral never applies on this branch

src/kiro_crew/kiro_cli.py and src/kiro_crew/session_directive.py match main byte for byte; the harness edits in src/kiro_crew/acp/harness/ and src/kiro_crew/acp/runtime.py, src/kiro_crew/agent_sdk/tool_search.py, src/kiro_crew/config/sections.py, config-baseline.json and docs/ are the upstream hunks.

Backwards compatibility

Compatible: on any spawn that is not the pinned >= 2.27.0 install, Crew's servers stay resident exactly as today; an explicit ASBX_KIRO_MANDATORY_MCPS (including empty) is honoured verbatim.

Reader: src/kiro_crew/acp/harness/_common.py:apply_mandatory_mcps_env -- release -- removed; its one caller (apply_spawn_env in the kiro/KAS harnesses) now calls pin_mandatory_mcps_env
Reader: src/kiro_crew/agent_sdk/tool_search.py:MANDATORY_MCPS_ENV, mandatory_mcps_env_value -- release -- removed; no remaining importer on this branch (grep)
Reader: test/test_acp_mandatory_mcps.py -- release -- replaced by test/test_acp_tool_search_spawn_env.py

Tests

Carried from upstream: test/test_acp_tool_search_spawn_env.py (the gate for pinned, sibling, old, override, pod and missing binaries; the env pinning per harness), the #16700 envelope-unwrap tests, and test/test_spawn_audit.py. On this branch the four test_deferral_requires_the_pinned_install cases fail without the chat_sibling helper and pass with it.

Manual verification

Related Issues

Part of #17247

Pattern harvest

Rule candidate: review-prompt
Pattern: a backported helper call inside a never-raises guard turns a missing dependency into a silent no-op; backport tests must assert the positive branch

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

…release/0.8.0)

Backport of #16131, #16700 and #17250 to release/0.8.0, plus the
kiro_cli.chat_sibling helper #16131 calls (from #14982; only the helper,
not #14982's KAS spawn change).

- #16131: ASBX_KIRO_MANDATORY_MCPS no longer pins every Crew-owned MCP
  server resident. They defer under Tool Search when the spawn runs the
  pinned kiro-cli (or its chat sibling) at >= 2.27.0; any other binary or
  version keeps them resident. An operator's ambient value still wins.
- #16700: a deferred call's rawInput is {"tool_id", "arguments"}; the
  directive consumer now digests the arguments, so monitor_start,
  monitor_update and autonudge_stop claim their parked record instead of
  being dropped with CLAIM MISS input-differs.
- #17250: the bundled kiro-cli moves from 2.24.0 to 2.27.1, without which
  the >= 2.27.0 gate never opens on a desktop install.
- chat_sibling: without it mandatory_mcps_drop_allowed raises NameError,
  which it swallows, so deferral would silently never apply on this branch.

(cherry picked from commits af16284, af2619f, 9348a25)
@bolichen97
bolichen97 requested a review from a team as a code owner October 6, 2026 07:28
@bolichen97
bolichen97 requested review from cruisercohen and removed request for a team October 6, 2026 07:28
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Smoke the 0.8 desktop bundle end-to-end on 2.27.1 — the pin jumps three CLI minors into a stable line, beyond the deferral matrix the PR verified.

[DESIGN-REVIEWED] 6d2f99c

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 6d2f99cc5f80248a12884b580b372009b287b5c0 — 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: PASS

Confirm the 2.27.1 artifact sha256s and the 2.27.0 thinking-signature matrix — both rest solely on the author's recorded manual verification.

What this change ships

Inventory (9 items) — 9 justified

Intent: FIX — stop every 0.8 desktop chat paying Crew's resident tool schemas (~27k tokens, #15899) each turn, by backporting #16131/#16700/#17250.

  1. Crew's own tool schemas now defer on a pinned kiro-cli ≥ 2.27.0 spawn — justified
  2. Any other binary, older or unknown version keeps every Crew server resident, as today — justified
  3. ASBX_KIRO_MANDATORY_MCPS override now named in the operator-facing tool_search help — justified
  4. Deferred monitor_start/monitor_update/autonudge_stop calls now claim their parked record instead of CLAIM MISS — justified
  5. Bundled kiro-cli 2.24.0 → 2.27.1 with manifest sha256s — justified
  6. New kiro_cli.chat_sibling helper; one consumer (mandatory_mcps_drop_allowed, grep chat_sibling: 1 call site), declared, and the gate raises without it — justified
  7. apply_spawn_env gains spawned_binary on every harness (Codex accepts and ignores it) — justified
  8. Exemption test suite replaced by the floor/override suite, replacement declared with the deleted pin's reason preserved below the floor — justified
  9. MANDATORY_MCPS_ENV/mandatory_mcps_env_value removed from agent_sdk.tool_search (constant moved to harness._common; grep: no other importer) — justified

[FIRST-PRINCIPLES-REVIEWED] 6d2f99c

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 6d2f99cc5f80248a12884b580b372009b287b5c0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6d2f99c

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

@bolichen97
bolichen97 merged commit f263af4 into release/0.8.0 Oct 6, 2026
22 of 23 checks passed
@bolichen97
bolichen97 deleted the backport/0.8-tool-search-defer branch October 6, 2026 07:38
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 6d2f99cc5f80248a12884b580b372009b287b5c0 — this comment is updated in place on each push.

Review details

The version gate's trust premise contradicts this module's own recorded launcher-resolution rule, so it can clear Crew-MCP deferral on a kiro-cli-chat that was never probed.

FINDING — src/kiro_crew/kiro_cli.py:75 — chat_sibling trusts kiro-cli-chat in "the SAME directory" as the pinned launcher as the engine that will run, while BUNDLED_KIRO_CLI_ENTRY 40 lines above records the opposite ("the launcher resolves kiro-cli-chat via $HOME/.local/bin and PATH and never looks in its own directory", echoed at docs/build/desktop-app.md:106, and contradicted again by docs/system-specs/modules/acp-client.md:635); if the recorded rule holds, a pin outside ~/.local/bin (e.g. ~/.cargo/bin/kiro-cli, /opt/homebrew/bin/kiro-cli) passes mandatory_mcps_drop_allowed on two same-dir binaries while exec reaches a different, unprobed chat binary, and a below-floor one bricks every later turn on the session → Fix: resolve the probe candidate the way the launcher does (or refuse a pin whose directory is not one the launcher dispatches through) and correct whichever of the two in-repo premises is wrong.

FINDING — src/kiro_crew/kiro_cli.py:178 — the new docstrings state a contract no code implements: "callers fall back to binary unchanged" and "a KAS spawn … has to enter through the chat binary … (the KAS spawn skips that sibling for the same reason)", while chat_sibling's only caller (mandatory_mcps_drop_allowed) turns None into a hard return False for a POSIX kiro-cli pin and no spawn path swaps to the chat binary at all (kas.resolve_spawn → build_kas_argv(kas_bin) uses the resolved launcher verbatim) → Fix: state what the code does — None means "no verifiable sibling", and no spawn path performs a chat-binary swap today.

FINDING — src/kiro_crew/config/sections.py:1273 — the help enumerates the resident cases as "any other executable, an older or unknown version" but omits the unconditional if not spawned_binary or (os.environ.get("KIROCREW_KIRO_BIN") or "").strip(): return False, so an operator who points KIROCREW_KIRO_BIN at a 2.27.1 kiro-cli (which becomes the pin) satisfies every condition the string names and still never gets deferral, with nothing telling them why; config-baseline.json:633 and docs/architecture/mcp.md:1597 carry the same gap → Fix: name the KIROCREW_KIRO_BIN override as a resident case in all three copies.

[OPUS-REVIEWED] 6d2f99c

Verdict parsed from the review's SHA-scoped output markers for commit 6d2f99cc5f80248a12884b580b372009b287b5c0.

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

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.

1 participant