Repository navigation
fix(pi): clear main's real-adapter lane and set-gate ratchet reds - #22951
Conversation
…-adapter lane #22883's node-engine guard confines each 'node --version' probe through _pi_probe_wrap, which calls the sync pi_mod.wrap_argv. The lane (#22807) replaced only wrap_argv_async and the preflight, so on a runner without user namespaces every pi_session test errored at setup with SandboxUnavailableError. Replace the sync wrap by identity too, and say so in the module docstring.
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: both items are test-lane and ratchet repairs for main reds the description links, and no default or behaviour changes. What this change shipsInventory (3 items) — 3 justifiedIntent: get main's two required pi checks (Real Adapter lane, set-gate ratchet) passing again so rebased backend PRs stop inheriting reds — a FIX.
[FIRST-PRINCIPLES-REVIEWED] 56e0114 Description read[DESCRIPTION-READ] bc318f16d43cdbf079c21991c1cc9e90acc237f4dd330f868cdfad2103bc63ac That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The PR touches only backend code and tests, with no user-visible controls, strings or states, so the missing blind read leaves no evidence gap. [UX-REVIEWED] 56e0114 Description read[DESCRIPTION-READ] 47fe8dc1d6338a55015cf3f71886414475ced0d18a809b6a4e6aa9a41a4f19a4 That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: both fixes go to the cause of each red, and they behave the same as before ( Notes
[DESIGN-REVIEWED] 56e0114 Description read[DESCRIPTION-READ] b6a72afb9452458a824f268c2f45760e6ad3da64c512bada21868127f0ceac21 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- website/src/pages/chat/useChatPageSessionController.ts:602 -- Immediate Back loses the pushed session’s Forward provenance
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1: LOW harm. I confirmed every condition the failure needs:
The result is visible on screen: Forward shows A instead of B, and only that history entry's The real fix is a third recording point keyed to how soon False positive or not applicable? A repository writer can comment: |
buluoray
left a comment
There was a problem hiding this comment.
Approve at 79cd0bc. Fixes main red on the Real Adapter Contract Tests lane (first seen on b700d47, still red on 0144ea1).
The cause holds: #22807's lane stands in for the OS sandbox by patching wrap_argv_async, but #22883 added _pi_probe_wrap, which calls the sync wrap_argv that pi.py imports at module level (pi.py:58, called at :281). On a runner without user namespaces that real wrap raises SandboxUnavailableError during resolve_spawn, so all six pi_session tests error at setup. Patching pi_mod.wrap_argv with an identity is the matching stand-in, because _pi_probe_wrap looks the name up on the module at call time.
Test-only (one file, +11/-4), no product or sandbox change, and the Real Adapter lane is green on this PR.
#22808 gated _mirrorless_member_mounts on two new 'backend in ACP_BACKENDS_SESSION_MCP_ARRAY' tests, which #22489's set-gate ratchet (shrink-only, allowlist 2 for this file) counts, so main reds test_no_new_runtime_site_gates_a_field_backed_line_on_a_set. The question those sites ask is who reads this backend's spec, which registry.PROJECTIONS declares per backend: BROKER_ONLY (pi) means no projection is written and the harness reads no spec of Crew's. Read that record, as this file already does for per_tool_deny, so the file is back to its 2 allowed sites and the zero-tool ban is unchanged.
buluoray
left a comment
There was a problem hiding this comment.
Re-approve at 56e0114. This now clears both main reds on 0144ea1.
- Real Adapter (pi): unchanged from my earlier approve. The lane now stands in for the sync
wrap_argvthat_pi_probe_wrapcalls (pi.py:281) as well aswrap_argv_async. - Card ratchet (
test_no_new_runtime_site_gates_a_field_backed_line_on_a_set, red on Linux 3.12 shard 7 and Windows shard 7): #22808 gated_mirrorless_member_mountson membership inACP_BACKENDS_SESSION_MCP_ARRAY, which #22489's tightened ratchet now counts. The fix reads the backend's declared projection instead (projection_for(self.backend).kind is ProjectionKind.BROKER_ONLY). Behaviour is the same for this function: it is only reached for mirror-less backends, and among the session-array backends the only mirror-less one is pi, which is the onlyBROKER_ONLYrow inproviders/mirrors/registry.py. kiro-cli stays out because its projection isNATIVE.projection_forraises on an undeclared backend, and the caller has already resolvedmirror_for, so no backend falls through silently. The comment inbackends_mcp.pyand the capability tests are updated to match.
CI on this head: 84 passed, 0 failed, the rest still running.
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed at 56e0114. This fixes two of the current main reds.
Set-gate ratchet:
- The allowlist for
acp/client_mcp_array.pystays at 2, andtest_backend_cards_advertised.pyis not changed. The two new set gates are converted to read the declared projection, so the ratchet is not weakened. - Equivalence:
BROKER_ONLYresolves to{pi}, and the only mirror-less member ofACP_BACKENDS_SESSION_MCP_ARRAYis alsopi. The removedACP_BACKENDS_SESSION_MCP_ARRAYclause in the early return was already covered byACP_BACKENDS_MEMBER_DISPATCH, which containspi. The caller resolvesmirror_forfirst, so an undeclared backend still fails before this point. - I ran the ratchet,
test_agent_sdk_capabilities.py,test_pi_zero_tool_ban.pyandtest_member_mount_pi.pyon this head (108 passed), and the ratchet plus the capabilities test again on this head merged with current main (68 passed).
Real Adapter lane:
- The change adds an identity stand-in for the sync
pi_mod.wrap_argv, the same stand-in the lane already uses forwrap_argv_async. It adds no skip and no condition, so a real adapter failure still fails the lane. The lane is green on this head.
Not covered here, still open on main: the shard 1 circular import in security.pass_compose, the Windows shard 6 tmpdir residue, and the main Coverage Gate red (it passes on this PR).
The code looks good to ship. I am leaving a comment, not an approval, because PR Readiness is still pending on this head. Auto-merge is already enabled, so nothing else is needed from me.
Problem / Motivation
Goal: Turn main's two red pi checks green again: the "Real Adapter Contract Tests" lane and the backend set-gate ratchet.
Both come from merged pi PRs that each passed alone and clash on main:
pi_sessiontests intest/test_pi_real_adapter.pyerror at setup withkiro_crew.sandbox.SandboxUnavailableError: ... unshare(CLONE_NEWUSER) failed with errno 1 (EPERM), throughresolve_spawn->_pi_node_choice->_pi_probe_wrap->wrap_argv.test/test_backend_cards_advertised.py::test_no_new_runtime_site_gates_a_field_backed_line_on_a_setfails with{('acp/client_mcp_array.py', 'ACP_BACKENDS_SESSION_MCP_ARRAY'): 4}against an allowlist of 2.Why it matters
Both checks are required, so every backend PR rebased on main inherits two reds it did not cause (#22923 and #22911 among them). Meanwhile the pi contract facts go unmeasured and the set-gate ratchet stops guarding anything new.
Not a goal
"tools": [], kiro-cli still never reaches the record.What changed (motivation → approach → change)
1. Real Adapter lane (test-only,
test/test_pi_real_adapter.py).launch_mod._run_preflight_boundedandpi_mod.wrap_argv_asyncwith identity. fix(pi): run pi under a Node that meets its engine floor #22883 (node-engine guard) added_pi_probe_wrap, which confines eachnode --versionprobe through the syncpi_mod.wrap_argv. Nothing replaced that one, so the probe reached the real sandbox._drivealso replacespi_mod.wrap_argvwith an identity stand-in. The module docstring's stand-in bullet now names both wraps.2. Set-gate ratchet (
src/kiro_crew/acp/client_mcp_array.py).self.backend in ACP_BACKENDS_SESSION_MCP_ARRAYtests in_mirrorless_member_mounts. test: count aliased, set-op and helper set gates in the card ratchet #22489 then merged the wider ratchet, and its allowlist for this file is 2 — the two older sites. Each PR was green alone.mcpCapabilitiesadvertises (kiro-cli takes an array too). They ask who reads this backend's agent spec.registry.PROJECTIONSalready declares that for every backend:NATIVE(kiro-cli reads it itself via--agent),MIRROR,EXTERNAL, orBROKER_ONLY(pi: no projection is written and the harness reads no spec of Crew's). The same file already reads that record rather than a set forper_tool_deny.records_zero_tools = projection_for(self.backend).kind is ProjectionKind.BROKER_ONLY, computed first; the early return becomes "not recording and not a member backend". Only mirror-less backends reach this function, via_resolve_session_mcp_serversaftermirror_for. Today the result is the same as before:BROKER_ONLY= {pi} = mirror-less ∩ACP_BACKENDS_SESSION_MCP_ARRAY.mirror_forhas already resolved the record by this point, so an undeclared backend raised earlier and this adds no new failure mode. The file is back to its 2 allowed sites.ACP_BACKENDS_HONOR_ZERO_TOOL_BANcomment inagent_sdk/backends_mcp.py, and the rule recomputed intest_honor_zero_tool_ban_membership_matches_the_rule. The membership both describe is unchanged.No file in this diff matches a Sensitive Change Review glob (checked with the script's own
SENSITIVE_GLOBS).Backwards compatibility
Compatible: same backends record and enforce the zero-tool ban as before (pi only, on this path); no constant, key or set membership changes.
Removes nothing: two set-membership tests are replaced by an equivalent read of the declared projection; no path, row, key or function is removed.
Tests
test_no_new_runtime_site_gates_a_field_backed_line_on_a_set: fails on main (4 > 2), passes here.test/test_pi_zero_tool_ban.py,test/test_member_mount_pi.py: unchanged and green. Revert check: making the new predicate selectNATIVEinstead ofBROKER_ONLYfails 8 of them, so they exercise this path.test_honor_zero_tool_ban_membership_matches_the_rule: recomputes the rule through the same projection seam; the expected set is unchanged.test/test_pi_real_adapter.py(-m real_adapter): the lane being fixed.Manual verification
test/real_adapters(npm ci,PI_ACP_BIN/PI_ACP_PI_COMMANDpointed at it,KIROCREW_E2E_REQUIRE=1). The host'sunshare -Ualso fails with EPERM, and its outer-sandbox env markers were unset sowrap_argvtakes the same path it takes on CI. Main 912acf5:1 passed, 6 errors(SandboxUnavailableError). This branch:7 passed. Already green on this PR's CI at the first head.test_codex_session_mcp.py::test_the_installed_adapter_still_builds_the_frames_the_refusal_readsfails the same way on a clean main worktree (locally installed codex-acp).test_runner_facade.pyfails only when the temp dir is inside the git-ignored worktree, and passes with it outside.Related Issues
N/A: no issue; the failing main run is linked above. Clashing merges: #22807 / #22883 (lane), #22808 / #22489 (ratchet).
Pattern harvest
Not generalizable: both defects are merge-order clashes between PRs that were each green alone. The checks that caught them (the real-adapter lane and the set-gate ratchet) are the generalized guard, and they went red on the first merge that combined them.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.