Repository navigation
Description
Context
Follow-up from the #3655 spike. That spike could not say which identity-supervisor setup step missed the 5,000 ms readiness deadline in run 42185293538, job 127784600665, because nothing records it. This issue adds the bounded diagnostic that would name the step the next time it happens. Citations are against origin/main 1619741f2.
What the host sees. readySteps (packages/ui-sdk/src/server/worker-identity.ts:124-154) polls only for the supervisor's ready file. On ENOENT it re-checks the supervisor's process identity and throws worker_identity_setup_timed_out once STATE_SETUP_MS (packages/ui-sdk/src/server/worker-launcher.ts:70) has passed (worker-identity.ts:148-150). That deadline is set when the bootstrap is spawned (worker-launcher.ts:1443). So the 5,000 ms covers the Bun worker-entry start, the execve into the Python supervisor, and every supervisor step before ready.
What the supervisor does before ready. In WORKER_IDENTITY_SUPERVISOR (packages/ui-sdk/src/server/worker-identity-program.ts), in order:
- Initialise and bind the control listener (
:106). - Spawn the helper's
launchoperation (:114) and wait for its acknowledgement throughpacket(launch_local)(:130). The socket timeout is 5 s (:110). - Wait for bubblewrap's
--json-status-fdchild PID (:135-144), with its own 5 s bound. - Call the helper's
mountsoperation (:147). This allows a 5 s socket timeout plus a 5 s wait (:50,:66). - Publish
ready(:164).
Why the reason is lost. Each of those steps has a bound of 5 s or more, so the host deadline always fires before the supervisor can name a stalled step. The supervisor reports a failure only through its except path (:236-245): a {ok:false} record plus a stderr line. That path runs terminate() first, which makes another helper call. Meanwhile the host's close request either fails at once or times out after 6 s. After that, the supervisor is SIGKILLed (supervisionLostSteps, worker-identity.ts:52-59), and the host reads stderr (launchDiagnostics, worker-launcher.ts:1316-1324, read at :1584). In the failed job that read was empty: the requirement has no (detail) suffix (:1596-1599).
The identity helper in the native proof is test-only fixture code (packages/ui-sdk/tests/fixtures/identity-helper.c and the fixture's helper.py). The diagnostic therefore has to tell three things apart: host startup cost (infrastructure), a helper launch/mounts stall (fixture), and a bubblewrap status or supervisor stall (product or infrastructure).
Out of scope
- Raising
STATE_SETUP_MSor any supervisor sub-step bound, adding retries, or weakening the separate-UID qualification. - Any change to cleanup,
closeSteps/fallback ordering, or identity verification. - Writing progress to the supervisor's stderr. After a successful launch that stream is the worker's stderr (
worker-launcher.ts:1439-1440,pipes.streams()at:1491), so progress lines would pollute it on every launch. - The ci: attribute recurring native automatic-index aborts on main #2921 automatic-index abort.
Scope
- Supervisor. Before each pre-
readystep, the supervisor overwrites one bounded progress record atcfg['ready'] + '.progress'. The record is at most 128 bytes, is written by temporary file plusrename, and holds{"step": <name>, "ms": <ms since supervisor start>, "wallMs": <time.time()*1000>}. The steps arestarted(after the server identity check),listening(after:106),launch-sent(after thesendmsgat:127-129),launch-acked(after:130),status-read(after:144) andmounts-acked(after:147). The record lives in the broker's existing privatemkdtempSyncdirectory (worker-identity.ts:46), so the existingrmSyncat close removes it. It carries no descriptor, path or authority. - Host. Only when
readyStepsthrowsworker_identity_setup_timed_out, and only whenlaunchDiagnosticsis empty, the launcher fills the existing(detail)channel (worker-launcher.ts:1584,:1596-1599). It reads the record with a bounded, non-following read, and the detail is capped at the existing 400 bytes (:1321). The detail gives the last step, itsms, andwallMsminus the host's spawn time. A missing record reads asstep: none. The requirement prefix,errorClassand the cleanup path stay byte-identical. - Fixture.
captureMaintenanceStage(packages/ui-sdk/tests/maintenance-stage-provenance.native.ts) and the separate-UID harness already retain the thrown message indefault-controls-server.stderrandnative-fixture.json. Confirm the detail reachesruntime-host-proof.
Acceptance criteria
- A keyless unit test drives
readyStepswith a progress record oflaunch-sentand noreadyfile. It asserts that the launch failure's requirement isworker_identity_setup_timed_out (… launch-sent …)and that itserrorClassisworker_host_unsupported. Receipt: the test fails onorigin/mainbecause the requirement has no detail, and passes after the change. - A test with no record asserts
step: none. A test with an oversized record, or one that is a symlink, asserts a bounded refusal, not a read through the link. - A new native fault variant joins the separate-UID qualification (
packages/ui-sdk/tests/identity-broker-qualification.native.ts, beside the existingfault-*helpers): a helper whoselaunchoperation never acknowledges. Its expected outcome nameslaunch-sent, and ordinary identity cleanup still passes. Mutation receipt: remove thelaunch-sentwrite, watch that case fail on its step assertion, then restore. STATE_SETUP_MS, every supervisor bound and the cleanup and identity assertions are unchanged, which the diff shows.bun scripts/prove-worker-identity.tspasses with its existing bounds in the hostedruntime_hostjob.
Verification
Keyless unit tests through bun run test. Native proof comes only from hosted runtime_host (bun scripts/prove-worker-identity.ts). A host without unprivileged user namespaces cannot run it locally.
Contract impact
Expected to be additive. WorkerHostError already carries requirement (detail) whenever launch stderr has content, and this issue adds detail only to a case that today has none. Before implementing, confirm this against docs/integration-contract/wire.md:938 and docs/integration-contract/http.md:224. If it counts as a contract change, the commit takes the CONTRACT: prefix and updates the index in the same commit.
Refs #3655
Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Rechecked the readiness loop, host deadline, supervisor sequence and empty-stderr detail path against cited main. The prescribed bounded diagnostic/native fault proof is a complete brief; preserve p1 and add agent-ready. No native qualification was run by this triage.
Activity
schlessera commentedon Nov 8, 2026
Maintainer, 2026-11-08: commit this to 0.45.0 and work it in the current run. Before implementing, the readiness review still has to check the contract surface (
docs/integration-contract/wire.md,http.md).schlessera commentedon Nov 8, 2026
Claiming (claim token
wi-3664-a63e5), branchfeat/record-readiness-progress, fromorigin/maina63e564f0.Readiness. Every
file:linein the body still matchesa63e564f0: none ofworker-identity.ts,worker-identity-program.ts,worker-launcher.ts,identity-broker-qualification.native.ts,maintenance-stage-provenance.native.ts,wire.mdorhttp.mdchanged since1619741f2.bun scripts/collisions.ts --pathsreports one path collision: draft #3464 also editsworker-launcher.ts(different region). The rest are closure-only.Contract check (wire.md:938, http.md:224): additive.
errorClassstaysworker_host_unsupportedand the message staysAgent worker boundary unavailable: <requirement>. <route>.WorkerHostStatus.requirement) names the requirement. It does not list requirement strings, and no contract or hosting doc namesworker_identity_setup_timed_out.(detail)suffix already appears on requirements whenever launch stderr has content. This change adds a detail to one requirement that today never has one. No field is added, removed or retyped, and no value changes meaning.CONTRACT:, a sentence goes intowire.md,http.mdand the index, and there is a minor changeset. Noneeds: decision.One implementation note, from the source. For a helper that never acknowledges
launch(the native fault case), the supervisor'spacket(launch_local)times out about 5 s afterlaunch-sent. That is a few hundred ms after the host deadline, so itsexceptpath usually does writeWorker identity supervision failed: timed outto stderr before the host reads it. That line doesn't name a step. If the progress detail appeared only when stderr was empty, this fault case would never showlaunch-sent. So on aworker_identity_setup_timed_outthe progress record goes first in the existing(detail), followed by any stderr, all within the existing 400-byte cap. Every other requirement keeps its detail byte-for-byte, and theNO_TMPFS_SIZEmapping still tests only the stderr part.schlessera commentedon Nov 8, 2026
Delivered in #3703, squash
e4d4ac8434a41b0f4c2d1c7997dbc601756390b7onmain. Its parent is the tested basea63e564f0, and its treefc556eb0matches the candidate checkout1da147f83.packages/ui-sdk/tests/worker-identity-progress.test.tsfailed first onorigin/main:Received: "worker_identity_setup_timed_out", with no detail. It passes with the change. There were three mutations, each restored: the supervisor'slaunch-sentwrite, the launcher's read, andO_NOFOLLOW. Each failed its named assertion.runtime_host(candidate run 42475324020, job 128715561636) ran the newno-launch-ackfault case:{"setupTimeout":{"requirement":"worker_identity_setup_timed_out (step: launch-sent, ms: 0, sinceSpawnMs: 69; Worker identity supervision failed: timed out)","errorClass":"worker_host_unsupported"}}. The case passed, as dididentityQualification(29 cases).wire.mdandhttp.md, plus a minor changeset).STATE_SETUP_MS, the supervisor bounds, cleanup and identity checks did not change.The #3655 root cause stays unattributed until a recurrence carries this detail.