Repository navigation
feat(macos): guide missing native permissions in chat - #169635
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 real behavior proof before merge. What this changesThis PR adds chat cards that guide users through missing Mac permissions and offer user-confirmed retry after access becomes effective. Example: A screen.snapshot request targets Example Mac without Screen Recording access.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep open: this maintainer-authored PR provides useful native permission recovery, and no new actionable code defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherNative permission owners check Mac capabilities, node transports carry typed refusals to the Gateway, and chat renders recovery actions through the existing device-settings bridge. flowchart LR
A[Agent tool request] --> B[Gateway node dispatch]
B --> C[Mac permission owner]
C --> D[Typed permission refusal]
D --> E[Chat permission card]
E --> F[Native consent and settings]
F --> G[Refreshed permission snapshot]
G --> E
Technical reviewBest possible solution: Keep the shared typed refusal and existing native permission owners, with snapshot-confirmed recovery and explicit user retry. Do we have a high-confidence way to reproduce the issue? The base native runtime returns free-text camera, location, and computer permission refusals; source inspection establishes the recovery problem without executing target code. Is this the best way to solve the issue? The approach fits the existing owners: native code controls consent and effective access, the Gateway preserves typed refusals, and chat derives recovery state without automatically repeating commands. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 001e13bc4f7d. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Source checks preserve native authority, but final-effect rejection still needs validation. EvidenceWhat I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (13 earlier review cycles; latest 8 shown)
Reviewed October 12, 2026, 11:44 PM ET / October 13, 2026, 03:44 UTC (Revision 14). |
416ccd8 to
a49eee3
Compare
|
a49eee3 to
ed4cf82
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Reuse the focused viewer fixture repair from a150e15. Preserve tooltip-first Escape and keyboard focus while keeping the existing single-Escape dismissal assertion.
73761aa to
c112b53
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* feat(macos): guide missing native permissions in chat * fix(ui): keep permission actions typed and grouped at startup * style: satisfy permission card lint checks * fix(macos): complete one permission remediation at a time * fix: preserve permission recovery across desktop upgrades * fix(ui): preserve permission cards in current chat rendering * fix(ui): use the existing transcript bridge for permission cards * test: align permission fixtures with current client contracts * refactor(macos): remove retired camera permission helper * fix: finish permission transcript and test isolation * chore(ui): regenerate permission card boot manifest * test(ui): clear file hint before viewer dismissal Reuse the focused viewer fixture repair from 73f1acd. Preserve tooltip-first Escape and keyboard focus while keeping the existing single-Escape dismissal assertion. * test(ui): group native permission contract coverage * fix(macos): separate camera discovery consent from capture access * test(node-host): prepare permission invoke config snapshot
What Problem This Solves
Native Mac commands report missing privacy permissions as unrelated text errors, so agents retry or send people hunting through System Settings.
User Impact
Missing native permissions now produce an inline Grant card. It names the affected Mac and permissions, uses the existing native grant/settings/confirmation/relaunch flows, and offers Try again only after the native snapshot reports effective access. The agent is told to wait for user confirmation.
The error contract is additive:
PERMISSION_MISSINGwith{ capabilities, state }, where state isnot-determined,denied,restart-required,stale-grant, ordisabled-in-openclaw. Computer Control reports Accessibility, Event Posting, Screen Recording, and its local toggle together. Commands stay discoverable while disabled; execution remains gated. Camera enumeration requires only the existing OpenClaw camera toggle (cameraEnabled); capture/PTZ separately require macOS Camera access (camera). Grant therefore enables enumeration without requesting capture access. Automatic notification overlay fallback retains its behavior.Why This Change Was Made
PermissionManagerowns native checks and typed failures. The Gateway preserves the error through node, computer, and exec tools and publishes it on the existing, run-scoped notice stream. Live notices and persisted tool results render the same card, including when ordinary tool output is hidden. Existing app confirmation remains authoritative; each click handles only the current primary remediation, so stale Accessibility does not accidentally trigger a lower-priority Screen Recording relaunch; a remote node cannot grant permissions on the Mac showing its card. Permission owners carry the current document/node check through awaited authorization reads to the final OS request. First-use Accessibility remains explicitly requestable; an unsuccessful Event Posting request opens Settings and offers conditional relaunch recovery for cached denials.Desktop shell contract
Cards consume the shell-neutral optional capability
NativeDeviceSettingsCapability.resolvePermission(request): Promise<void>. The request is{ nodeId, nodeName?, command, capabilities, state }. The Mac adapter sends{ type: "resolve-permission", request }through the existing native device-settings transport; the Tauri shell can implement the same capability with its own transport. Cards contain no WebKit/platform detection.Snapshots add optional
device.nodeIdand optional permission-entrystate. Contract-1permissions.entriesretains the released seven IDs; optionalpermissions.additionalEntriescarries Event Posting, and the current UI validates and merges it. The host validates the active local node before effects, including after native consent. Resolving the action promise only acknowledges dispatch. Snapshot changes, local capability switches, and location mode determine grant completion; Try again sends a short user message through the existing chat path. Without a matching shell capability, the card directs the user to the OpenClaw Mac app on the target device.The Gateway advertises
node-permission-errorsin hello capabilities. Native and headless node transports send typed error details only when this capability is present, preserving the closed invoke-result shape accepted by older Gateways. Both the direct native socket and app-hosted child pipe preserve details.Remaining live proof
The lead owns the signed-app TCC/consent/relaunch/retry, node/document authority-negative, and stable-upgrade VM proof. Local Swift execution and synthetic UI proof do not replace that live test. No operator app, LaunchAgent, or live Gateway was changed.
Evidence
DEVELOPER_DIRand SDK were pinned to/Applications/Xcode.app. App/shared test builds pass in 790.02 s / 525.09 s wall. An enclosing OS sandbox denied operator files/services and network; all task.builddirectories were removed afterward. This proves native owners with injected OS services, not actual TCC consent.I granted Screen Recording, try again.pnpm openclaw --profile zc-perm gateway call node.invokeexercised isolated CLI → Gateway port 19813 → headless node,system.runwith argv["/usr/bin/true"]andneedsScreenRecording: true. It returnedPERMISSION_MISSING,{ capabilities: ["screenRecording"], state: "not-determined" }, node/command projection, and no-retry guidance. This ran at prior head416ccd8fa2a3e3e5c754c04dc7a2e0421979b6d3; no current signed-app TCC proof is claimed.Current head:
8e2bec12aff743c47b3882f03bfbee72b94be5c8. Committed-branch autoreview is scoped-clean, with no actionable P0–P2 findings. This head fixes ClawSweeper's sole code finding onc112b53: the node-invoke fixture now republishes its runtime config snapshot after isolated-state replacement. Final focused proof passes (341.20 s launcher); the equivalent import variant passed all 28 tests (266.39 s). The existing permission assertions and cleanup are retained. A prior local teardown finding was disproved by the complete owner: close returns before permission preflight; the final review included the intact source and confirmed the bypass.Pinned CI attribution
CI run 38325822517 completed on
8e2bec12aff743c47b3882f03bfbee72b94be5c8: 90 success, 16 skipped, 6 failure, including the aggregateopenclaw/ci-gate. The five failed test jobs contain 28 cases across eight files. All final failed-job logs were fetched once or reused from the prior lane.Fresh comparisons use immutable branch base
d4820c404e000fbcbf608240260368d044363abb. This is the branch's last main ancestor; the branch has no later main merge. CI separately tested synthetic merge18507507d1b3f4651eefb19baaaf37448539dcefwith newer main parent981e312ce1a203642f06de9cbfee9b74d2451712. Source inspection attributes the sidebar and strict-config failures to that newer main. Passing local replays are not reported as repairs.The separate CI same-session cancellation remains unresolved: local head and base pass the earlier supervisor-state assertion and fail later on the inherited early-reply assertion. CI contains no retained runtime diagnostic artifact exposing the cancellation reason.
ui/src/e2e/chat-flow.navigation-presentation.e2e.test.tssrc/agents/embedded-agent-runner/run/lane-controller.test.tssrc/agents/embedded-agent-runner/run/lane-controller.attempt-controls.test.tstest/e2e/qa-lab/runtime/gateway-heartbeat-session-routing.e2e.test.tstest/e2e/qa-lab/runtime/native-worker-slot.e2e.test.tstest/e2e/qa-lab/runtime/required-native-same-session.e2e.test.tstest/e2e/qa-lab/runtime/node-worker-launch-wire.e2e.test.tstest/e2e/qa-lab/runtime/paired-node-worker-upgrade-wire.e2e.test.tstest/e2e/qa-lab/runtime/paired-node-worker-lifecycle-wire.e2e.test.tstest/e2e/qa-lab/runtime/skill-library-worker-wire.e2e.test.tssrc/gateway/gateway.sessions-send-hot-reload.e2e.test.tsui/src/pages/plugins/plugin-skills.e2e.test.tssrc/gateway/server.agent-input-authority.test.tssrc/gateway/server.sessions-send-resume.test.tssrc/gateway/server.sessions-send-owner-continuation.test.tsui/src/e2e/new-session-page.cloud-startup-failure.e2e.test.tsscripts/e2e/mcp-code-mode-gateway-client.tssrc/worker/worker.fault-injection.test.tssrc/node-host/invoke.test.tsThe first 11 rows are fresh exact-head/pinned-base runs. The remaining eight rows retain already-settled prior-lane evidence and explicitly identify earlier-main comparisons. Wall time includes wrapper preparation; the first baseline E2E invocation includes the 6m 18.4s runtime build. Each fresh invocation selected one file with
--maxWorkers=1; no test timeout or assertion was weakened.Autoreview: retained committed-branch scoped-clean, no P0–P2 findings. No new source delta required another review. ClawSweeper reviewed the exact head
8e2bec12aff743c47b3882f03bfbee72b94be5c8, updated2026-10-13T00:34:23Z, with no code findings. Signed native authority/recovery and upgrade proof remain outstanding.All 28 current-head failing cases
Every failing case in run 38325822517
Production +1,560/−527 (net +1,033); tests +1,200/−166 (net +1,034); docs +33/−0; generated files +22/−10, measured against base
d4820c404e000fbcbf608240260368d044363abb. Growth adds the typed native owner, negotiated transport contract, shared card, and focused boundary proof; the camera follow-up itself adds six net production lines.All captures below were inspected and contain synthetic mock-Gateway data. The before image uses a legacy untyped error fixture on the candidate UI; it is not an older app capture. The current mock-Gateway flow proves native action dispatch, refreshed permission completion, and the exact user retry message.
All permission states, restored history, and narrow layout
Release-note context: macOS native permission failures now show a Grant card with explicit recovery and user-confirmed retry instead of free-text failure loops.