Repository navigation
fix(macos): retire skill trust when switching gateways - #137563
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 1:50 AM ET / 05:50 UTC. ClawSweeper reviewWhat this changesThe PR binds automatic macOS skill-binary trust to the Gateway that supplied it, revalidates that trust before command launch, refreshes the approvals pane on Gateway connection, and retires the Node-host cache on disconnect. Merge readiness⛔ Blocked before merge - 2 items remain The PR remains necessary and its final launch-admission check addresses the prior authorization-boundary finding. It should remain open until the in-progress exact-head macOS checks complete. Priority: P1 Review scores
Verification
How this fits togetherExec Approvals consumes Gateway skill metadata to auto-allow known command-line tools, commits local policy, and then launches a child process. Gateway replacement must invalidate trust from the retired connection without revoking explicit or manual approvals. flowchart LR
A[Selected Gateway] --> B[Skill status]
B --> C[Gateway-bound trust snapshot]
C --> D[Approval evaluation]
D --> E[Policy commit]
E --> F[Launch admission]
F --> G[Child command]
A --> H[Approvals pane]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +2, Tests +276, Docs +9, Other +539. Total +826 across 15 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the source-bound snapshot and final pre-spawn revalidation as the canonical automatic-skill authorization path, then merge after exact-head macOS validation is green. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the added macOS and Node boundary tests warm trust on Gateway A, retire that connection, and verify a replacement Gateway cannot use A's automatic authorization. Is this the best way to solve the issue? Yes: carrying the Gateway lease in the existing authorization basis and checking it at commit and pre-spawn boundaries avoids a parallel policy path while preserving independent explicit and manual approvals. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eab200e1b863. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
a699171 to
60947d5
Compare
60947d5 to
2fae6c9
Compare
920cc2b to
caf69a6
Compare
2fae6c9 to
2dbe84c
Compare
2dbe84c to
64a4954
Compare
64a4954 to
79f7e14
Compare
Keep native trust snapshots source-bound through the final execution authorization check and replace headless caches when their connection retires. Refresh Gateway-derived approval lists while preserving Mac-local policies and drafts.
Prepare the socket with a status request before the unchanged readiness deadline. Count health requests separately so setup cannot consume the unavailable response; require one connection and both health attempts.
e340794 to
e720c2b
Compare
|
Merged via squash.
|
* fix(nodes): bind skill trust to its gateway connection Keep native trust snapshots source-bound through the final execution authorization check and replace headless caches when their connection retires. Refresh Gateway-derived approval lists while preserving Mac-local policies and drafts. * test(macos): isolate readiness retries from connection setup Prepare the socket with a status request before the unchanged readiness deadline. Count health requests separately so setup cannot consume the unavailable response; require one connection and both health attempts. * fix(macos): revalidate gateway skill trust at launch admission
Related: #137502 (merged). This PR targets
mainand contains the gateway-bound skill-trust repair and a bounded readiness-test fixture correction found during its CI validation.Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where operators switching Gateways could continue automatically trusting skill binaries supplied by the previous Gateway when Auto-allow skill CLIs was enabled. The Mac's Exec Approvals pane could also retain the previous Gateway's binary list and agent choices instead of loading the new Gateway's data.
Why This Change Was Made
Skill trust now retains its originating Gateway through cached reads, native evaluation, the authorization check inside the existing SQLite transaction, and application launch admission; replacing a node connection also retires its TypeScript cache. The mounted Mac pane follows connection changes through the same owner, while same-Gateway reconnects retain valid cached trust and local policies and drafts keep their selected scope.
User Impact
Switching to Gateway B no longer lends it Gateway A's cached skill trust. B's own trusted binaries and agent choices load automatically, including when B becomes available after a failed connection. Auto-allow remains an opt-in convenience for trusted operator environments; manual allowlists, explicit approvals, policy defaults, storage schemas, and protocol/configuration formats are unchanged.
Evidence
Final signed candidate
e340794001fc638dbab1bde8a8e2f23c6fe4571epassed the real A/B flow. A executed/bin/sh -c true; actual native Primary promotion to B caused the same running app to deny it 57.617 seconds after the A invocation began, inside the unchanged cache-lifetime proof window. A fresh launch of the same Developer ID signed bundle on B also denied it. The canonical runner confirmed typedSYSTEM_RUN_DENIED: allowlist miss, restored the original policy, and verified both temporary skill directories absent. This signed switch proof complements the deterministic post-commit real-process marker test below. The earlier signed cache candidate also passed the same A/B/fresh-B controls, with B invoked 4.445 seconds after A.truecommands. Before the repair, B incorrectly succeeded within the cache TTL and after a failed refresh, with A-positive controls passing. The candidate passes all four focused cases and the complete nine-case file./bin/sh -c truesucceeded on A and, after actual UI promotion, on B 4.795 seconds later in the same app. A cold instance of the same build on B denied the exact command withSYSTEM_RUN_DENIED: allowlist miss. The synthetic policy was restored and fixture directories removed.truewhile actual Primary B advertisedprintf, without a tab, scope, toggle, reopen, or refresh action between captures. This observation is independent of the timed execution proof. Signed UI AFTER now changes A'strueto B'sprintfautomatically in that same mounted pane. Matching source receipts and the synthetic Gateway ledger confirm B supplied the result. The temporary toggle was restored Off and the original main/Access view restored. Native tests additionally cover the agent catalogue.Production: +148/−78 (net +70). Tests/support: +814/−67 (net +747). Docs: +9. Production growth carries source ownership through authorization and detached launch admission and supplies the missing pane lifecycle, replacing the unbound read, unowned authorization Boolean, inline launch body, and one-shot pane load.
Before: Primary B is selected but the retained pane still shows A's
true.After: switching to B automatically displays its
printfin the retained pane.The UI uses synthetic WebSocket Gateways; the timed execution proof uses two isolated real Gateways. An initial AFTER attempt completed only its A control before Parallels rejected the harness's inline process-inspection command; guarded cleanup succeeded. A standalone inspection script preserved the same identity checks for the complete run above. No application code or authorization rule was changed for that transport repair.
The original cache and pane repair remains byte-identical to its reviewed and signed-live-tested source. The additional launch-admission repair below has separate failure-first real-process proof and independent review. The Settings repair #137502 is merged; its signed parent testing covered unavailable B, error-preserving Refresh, automatic recovery, actual B→A→B Primary promotion, and Config Reload/revisit.
CI on the earlier
64a4954head found two independent timing failures. Its first session rollback exceeded the unchanged 120-second deadline despite including #137743. A controlled Linux comparison of the same 214-pattern child passed all 2,959 cases in both arms and measured the first rollback at 85.411 seconds before versus 4.120 seconds with only the four reviewed Browser production files from #137671. This supports the cold Browser initialization cost; the baseline did not cross 120 seconds, so it is not an exact timeout reproduction or a general performance guarantee.The other failure was the existing Mac readiness test combining a cold handshake and a health retry within one second. A deterministic held-challenge reproduction retained the original assertions and failed after 1.047 seconds with zero health requests dispatched. The fixture now establishes the connection through a status RPC before the same one-second audit; health-only response counting preserves
UNAVAILABLEfollowed by success. The test requires one socket, both health attempts, running status and no repair marker. Production code and deadlines are unchanged.That two-file correction passed independent P0–P2 review, all 47 readiness tests, 50 socket/timeout sibling tests, and the complete original-order app run at CI's parallel width of three: 2,082 tests across 218 suites, plus both named AppState isolation tests. The repaired test took 2.168 seconds overall while satisfying the unchanged one-second audit. All 84 recorded source hashes and protected profile/policy hashes stayed unchanged. The test-only delta is +28/−6. Explicit test-file lint also identified existing whole-suite style/length findings outside the canonical Sources lint scope, with no new diagnostic category; these were present before the correction.
Current head
e720c2bef069e6d1a85f959fefe060da4707f3f2rebases the reviewed three-commit repair onto maine5d413f7e54a85f0a365ddcf36bd1ba23afcb212, including the separately approved ordinary-CI availability policy in #137881. All 15 changed files and all three stable patch IDs are identical to signed, reviewed e340. The two original cache/test commits were unchanged by the mechanical rebase; this final commit adds the reviewed application launch check and its regression controls. All 15 PR files are included in the native source proof. The independent Browser repair #137671 remains separate. Current-head required CI is complete and green. The prior e340 run is 33835450407.Maintainer disposition: accept the source-bound trust repair; required exact-head macOS and Node validation is green. The Settings parent is merged and the PR targets main. The authorization transaction and application launch admission must retain the captured Gateway provenance; clearing only the cache or pane would leave an already prepared command vulnerable to a switch. The additional production state is justified at these distinct lifecycle boundaries, while the existing opt-in, manual allowlists, policy defaults, schema and protocol remain unchanged.
Application launch-admission follow-up
The later ClawSweeper finding was accepted: checking source trust only at the SQLite commit left the detached command able to reach the app's launch preflight after Gateway replacement. The baseline, using the same production launch body extracted without a behavior change, committed A's real cached skill authorization and then switched before execution. Its replaced-Gateway case successfully ran
touchand created the marker; the three expected denial/marker/preflight assertions failed while the unchanged-Gateway control and prior store/cache assertions passed.The canonical launch helper now carries the already-built authorization into the existing preflight. It rechecks the retained snapshot only for effective current-policy or ask-fallback allowlist decisions backed by automatic skill trust. Explicit approvals, auto-review, full policy and manual allowlists keep their independent authorization basis. CWD validation, caller cancellation, response mapping and the existing local-policy commit remain in place; there is no second policy transaction or test pause hook. The removed inline launch body is replaced by this one production helper.
The same regression now covers unchanged, disconnected and replaced Gateways across skill, fallback, explicit, manual and full-policy decisions: 15 real-process argument combinations. The complete owner suite passed, including all 15 controls, followed by 77 executor/CWD/cancellation/timeout/store sibling tests and the full original-order app suite at CI width three: 2,082 tests across 218 suites in 133.347 seconds, plus both named AppState tests. All 87 recorded source hashes and protected profile/policy hashes stayed unchanged. This is native production-helper and real-process proof; the signed A/B observations above are identified separately. Independent managed Codex P0–P2 review is scoped-clean; targeted formatting, strict lint and patch checks passed. The incremental production delta is +34/−9 (net +25), carrying effective authority across the detached launch boundary; the existing test grows by +43/−18 (net +25).
ClawSweeper disposition: the requested source revalidation, post-commit marker proof and redacted runtime evidence are addressed at application launch admission. The exact final commit
e340794001fc638dbab1bde8a8e2f23c6fe4571e(tree8353460d25761b90203c5b6ce159a6d77cc958c8) additionally passed frozen dependency installation, native compilation, all 154 owner/sibling tests, the complete original-order 2,082-test/218-suite app run in 135.489 seconds at width three, and both named AppState tests. All 928 recorded native/source hashes and protected profile/policy state stayed unchanged. The final signed runtime smoke above is complete. Before this base refresh, exact-head e340 CI run 33835450407 attempt 3 had 86 successful jobs and 13 skipped jobs; only the production audit and its aggregate gate failed. Both macOS Swift tests and release build are green. Attempt 2 had one Dashboard test time out before its notification action, waiting for the initial WebKit document; the unchanged-source retry passed. The first failure is retained, and its cause is not yet attributed. No timeout or document-readiness assertion was weakened. The latest audit exhausted three requests and ended in HTTP 503 from npm; required clearance has not been waived. ClawSweeper's latest review on this exact head (04:46 UTC) reports no actionable code/security finding and asks for the failed Swift/aggregate gates to be resolved: Swift is now green, and the audit availability classification is now supplied by the separately approved main change #137881.Named dependency follow-up: Subprocess launch admission can outlive cancellation while queued for native spawn. The pinned Swift Subprocess 1.0.0 revision
b3937ab85dd32f6e9435914599c1519074769c1aperforms asynchronous preparation/background queueing after the configurable callback (Darwin source lines 423–450 and 559–565;Thread.swiftlines 53–66). Moving the check to that callback alone would retain the later hop. This patch checks source validity at the app's launch admission; it does not claim atomic OS-spawn authorization or fix the dependency's later cancellation window. No dependency override, lock across asynchronous work, or replacement process backend is introduced.The main refresh does not claim npm audit clearance. The CLI still returns a distinct incomplete result when the advisory service is unavailable; ordinary CI records that warning under #137881, while known findings, permanent failures and release/local callers remain blocking. The prior exact canonical host probe also exhausted three requests in 185.756 seconds; its failure is preserved. Final signed-smoke cleanup stopped every owned app/worker/gateway process, freed all four ports, retained exact profile/config bytes and restored the original policy.
Current-head integration checks: CI run 33840351788.
Final landing validation: exact head
e720c2bef069e6d1a85f959fefe060da4707f3f2passed CI 33840351788 on its second attempt. The initial attempt completed all non-Swift checks; its two unassigned Swift jobs were moved through the existing failed-job recovery route to hosted macOS, where release and full tests passed. ClawSweeper's latest exact-head review at 05:50 UTC found no actionable code or security issue; its only remaining rank-up was those Swift checks, now complete. The audit result retains the explicitly documented incomplete-service warning. A separate diagnostic full app run passed 2,082 tests in 139.898 seconds without reproducing the earlier WebKit timeout; the original failure remains an unattributed follow-up. All diagnostic overlays and protected state were restored.