refactor: extract UpdateCoordinator from App.xaml.cs
Summary
App.xaml.cs had grown to over 4000 lines with update check, download, install, and dialog coordination mixed in alongside unrelated concerns. This moves the entire update flow into a dedicated UpdateCoordinator service.
What changed
- New
Services/UpdateCoordinator.cs— holds the three concurrency fields, six methods, and all update-related logic App.xaml.cs— adds a single_updateCoordinatorfield, wires it up during startup, and delegates all four call sites (startup check, CLI arg,IAppCommands, deep link handler)- XamlRoot is resolved at call time via a
Func<XamlRoot?>(hub window first, keep-alive fallback), so the coordinator has no direct reference to any window - Fixes a latent bug where
UpdateCommandCenterInfo.Detailwas mutated in-place on the existing object;AppState.UpdateInfoonly firesPropertyChangedon assignment, so the mutation was silently dropped by the UI
Testing
./build.ps1dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restoredotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restoredotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore
Proof
Manual run after the UpdateCoordinator extraction. The log shows the update flow firing through the new coordinator on startup:
Checking for updates...Update available: v0.5.0Skipping update prompt for remembered version v0.5.0
Behavior preserved: the check runs, the version is detected, and the remembered-version skip is honored — identical to the pre-refactor path.
https://github.com/user-attachments/assets/ddb3cca6-bf3c-4316-90a9-0a533de00bd4
Notes
No behavior change is intended. The update dialog, skip logic, concurrency model, and #if DEBUG paths are preserved exactly. Addresses part of #554.
Co-Authored-By: Claude Sonnet 4.6 [email protected]
Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 11:10 AM ET / 15:10 UTC.
Summary
This PR adds UpdateCoordinator, moves update check/prompt/download/install logic out of App.xaml.cs, and delegates startup, tray, app-command, and deep-link update entrypoints to the new service.
Reproducibility: not applicable. this is a refactor PR rather than a bug report. The attached recording provides after-refactor behavior proof for the startup update-check and remembered-skip path.
Review metrics: 2 noteworthy metrics.
- Diff surface: 2 files changed, +484/-466. The refactor is concentrated in one new service and one delegation edit, so maintainers can focus review on update-flow behavior preservation.
- Delegated entrypoints: 4 entrypoints delegated. Startup, tray menu, app command, and deep-link update paths all move through the new coordinator and are the main behavior surface to verify.
Merge readiness Overall: 🐚 platinum hermit Proof: 🐚 platinum hermit ✨ media proof bonus Patch quality: 🐚 platinum hermit Result: ready for maintainer review.
Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.
Rank-up moves:
- none.
Mantis proof suggestion A short desktop proof would still be useful if maintainers want visual coverage of the manual Check for Updates/status-dialog path beyond the submitted startup log recording. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:
visual task: verify manual Check for Updates still updates command center status and shows the expected update dialog after the UpdateCoordinator extraction.
Risk before merge
- [P1] GitHub
testande2etestswere still in progress at review time, so merge should wait for the normal required checks to finish. - [P1] The attached recording covers startup update check and remembered-version skip, but not a full download/install path; maintainers may ask for that separately if they want full updater-flow proof before merge.
Maintainer options:
- Decide the mitigation before merge
Land the focused extraction after the in-progress checks complete, preserving the existing updater semantics and keeping the whole-objectUpdateInforeplacement. - Pause or close
Do not merge this PR until maintainers decide whether the risk is worth taking.
Next step before merge
- No automated repair is indicated because no actionable patch defect was found; this needs normal maintainer review and CI completion.
Security Cleared: The diff moves existing updater logic without changing dependencies, workflows, permissions, secrets handling, release sources, or package references.
Review details
Best possible solution:
Land the focused extraction after the in-progress checks complete, preserving the existing updater semantics and keeping the whole-object UpdateInfo replacement.
Do we have a high-confidence way to reproduce the issue?
Not applicable: this is a refactor PR rather than a bug report. The attached recording provides after-refactor behavior proof for the startup update-check and remembered-skip path.
Is this the best way to solve the issue?
Yes: extracting one cohesive update coordinator is a narrow maintainability step, and the UpdateInfo assignment change matches the AppState notification contract. Merge should still wait for the in-progress checks and ordinary maintainer review.
AGENTS.md: found and applied where relevant.
Codex review notes: model gpt-5.5, reasoning high; reviewed against eb06fba21c44.
Label changes
Label changes:
- add
proof: sufficient: Contributor real behavior proof is sufficient. The PR body now links an inspected MP4 recording showing after-refactor startup update logs and the remembered-version skip path in a real Windows session. - add
proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body now links an inspected MP4 recording showing after-refactor startup update logs and the remembered-version skip path in a real Windows session. - add
rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. - add
status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The PR body now links an inspected MP4 recording showing after-refactor startup update logs and the remembered-version skip path in a real Windows session. - remove
status: 📣 needs proof: Current PR status label isstatus: 👀 ready for maintainer look. - remove
rating: 🦪 silver shellfish: Current PR rating israting: 🐚 platinum hermit, so this older rating label is no longer current.
Label justifications:
P3: This is a low-risk maintainability refactor with no urgent user-facing regression reported.rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The PR body now links an inspected MP4 recording showing after-refactor startup update logs and the remembered-version skip path in a real Windows session.proof: sufficient: Contributor real behavior proof is sufficient. The PR body now links an inspected MP4 recording showing after-refactor startup update logs and the remembered-version skip path in a real Windows session.proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body now links an inspected MP4 recording showing after-refactor startup update logs and the remembered-version skip path in a real Windows session.
Evidence reviewed
What I checked:
- Repository policy read: Full target AGENTS.md was read; its validation expectations were applied as review context, but no build/test commands were run because this review is explicitly read-only. (
AGENTS.md:1, eb06fba21c44) - Current main still has old shape: On current master, update initialization and all update helpers remain in App.xaml.cs, and no Services/UpdateCoordinator.cs exists, so the PR is not implemented on main. (
src/OpenClaw.Tray.WinUI/App.xaml.cs:3286, eb06fba21c44) - PR delegates update entrypoints: The PR constructs UpdateCoordinator during startup and delegates the startup update check, tray menu action, app command, and deep-link action to it. (
src/OpenClaw.Tray.WinUI/App.xaml.cs:444, e41c322b0544) - Extracted implementation inspected: The new UpdateCoordinator contains the moved metadata check, remembered-skip handling, manual-check guard, status dialogs, and download/install helper using injected updater/AppState/settings callbacks. (
src/OpenClaw.Tray.WinUI/Services/UpdateCoordinator.cs:47, e41c322b0544) - UpdateInfo assignment contract: AppState.UpdateInfo raises observers through assignment via SetField, which supports the PR's whole-object replacement for the remembered-skip detail update. (
src/OpenClaw.Tray.WinUI/Services/AppState.cs:165, eb06fba21c44) - Real behavior proof inspected: The linked 11-second MP4 was downloaded to the scratch area; extracted frames show terminal logs for checking updates, update available v0.5.0, remembered-version prompt skip, and the WinUI app opening after the refactor. (e41c322b0544)
Likely related people:
- shanselman: GitHub commit history shows Scott added the updater/installer flow and later rewrote the update dialog/progress window behavior that this PR extracts. (role: feature owner / original update-flow contributor; confidence: high; commits: bfa0e6c0f96f, ad1409ca68e1, 6e2069d0adfd; files:
src/OpenClaw.Tray.WinUI/App.xaml.cs,src/OpenClaw.Tray.WinUI/Dialogs/UpdateDialog.cs,src/OpenClaw.Tray.WinUI/Dialogs/DownloadProgressDialog.cs) - RBrid: GitHub path history shows RBrid authored the manual Check for Updates feedback and AppVersionInfo/status update flow that is moved by this PR. (role: update command-center contributor; confidence: high; commits: f3d3fd2772f3; files:
src/OpenClaw.Tray.WinUI/App.xaml.cs,src/OpenClaw.Tray.WinUI/Dialogs/UpdateDialog.cs) - ranjeshj: Recent history and blame show Ranjesh touched the App.xaml.cs and UpdateDialog update path while enforcing warning-clean builds and broader WinUI cleanup. (role: recent area contributor; confidence: medium; commits: a727197dd709; files:
src/OpenClaw.Tray.WinUI/App.xaml.cs,src/OpenClaw.Tray.WinUI/Dialogs/UpdateDialog.cs)
What the crustacean ranks mean
- 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
- 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
- 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
- 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
- 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
- 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
- 🌊 off-meta tidepool: rating does not apply to this item.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.
How this review workflow works
- ClawSweeper keeps one durable marker-backed review comment per issue or PR.
- Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
- A fresh review can be triggered by eligible
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch. - PR/issue authors and users with repository write access can comment
@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto request a fresh review only. - Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
- Maintainer-only repair and merge flows require explicit commands such as
@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review. - Maintainers can comment
@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.
@clawsweeper re-review
🦞🧹 ClawSweeper re-review requested.
I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.
Re-review progress:
- State: Failed
- Detail: The targeted re-review did not finish cleanly. Check the workflow run for details.
- Run: https://github.com/openclaw/clawsweeper/actions/runs/26686750519
- Updated: 2026-05-30T14:50:17.261Z