Repository navigation
refactor(exec): share package-manager option scans - #139482
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 5, 2026, 7:11 PM ET / 23:11 UTC. ClawSweeper reviewWhat this changesShares package-manager argument scanners and prepares reusable option sets while preserving command extraction and execution-approval behavior. Merge readiness✅ Ready for maintainer review Keep open: this is a useful, maintainer-requested cleanup that is absent from current main. The reviewed changes preserve parsing and approval restrictions; no actionable defect was found. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw analyzes package-manager commands before matching reusable execution approvals and binding mutable script files. These scanners identify the inner command and options that change its execution context. flowchart TD
A[Package-manager command] --> B[Shared option scanner]
B --> C[Inner command classification]
B --> D[Context-changing options]
C --> E[Reusable approval matching]
D --> E
C --> F[Mutable script binding]
E --> G[Existing execution policy]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -128. Total -128 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Use the shared scanners while retaining the existing option sets, stopping rules, and approval-boundary coverage. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving cleanup rather than a reported runtime defect; source inspection supports equivalence. Is this the best way to solve the issue? Yes: reusing the existing scanner removes connected duplication while preserving the distinct npm and leading-option parsing rules. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c91b1eaab768. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
de402b2 to
084f517
Compare
|
Merged via squash.
|
* origin/main: (95 commits) perf(build): avoid unrelated gateway artifact scans (#127757) fix(update): deliver terminal progress after long updates (#139289) fix(ui): show session hover cards for local chat URLs (#139384) perf(ui): reuse unchanged transcript key snapshots (#139400) fix(ui): make subagent sessions view-only (#139381) fix: open agent state on SQLite builds without extensions (#139487) perf(skills): detach cached metadata from source strings (#139478) fix(ui): show primary user in multi-agent profile hero (#136736) perf(sessions): stop decoding the session row four times per SQLite entry patch (#136361) refactor(exec): share package-manager option scans (#139482) fix(ci): authorize frozen mobile release candidates (#139441) fix: avoid session deletion slowdown in large session stores (#139467) perf(gateway): reuse node invocation idle timers (#139354) fix(auth): preserve selected profiles across plugin scopes (#139413) fix(discord): retain voice input until transcription completes (#139484) fix(agents): name Gateway storage failures in run-failure copy (#139409) fix: keep subagent checks responsive in large session stores (#139450) fix(memory): index notes when optional embeddings cannot start (#139463) fix: refresh pending approvals when reopening chat (#139457) fix(tooling): preserve Git hook choices during install (#139461) ...
Related: #135868
What Problem This Solves
Maintainer-requested cleanup supporting the #135868 split: package-manager command analysis repeats option scanners and reconstructs the same option sets at several call sites. That duplication makes it harder to keep reusable exec approvals and mutable-script detection consistent.
This is the independent
clean-broadcompanion lane; it extracts none of the numbered recovery stages.Why This Change Was Made
Share the existing option scanner with pnpm and Yarn command extraction, combine the two context-option scans with their distinct stopping rules, and prepare the unchanged package-manager option sets once. npm still detects context options after the command until
--; leading scans still stop at the first command or unknown flag.Production LOC: +103 / -231 (net -128), one file, 334 changed lines. Tests, tooling, and docs: +0 / -0. No compatibility path, public export, supported option, or approval rule is removed.
User Impact
No intended behavior change. Existing package-manager commands retain the same execution target, reusable-approval restrictions, and mutable-file binding.
Evidence
v2026.9.2. Its context restrictions come from fix: reusable exec approvals apply to approved arguments #112946; these are retained.node scripts/run-vitest.mjs src/infra/exec-approvals-allow-always.test.ts src/infra/exec-wrapper-trust-plan.test.ts src/node-host/invoke-system-run-plan.test.ts: 178 tests passed.git diff --check: passed. No build required: imports and packaging boundaries are unchanged.084f5176217b1ff993119c123a17ed4c987ba5e1: passed; the CI watcher returnedGREEN.de402b243ab59884c908a5d855c15276d68ca863: no findings and no before-merge or rank-up actions. The review confirmed the scanner stopping rules and read-only option-set consumers.node scripts/check-changed.mjs: passed the complete selected core/coreTests plan, including all type shards, three export scans, and architecture guards.Deletion rationale: the removed walkers used the same token/value/unknown-option rules as the retained scanner; the context scans differed only at positional tokens, unknown flags, and the delimiter, now explicit in the scan scope. Existing owner-boundary tests remain intact. The exported pnpm option sets have only read-only production consumers in mutable-file operand detection.