Repository navigation
fix(workers): honor profile setup-script opt-out - #192538
Conversation
Co-authored-by: galiniliev <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes the worker profile’s setup opt-out apply to repository preparation, checkout, and startup lifecycle commands. Example: A Crabbox profile sets settings.runSetupScript=false while an administrator requests repository setup.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current setup-policy bypass, the previous proof request is satisfied, and no actionable patch defect was found; failed CI gates remain unresolved. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway dispatch combines profile policy, repository setup intent, and current operator authority before preparing a worker and activating its workspace. flowchart TD
A[Authenticated dispatch] --> B[Profile and repository admission]
B --> C[Preparation identity]
C --> D[Worker provisioning]
D --> E[Repository checkout]
E --> F[Startup lifecycle]
F --> G[Session activation]
Technical reviewBest possible solution: Keep profile suppression in the existing preparation and startup owners while preserving checkout, secret validation, and current operator authority. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the bypass, and supplied native negative-control output records forbidden prepare and checkout effects after removing the policy repairs; this review ran no target code. Is this the best way to solve the issue? The patch repairs policy precedence at the existing owners, keeps caller authorization separate from profile suppression, and adds native acceptance of the existing setting without introducing a competing execution path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f9ca54aefc19. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +10, Tests +2359, Docs +1, Other +8. Total +2378 across 25 files. Added test files: 13. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 4, 2026, 12:10 PM ET / 17:10 UTC (Revision 4). |
Address hosted review with production-owner proof and preserve current authority and lifecycle ownership. Co-authored-by: galiniliev <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Honor the documented profile flag in Crabbox and initialize presence only after repository capabilities attach. Prove preparation and runtime-image checkout through actual Gateway, managed Node CLI and worker effects, including revocation and missing-policy controls. Preserve secret validation before policy. Allocate exactly 2,089 native regression/support lines; shared baseline remains unchanged. Integrate the already-landed QA dependency without duplicating its production changes. Co-authored-by: galiniliev <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* fix(workers): honor profile setup-script opt-out Co-authored-by: galiniliev <[email protected]> * fix(workers): enforce profile setup opt-out on repository checkout Address hosted review with production-owner proof and preserve current authority and lifecycle ownership. Co-authored-by: galiniliev <[email protected]> --------- Co-authored-by: galiniliev <[email protected]>
What Problem This Solves
Fixes: a worker can run a setup script even though its selected profile disables setup scripts.
User Impact
A profile's explicit setup-script opt-out applies during preparation and prepared-image startup, including repository checkout setup. Existing recipe-secret validation is unchanged. No migration or new setting is introduced.
Why This Change Was Made
Make the native profile policy take precedence over per-request setup authorization at both existing execution paths. Keep preparation and startup on the same policy.
Evidence
settings.runSetupScriptbehavior, including omitted/true semantics and its distinction fromsettings.setup. Removed the invalid undefined JSON-setting fixture.node scripts/run-vitest.mjs src/gateway/worker-environments/provider-intent.test.ts src/gateway/worker-environments/placement-dispatch-prepared.test.ts --maxWorkers=1.Native Runtime Proof
The committed
test/e2e/qa-lab/runtime/worker-setup-policy.e2e.test.tsexercises a built Gateway, authenticated operator RPCs, actual managed Node CLI enrollment, native Git checkout, worker command execution, and real Podman filesystem/checkpoint effects. No production auth hooks or fabricated grants are used.prepareeffect, checkout succeedscheckoutsetup effectAll 8 native cases passed. Two input-equivalent counterfactual runs removed only the three setup-policy owner repairs: the disabled repository and image cases then observed forbidden
prepareandcheckouteffects respectively. These are product-boundary reds, not harness startup failures. All owned containers, checkpoints, Gateways, and retained process groups were verified absent afterward; the supplied image was preserved.This proof exposed and repairs two adjacent native defects: Crabbox's strict profile allowlist rejected the already-documented
runSetupScriptsetting, and initial worker presence maintenance consumed repository capabilities before plugin publication. Presence initialization now uses the existing post-plugin/pre-recovery owner. Recipe-secret validation remains before setup-policy evaluation.The source-qualified composition used native base
8bc44540c46d8d1e3d80800c7ea1b11277c2db02, this PR's previously published policy, and the QA/password support subsequently landed in #192540. Integration includes that landed dependency through main7c2ff8f775acca3e5c93c9c22b6247e37df29bae: all 17 changed file hashes and all eight dependency hashes matched the executed source on integration. The final follow-up only addsunknownrejection typing and a bounded cleanup-error name in two test helpers, plus exactly five allocated lines; focused types/lint/format, all 21 provider tests, and a fresh independent P0–P2 review passed for that delta. Of 48 full-source review contracts, 47 are byte-identical; the remaining sessions-create commit guard adds agent/tool-requester fencing that is inactive for these operator-created cases. This is source-equivalent integration evidence, not a claim that the complete refreshed main tree ran in the original runtime proof.Supporting qualification: 180 tests passed (107 startup/presence/integration, 59 policy/provider, 14 prompt-prefix stability), focused types, typed lint, formatting, whitespace checks, and complete-source independent P0–P2 review. The existing recipe-secret checks and native TLS/Git verification remain enforced.
Limits: external GitHub/model/backend responses are synthetic. There is no live cloud allocation, post-setup model-turn completion, or warm-checkpoint-fork reuse claim; the image matrix exercises native
runtimePreparation.source=image. An earlier model-stage stall is not claimed fixed. Private runtime TLS/config material is excluded from the PR.Captured native final-effect receipts
Original runtime output, effect receipts, and executing-source identity
These are captured results from the retained native execution, not a new rerun or reconstructed expected outcomes. The seven-case selection and separate image-allowed selection together cover eight cases; their skipped counts are preserved below. The original source composition and integration limits above still apply. The test writes the
evidenceandcleanedfields only after its final effect/resource assertions (writer).For each original JSON receipt, the excerpt below preserves its entire
evidenceobject andcleanedvalue. Only the separate backend diagnostic array is omitted because it contains local transport details. The SHA-256 identifies the complete retained original; the actual effect excerpt is supplied inline for reviewer access.{"file":"current-policy-matrix/repository-allowed.json","sha256":"5caf6fb3931a7e1f3db6d7eb04198d270f6cf6536e6bed7c4778b00b9ed8e876","evidence":{"mode":"repository","scenario":"allowed","source":"project","checkout":true,"effects":["prepare"]},"cleaned":true} {"file":"current-policy-matrix/repository-disabled.json","sha256":"a6e9140e72c94524af981da924b888a6af3c51562bae17fc0abf814adac0c840","evidence":{"mode":"repository","scenario":"disabled","source":"project","checkout":true,"effects":[]},"cleaned":true} {"file":"current-policy-matrix/repository-non-admin.json","sha256":"10c4e2bb26786cfbff68e5bb18b25f0834b1b67e309df79953960b18df72b1e1","evidence":{"mode":"repository","scenario":"non-admin","source":"project","checkout":true,"effects":[]},"cleaned":true} {"file":"current-policy-matrix/repository-revoked.json","sha256":"14a768577f3c2bd1c0bdaf27f2bfb9d528be245e51f5ff11ef8e594055b86bbf","evidence":{"mode":"repository","scenario":"revoked","revoked":true,"effects":[],"settled":true},"cleaned":true} {"file":"image-allowed-native-git/image-allowed.json","sha256":"e225cce1649c93c3c4f9a1c565f7284c36bf86e81fe309415183b8e6094421b0","evidence":{"mode":"image","scenario":"allowed","source":"image","checkout":true,"effects":["checkout"]},"cleaned":true} {"file":"current-policy-matrix/image-disabled.json","sha256":"3029bd21deff2d139aa68ae627399860f01e336029ccf9dc745071a69fe2b1fd","evidence":{"mode":"image","scenario":"disabled","source":"image","checkout":true,"effects":[]},"cleaned":true} {"file":"current-policy-matrix/image-non-admin.json","sha256":"6701f98c036002d37ed6b1f2c8659706c3b5f80f233d4295c81b1b747ff41e37","evidence":{"mode":"image","scenario":"non-admin","source":"image","checkout":true,"effects":[]},"cleaned":true} {"file":"current-policy-matrix/image-revoked.json","sha256":"819d872fd1e24ec48d1d0859b6cda06d77dd8de102d545ad7573d137b33ded11","evidence":{"mode":"image","scenario":"revoked","revoked":true,"effects":[],"settled":true},"cleaned":true}Captured Vitest lines (ANSI styling removed; original filenames retained):
Input-equivalent missing-policy control: only the three policy owner files were restored to their base bytes; all 31 compared inputs were verified. Build exit 0; test exit 1, two failed and six skipped. The actual forbidden effects were:
The negative controls repeat the intended forbidden-effect failure during cleanup before per-case JSON is written; they are supported by the original failure output, successful backend command receipts, and independent owned-resource absence checks, not invented per-case success receipts. Compiled stack mapping was stale, so no stack line is used as source identity.
Executing-source pins (the eight QA dependency files are source context; only the relevant helper subset executes in this matrix):
{ "nativeBase": "8bc44540c46d8d1e3d80800c7ea1b11277c2db02", "publishedPolicyHead": "1a94ed8ab868dae58e70b21fb8f71e086d464601", "policyPatchSha256": "daa4bfdd01d0eda8c7868d0b1e2976c0c0b15738f08f313fe3760942c39bdca7", "runtimeProofPatchSha256": "4e0f5e6add387afa0116caf8bd859df92ebe491a39b942a8ddf05e6f645c70a0", "executedMatrixSha256": "6f9ad08f5933d8416f5c9ed29f119af9f1f32a0d06baff9c9133d78ad3023f2c", "qaDependencyFileSha256": { "config/test-lines-allocations/github-worker-initial-launch.txt": "fc826382e5a182e58f63441b7eefc9390c992b9ef0b8b3835fc3b8d48a39a30f", "extensions/qa-lab/src/gateway-child-setup.ts": "bfc1e7f1b1f0ffce5880a4be6b6d547a7ad35a3fef8105d2a37af1ed8cd4c7b1", "extensions/qa-lab/src/gateway-child.ts": "ba0ad682a895e8730c9578968726aa5ac582e2d1514bd5317e4779fe2f9fb930", "extensions/qa-lab/src/gateway-rpc-client.ts": "fe4f851589d610de22ff12cbc687baa6fed2cc4f027e492924b8144ff3148c34", "extensions/qa-lab/src/gateway-rpc-client.test.ts": "fdfaf3e835307c53b2dff7477d3440bddf49f039e518331b4867098a1406c226", "test/e2e/qa-lab/runtime/paired-node-worker-wire-fixture.ts": "d2f77fad7f55a3a57e2c17358a8e6fd0df95aa66a08d575ec5fd696aad320edd", "test/e2e/qa-lab/runtime/worker-github-api-preload.mjs": "5b893b6045be5299be911122970c9d038420b97cc5e57b40bbf2e40469277c31", "test/e2e/qa-lab/runtime/worker-github-initial-launch.e2e.test.ts": "6f58631379046325910e51412547375bddd4dc59edca359a145771d6352f481c" } }The retained runtime proof patch is source-equivalent to the integrated candidate except for the separately reviewed rejection typing/cleanup diagnostic already described above. These receipts do not assert execution of the complete refreshed main tree, live Azure, a model completion, or warm-checkpoint-fork reuse.
Exact test-cost accounting
This follow-up allocates exactly 2,089 justified counted lines for the native matrix, provider regression, and real-lifecycle fixture support. Together with the existing 196 policy lines, the full PR adds and allocates 2,285 lines. The shared scalar is unchanged. On integration main
7c2ff8f775a, the canonical checker reports baseline 6,466,021 / ceiling 6,465,830 (191 over; exit 0 under the no-growth rule), versus candidate 6,468,306 / ceiling 6,468,115 (the same 191 over; exit 1 because tests grow). This inherited deficit is retained, not padded or reported green. Exact-head CI and hosted overall rating remain separate landing gates.Exact-head CI attribution
Current source remains
bd7405b07387497db6c325a2343174b1d4bc0ad7. The completed hosted review rates overall Platinum (4/6) and proof confidence Diamond (5/6), with no actionable findings.CI run 41867356457, attempt 1, executed
ef48bc0aa53304d2b8255ebdbb105d03514075fe(base7c2ff8f775acca3e5c93c9c22b6247e37df29bae+ this head). All 79 terminal jobs were inspected: nine nonaggregate failures and their downstream gate.security-fastpassed.browser-panel-render.tsx:149: a possibly undefined split index is passed as required description. Exact base and candidate reproduce the same sole diagnostic in the owning UI-chat leaf. Producer, consumer, configs and lock match; all seven broad commands were not replayed.sessions_spawntarget-policy denial. No authorization bypass observed.template.jsonfixture against the native CLAW.md/YAML reader; removal is already in the baseline.The three runtime cases belong to one failed job. Reproductions used separately pinned base/merge builds, frozen dependencies, the same immutable rootless image and pinned Bun. Local build/launcher Node 26.12.1 differs from CI 24.22.1; serial selected tests are not whole-shard timing equivalence. Owned containers were verified absent.
The invalid suggestion to remove 191 test lines while retaining allocation was rejected: credit cannot exceed net growth, and reducing both preserves the debt. No tests, source, shared scalar, or budget rules were weakened. The documented inherited-failure route is being evaluated using concrete attribution; failed CI remains failed, and native security, source, review, authority and drift checks remain enforced.
Contributor credit
Co-authored with @galiniliev.
Work sessions