Repository navigation
fix: let the next update settle a package publication that a killed update left behind - #200550
Conversation
An update killed between publishing its journal and installing the new package left the next `openclaw update` and `openclaw update repair` refusing with "Package publication is incomplete" until someone ran the printed recovery command. Settlement now first brings such a publication to rest with the recovery that command runs, under a claim in the recorded lease store that proves the original updater gone, then closes the aborted or published operation through the existing settlement. It resumes only a journal this build's own helper was sealed for, never replaces an installed package, and never resumes under a caller-supplied claim. The update records what it settled as a package-publication-recovery warning step. Refusals that remain name their cause and a step that works: a lost lease store and a changed installation now name the reinstall that supersedes the operation.
Recovery keeps group/other read and execute access on retained package contents and clears only write access (openclaw#193272). The installed recovery lane still expected owner-only modes, so its first tree comparison failed on every entry.
|
🦞👀 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. |
Unlinking a link and creating it again can reuse the freed inode on Linux, which leaves the launcher's recorded identity unchanged and the publication legitimately resumable. The control now keeps the old link under another name, so the new one always has a new identity.
…tover-publication
|
Codex review: blocked before merge. What this changesLets update and repair settle eligible npm package publications left behind by a killed updater. Example: An updater is killed with candidate 2026.12.1 waiting under previous while 2026.11.3 remains installed.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this maintainer-authored PR addresses a concrete recovery failure that current main still leaves unresolved. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherCLI update admission and repair consume the package-publication journal and executor lease, then invoke the existing publication owner to settle recovery and report its outcome. flowchart TD
A[Update or repair CLI] --> B[Activation settlement]
B --> C[Recorded lease store]
C --> D[Publication owner]
D --> E[Installed package and journal]
E --> F[Recovery receipt and output]
Technical reviewBest possible solution: Keep settlement with the existing recovery owners and construct the replacement launcher before renaming it over the original in the test fixture. Do we have a high-confidence way to reproduce the issue? Current-main eligibility shows the incomplete-publication refusal, and the supplied base/head kill sweep and installed-package results identify the same path; no target code was executed during this review. Is this the best way to solve the issue? The production approach is appropriately narrow: eligible dead publications reach the existing publication and settlement owners while an installed package remains untouched. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 780c63ef2497. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +193, Tests +397, Docs +81, Other +1. Total +672 across 16 files. Added test files: 2. View PR surface stats
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. Review metrics
LabelsLabel changes:
Label justifications:
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 17, 2026, 5:26 AM ET / 10:26 UTC. |
…tover-publication
…tover-publication
…tover-publication
|
Merged via squash auto-merge.
|
…pdate left behind (openclaw#200550) * fix(update): settle a killed package publication on the next update An update killed between publishing its journal and installing the new package left the next `openclaw update` and `openclaw update repair` refusing with "Package publication is incomplete" until someone ran the printed recovery command. Settlement now first brings such a publication to rest with the recovery that command runs, under a claim in the recorded lease store that proves the original updater gone, then closes the aborted or published operation through the existing settlement. It resumes only a journal this build's own helper was sealed for, never replaces an installed package, and never resumes under a caller-supplied claim. The update records what it settled as a package-publication-recovery warning step. Refusals that remain name their cause and a step that works: a lost lease store and a changed installation now name the reinstall that supersedes the operation. * fix(ci): expect readable package modes in the installed recovery lane Recovery keeps group/other read and execute access on retained package contents and clears only write access (openclaw#193272). The installed recovery lane still expected owner-only modes, so its first tree comparison failed on every entry. * test(update): keep the replaced launcher's inode distinct Unlinking a link and creating it again can reuse the freed inode on Linux, which leaves the launcher's recorded identity unchanged and the publication legitimately resumable. The control now keeps the old link under another name, so the new one always has a new identity. * docs(update): say what repair does with a publication under its own claim
…e publishing the package (#200460) * fix(update): keep openclaw runnable when an npm update is killed while publishing the package * test(update): avoid a shadowed name in the surviving exchange tool test * test(update): keep the displacement refusal and manifest-read tests on their paths (cherry picked from commit 413d9ee) Companion disposition: #200273 and #200366 prerequisites included; #200532 and #200550 recovery companions follow. Release adaptation: none. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 156510063401de1ab38e8def5d0acfe381ef813f)
…pdate left behind (#200550) * fix(update): settle a killed package publication on the next update An update killed between publishing its journal and installing the new package left the next `openclaw update` and `openclaw update repair` refusing with "Package publication is incomplete" until someone ran the printed recovery command. Settlement now first brings such a publication to rest with the recovery that command runs, under a claim in the recorded lease store that proves the original updater gone, then closes the aborted or published operation through the existing settlement. It resumes only a journal this build's own helper was sealed for, never replaces an installed package, and never resumes under a caller-supplied claim. The update records what it settled as a package-publication-recovery warning step. Refusals that remain name their cause and a step that works: a lost lease store and a changed installation now name the reinstall that supersedes the operation. * fix(ci): expect readable package modes in the installed recovery lane Recovery keeps group/other read and execute access on retained package contents and clears only write access (#193272). The installed recovery lane still expected owner-only modes, so its first tree comparison failed on every entry. * test(update): keep the replaced launcher's inode distinct Unlinking a link and creating it again can reuse the freed inode on Linux, which leaves the launcher's recorded identity unchanged and the publication legitimately resumable. The control now keeps the old link under another name, so the new one always has a new identity. * docs(update): say what repair does with a publication under its own claim (cherry picked from commit 0ce9c77) Release adaptation: none. Companion disposition: update publication, custody, Doctor and best-effort maintenance fixes are ported together in dependency order; #200331 supplies the owed-step owner required by #200507/#200579. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 2dd257b6ce71507101c2563df56ff6662376ace0)
…aw#194058) Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139. Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact. Co-authored-by: TorstenW <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: steipete <[email protected]> (cherry picked from commit 7c702c3) Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression. Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109) Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd) (cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
Related: #200460
What Problem This Solves
If
openclaw updateis killed while it installs the new npm package (a closed terminal, an OOM kill, a crash), its publication journal stays behind. The installed package keeps working since #200460, but the nextopenclaw updateandopenclaw update repairboth refused withPackage publication is incompleteuntil someone ran a printed recovery command with a recorded external runtime. One killed update blocked every later update, and repair could not help.User Impact
The next
openclaw updateoropenclaw update repairnow settles the leftover publication itself:The update prints what it settled and records it as a
package-publication-recoverywarning step in its result and run history.update repairrecords a settlement entry under the operation ID.What still needs a person, measured in a real installed package: after this change the next
openclaw updatesettles the publication and then stops at a second, separate check,Update <id> has unfinished recovery; reconcile it before starting another update, because the killed update run itself is unreconciled. Oneopenclaw update repairclears it (repair now succeeds in one pass, where it refused before), and updates work again. That check lives in the update-run recovery admission, which this PR does not change. So the manual work goes from "printed external-runtime command, then repair" to "oneopenclaw update repair"; it is not zero yet.It still refuses, with the reason and a next step, when:
Run openclaw update repair, which refuses the same way, as does the printed command;update repairalready holds a reclaimed handoff or cancelled-update claim for the installation (unchanged: it reports the recovery command). Since fix: recover older update handoffs during repair #200532 that claim is taken in the journal's lease store, so resuming under it could be made sound by passing the store identity along with the claim. This PR does not do that.No journal field, journal version, SQLite schema, config option, wire protocol, or dependency changes.
Why This Change Was Made
Settlement already handled an untouched preparation and an installed candidate, and left "a publication that still needs file changes" to the printed command (#181307) so that nothing would be republished beneath a running Gateway. A kill between journal publication and the exchange lands in that third case, although the only file changes it needs are inside the journal's own recovery directory.
The settlement owner (
settlePendingPackageActivation, shared byupdateandupdate repair) now first brings such a publication to rest with the recovery the printed command runs (the publication owner'spublish(true)), then closes the aborted or published operation through the existing settlement, under one claim. It adds no second reading of the recovery directory layout. It resumes only when all of this holds:Everything the publication owner already refuses (changed package, changed launcher, ambiguous roles, unknown artifacts) still refuses; the refusal now carries the operation ID, a step that works, and the cause.
To stay under the 700-line cap of
package-update-activation.ts, the lease inspection moved unchanged topackage-update-activation-settlement.ts, and the new decision and messages live inpackage-update-activation-prepare.tsbeside the recovery-command resolution whose helper lookup they share.Version compatibility
Evidence
Kill sweep through the real entry points
The existing kill sweep runs the real publication owner in a child process and SIGKILLs it after every boundary. Each killed installation then got the start of the next
openclaw update(prepareUpdateCommand: automatic settlement, then admission) twice, theupdate repairCLI, and the printed command's recovery. macOS, exchange toolosascript. Base measured atf41651d3acb(journal sweep fixture given a published-style candidate with its dist inventory); the branch was cut from96763b979fe, and later main movement did not touch these files.Original updater dead, lease store intact, with an exchange tool (37 boundaries):
openclaw update, baseupdate repair, basepreparingPackage publication is incompletepreparedpublication-not-started)previouspublishing, intentpublishpublishingtopublication-completeWithout an exchange tool (41 boundaries) rows 1-27 and the installed-candidate rows are the same, and:
openclaw update, baseupdate repair, basepublishingpublishingENOENTOn this branch the second update in every row finds nothing to settle and nothing to refuse. Rows 33-34 are reachable only by an update process that does not run from that installation;
openclawcannot start there.Rows that must still refuse (candidate waiting under
previousunless noted):preparingand publish-intent rows withPackage publication is incomplete, naming a recovery command that itself refusesAnother update executor owns this installation ... retry openclaw update repair in a moment; nothing on disk changespreparingand publish-intent rows refuse withlease database identity changed ... Run openclaw update repair; repair and the printed command refuse the same wayPackage publication is incompletePackage publication <id> cannot be resumed ... Cause: Package publication object changedPackage publication is incomplete... cannot be resumed ... Cause: Package launcher changed outside its publication intentPackage restoration is unfinishedPackage publication is incompletewith the recovery commandPackage publication is incompleteA replaced installation (a manual reinstall) is not a refusal, before or after: its stale journal is retired with the evidence kept.
Real installed package, Linux container
A scratch variant of the
package-installed-recoveryDocker cell (packed build installed with npm, Node 24, arm64) kills a realopenclaw updateright after the candidate takes the nameprevious, then runs the public commands.openclaw updatePackage publication is incompleteSettled previous package update <id> (publication-not-started) ... is aborted: the installed package is kept ...; journal complete; then exit 1,Update <id> has unfinished recovery; reconcile it before starting another update.openclaw update repairPackage publication is incompletecoreUpdate: completedopenclaw updateafter repairopenclaw update repairas the first command after the killTests
Head
afbaf028d62. Runs name the commit they ran on; later commits are a test-fixture fix, a docs wording change, and merges of main.src/cli/update-cli/update-command-publication-kill.process.test.ts, 12 cases: the every-boundary sweep throughprepareUpdateCommand(settles, second update idempotent, launcher still starts the served package); the three no-tool boundaries including the missing package;update repairthrough the CLI with its run-history record; the dry-run preview; a lost lease store (removed and replaced) followed by the reinstall the message names; settlement under a caller's claim; and five controls (live updater, edited package, replaced launcher, rollback, another build). Against base production code 9 of the 12 cases fail, the sweep at the first journaled boundary withPackage publication is incomplete; the caller's-claim, rollback and other-build controls pass on both, as intended, because those refusals did not change.update-command-target-settlement.test.ts: one case that the step from admission reaches run history before the first target decision. Fails with the baseupdate-command-target.ts.960bda59ed0(this branch merged with main including fix: recover older update handoffs during repair #200532, which touched the same settlement file): 22 infra files, 415 tests, and 13 CLI files, 277 tests, all pass, plusupdate-repair-handoff.test.tsfrom fix: recover older update handoffs during repair #200532. Onafbaf028d62(one more unrelated main merge and a docs wording commit): the new file, 12 tests on Bun, andupdate-repair-handoff.test.ts.pnpm tsgo:alland the session-identity, test-lines (+397 of 400) and max-lines checks pass onafbaf028d62.OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs, the mock-export check,eager-import-closureandupdate-restart-module-outcomepassed on13e34c3cccd, before the fixture and docs commits.42225b76677: one real failure,checks-node-changed-compact-small-12. The launcher control in the new test unlinked the launcher and created it again; Linux reused the freed inode, so the launcher's recorded identity was unchanged and the update correctly resumed. The control now keeps the old link under another name. That was a fixture defect, not a product one.--maxWorkers=1, 76 s wall with a cold compiled-subprocess generation); 23 s of that is the sweep. It stays a full sweep because the property is "no boundary leaves the next update refusing", and the earlier fix covered representative states and missed the ones between them. A new boundary in the publication now fails this test instead of shipping as a refusal.Test audit (whole files): the new test and
package-update-kill-sweep.test-support.ts(the kill-sweep helpers, moved out ofpackage-update-release-switch.process.test.tsunchanged so both suites share it);package-update-release-switch.process.test.ts(no case or assertion changed, one stale comment corrected); its child fixture (the journal candidate now carries its module type and dist inventory, as a published package does);package-update-publication-boundary.test.ts(one expectation changed: with its updater alive, settlement now refuses withAnother update executor owns this installationinstead ofincomplete, which is the behavior change, not a weaker assertion);update-command-target-settlement.test.ts;test/scripts/upgrade-survivor-installed-recovery.test.ts. Nothing was pruned: no dead or redundant case turned up in them.package-installed-recoveryDocker laneRun locally for the
partial-previouscut.96763b979fethe lane fails at its first tree comparison:Package tree changed: ".": mode 755 -> 755 (expected 700) ... (46815 field differences). Recovery has kept group/other read and execute access since fix(update): keep restored npm packages readable by non-root services #193272; the lane still expected owner-only modes. With the expectation and its unit tests aligned, the cut passes displacement, status, both repairs, the interrupted retirement, its resume, and archival.openclaw updateexits 1 withUpdate <id> has unfinished recovery; reconcile it before starting another update.This is the update-run recovery admission refusing while the killed run is unreconciled, the same check as in the table above. The lane's expectation (the next update just works) matches the "updates always work" rule, so the lane is right and stays red until that admission reconciles a dead run itself.One unit test in the lane's file,
keeps shared evidence readable through restrictive umask, fails on this macOS host on base and on this branch alike (448 !== 1512, a setgid directory mode); it is unrelated.Review
The repository's autoreview helper does not work on this machine. One fresh read-only reviewer agent reviewed the diff and the tests without the author's reasoning; this replaced autoreview. What it found and what was done:
Not proven
openclaw update: covered in two halves (admission produces the step; target preparation records it).Second independent run before landing. On
0ffc5d98176(this branch withmainmerged in):pnpm tsgo:allpasses; 7 files, 124 tests pass (update-command-publication-kill.process,update-command-target-settlement,package-update-publication-boundary,package-update-release-switch.process,package-update-activation-durability,package-update-activation-recovery-command,update-repair-handoff); the two restart/closure script tests, the session-identity ratchet andcheck-changed(dead code skipped) pass.upgrade-survivor-installed-recovery.test.tscasekeeps shared evidence readable through restrictive umaskfails on this macOS host on this branch and identically onmainatc48b8293ae6. Head6d471dac0fdadds amainmerge of release-evidence tooling only; nothing was rerun locally for it.