Repository navigation
fix(ui-sdk): keep a separate-identity payload out when its coordinator dies before release - #4007
Merged
Merged
Conversation
…r dies before release A separate-UID launch was gated only by bubblewrap's --block-fd on a pipe whose sole writer is the same-UID identity coordinator. bubblewrap starts the sandbox on that pipe's end-of-file, so a coordinator SIGKILLed after spawn and before release (alone, or together with the server) started the unqualified payload. Every separate-identity payload now runs behind STATE_GATE, the trusted absolute /bin/sh that needs one complete `go` line on stdin and refuses end-of-file or anything else. The server writes that line only after the coordinator confirms its release. The live launch and the synchronous host probe both do this. The identity helper protocol is unchanged: it requires --block-fd and never constrains the command after `--`. Adds a same-UID stand-in helper and a crash suite that runs the real launcher and coordinator. Records the ruling in policy-write-boundary.md and the host protocol doc, and moves the worker-launcher citations the edit shifted. Closes #3402 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closed
6 of 8 tasks
This was referenced Nov 15, 2026
schlessera
marked this pull request as ready for review
November 15, 2026 14:21
This was referenced Nov 15, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3402
Supersedes draft #3464, which was stacked on #3408 (since merged). This PR carries #3464's single commit onto current
main(3f8ff2934) and redoes the citation moves against the current launcher.What changed
A separate-UID worker launch no longer starts its payload when its identity coordinator dies between spawn and release. Before this change, the payload's only gate was bubblewrap's
--block-fd, whose pipe has one writer, the same-UID coordinator (WORKER_IDENTITY_SUPERVISOR), and the launcher removedSTATE_GATEfrom these payloads. bubblewrap starts the sandbox when that pipe reads end-of-file. Now every separate-identity payload, with or without runtime state, runs behindSTATE_GATE(function identityStartGate): the trusted absolute/bin/shthat needs one completegoline on stdin and exits 125 on end-of-file or anything else. The server writes that line only after the coordinator confirmsrelease, and it holds stdin's only writer, so the payload starts only when both holders have authorised it. The synchronous host probe's identity path does the same. The ruling is a dated section indocs/decisions/policy-write-boundary.md(replacing the #3392 amendment's "Not covered" pointer), and a paragraph under "Separate worker identity" indocs/hosting/agent-workers.md.Why this shape
This is #3392's mechanism (an in-sandbox gate that needs an explicit
goline and fails closed on EOF), carried into the helper path on stdin rather than fd 4. The fd 4 gate needs bubblewrap to run without--block-fdand a descriptor that survives into the sandbox. The identity helper protocol requires--json-status-fdand--block-fdon the coordinator's pipes and closes every other descriptor before it execs bubblewrap, so moving to fd 4 would break every installed helper and need a breaking-contract ruling. The protocol never constrains the command after--, so the stdin gate needs no helper change. It reads a byte at a time, so payload stdin after the gate line is unchanged. No contract surface moved.Proof
Tests ran at
33325124bonorigin/main3f8ff2934; the receipt is from5326175after merging main (governed-writable-workers.mdoverlapped). Host: Linux 7.0.0-42, Bun 1.4.4, bubblewrap 0.11.1, real user namespaces, no container. No network or provider key; the only payload content is Odysseus marker files in owned temporary directories.packages/ui-sdk/tests/identity-gate-holder-crash.test.ts(withtests/fixtures/identity-gate-holder-crash-server.tsand the same-UID stand-in helpertests/fixtures/identity-gate-helper.py) runs the reallaunchAgentWorker/launchAgentWorkerAsyncseparate-identity path and the real coordinator in a separate server process; onlyworkerIdentityHelperis spied to select the stand-in. It SIGKILLs the coordinator during setup, after setup before release (sync, async, and with no runtime state), the server and coordinator together, and the server alone; each case waits until every process of the launch is dead before it looks for the marker. The released control starts the payload exactly once with descriptors0 1 2and byte-identical stdin (itself starting withgo\nand containing NUL/0xff).Failing first — the new test against
origin/main'sworker-launcher.ts, 2 of 2 runs:After the fix: 7 pass, 0 fail.
Mutations (scripted on
worker-launcher.ts, restored and confirmed byte-identical withcmp):identityStartGateis a no-op (state launches keep their gate, stateless ones have none)STATELESS_COORDINATOR_DEATH_PAYLOAD_NEVER_STARTS(1 fail)go\nbefore the coordinator's release instead of after itCOORDINATOR_DEATH_…(sync, async),HOLDERS_DEATH_…(3 fail)STATE_GATEaccepts EOF (IFS= read -r go; exec "$@")COORDINATOR_DEATH_…(setup, sync, async),STATELESS_…,HOLDERS_DEATH_…(5 fail)Neighbouring suites on the host, patched: ui-sdk
gate-holder-crash,refused-launch-gate,worker-launcher,worker-status(57 pass),default-identity-phases,native-identity-inspector,worker-identity-progress(22 pass); ui-serverqualified-identity-helper,worker-host-gate,worker-host-status,worker-probe-placement(34 pass).bun run typecheckpasses.bun scripts/check-citations.tsreports no driftedworker-launcher.tscitation.bun run check:pr --base origin/main # Local preflight passed; affected fast invariants 993 pass, 0 fail{"version":1,"kind":"brain-check-pr-receipt","head":"532617581ea77ff1231d1a8846a319eb47a22719","base":"origin/main","mode":"focused","startedAt":"2026-11-15T14:18:41.351Z","finishedAt":"2026-11-15T14:20:17.120Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":15452.427912000003},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":147.84460599999875},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":158.6832609999983},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":23.541333000001032},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":79969.786913}]}Collisions (
bun scripts/collisions.ts --json --pr 4007at head33325124b): textual with draft #3393 ondocs/decisions/governed-writable-workers.md(citation line numbers only); otherwise closure-only reports.Not run locally: the disposable-container cross-UID qualification (
scripts/prove-worker-identity.ts), which needs the pinned native-runtime image and rootful Docker. Its existing cases exercise this path with the real setuid fixture helper, so hosted native proof is the cross-UID receipt.Guard checklist (proportionate containment)
goline on stdin; end-of-file or any other line ends that sandbox with exit 125. It does not cover post-release server or coordinator death, which is unchanged.Checklist
integrate.ts confirm.)docs/reflect the change, or nothing documented moved.docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.Anything left open
🤖 Generated with Claude Code