refactor(tray): move Permissions into shared-state MVVM ownership - #1075
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 6:45 PM ET / 22:45 UTC. ClawSweeper reviewWhat this changesThe PR moves Permissions-page state, permission writes, and execution-approval presentation into shared observable owners, and rebuilds local MCP capabilities from current settings after a restart. Merge readinessKeep open. This collaborator-owned, actively landing base layer is mergeable and no discrete correctness defect was found; landing the broad ownership transfer remains a maintainer decision after current-head checks finish. Priority: P2 Review scores
Verification
How this fits togetherThe tray Permissions page edits persisted node permissions used by capability gating and the local MCP server. UI and MCP settings writers converge through shared stores, then tool discovery reads the resulting capability set. flowchart LR
A[Permissions page] --> B[Shared settings store]
C[Local MCP settings call] --> B
B --> D[Permissions view model]
B --> E[Capability gating]
E --> F[Local MCP server]
F --> G[Tool discovery]
D --> A
Decision needed
Why: The change is an intentionally broad architectural transfer with downstream PR dependencies, so source correctness alone cannot choose its landing order. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the current resolved head only after its active checks complete and the maintainer accepts this atomic shared-state ownership layer as the base for the dependent tray refactors. Do we have a high-confidence way to reproduce the issue? Not applicable: this is an ownership refactor rather than a reported defect. The PR body includes a runtime exercise of the affected Permissions and MCP paths, although it predates the current integration merge. Is this the best way to solve the issue? Yes. The source follows the architecture ledger by keeping WinUI rendering in the page and moving shared mutable settings and approval state to dedicated observable owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4206611f2b2e. 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 (11 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
57ac65d to
aaebf76
Compare
|
Exact-head closeout for
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Current-main merge-result validation is now complete and recorded in the PR body.
The earlier ClawSweeper re-review is already queued, so no duplicate review command was posted. |
Resolve Permissions ownership conflicts while preserving argument-bound exec approval semantics and current-main behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d01a60a1-e002-4e6c-b3a2-3ced75fb5b66
Current-head Permissions UI proofAutomated with Windows UI Automation against commit 1. Shared Permissions overviewThe page loaded current node status and capability settings through the new shared-state presentation path. 2. Invalid executable-path validationEntered basename-only 3. Saved and persisted path-only ruleEntered Cleanup and result
|



Moves the Permissions page's presentation, lifecycle, and shared settings behavior out of code-behind into a WinUI-free view model while preserving current security, command exposure, and visual behavior.
What changed
PermissionsPageViewModeland no-cache runtime projection, activated through the existing navigation scope.ISettingsStorefield-scoped, serialized, versioned, and origin-aware so Settings, Permissions, tray, Hub, Connection, and local MCP writers converge without self-echo or stale updates.ExecApprovalsStore; runtime and UI continue sharing one authoritative store.NodeCapabilityGatingas the sole command-exposure owner and preserve BrowserProxyActivation/shared-token behavior.tools/listreflects current persisted permissions without a gateway reconnect or app restart.PermissionsPage.xaml.csfrom 891 to 557 lines while leaving the visual tree intentionally unchanged.Ownership transfer
PermissionsPage.xaml.csdirectly owned settings mutation, runtime projection, approval-file presentation, and subscriptions.PermissionsPageViewModel,PermissionsPageRuntimeSource,ISettingsStore, and the App-ownedExecApprovalsStorepresentation contract.NotifySettingsSaved; active surfaces and MCP capability discovery converge to the newest version; command exposure remains owned byNodeCapabilityGating.Scope decision
This lands as one atomic ownership transfer. Splitting the view model, shared-settings convergence, and V2 approval observation would temporarily leave parallel mutable owners or require throwaway compatibility paths. Visible Fluent/icon/card cleanup remains separate, so this PR stays behavior- and visual-identical.
Validation
Exact validated head:
aaebf76640f4e2c67c40c77470bf86d98da2e086../build.ps1: all 5 projects passedOpenClaw.Shared.Tests: 3,415 passed, 32 skipped, 0 failedOpenClaw.Tray.Tests: 2,126 passed, 0 skipped, 0 failedOpenClaw.WinNode.Cli.Tests: 126 passed, 0 skipped, 0 failedThe focused set includes restart rebuilding from current settings, origin suppression, monotonic versioning, two-consumer convergence without echo, background UI dispatch, stale mutation rejection, CAS retry preservation, Permissions row/order parity, and code-behind ownership guards.
External CI status
At the time of this update, the PR has 28 checks: 13 successful, 14 skipped, 1 failed, and 0 pending.
The failed aggregate
Build and Test / testjob reported two environmental/repository-wide blockers outside this PR's changed paths:2026.6.11, npm latest2026.7.1-2.Run_EchoCommand_PowershellandRun_CapturesStderr.Both Shared tests pass in the exact-head local run above. Build jobs were skipped after the aggregate test job failed. CodeQL is green.
Review status
ClawSweeper reviewed exact head
aaebf76640f4e2c67c40c77470bf86d98da2e086with no actionable findings and no security findings. Its remaining proof request was an exact-head runtime demonstration of the final MCP restart rebuild behavior. The transcript below provides that evidence.Real behavior proof
Exact head
aaebf76640f4e2c67c40c77470bf86d98da2e086was launched with the side-by-side Dev identity, isolated tray data, and local MCP port18765because another worktree already owned the release identity and default listener.8307618988, left running and untouched83076was stoppedInspectable exact-head transcript
This demonstrates the final restart fix directly: after Camera was disabled, stopping and restarting local MCP rebuilt capabilities from current persisted settings and continued serving 48 tools with no camera commands. Restoring Camera through raw MCP updated the already-open WinUI page and returned both raw JSON-RPC and
winnodediscovery to 51 tools.Permissions UI and persisted-field parity
Native WinUI Automation inspected all visible permission toggles after restoration. 10/10 matched persisted settings:
Evidence manifest
The sanitized proof bundle retains raw JSON-RPC responses,
winnodeoutput, UI/settings parity, process cleanup, final-state restoration, and SHA-256 hashes. It does not retain the MCP bearer token.proof-summary.json14a0326c99821d450a55323e4e33264f0b30ba53324eebe3c629aab630db7c21936527832a77fbf9caf30ea32f8f65850d2f1018c55cd765047689d1006cad4b4694cc3c8496e3c5715b798864ce95e20a40102b65c5bdee009ec1a9fb52c0b412f5ecb44aee0d0c8d30b46f029db172f1ce06fec3a696973bbb75d3043a3efbc4a9e8d82de9bc3822ded9135c6b61e64c67fc93d30b486c53bf45a7c9d56a4482e846c38abbdd42c6c27902cce49ecdad4be1729f8947290369f5785698cd1c3bbc8216d4fb7e44cece7fbeb1821335d4858a7b6ea3077eb528dddd5da84ef8Current-main integration proof
A disposable detached workspace combined current main
aac07abb1fbdaf2d75aa269397f094256188e1b5with A0aaebf76640f4e2c67c40c77470bf86d98da2e086without rewriting any branch or remote.d2de6150753b82c0f093582d0d1f9a20b59b2ef7f390ecf7cc830ccb9ee7ce09be35bbcd247dc12d487e20364ff7dfdadd31e85842aafaeddf58b6a0git diff --cached --checkclean<Compile>entriesSynthetic merge validation
./build.ps1: all 5 projects passedThe disposable worktree was removed after validation. The retained sanitized merge manifest SHA-256 is
5a994a589b49318ea5284ca16dab675e0e3e27ad92c8e70bd732201b7b167404.This proves the four overlapping files preserve the semantic union of current-main chat/session/tool behavior and A0 Permissions ownership. No A0-A3 branch rewrite is required for integration.
Deferred visual work
This PR intentionally preserves the existing capability icons, colors, cards, spacing, and copy. Fluent icon/token/SettingsCard cleanup remains a separate visible-design change.