Repository navigation
CONTRACT: fix(backends): use the host app exec wrapper - #2397
Merged
Merged
Conversation
Carry optional host exec through startup and per-turn probes, backend construction, Claude SDK spawning and Pi worker-local tools. Preserve explicit-empty and omitted-host compatibility. Add keyless runtime and propagation mutation coverage; include the additive contract, minor changeset, API report and moved citations.
…ions Keep explicitly supplied host configuration copied per backend, including empty configuration. Preserve omission through standalone construction and resolve the host fallback for each Pi worker turn. Add intended-red controls for ambient changes after construction and correct the additive contract and changeset wording.
This was referenced Oct 18, 2026
Open
Reconciles moved app.ts, agent/backend.ts and backend-module.ts citations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pi serializes the host exec into worker-local grep/bash, so the wrapper and killer must exist inside the worker's view. Bind each configured helper file read-only into ordinary and restricted views, never its directory, and select the exec once per worker before any relay, reservation or worker is acquired. Refuse a wrapper or killer that is not an absolute regular file (directly or through a symlink), and refuse a nonregular wrapper for an ordinary Claude worker, so a directory is never bound into a worker below its masks. Real bubblewrap governed/strict/restricted workers run the real worker-local tools through a masked, aliased wrapper and cancel through the killer. Refs #1429 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Includes #2377. Reconciles moved app.ts citations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
schlessera
marked this pull request as ready for review
October 22, 2026 15:14
schlessera
marked this pull request as draft
October 22, 2026 15:14
schlessera
marked this pull request as ready for review
October 22, 2026 15:20
This was referenced Oct 22, 2026
This was referenced Oct 22, 2026
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.
Refs #1429
What changed
Each app passes its resolved exec configuration through startup probes, backend construction, Claude per-turn probes and SDK workers, and Pi grep/bash, including the tools inside Pi workers. Host A/C stays authoritative over ambient B. Explicit
{}disables the optional wrapper. Omitted standalone options keep the late ambient fallback, which Pi resolves once when each worker starts.This head also redoes the worker-boundary corrections from the unpublished
d6e1e889candidate, which this session could not recover:workerExecHelpers, exported fromui-sdk/internal.Why this shape
The existing backend context and factory options carry the additive configuration (#1429, #1343). No new seam is added. Helpers go through the launcher's existing
readPathshandling, so the mask and alias behavior is the one runtime paths already have. Host-owned helper targets must stay stable through launch; no TOCTOU guarantee is claimed. Permissions, provider history, argv semantics, private masks and deadlines are unchanged. History is preserved: this branch mergesorigin/mainnormally on top of the published headf462a8f84, without a rebase or force-push. That merge includes #2377.Proof
Base
aa8c8966b(origin/main), headf5684cedd.New failing-first receipt.
packages/ui-backend-pi/tests/worker-host-exec.test.tslaunches real bubblewrap workers in the governed, strict and restricted profiles. Each worker runs the actual worker-local grep/bash tools through a masked, aliased wrapper and cancels through the killer. The file also has 10 refusal cases. It was run against the publishedworker-session.tswith only the tests added:HOST_HELPER_VISIBLE_IN_WORKERwithENOENT … posix_spawn '…/private/links/wrap'.worker launchedinstead of the refusal.NO_RELAY_BEFORE_HELPER_REFUSAL(1 envelope call).Mutations. Each was applied, ran red on the named assertion, then was restored byte-for-byte:
readPathsHOST_HELPER_VISIBLE_IN_WORKERreadPathsHOST_HELPER_VISIBLE_IN_WORKERHELPER_SIBLINGS_STAY_MASKEDCLAUDE_WORKER_WRAPPER_REGULARexec = ambientExecConfig())PI_WORKER_HOST_EXECSDK_WORKER_HOST_ARGVSuites.
bun run test packages/ui-backend-claude packages/ui-backend-pi: 1173 pass / 0 fail / 5817 assertions onf5684cedd.tsc --noEmitandbun run lintare clean.bun run api-report: the only delta is the new internal exportworkerExecHelpersinui-sdk.txt. The three optional publicexecfields are unchanged from the original candidate.tests/decision-citations.test.ts: 44 pass after the citation reconciliation.Default local preflight on
f5684cedd, three runs:Hit my own outer 3,500 s shell
timeoutduring feedback (exit 124; feedback child 137) on a host running four concurrent preflights. Fast invariants were 744 pass / 0 fail, and no test failure was recorded. This is a harness cutoff, not a gate result.Lint/leakage, environment, changeset and fast invariants passed (744 / 0). Import-graph feedback (296 files) finished 3,501 pass / 2 fail. Both failures were in
ui-server/tests/brain-client.test.ts: the combined process hit maintenance admission state (EPERM fchownandtemporary storage is busy). The file passes alone (35 / 0) and paired withsync-runtime(46 / 0). Filed as ui-server: brain-client version-pin and wrapper cases fail in combined feedback on maintenance admission state #2655; this diff does not touch that code.Feedback finished 3,502 pass / 1 fail:
hygiene-review.test.ts"Actions production cap…" overran its 30 s deadline (32.8 s). It passes alone (36 / 0). Recorded on ui-server: maintenance release reports missing fixture state after refresh timeout #2412, which covers the same overrun class.Passed (exit 0): lint/leakage, environment, changeset, 744 fast invariants / 0 fail, and import-graph feedback 3,503 pass / 0 fail (296 files).
No deadline, guard or test was weakened between runs, and the head did not change.
History. The earlier receipts keep their own identities. The original
f462preflight failed (2 native exit-137), andd6e1e889's R1/R2 and draft-runtime setup-hook receipts belong to that unpublished tree. None of them is transferred to this head.Checklist
f5684cedd(run 4). Hosted ready-candidate proof is pending (the coordinator owns confirmation); draft gates are green on this head..changeset/host-backend-exec.md, a four-package minor, updated for the helper behavior.package-api.mdcomponent describes helper visibility and refusal, and the index entry is retained. The commit is prefixedCONTRACT:.worker-spawn.ts,exec-wrapper.ts,worker-session.ts,app.ts,agent/backend.ts,backend-module.ts).Anything left open
Complete selected hosted proof (all six categories plus pack qualification) on the matching head, ready-candidate confirmation and merge. These are coordinator-owned.
🤖 Generated with Claude Code