Repository navigation
fix: keep the migration window responsive while finalizing - #2391
shanselman wants to merge 1 commit into
Conversation
StoreMigrationOperations.FinalizeAsync invoked the coordinator directly, so detection, removal verification, receipt reading and inventory hashing ran on the migration window's dispatcher before the first await. Wrap it in Task.Run like PrepareAsync and CompleteAsync, and add a UI-thread regression test. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 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: passed. What this changesThis PR schedules migration finalization on the thread pool and adds a WinUI dispatcher regression test. Example: Companion finalizes an Inno-to-Store migration with a completed receipt and 64 identity directories.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it provides a focused fix for a dispatcher-blocking path still present on main, and no concrete code defect was found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe migration window invokes StoreMigrationWorkflow, which awaits StoreMigrationOperations; the connection-layer coordinator verifies source removal, validates the receipt and inventory, applies startup preferences, and returns a finalization decision. flowchart TD
A[Migration window] --> B[StoreMigrationWorkflow]
B --> C[StoreMigrationOperations]
C --> D[Thread pool]
D --> E[Finalization coordinator]
E --> F[Source checks and migration records]
E --> G[Startup preference and cleanup]
E --> B
Technical reviewBest possible solution: Keep scheduling at the existing WinUI facade boundary while preserving dispatcher-bound workflow updates and every migration validation and cleanup rule. Do we have a high-confidence way to reproduce the issue? The window's Loaded handler reaches the workflow and direct facade call on the dispatcher, where the coordinator performs synchronous inventory work before its first await; this establishes the main-branch failure path without a live reproduction. Is this the best way to solve the issue? Task.Run around the complete coordinator invocation is the smallest complete repair, matches the sibling operations, and leaves UI continuation and migration decisions with their existing owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8d31176d3ad4. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel 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 Reviewed November 27, 2026, 12:37 PM ET / 17:37 UTC. |
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
274a40786644e76d4ccff7adfe4eafb54dbaeafb↑ Coordinator already resumes with ConfigureAwait(false) and touches no UI state; the workflow still awaits on the dispatcher.
↑ 22 StoreMigration UI tests, 148 Connection StoreMigration tests, full Tray tests pass.
↓ No packaged Store-to-Inno migration run on a real machine.
↓ Frozen progress indicator not independently observed.
Closes #2244
What Problem This Solves
When Companion launches after a completed migration from the previous installer, the migration window checks the old install and hashes the migrated identity files. That work ran on the window's UI thread, so the window could freeze for a couple of seconds before continuing.
User Impact
User impact: the migration window stays responsive while finalization checks run. No change to what finalization verifies or decides.
Why This Change Was Made
StoreMigrationOperations.FinalizeAsynccalled the coordinator directly, and the coordinator does all of its blocking work (detection, removal checks, receipt read, inventory hashing) before its first await. It now starts on the thread pool withTask.Run, like itsPrepareAsyncandCompleteAsyncsiblings. The startup-task call keeps its own existing off-UI-thread marshalling.Evidence
StoreMigrationOperationsThreadTestscalls the production facade from the WinUI dispatcher with a stub detector. Without the fix it fails ("Finalization started on the dispatcher thread."); with the fix it passes.dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 --filter "StoreMigrationOperationsThreadTests|StoreMigrationWindowProofTests": 22 passed../build.ps1: passed.dotnet test tests/OpenClaw.Tray.Tests: 7050 passed.dotnet test tests/OpenClaw.Shared.Tests: first run 1 failure (unrelated; this change is not compiled into Shared), rerun 6175 passed, 28 skipped.dotnet test tests/OpenClaw.Connection.Tests --filter StoreMigration: 148 passed.Not verified: a real packaged Store migration with an Inno source on a live machine.
Required proof pools
none: thread scheduling fix with no visual, installer, or Gateway change; covered by the dispatcher-thread regression test.