Repository navigation
fix: backport #31016 and #33057 to 0.12.1 (agent socket for enforced harnesses) - #33177
Conversation
…ss (#31016) * feat(dashboard): add the agent socket and its ipc capability Phase 1a of rfc-sandbox-ipc-capability. A Kiro Crew server under an enforced harness is withheld the internal secret by design, so every gateway-backed tool it serves is refused (#11988). This adds a second unix listener that authenticates by connection instead: a one-time pickup is redeemed for a capability bound to the redeeming process, admitted only from that process, on internal routes, for the session its stub token names. token_auth routes an admitted request onto its ordinary internal-grant arm; the listener takes no secret, cookie or bypass. Nothing issues a pickup yet, so no session changes. * fix(acp): let kirocrew-core reach the gateway under an enforced harness Phase 1b of rfc-sandbox-ipc-capability. An enforced harness (codex, opencode, goose, pi) masks the internal secret from kirocrew-core, so every gateway-backed tool, memory included, was refused internal_secret_missing. The session's array now carries a one-time pickup on kirocrew-core's element for those harnesses only; the server takes it out of its environment at startup, redeems it on the agent socket, and sends every request there by capability, never over TCP. Other harnesses keep today's array and path unchanged. (cherry picked from commit 2f20f5b) Original author: Ray Xu (#31016).
…ck (#33057) The capability store's weakref.finalize callback took the store's non-reentrant lock. The cyclic garbage collector can run that callback on a thread that already holds the lock (inside issue, or redeem's locked liveness check), and the thread then waits on itself forever, hanging the event loop or the subprocess executor. The finalizer now only queues the pickup's digest; the next issue, redeem or verify drops every queued pickup and its capability under the lock before it reads, so a retired pickup is never served. Refs #31016, #32866 (cherry picked from commit 1d9a632) Original author: Ray Xu (#33057).
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. This backport changes only backend IPC code, tests and docs, and adds or changes no user-visible control, so no screenshot is needed. [UX-REVIEWED] 903e0db Description read[DESCRIPTION-READ] 4fccd4199c7ab2aa56f469d1612bd4ba25550a39770d891fbc81a310ccb63195 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: this is a straight backport of reviewed Notes
[DESIGN-REVIEWED] 903e0db Description read[DESCRIPTION-READ] cd59ddaba9a8da461d72e1de5abd3b352a422367170c54d387d2406ca5e0ab19 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This backports four reviewed fixes from What this change shipsInventory (5 items) — 4 justifiedIntent: under an enforced harness on 0.12.x, Kiro Crew's own MCP tools should reach the gateway again, and the gateway should not hang. This is a FIX (backport).
[FIRST-PRINCIPLES-REVIEWED] 903e0db Description read[DESCRIPTION-READ] e0be54cdedbd56e28855a64719517724c77a73e5faba38634b081a8f3f48d410 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
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: |
with_ipc_pickups matched the element name only, so when an operator stubs kirocrew-core through the gateway broker the pickup landed on the stub's environment. The stub never takes it out, so a same-uid shell in the session could read it from /proc/<pid>/environ and redeem it for a capability that reaches the internal routes. A pickup now goes only on an element that launches the server directly; an argv running the broker stub module, or one that cannot be read, gets none. The enforced-spawn e2e child also runs with -B so it writes no bytecode into the checkout it imports. Refs #31016, #33177
…#33192) with_ipc_pickups matched the element name only, so when an operator stubs kirocrew-core through the gateway broker the pickup landed on the stub's environment. The stub never takes it out, so a same-uid shell in the session could read it from /proc/<pid>/environ and redeem it for a capability that reaches the internal routes. A pickup now goes only on an element that launches the server directly; an argv running the broker stub module, or one that cannot be read, gets none. The enforced-spawn e2e child also runs with -B so it writes no bytecode into the checkout it imports. Refs #31016, #33177
…#33192) with_ipc_pickups matched the element name only, so when an operator stubs kirocrew-core through the gateway broker the pickup landed on the stub's environment. The stub never takes it out, so a same-uid shell in the session could read it from /proc/<pid>/environ and redeem it for a capability that reaches the internal routes. A pickup now goes only on an element that launches the server directly; an argv running the broker stub module, or one that cannot be read, gets none. The enforced-spawn e2e child also runs with -B so it writes no bytecode into the checkout it imports. Refs #31016, #33177 (cherry picked from commit b4a5645) Original author: Ray Xu (#33192).
|
span=fc798caba597
|
GET /api/ipc/session answered a verified capability holder without writing any audit row, so a granted capability decision never reached the operator's SEL. Every other grant on the agent socket is recorded. The session-query success path now writes the same granted dashboard.token_auth row as the internal-route grant. Refs #31016, #33177
GET /api/ipc/session answered a verified capability holder without writing any audit row, so a granted capability decision never reached the operator's SEL. Every other grant on the agent socket is recorded. The session-query success path now writes the same granted dashboard.token_auth row as the internal-route grant. Refs #31016, #33177 (cherry picked from commit 8e4486f) Original author: Ray Xu (#33269).
|
span=78195fa567a8
|
…#33192) with_ipc_pickups matched the element name only, so when an operator stubs kirocrew-core through the gateway broker the pickup landed on the stub's environment. The stub never takes it out, so a same-uid shell in the session could read it from /proc/<pid>/environ and redeem it for a capability that reaches the internal routes. A pickup now goes only on an element that launches the server directly; an argv running the broker stub module, or one that cannot be read, gets none. The enforced-spawn e2e child also runs with -B so it writes no bytecode into the checkout it imports. Refs #31016, #33177 (cherry picked from commit b4a5645) Original author: Ray Xu (#33192).
Problem / Motivation
Goal: Bring #31016 (kirocrew-core reaches the gateway under an enforced harness, through a capability-bound agent socket) and its deadlock fix #33057 from
mainontorelease/0.12.0, in one small batch.Why it matters
On 0.12.0, an enforced harness withholds the gateway's internal secret from its child, so the Kiro Crew MCP server inside it cannot reach the gateway's internal routes and its tools fail. #31016 adds an agent socket that admits that server by a one-time pickup bound to the peer pid. #31016 was dropped from fast batch 1 (#32866) because Opus found that its capability store's
weakref.finalizecallback took a non-reentrant lock that garbage collection can re-enter on the same thread, hanging the gateway. #33057 fixes that onmain, so the two ship together.Not a goal
main; nothing is changed only here.CHANGELOG.mdchange.What changed (motivation → approach → change)
Five picks with
-xontorelease/0.12.0@c87b986e65(the live head fromgit ls-remoteat the start), one commit each, in this order:30e1626165security.mdtext links torfc-sandbox-ipc-capability.md, which release lacksdocs/request-for-change/README.mdhand-resolved: release has an older audit sentence, so #30788's sentence was appended to it and its row inserted2f20f5b5601d9a632618b4a564562dkirocrew-coreelement, so no other same-uid process can read and redeem it; the e2e child runs with-B8e4486f613_log_auth), like every other capability grantEvery commit is authored with the public identity and names its original author.
builder-security checked: #31016 adds a unix listener (
agent-ipc/agent-<port>.sock) in the gateway's data home, same uid only, no TCP, refusingX-Internal-Secret; it is taken exactly as merged onmain, where it was reviewed. No other bind, route, auth or storage change.Backwards compatibility
Compatible: the dashboard TCP path and the existing secret-based internal auth are untouched; the agent socket only adds a way in for enforced-harness children.
Removes nothing.
Tests
Proof: not provable -- other: a backport of main commits whose proof ran on their own PRs
release/*, so the related set was run here: every test file the picks touch or that imports a changed module or reads the touched docs, 262 files, sequential batches of 20,-n0. 11101 passed, 0 failed, includingtest/test_agent_ipc.py(the newtest_an_owner_collected_while_the_store_lock_is_held_does_not_hangandtest_a_granted_session_query_writes_one_granted_sel_row),test/test_agent_ipc_client.py(the newtest_a_broker_stub_for_kirocrew_core_gets_no_pickup) andtest/test_agent_ipc_enforced_spawn_e2e.py.--platform linux) pass.scripts/docs-lint.shreports one finding,docs/decisions/2026-11-07-a-registered-themes-overlays-can-be-turned-off.mdnot indexed, which a cleanrelease/0.12.0@c87b986e65reports the same way; this batch does not touch it.Manual verification
N/A - verified on the main PRs. The 0.12.1 RC soak is the end-to-end check.
Screenshots / video
N/A - no frontend file changes.
Related Issues
Backport to the 0.12 line for 0.12.1 of #31016, #33057, #33192 and #33269 (prerequisite #30788). Refs #32866.
Sibling sweep
Siblings: none -- the source PRs carried their own sibling sweeps; this PR only carries those fixes.
Pattern harvest
Not generalizable: this PR only carries fixes already on
main. The source PRs have their own harvest.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.