Repository navigation
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check one live pi 0.99.2 session to confirm the receipt exists before [DESIGN-REVIEWED] 2f7e92b Description read[DESCRIPTION-READ] 30da85fb21f8c58e7ede87d16fa16d020f02d32a3cecafd259baa56e945195df 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 |
First Principles Review (Opus 5.5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The defect has no evidence behind it, and the description contradicts itself: the Goal says servers are listed "available", but it also says unreported servers already render Not justified as shipped
What this change shipsInventory (6 items) — 4 justifiedIntent: when pi did not register Crew's MCP servers, say so with the cause before the first prompt. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 2f7e92b Description read[DESCRIPTION-READ] 5e8f28ec12b973fc776a1b799c76f09d66e118476c39ab1a84747ce8aad8a19c That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
Pushed What changed:
Live pi evidence: none. The description says so under Manual verification, and the design no longer depends on it. |
c2d235d to
5624fea
Compare
|
Pushed Why the Goal changed. The old Goal promised "each unconfirmed server as failed". Design Review showed that recording an unknown in the failed bucket is the harm this PR exists to remove. Clearing conditions, one by one
Not claimed. No live pi-acp Previous head's backend reds. These are not from this diff:
|
5624fea to
2f7e92b
Compare
|
Pushed Item 2 (zero consumers): I took the clearing condition as written. The Design Review's condition still holds: nothing unconfirmed reaches the failed bucket. As a negative control, writing failed rows on that path turns 13 tests red, including Goal wording. The frozen Goal says the report names unconfirmed servers "unconfirmed, never failed". After this reduction the report does not name them at all; the log does. "Never failed" is unchanged. I have not edited the Goal again and will only if a maintainer asks. Item 1 (no linked reproduction) is a fact about #19774, not about this diff. I can't produce a live pi reproduction on this host, and the description already says so.
|
|
HOLD at 2f7e92b: reserved for a human reviewer, and the current First Principles CONCERNS have no reply. The PR changes the sealed pi tool-gate extension and re-pins its digest. The new extension adds handoff statuses, per-name causes, and a receipt file that the agent process writes into its scratch window (kiro_crew_tool_gate.ts L196-L343). Every pi spawn also gets a new env var (pi.py L938-L948). The repository's review policy reserves gate and sandbox-write changes for a human. Open on this head:
I found no concrete defect in the gate logic. The receipt is written with exclusive create and mode 0600, and a missing receipt only logs a warning. — crew-pr-reviewer (r116) |
|
This branch now conflicts with main. A recent merge changed client_mcp_array.py in the acp package, which this PR also edits. Could you rebase onto the current main and resolve the conflict? Thanks. |
On pi, Crew's MCP servers reach the session only through the gate extension's handoff file. The host never confirmed the extension registered them, so a missing, unreadable or wrong-nonce handoff left a session with none of Crew's tools while the card said they were available. The routing read-back cannot answer this: it is a separate pi child that never sees the handoff. The session's own pi process now answers it. During session_start the extension writes the names it registered (minus any shadowed by pi's own mcp.json) to a nonce-bound receipt in the session's scratch window. pi finishes session_start handlers before it reads its first RPC command, so the receipt exists before pi-acp answers session/new or session/load. The host reads and removes it before the first prompt, without submitting one: - no handed-off servers: nothing to confirm - receipt missing, malformed, for another nonce, naming a server not handed off, or confirming none: the session is refused - confirming only some: each missing server is recorded as failed on the session's MCP report, so the card never lists it available The handoff file is discarded whether or not the check passes, and a load-to-new retry clears the previous child's receipt. Closes kirodotdev#19774 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
That the receipt lands before pi-acp answers session/new or
session/load was read from the published sources, never pinned by a
live run, and PI_MIN_VERSION is a floor, not a pin. A missing receipt
therefore proves nothing about registration, and must not be recorded
where readers take it as final: the failed bucket feeds the subagent
spawn notice ("do not retry it") and the webhook and task "unusable"
lines, not only the MCP card.
Three outcomes per handed-off server:
- registered: the receipt names it; nothing is recorded
- confirmed unregistered: the receipt says the handoff did not load
(none, unreadable, malformed, or a seal that does not open under
this session's nonce), or names a per-server cause (pi's mcp.json,
an unreadable mcp.json, a refused or replaced registration); a
failed row naming that cause
- unconfirmed: no scratch window, no valid receipt, or a receipt
silent on the server; a warning log naming the cause and nothing on
the report, so the card shows the server as not reported
The extension writes a version-2 receipt carrying the handoff status
and per-server causes, so a handoff that never opened is no longer
reported as mcp.json shadowing. Failed rows past the bucket cap are
counted in unregistered_omitted, apart from pruned_omitted. No outcome
refuses the session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Head branch was pushed to by a user without write access
2f7e92b to
79e53a9
Compare
|
Rebased onto main Conflicts, all additive:
Local checks (Windows, Python 3.13, Node 22):
|
|
[operator: bolichen97] Continuing this in #31121; thanks for the start. |
|
Thank you @leonlaiyc! Your commits landed on main through the in-repo copy #31121 (authorship kept), which ran CI on in-repo runners. Closing this one as merged via #31121. |
Problem / Motivation
Goal: A pi session's MCP report says, before its first prompt, which handed-off Crew servers its own pi process confirmed it did not register (failed, with the cause it named) and which nobody confirmed either way (unconfirmed, never failed), instead of listing them all available.
On pi, Crew's MCP servers reach the session only through the gate extension's per-session handoff file (#19760), because pi-acp drops the
session/newarray. The host never confirmed that registration happened. If the handoff file is missing or unreadable, or carries the wrong nonce, the extension registers nothing, and the session runs with none of Crew's tools while the card says they are available. The routing read-back cannot answer this: it runs a separate pi child without the handoff, because it must not start Crew's servers.Why it matters
Every Crew capability on pi (send_message, memory, cron, crew tools) is an MCP tool. A silent registration failure leaves the agent without them while the dashboard claims they are there, so the user sees an agent that "ignores" its tools with no named cause. Only the session's own process can say what it registered.
Not a goal
mcp.jsonshadows some Crew server names: the extension already refuses those tools and warns; this PR only makes the card say so.What changed (motivation → approach → change)
Root cause. Registration happens inside the pi process that pi-acp starts during
session/new. Nothing travelled back from that process to the host.Why a receipt, beside the mount check. pi is in
ACP_BACKENDS_SESSION_MCP_ARRAY, somcp_mount_checkalready runs for every pi session. It answers a narrower question, and it answers it later:_stub_serverreturns nothing for an element whose argv lacks the broker'sSTUB_MODULE. pi's handoff issession._session_mcp_servers()(the agent's own spec servers, exec'd directly or remote) plus_pooled_mcp_servers()(harness/pi.py,resolve_spawn). The mount check cannot see the first half, so the receipt is the only signal for those servers.mcp.jsonboth look like "not mounted".MOUNT_WINDOW_SECS(30 s) after the session opens. A subagent reads the report once, at spawn (_warn_unusable_mcp_servers), so it never sees that row. The receipt is read before the first prompt.The two compose: the receipt records first, and
record_not_mountedleaves any server already in a bucket alone. An unconfirmed server is recorded nowhere, so a later mount-check row or frame for it is recorded as usual.Ordering is read from source, not live. In
@earendil-works/pi-coding-agent0.99.2 (the floorPI_MIN_VERSION), RPC mode awaitsbindExtensions(modes/rpc/rpc-mode.js:289). That awaits everysession_starthandler (core/agent-session.js:2556,core/extensions/runner.js:813) before it attaches its stdin reader (rpc-mode.js:644). pi-acp's session create awaitsget_stateon that stdin before it returns. No live run pins this, andPI_MIN_VERSIONis a floor rather than a pin. So a missing receipt proves nothing, and no outcome refuses the session.Three outcomes per handed-off server. The failed bucket is final to every reader, not only the card.
_spawn_mcp_noticetells a subagent "will not appear later -- do not retry it", andtask_executor.pyanddashboard/handlers/hooks.pyprint it as "MCP servers unusable in this run". So only a confirmed refusal goes there:none/unreadable/malformed/unsealed(seal does not open under this session's nonce and key)mcp.jsonmcp_json/mcp_json_unreadable/refused/replacedChange.
kiro_crew_tool_gate.ts:readMcpHandoffreturns a status beside the servers. The extension tracks a cause per shadowed name and writes a version-2 receipt:{marker: 2, nonce, handoff, registered, unregistered: {name: cause}}. It still uses mode0600and exclusive create, in the session's scratch window. Gating behaviour is unchanged.PI_GATE_EXTENSION_SHA256updated.acp/mcp_session_report.py: a newunregistered_omittedcount for failed rows past the cap, kept apart frompruned_omitted("left out as unstartable"), which these are not, and named inproblem_summaryandpayload(). No other report field is added: an unconfirmed outcome gets no bucket, because nothing outside tests would read one (First Principles on5624fea754), and the card already renders a server in no bucket asno_report.acp/pi_mcp_registration.py:read_registrationvalidates the v2 shape. A wrong version, nonce, status or cause, a non-string name, or a name both registered and unregistered all read as unknown. The receipt is removed either way.verify_registrationapplies the table above and logs one warning per outcome.harness/pi.py:apply_spawn_envpointsKIROCREW_PI_MCP_RECEIPTat a nonce-named file in the session's scratch window, dropping an inherited value first.client_start._initialize_sessioncalls it and discards the handoff in afinally.client_mcp_array._republish_pi_mcp_handoffclears the previous child's receipt on a load-to-new retry.harness-parity.mddocuments the receipt, its statuses and causes, the three outcomes and their readers, and what it adds beyond the mount check.The frontend is unchanged. A server in no bucket already renders as
no_reporton the card, which is the honest state for an unconfirmed one.Backwards compatibility
Compatible: no pi session is refused, and the report payload only gains one key,
unregistered_omitted. Writer sweep on origin/main @ b92a9c3: the receipt has exactly one writer, the sealed gate extension shipped in this same PR and verified by digest at every spawn. Sessions with no handed-off servers, and every non-pi harness, are unaffected.Reader: src/kiro_crew/acp/client_start.py:_initialize_session -- chat, cron, subagent, app, crew page (every pi session start) -- every session opens as before, confirmed or not;
test_session_start_opens_once_the_child_confirms,test_session_start_without_a_receipt_opens_and_reports_before_the_first_promptReader: src/kiro_crew/subagent_manager/run.py:_warn_unusable_mcp_servers / _spawn_mcp_notice -- subagent -- an unconfirmed server never reaches the "do not retry" notice; a confirmed refusal does;
test_unconfirmed_never_reaches_an_unusable_reader,test_a_confirmed_refusal_reaches_the_subagent_noticeReader: src/kiro_crew/agent_sdk/mcp_problems.py:session_mcp_problems (task_executor.py, dashboard/handlers/hooks.py) -- task, webhook -- silent for unconfirmed, names a confirmed refusal; same two tests
Reader: src/kiro_crew/acp/mcp_mount_check.py:run_mount_check -- every session-array harness -- skips a server already in a bucket; an unconfirmed server is in none, so its row is recorded as before
Reader: website/src/pages/chat/McpToolsPanel.tsx -- chat MCP card -- ignores the new key; an unconfirmed server renders
no_report, a confirmed refusal renders failed with its causeTests
test/test_pi_mcp_registration.py(rewritten, 30 cases):mcp_json,mcp_json_unreadable,refused,replaced). Only the unregistered server is failed, with that cause's reason.none,unreadable,malformed,unsealed): every server failed with that handoff reason, and no reason mentionsmcp.json.unregistered_omitted == 1while a pre-existingpruned_omitted == 2stays 2, and the summary carries both "+N" clauses.no valid receipt, and the receipt removed.no scratch window.problem_summary()(with and without reasons),session_mcp_problems,_warn_unusable_mcp_serversand_spawn_mcp_noticeare all empty. A confirmed refusal reaches the subagent notice with just that server's name._initialize_sessionopens with or without a receipt and removes the handoff either way.test/test_pi_gate_extension_mcp.py: the real.tsruns under Node 22.23 and writes the v2 receipt:registeredfor a clean handoff;unregistered: {kirocrew-core: mcp_json}for a shadow, andmcp_json_unreadablefor a brokenmcp.json;handoff: unsealedwith empty causes for another key or nonce;handoff: malformedfor a non-handoff file.test/test_mcp_session_report.py,test/test_mcp_session_report_wiring.py: exact-payload pins gain the four new keys.test_unconfirmed_never_reaches_an_unusable_reader, whose failure shows "failed to start: kirocrew-core (...)" reaching the subagent reader.Local gates on
2f7e92b794: black, isort, flake8, mypy (changed modules), subprocess-encoding, comment-history, brand, file-line cap (0 failures),test_flake_pattern_ratchet.py(60 passed). Related suites on5624fea754(test_acp_pi_backend*.py,test_acp_pi_crew_tools.py,test_pi_*.py,test_subagent_mcp_report_visibility.py,test_mcp_session_report*.py,test_acp_mcp_startable.py): 376 passed, 13 skipped; on2f7e92b794the registration, report, subagent-notice and extension files: 151 passed.check_harness_parity.pyagainst this branch's base reportsACP_BACKENDS_MEMBER_CAPABILITIES [claude]: allowlisted but now proven, an entry this diff does not touch.Manual verification
Not performed: pi and pi-acp are not installed on the verification host, so no live pi-acp
session/neworsession/loadwas driven, and none is claimed. The receipt ordering is a reading of the publishedpi-acp@0.0.34and@earendil-works/pi-coding-agent@0.99.2sources (line references above). The design does not depend on it: if a pi version answers beforesession_startfinishes, the cost is servers shown unconfirmed in the report and a warning in the log. No failed row, no "do not retry" subagent notice, no refused session. The extension's receipt writing is exercised by the real.tsunder Node intest_pi_gate_extension_mcp.py, which is not a pi run.Related Issues
Closes #19774
Builds on #19760 / #19761.
Pattern harvest
Rule candidate: review-prompt
Pattern: an "unknown" outcome recorded in a bucket whose other readers treat membership as final (here the MCP report's failed bucket, read by the subagent "do not retry" notice). Before adding a row to a shared status bucket, enumerate every reader of that bucket, not only the UI that motivated the change.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
🤖 Generated with Claude Code