Repository navigation
fix(desktop): restore tray stop and simplify Rust state - #139241
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: blocked before merge. Reviewed September 5, 2026, 4:12 PM ET / 20:12 UTC. ClawSweeper reviewWhat this changesRestores desktop tray Stop, consolidates Rust connection and menu state, updates desktop and Watch dependencies, and repairs asynchronous Swift test waits. Merge readiness⛔ Blocked before merge - 1 item remains The tray fix remains necessary on current main. No blocking introduced defect was found, and the latest Swift test changes preserve the relevant assertions. Maintainer-authored work also remains protected from automated closure. Priority: P2 Review scores
Verification
How this fits togetherThe desktop companion turns tray actions into local OpenClaw CLI commands, then updates its connection, dashboard, and Quick Chat state from Gateway results. The secondary Watch changes simplify initialization in its native audio transport. flowchart TD
A[Native tray action] --> B[Serialized desktop operations]
B --> C[CLI command adapter]
C --> D[Gateway service]
D --> E[Service status]
E --> F[Tray and connection state]
F --> G[Dashboard and Quick Chat]
Before merge
Agent review detailsSecurityNone. PR surfaceDocs +2, Other -117. Total -115 across 21 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep explicit Stop consent in the desktop CLI adapter while preserving graceful Restart, existing preferences, and the shared lifecycle owners. Do we have a high-confidence way to reproduce the issue? Yes: current main combines null subprocess stdin with a Stop invocation lacking the consent flag required by the CLI. The supplied native comparison corroborates that path; this review did not execute it. Is this the best way to solve the issue? Yes for the tray defect: supplying consent at the explicit desktop action preserves the CLI safety guard and avoids changing Restart semantics. The surrounding refactors preserve the inspected owner contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e8fbf33b32be. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Completed the notification-plugin source review requested by the review and its rank-up move. The exact upstream comparison is one commit and one file, Since the reviewed head, the final shutdown audit also found and fixed an actual native tray bug: Stop ran @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Consolidate desktop connection, reconnect, CLI status and tray ownership; remove dead helpers and use derived Watch state initialization. Reduce production Rust by 162 lines while preserving onboarding, native auth and lifecycle contracts. Refresh compatible desktop and Watch dependencies. Retain blocking 1.6.2 after reproducing idle worker retention in 1.7.0, and preserve the existing updater pin pending correct Windows cleanup ordering.
CI could observe the persisted verified receipt before the outer retry continuation scheduled recovery. Wait for the actual deadline callback with the existing budget and retain all exact assertions.
Native CLI subprocesses are non-interactive, so an explicit Stop action must supply the CLI's --force consent flag. Keep Start and Restart unchanged; restart --force would bypass graceful draining. A real-subprocess regression fails before the fix and verifies Stop, Start, Restart and Stop afterward. All 136 Rust tests pass on macOS; native Linux before/after tray proof follows before landing.
8b7b195 to
ec2f771
Compare
Anchor the legacy timed refresh before creating observed-URL followers, and remove the redundant late caller from the timeout-survival test. A delayed legacy call legitimately requested another rotation after the fixture reply. Keep mixed deadlines, one request, matching URLs/TLS, and survivor assertions. The exact CI failure is captured; nine focused tests and ten consecutive stress iterations of both changed cases pass. Independent review is clean.
|
Maintainer disposition of the latest dependency-inspection limitation: resolved by direct exact-revision source inspection and successful native builds. The notifications update remains one commit, one file, and two diagnostic conversions. Here is the complete upstream patch so review does not depend on another API/raw-source fetch: @@ -118,8 +118,8 @@ Stderr: {}
Stdout: {}
",
swift_target_triple(),
- String::from_utf8(output.stderr).expect("Stderr must be valid UTF-8"),
- String::from_utf8(output.stdout).expect("Stdout must be valid UTF-8"),
+ String::from_utf8_lossy(&output.stderr),
+ String::from_utf8_lossy(&output.stdout),
);
let output = swift_build_command()Exact upstream comparison. The complete build script and both source trees were inspected: runtime Swift/Rust sources, Cargo manifest/features, build commands, and target/deployment selection are unchanged. The changed revision passed desktop Rust builds/tests on macOS and Linux; current-head macOS release and test CI also pass. The remaining review limitation is the reviewer environment’s source retrieval, not an unresolved source or behavior defect. No code change or additional upstream fetch is required for this item. The latest review’s assertion-preserving Swift test changes have also passed the full OpenClawKit/macOS CI stages, nine focused local tests, and ten repeated runs of both repaired cases. The fresh final-patch app changed gate passed all 1,109 app/host tests with pinned dependencies. Final CI is completing its Watch screenshot job. |
|
Merged via squash.
|
) Fix Tauri tray Stop by forwarding its explicit operator intent through the CLI's existing noninteractive consent flag. Stop remains graceful; Start and Restart keep their existing arguments and drain behavior. A real subprocess regression and native before/after comparison cover the failure and recovery. Consolidate Rust connection completion, Gateway reset state, CLI result handling and native menu ownership; remove unused navigation/auth helpers. Refresh compatible desktop and Watch RTC dependencies and notices. Retain blocking 1.6.2 after reproducing an upstream idle-thread retirement regression, and retain the existing updater pin pending the Windows cleanup-order repair. Net production Rust: -156 lines. No new configuration, schema or protocol surface. Wait for the actual pending-verification deadline callback in the macOS test while preserving its timeout budget and assertions. Remove a redundant late surface-refresh test caller and preserve observed URLs across asynchronous admission; mixed deadlines and one-rotation assertions remain. Validation includes 136 desktop Rust tests on macOS, 136 + 10 on Linux, explicit logind integration, 12 Watch media tests, all four Watch release slices, native Codex and cold Ollama onboarding, retry recovery, Quick Chat after restart, and real tray Stop/Start/Restart. The nine focused surface tests and ten repeated runs of the changed cases passed. Full PR CI and independent review passed.
What Problem This Solves
Fixes an issue where choosing Stop Gateway in the Tauri tray returned an error while the local service kept running. Native subprocesses have no terminal, and the app omitted the CLI’s required non-interactive stop consent.
Also completes the maintainer-requested Rust cleanup: consolidate repeated connection/reconnect setup, tray state, and unused navigation/auth/routing helpers, and refresh compatible desktop and Watch RTC dependencies.
Why This Change Was Made
Only Stop supplies the CLI’s
--forceconsent flag; service shutdown remains graceful, and Restart keeps its existing drain behavior. Local connect, install, and restart now share their identical completion path. Gateway configure/clear share cache invalidation and reconnect signaling; the CLI adapter alone enforces process success before decoding JSON. Native menus own their items, Quick Chat reuses its existing WebView guard, and Watch uses derived initialization without changing its C ABI or entropy checks.Reduces production Rust by 156 lines (+220/−376). Tests grow by four lines (+53/−49 across Rust and Swift), including the new service-action regression and repaired Swift callback wait. This includes canonical formatting that adds 56 lines to the Watch file. No new runtime setting, persistence representation, or protocol change. Existing navigation fences, TLS/identity checks, sleep generations, renderer callback ownership, and error visibility remain intact.
User Impact
Stop Gateway now stops the local service and exposes the stopped screen; Start and graceful Restart continue to work. The remaining cleanup preserves desktop onboarding, connection/reconnection, Quick Chat, and Watch audio behavior. Removes repeated configuration clones and keeps state transitions in one owner. The dependency refresh includes detached-opener child reaping and TLS read batching; no claimed end-to-end latency improvement from this refactor alone.
The desktop accepts 21 compatible transitive updates and advances the notifications plugin to its narrow Swift diagnostic fix. Watch updates getrandom to 0.4.3 and three compatible build dependencies, with matching license notices. Existing networking/crypto packages already match their current stable releases.
Evidence
cargo test --locked --all-targets --manifest-path apps/linux/src-tauri/Cargo.toml— 136 passed; final build has no compiler warnings. The new service-action regression fails on the pre-fix Stop invocation.openai/gpt-5.6-sol. Codex guided handoff completed in 13.029s. Real tray-menu events opened Quick Chat and Open Dashboard; composited Quick Chat replied with visible Done in 4.970s, then replied again in 4.083s after a 3.987s managed Gateway restart./api/psempty with one eligible installed 4B Instruct model; native Choose connection → Local only → Submit verified in 9.477s without a raw-API preload. Guided reply completed in 64.228s on CPU;talk to agenthanded off in 458ms, and reopening reached chat.gateway restart --json. Lifecycle Testbox run.git diff --checkpass. The app changed gate passed on the final patch in an isolated normal checkout with pinned dependencies and Swift tools, including all 1,109 app/host tests. Final independent review found no actionable P0–P2 issues. CI then exposed a race in the existing macOS pending-verification test: the receipt preceded its deadline callback. The test now waits for the callback using the same budget and all original assertions; its focused 15-test suite and fresh independent review pass. A separate iOS CI polling failure was also diagnosed and validated locally (249 owner-suite tests). During landing, refactor(macos): move app settings into the Dashboard and keep Connection native #138092 independently merged the equivalent event-wait repair into main, so the rebased branch uses that canonical fix and drops the duplicate patch. The macOS callback test moved with that refactor; its identical repair now lives inOnboardingDashboardHandoffTests.swift. Rust source, Cargo locks, and the CLI service contract are byte-identical to the native-tested revision. The rebased CI run then exposed a pre-existing OpenClawKit test race: a late legacy refresh caller could request a second rotation after the fixture response. The test-only repair anchors the initial timed request before starting followers with their original observed URL, and removes a redundant late join from the timeout-survival case. Mixed deadlines, one-request, survivor, result-equality and TLS-route assertions remain. Nine focused tests and ten consecutive stress repetitions of both changed cases passed. Full CI passed on the final head, including macOS/iOS tests, Watch operation tests, Android, release builds and screenshot jobs.The notification-plugin exact upstream diff was directly inspected: only two Swift failure-diagnostic UTF-8 conversions change in
build.rs; runtime sources, manifest, features, build commands and target selection are unchanged. This addresses ClawSweeper’s dependency-source review request; the complete upstream patch is also included inline in the maintainer disposition comment because the reviewer environment could not retrieve it.Dependency holds: retain updater 2.10.1 because current 2.11.0 still runs Tauri cleanup before returning Windows installer errors. Retain blocking 1.6.2 in the existing lock: identical upstream probes show 1.6.2 returns from 13 threads to 1 after 750 ms, while 1.7.0 retains all 13 after 1.5 s. The latter proves an upstream idle-retirement regression, not a measured desktop leak. No new patch, override, or manifest pin was introduced.
QA also observed the documented graceful-stop drain (315 seconds);
gateway stop --forcepermits non-interactive stop and does not bypass draining. Follow-up: cancel cancellable interactive prompt waiters before drain while preserving normal reconnects and commit-locked work. This is outside the Rust refactor.Follow-ups: revisit blocking after upstream restores idle-worker retirement; lift the updater pin only after Windows cleanup follows successful installer launch. Broader widget-state consolidation needs separate renderer-restart/native lifecycle proof; existing legacy preference/config file storage remains a separately scoped migration topic. The focused package build also reported an existing unused Bool result in ChatViewModelSessionActionTests.swift:1067; that unrelated test warning is a follow-up.
Before/after native retry proof (synthetic fixtures, both inspected):
Native Codex onboarding reached the verified model and enabled composer:
Actual native tray Stop, before and after the consent fix (idle Gateway):
Both task-owned Blacksmith Testbox leases are stopped and independently verified completed. The model proof used the normal configured workloads; the separate lifecycle comparison used an explicitly idle Gateway.