Repository navigation
fix(update): finish Windows updates after state migration - #157262
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 24, 2026, 4:21 PM ET / 20:21 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch changes Windows update handoff after state migration, adds five regression scenarios and Windows CI selection, and documents recovery for updates driven by older versions. Regression provenancePossible regression — suspected (failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: current main still contains the source-backed Windows update failure, and this PR addresses that path. Merge readiness remains blocked by the previously requested real Scheduled Task activation and failure-compensation proof. Priority: P0 Review scores
Verification
How this fits togetherThe update CLI stops a managed Gateway, installs the new OpenClaw build, and passes finalization to that build. On Windows, a suspended Scheduled Task must remain under update custody until activation or failure compensation finishes. flowchart LR
A[Update request] --> B[Inspect managed Gateway]
B --> C[Stop Gateway and suspend task]
C --> D[Install build and migrate state]
D --> E[Check live update authority]
E --> F[Candidate finalizer]
F --> G[Activate task or compensate failure]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -9, Tests +102, Docs +8, Config 0. Total +101 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the live executor as the handoff authority and verify, on an isolated real Windows Scheduled Task installation, that the candidate reaches readiness and that a failed finalizer leaves the task safely recoverable. Do we have a high-confidence way to reproduce the issue? Yes, the source gives a high-confidence failure path: after a newer schema is published, the old Windows handoff callback reads the update ledger through the retained runtime. The five regression cases exercise that refusal, though this review did not run them. Is this the best way to solve the issue? Yes, removing the incompatible read from the suspension owner is a narrow repair, and the live executor and service-identity checks remain. A real Windows handoff is still needed to establish the claimed end-to-end outcome. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6b4595575af2. LabelsLabel changes: No label changes. Label 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 (6 earlier review cycles)
|
740da0f to
a9d2f04
Compare
…57262) * fix(update): finish Windows updates after state migration * test(update): release Windows fixture coordinators before cleanup * test(update): avoid shadowing migration database in cleanup assertion * test(ci): allow small Windows fixture timing overage
What Problem This Solves
Fixes Windows npm-global updates stopping with recovery pending after candidate Doctor migrates the state database, before post-core plugin convergence and Gateway activation can run.
Fixes #157077. Thanks @joshbunker for the report and the follow-up activation timeline.
User Impact
The repaired driver hands its suspended Scheduled Task to the compatible candidate finalizer without reopening migrated state through the old runtime. A plugin version warning can reach normal activation and completion instead of being stranded before finalization.
This repairs the next update hop driven by this version; installing the candidate cannot patch an already-running 2026.9.5 driver. An installation already left pending by that driver still needs the installed version's
openclaw update repair.Why This Change Was Made
The violated invariant is that, after candidate Doctor advances canonical state beyond the parent's schema contract, only the compatible candidate may reopen that state or finish the update. The Windows Scheduled Task suspension owner retained a callback that checked
getUpdateRun()through the old parent. Callinghandoff()therefore threw a schema-version refusal before launching the candidate finalizer. All five regression cases failed at that same read before their intended warning, launch-failure, terminal-failure, or changed-service outcome could run.Remove this redundant history read from the suspension owner. The original live executor fence, caller authority, and native service-identity guards still authorize handoff and compensation. The candidate now receives custody: warning completion is accepted, genuine child failures are reported, and a replaced or changed protected task is still rejected.
Windows disables Scheduled Task autostart and awaits service stop before package replacement and Doctor migration; it enables the task only at candidate activation. Linux/macOS use the same stop-before-mutation barrier and stopped convergence interval, without the Windows autostart handoff callback. The reporter's follow-up confirms the task had stopped: the newer-schema refusal was consistent with the retained updater reopening state, not proof that the old Gateway survived the stop.
Related: the pre-migration snapshot and rollback-restoration decision for #157107/#157077 belongs to L1267. This PR does not add snapshots, reverse migrations, or change rollback policy.
Evidence
Behavior proof and fresh branch review are complete. The changed-file gate passed with the already-merged base fix described below.
check:changedpassed.a3a4e23cb009b66b406515fe606f2e80769f9921, verified by Crabbox; artifact metadata records its synthetic source-capsule commit): both variants passed published 2026.9.5 → fixture candidate → next fixture version; all four hops exit 0, running build/version matched, readyz and channels ready, settled=true, no plugin errors, no repair entries, and zero transaction residue. PIDs: baseline 618 → 4422 → 11256; repaired 618 → 4422 → 11290. Mock inference requests: 0. The harness relabels only fixture package versions to force both hops. Blacksmith run.autoreview --mode branch --base origin/main: scoped-clean through P2.update-cli.test.tsmonolith is covered by the coordinator's explicit timing ruling and the split in test(cli): split and speed up update-cli tests #157018; its 515 cases passed. All 36 direct/one-barrel importer files passed: 1,521 tests, including 817 tests in the 30 resumed files (485.09 s command wall).check:changedinitially passed all typecheck/guard/dead-export steps, then hit the unchanged 704-lineagent-run-registry.tsagainst its 700-line cap. The owning fix is already merged in refactor: share active run state precedence #157168 (92635da29126). The complete check then passed (exit 0, 36m24s) with that exact upstream patch applied only in the disposable Testbox copy; no suppression, baseline, or PR source change was made for it. This qualification includes all core/test typecheck shards, core/script lint, schema guards, and runtime import-cycle checks. Check Testbox run.checks-windows-node-test-3passed on740da0fbe77f551ad33be7400d637faff96c5746. All five regression cases executed and passed: plugin warning 1.092 s, launch failure 1.187 s, failed terminal result 0.995 s, replaced task 1.476 s, changed protected task 1.353 s (6.103 s total case time; containing CLI shard 16.09 s).check-lint-core-1also passed on that head. The preceding push exposed a no-shadow diagnostic in the new closure assertion; the final commit only renames its callback parameter, with single-file lint and fresh P2 autoreview clean. Auto-merge remains off.cleanupTempDirswithEPERM; none of the handoff assertions failed. The fixture retained an idle SQLite coordinator beneath its temporary Windows home. It now uses the existing coordinator runtime scope withkeepAlive: false, and checks that its real SQLite handles have closed before directory cleanup. Production code and the original handoff assertions are unchanged.