Repository navigation
refactor(exec): deslop safe-bin argument validation - #161109
Conversation
|
🦞👀 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. Reviewed September 29, 2026, 6:40 AM ET / 10:40 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR replaces several private safe-bin argument helpers with one scan and shared option-value handling while keeping the exported validation interface. Merge readiness✅ Ready for maintainer review Current main and the latest release retain the earlier validator, so this cleanup remains distinct work. Source comparison found no changed allow or deny outcome, and no actionable patch defect emerged. The reported CI failures have no established link to the validator. Priority: P3 Review scores
Verification
How this fits togetherExec approvals checks agent commands before they run. For configured safe bins, the resolved executable and its arguments feed a profile validator whose result can satisfy an allowlist segment without an operator prompt. flowchart LR
A[Agent command] --> B[Parsed arguments]
B --> C[Trusted safe bin check]
C --> D[Argument validator]
D --> E{Profile permits use}
E -->|Yes| F[Allowlist segment satisfied]
E -->|No| G[Other approval checks]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -119. Total -119 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep a single validator owner with the documented safe-bin allow and deny behavior preserved at the exec approval boundary. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reports a behavior-preserving refactor, not a defect. Its parity claim has a described differential comparison, which this read-only review did not execute. Is this the best way to solve the issue? Yes. The patch removes private helper indirection within the existing validator while retaining its facade, profiles, and observed decision branches. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3baf08ac9b1a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Landing decision: the remaining red is outside this PR's ownerThis PR changes only exec-approval / safe-bin policy code in
Focused owner tests, scoped checks, type lanes and autoreview for this change are recorded above. Landing at the exact head under the maintainer's rule to land over failures outside the PR's owner. The Codex teardown race is tracked as a follow-up. |
What Problem This Solves
Safe-bin argv validation split one scan across several private consumers, repeatedly carrying the same profile sets and index through parameter objects. The owner now scans arguments directly and shares one option-value consumer. Production: +70/-189/net -119. Tests: +0/-0/net 0. Docs: +0/-0/net 0.
User Impact
No intended behavior change. Denied flags, unknown or ambiguous long options, short clusters, literal-token safety, stdin markers, tokens after
--, positional limits, and command-specific rejection remain unchanged. Public exports and SDK contracts are unchanged.Evidence
Blacksmith Testbox
tbx_01m3p5x5sd4nc634r78bz9n9zt(allocation run), frozen-lockfile install, pinned base64ef24b267b18ab32dc4acbe967d8c50d138c175and SHA-256 verification of the candidate file.pnpm test src/infra/exec-safe-bin-policy.test.ts src/infra/exec-approvals-safe-bins.test.ts --maxWorkers=1: 152 passed, 28.773s wall.git diff --checkpassed.node scripts/check-changed.mjs --base 64ef24b267b18ab32dc4acbe967d8c50d138c175 -- src/infra/exec-safe-bin-policy-validator.tspassed on the same lease in 29m3.059s, including production tsgo, all 27 selected test type graphs, lint, all dead-export scans and architecture guards.This slice is published after focused proof and review under the maintainer's requested workflow. No hosted CI was dispatched or rerun for proof.
Hosted CI failures under investigation
CI run 36547570255 passed the 29-file exec-approval shard and all non-test gates, but three untouched Gateway/CLI fixtures failed on merge
042d258binto main249d2270513b973f08cbe379aa355d2c5606c70c:109338135790:server.heartbeat-store-lifecycle.product-proof.test.ts, different-store case, followupagent.waitreturnederrorat line 248 before the store change. The assertion does not retain the underlying error.109338135565:models-list.membership.integration.test.ts, retained discovery/aborted-case test, 60s timeout. This rewritten fixture entered through the merge ref after test(gateway): release catalog owners when a models-list membership case aborts #161095; the PR head contains the prior fixture. Cold startup is a lead, not an established cause.109338135759:doctor-config-preflight.process.test.ts, canonical state after Doctor repairs cron, 45s timeout.A bounded search of main and unrelated PR runs found different failures, not these exact failures. The scripted Gateway fixtures do not invoke the safe-bin validator, but that source independence alone is not being presented as a reproduced inherited failure. No hosted jobs were rerun. Auto-merge remains armed while these failures are investigated; no fix or inherited-failure exception is claimed.
Coordinator attribution update
The heartbeat failure is independently confirmed on unrelated PR #160158, head
b7fd7e3dacfa1573cce771728ffb2f18a2cd1838: run 36548505088, job 109341201797 fails the identical different-store case at line 248 witherrorinstead ofok. That PR changes Doctor/daemon process census code and does not change the heartbeat fixture or safe-bin validator.This PR changes only the safe-bin argument validator. None of the failing tests changes that owner or exercises its validator: the heartbeat synthetic provider emits
sessions_spawnand text, the membership fixture exercisesmodels.list/config.patchagainst a synthetic provider, and the Doctor process test exercises repair/readiness without executing safe-bin commands. The full Gateway can import exec infrastructure transitively; mere module reachability is not a claim that these flows evaluate safe-bin argv. Their failure owners are the follow-up run lifecycle, model-catalog startup/fixture lifecycle, and Doctor child startup respectively.Only one additional comparison log was fetched for this attribution. No identical inherited failure has yet been established for the two timeout cases. A clean-main replay preserving their original shard membership and worker admission is being prepared; no CI rerun or passing replay is being treated as a fix.
The clean-main replay completed on
4e5b70b4c6284215e83f5aa799cafadb0b0f9a9eusing Testboxtbx_01m3p9pk2d4r7jfn2t1yr9ywcx: the original membership shard passed 12 files / 130 tests in 72.297s wall (the formerly timed-out case: 29.583s); the original Doctor shard passed 2 files / 37 tests in 205.927s wall including its required runtime build (the formerly timed-out case: 12.166s). Both used the original selector order and native eight-worker admission. These passing replays do not establish a fix or an identical inherited failure. With only the heartbeat failure independently reproduced, this slice remains parked under the maintainer's stated inherited-failure criterion. Its reviewed head and auto-merge request are unchanged.