Repository navigation
fix: show effective exec approval policy in Devices - #125756
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 5:48 AM ET / 09:48 UTC. ClawSweeper reviewWhat this changesThe PR adds resolved exec-approval defaults to Gateway and supported node snapshots, uses them in Devices, and limits editable node targets to nodes advertising both read and write commands. Merge readinessKeep open: current main still returns only the authored approval file and the Devices view still substitutes UI fallbacks, while this PR adds an owner-resolved snapshot value and consumes it with the established override precedence. It is a protected maintainer PR and should proceed through exact-head validation rather than auto-cleanup. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherDevices reads approval-policy snapshots from the local Gateway or a paired node, then presents editable policy defaults and agent overrides to operators. The snapshot producer resolves persisted policy defaults, while the UI applies authored wildcard and agent-specific overrides for the selected scope. flowchart LR
A[Approval policy file] --> B[Policy resolver]
B --> C[Gateway snapshot]
B --> D[Node-host snapshot]
C --> E[Devices page]
D --> E
E --> F[Scope precedence]
F --> G[Editable policy controls]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +32, Tests +149, Other +4. Total +185 across 10 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep resolved defaults owner-produced and UI-consumed with the tested precedence, then land only after exact-head protocol, Gateway, node-host, UI, and Testbox gates confirm the additive cross-version behavior. Do we have a high-confidence way to reproduce the issue? Yes: current-main source reproducibly derives Devices defaults from the approval file alone, so an empty file falls back to UI values instead of the policy owner's resolved defaults. Is this the best way to solve the issue? Yes: resolving defaults at the approval-policy owner and passing an additive snapshot fact to Devices avoids duplicating policy resolution in the UI while retaining wildcard and exact-agent precedence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 227230024d06. LabelsLabel changes:
Label 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
|
|
Land-ready proof for
Known gap: an unrelated broader local macOS packaging shard timed out and is not claimed as passing. Exact-head CI and the repository-native prepare gate are green. ClawSweeper also could not run its optional |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where users opening Devices → Exec approvals could see UI fallback values instead of the effective policy reported by the local Gateway, especially for a fresh approvals file. The page could show
Deny/On misswhile the owner-resolved defaults wereFull/Off. It also offered node targets as editable when they advertised only the read or only the write command.Why This Change Was Made
The approval-state owner now includes canonical
resolvedDefaultsin local Gateway snapshots, and the Control UI combines those reported defaults with authored defaults, wildcard overrides, and exact-agent overrides in the correct precedence. The shared node-host restores its opt-inincludeResolvedDefaultsresponse behavior for Mac node snapshots, while editable node targets now require bothsystem.execApprovals.getandsystem.execApprovals.set.This changes reporting and presentation only. Approval authorization, enforcement, and persisted policy semantics are unchanged.
Production LOC: +58/-22 (net +36), including +5/-1 generated Swift protocol projection. Tests: +151/-2 (net +149). The production growth is the new owner-reporting contract, restored node-host protocol behavior, stricter capability gate, and generated cross-language projection.
User Impact
Devices now displays the policy that will actually apply, while preserving authored defaults and wildcard/agent overrides. Operators can select only nodes that support both reading and saving approval policy.
Release-note context: Devices now shows effective exec-approval defaults and limits editable node targets to nodes that support both policy reads and writes.
Evidence
Fresh approval defaults
Before, fresh state rendered UI fallbacks (
Deny/On miss). After, it renders the owner-reported effective defaults (Full/Off).Editable node targets
Before, a read-only node could be selected for editing. After, only the node advertising both read and write commands is offered.
Source-blind browser evidence recorded the failing-before values and node list, then the passing-after values and capability-filtered list. All four captures were visually inspected and sanitized before upload.
Focused proof:
node scripts/run-vitest.mjs src/gateway/server-methods/exec-approvals.test.ts— 17/17 passednode scripts/run-vitest.mjs src/node-host/invoke.test.ts— 27/27 passednode scripts/run-vitest.mjs ui/src/pages/devices/view.devices.test.ts— 22/22 passednode scripts/check-changed.mjs -- <core and UI changed files>— exit 0Known proof gap: an unrelated broader local macOS packaging shard timed out and is not claimed as passing. Exact-head CI and the repository Testbox prepare gate remain required before landing.
AI-assisted; the maintainer inspected the implementation, proof, and final diff.