Repository navigation
fix(update): avoid stuck history after upgrades from older releases - #139608
TheCrazyLex wants to merge 1 commit into
Conversation
Older updater parents resume post-core work in the installed package without passing a run ID. Admitting a new row in that child records the already-updated version and leaves a running entry nobody can complete. Skip admission for that legacy continuation while retaining the existing parent-owned admission path for modern handoffs. Keep failure completion guarded when no run exists. Extend the existing post-core CLI test with isolated real-ledger checks for legacy and inherited-run continuations.
|
🦞👀 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. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to post-core resume admission, and the updated table-driven test suite directly exercises both legacy and modern handoff behavior against a real isolated ledger.
Pull request overview
This PR prevents post-core update finalization (run by a newly installed package after an upgrade) from creating an orphan “running” update-ledger entry when the upgrading parent release didn’t provide an update run ID (notably upgrades from 2026.9.1). It preserves modern behavior where post-core finalization continues under the parent’s existing run ID and avoids changing ledger schema or adding recovery behavior.
Changes:
- Skip
admitUpdateCommandRun()during post-core resume whenOPENCLAW_UPDATE_RUN_IDis absent, preventing creation of a new ledger row in legacy handoffs. - Make
controlPlaneUpdateSentinelMeta.runIdoptional when no run is admitted (run?.runId). - Extend the existing post-core CLI test into a two-case table to assert ledger behavior for both legacy (no run) and modern (inherited run) handoffs.
File summaries
| File | Description |
|---|---|
| src/cli/update-cli/update-command.ts | Avoids admitting a new update run during legacy post-core resumes without a run ID, preventing orphan “running” history entries. |
| src/cli/update-cli.test.ts | Adds table-driven coverage asserting post-core resume doesn’t invent a ledger entry, and preserves inherited-run ownership when provided. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@clawsweeper re-review The Evidence section now includes the successful hosted CI gate for the current head, alongside the red/green CLI tests with real ledger storage. The previous review receipt says complete, but its durable review comment still contains the starting placeholder. Please reassess the current branch and evidence. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 11:24 PM ET / September 6, 2026, 03:24 UTC. ClawSweeper reviewWhat this changesPrevent upgrade finalization started by older releases from creating an unfinished update-history entry, while preserving modern parent-owned history. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. No actionable patch defects were found, and the added installed-updater observations satisfy the previous review’s proof request. Priority: P2 Review scores
Verification
How this fits togetherThe updater replaces OpenClaw’s package and delegates plugin finalization to the newly installed CLI. Its shared history ledger supplies update status and completion reports to operators and clients. flowchart TD
A[Parent updater] --> B[Newly installed CLI]
B --> C{Inherited run ID?}
C -->|Yes| D[Reuse parent history]
C -->|No| E[Skip child history admission]
D --> F[Finalize plugins]
E --> F
F --> G[Return result to parent]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +6, Tests +20. Total +26 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep history admission with the update owner, allowing legacy children to return finalization results without inventing an unfinishable run. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure: a post-core continuation without an inherited run ID creates a running row that its older parent cannot complete. The contributor also records a failing pre-fix regression; this review did not execute it. Is this the best way to solve the issue? Yes. Skipping admission only for legacy continuations repairs the producer boundary and preserves existing modern admission, completion, and storage contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d6191a80e9a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review Added the requested installed-updater proof for exact head 825ffb9. Published npm 2026.8.2 handed finalization to the unchanged candidate, exited 0 with successful plugin finalization, and left zero update-history rows. A subsequent modern update exited 0 and retained exactly one succeeded/finished row whose ID matches the parent result, with original before version and target preserved. Real Gateway health and running-version checks passed at both hops. The Evidence section links the successful hosted run and full artifact, includes observed JSON and every-row checks, and states the existing Docker service-manager shim boundary. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Closing as superseded: the same fix is already on #139660 ( |
Related: #139284
What Problem This Solves
Fixes an issue where users upgrading from 2026.9.1 can finish plugin finalization but retain a permanently running update-history entry. The entry also reports the newly installed version as the starting version, obscuring what actually happened during the upgrade.
Why This Change Was Made
The older updater starts finalization in the new package without passing a run ID. Skip new-run admission for that legacy continuation: its parent cannot finish a ledger entry it never created. Modern continuations still reuse their parent's run through the existing admission path. This prevents new orphan records without adding history recovery or changing the ledger schema.
User Impact
Upgrades from parents predating the ledger no longer invent a running history entry during finalization. Modern updates retain their original version, target, and parent-owned completion behavior.
Evidence
requested / runningrow,before.version: 2026.9.2, and an empty target. The inherited-run case passed and retained the original2026.9.1starting version and target. The focused regression run had 1 failed, 1 passed, and 361 unselected tests.src/cli/update-cli.test.tsandsrc/cli/update-cli/update-command-post-core.test.tsusingnode scripts/run-vitest.mjs, including both ownership cases, normal update phases, rejected preflights, and post-core failures.git diff --check, and required autoreview passed. The PR CI gate passed for head825ffb9a8f21a33a1dda292d28a4d40fbbdda794.Installed legacy and modern handoff proof
Successful hosted run.
Full evidence artifact.
Exact product head:
825ffb9a8f21a33a1dda292d28a4d40fbbdda794.Proof branch head:
b732aefcbad385ed9b197ba1a2ecb3461bb66424.ok / ok, exit 0ok / ok, exit 0succeeded / finishedrow; parent result ID matches retained ID; original before/target preservedThe modern row ID is
cc2e18a5-a6d8-4036-8e34-7fbd36284ec4. Its before version is2026.9.2, after version is2026.9.99-first-hop.0, and target remains{channel: stable, tag: /tmp/openclaw-update-first-hop-future.tgz, kind: package}. Every retained step is completed, including post-update verification. There are no other rows, unfinished runs, or transaction residues. All three successive service process IDs differ.The first-hop missing-bridge negative control also reproduced its expected failure (exit 1,
shared-Y6bNiw2w.js). That is the existing compatibility-control case; the failed-first ledger regression remains the separately recorded CLI/SQLite test.Package checksums:
20e9c2f16742dfcebfb21504e51067d31e000a19577126ff4fab117e5e87dbe2.d485c26afe341492e5b95d4a3016428c6bacd9579ddf005a3c5ebf6d53b0d8a1.sha256:37d531d231c60b1a22a8090822ab9f20f0bc0bff5bbbbdef323d144e78603302.The product was packed before harness instrumentation. Installed build-info matches the selected package at each hop, and the first live RPC observation was recorded before the future hop replaced the candidate. History observation opened the existing SQLite database read-only and read all rows; no fixture admission, terminalization, or manual history mutation was used.
Scope: this uses the existing isolated Docker updater harness, including its systemd-control shim, with real installed CLI binaries, package replacement, Gateway processes, and RPC calls. Published 2026.8.2 supplies the pre-ledger parent contract through an already-supported compatibility bridge; the future fixture is derived from the candidate by the existing fixture generator. It is not a native systemd-host or macOS proof, and no operator Gateway or private configuration was used.
Actual observation summaries from the run:
{ "stage": "positive-first", "before": "2026.8.2", "after": "2026.9.2", "finalization": "ok", "historyRows": 0, "runId": null, "gatewayVersion": "2026.9.2", "gatewayHealthy": true } { "stage": "positive-second", "before": "2026.9.2", "after": "2026.9.99-first-hop.0", "finalization": "ok", "historyRows": 1, "runId": "cc2e18a5-a6d8-4036-8e34-7fbd36284ec4", "gatewayVersion": "2026.9.99-first-hop.0", "gatewayHealthy": true }Maintainer update
v2026.9.1post-core spawn contract: it supplies post-core context without an update run ID, so the original defect mechanism is valid.53b3ac0831350ad868cb0ca25daf691bbbd8e1f4, including Alex Naidis's co-author credit. Post-core children now return before top-level run admission, and the existing two-case regression checks successful plugin output and unchanged complete ledger contents with and without a forwarded parent run.b4ce0df975fab5f1a5bc234ad9643c6de40c9eb0in the combined runnode scripts/run-vitest.mjs src/cli/update-cli.test.ts -t 'finishes the admitted run|restored-generation completion|does not reopen the ledger after migrated|post-core resume children' --reporter=dot(4 passed; the two expected initialization failures belong to fix(update): clear active status when CLI initialization fails #139288). There is no red-on-current-main result for this already-fixed defect.825ffb9a8f21a33a1dda292d28a4d40fbbdda794; this is the existing run, not new CI.