Skip to content

fix(update): a failed shell completion or service definition refresh is never retried after an update - #200331

Merged
fuller-stack-dev merged 9 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-owed-steps
Nov 17, 2026
Merged

fuller-stack-dev merged 9 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-owed-steps

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

When an update succeeds but cannot refresh shell completion or the Gateway service definition, OpenClaw prints a warning at most and then forgets about it. Nothing records that the step is still outstanding, nothing retries it, and with --json a failed shell completion refresh is not reported at all.

This is the first slice of "owed steps": an update should finish and repair afterwards, instead of failing or forgetting a follow-up step the new version can run without.

User Impact

User impact: after an update that could not refresh shell completion or the service definition, openclaw update still exits 0, names the step as owed with its reason, and openclaw update status keeps showing it until a later openclaw update or openclaw update repair settles it.

  • openclaw update --json now carries the warning as an advisory step. openclaw update status --json and openclaw update repair --json list owedSteps.
  • An already-current openclaw update now refreshes shell completion when an earlier update owes it. It does not prompt. While that refresh keeps failing it can add up to the completion cache timeout (30 s) to the command.
  • Required database migrations, refused or invalid configuration, Doctor refusals and Gateway readiness still block. A failed or rolled-back update owes nothing.

No SQL schema, config, Gateway protocol, wire-schema or step-status change.

Why This Change Was Made

Contract. The update run ledger owns owed steps. An owed step is a finalize:owed:<id> row in the run's existing steps JSON: status skipped while owed, completed once it is settled, reason in detail (bounded to 500 characters and kept through compaction). The ids are a closed set, shell-completion and service-definition, defined with their label and retry hint in src/infra/update-run-owed-step.ts. The ledger exposes recordUpdateRunOwedStep, settleUpdateRunOwedStep and readOwedUpdateSteps, so no caller writes a step name. A row can be recorded and settled on a finished run that kept its result; the generic step writer still treats finished runs as immutable. The newest of the last 50 runs that mentions a step decides whether it is owed. Failed and rolled-back runs neither owe nor decide. A run that still owes a step an earlier run recorded writes its own row and leaves the earlier row unchanged, so the earlier run owes the step again if the later run fails. The next slice (plugin convergence, post-plugin Doctor) adds an id and registers its retry; the contract does not change.

Consumers. A failed shell completion refresh after a core update (cache write or profile install), and the two service definition paths where the update continues on the previous definition (installer failure, or the definition still outside the updated installation).

Retry.

Step Next openclaw update openclaw update repair
Shell completion Refreshes again, also when the core is already current. Settles when the cache refresh did not fail and the shell profile is not on the slow pattern. Settles on the same rule after its completion cache phase.
Service definition Settles only when this update's own service refresh succeeded. Otherwise the step stays owed and the warning repeats. Does not run the installer. After Doctor maintenance, settles on the updater's existing service verdict: the definition is owned and targets the active installation, or the service is proven absent.

A retry that fails or cannot run keeps the step owed, warns again and never fails the command. Gateway start does not retry owed steps.

Which process runs this. The installed updater runs first and cannot be patched. This table is read from source; no published-updater run was made.

Behaviour First update to a release with this change Following update
Record an owed step and retry earlier ones during openclaw update Installed updater, old code: nothing is recorded, as today. Exception: when the update migrated state so that only candidate code may finish it, the candidate process finishes the update and records. Installed updater, this code.
Hidden post-core update finalize child Candidate, this code: leaves completion and owed steps to its parent. Same.
openclaw update status and openclaw update repair after the update New CLI, this code. Same.

Published readers. Read from source at v2026.11.4, not proven by running a published build:

  • Its report and updateRunWarningMessages ignore a skipped finalize:owed:* row, so an older reader shows nothing for it.
  • Its codec keeps the row because of the finalize: prefix. If it rewrites a run that is over the byte budget it can drop the row's detail; this version then shows "no reason recorded".
  • Its Control UI step list shows the row under its raw name with status skipped and its reason.
  • The wire schema accepts the row: it uses only existing fields and statuses.

Tradeoffs and limits.

  • For an installer failure where the definition already targeted the installation, repair's check cannot prove the definition's content was rewritten. It relies on Doctor maintenance having run first. I read that call in src/commands/doctor-maintenance-restoration.ts but did not prove it runs in every repair.
  • After a manual openclaw gateway install --force, an already-current openclaw update keeps the service definition step owed until a core update refreshes the service or openclaw update repair rechecks it.
  • A repair that finds a healthy Gateway and skips finalization leaves owed steps unchanged.
  • update-command-post-update.ts was 710 lines on main, over the 700-line lint cap (advisory in CI, an error locally). Calling the retry on the already-current paths needed the service-skip block moved into the maintenance module, which also brings the file back under the cap.

Evidence

Before (base). Through the real openclaw update entry point with a private state database: an update whose shell profile install fails exits without error, and openclaw update status then shows no trace of the failure. Writing a settled owed row to a finished run through the existing step writer is silently dropped.

After (this branch).

  • The same update records the step; the update's own report and openclaw update status both print Shell completion refresh is owed: EACCES: permission denied. Retried by the next openclaw update; run openclaw update repair to retry it now.
  • openclaw update --json with a failing completion cache exits 0 with an advisory step, and openclaw update status --json lists the step in owedSteps. With a working cache the same update settles a step an earlier run owed.
  • A core update whose service installer fails records the service definition step; one whose installer succeeds settles an earlier one.
  • An already-current update settles an owed shell completion refresh, keeps it when the refresh fails again, keeps the service definition step it did not refresh, and exits 0 in both cases, with and without a running managed Gateway.
  • openclaw update repair settles both steps when the completion cache refreshes and the service targets the active installation. It keeps both, lists them as owedSteps in its JSON and warns on stderr, when the cache fails and the service targets another installation. Owed steps do not change the finalization status.
  • A step taken over by a later update that then fails is still owed by the earlier update. Before the second commit the later update settled the earlier row on takeover, and the step was dropped without a record when that update failed.
  • Negative control: an update whose Gateway stays unhealthy still fails with exit 1, settles nothing, and openclaw update status still shows the earlier owed step.
  • Ledger: record, list and settle on running, succeeded and skipped runs; nothing owed on a failed run, including a row recorded before it failed; other finished history stays immutable; the newest run decides; a step id from a newer release is still listed; the row and its reason survive step-count and byte compaction.
Commands, counts and commits

Head c2ead8e6692: the first commit 6b917db72ac (base 1139903ee16), a second commit 2f6b5b1cfbd, two commits that fix the CI failures described below, and main merged in (last at 24c8d1636de). The paragraphs below describe the first commit unless they say otherwise. The test runs below were made on the same change at base 827a749e2c6. 827a749e2c6..1139903ee16 touches release scripts, CI, unrelated docs and src/commands/triage-update.ts, none of which the update run ledger, the update finishing path or these tests read, so the runs were not repeated after the last two rebases. The ledger test file, format, lint and both ratchets were rerun at fd8d012d70c.

Red on base (production files restored to 9a6a00e3e2b, tests from this branch): 15 of 15 new or changed cases fail. One fails on behaviour (owes a shell completion refresh whose profile install fails, on the status assertion); the other 14 fail because the contract does not exist on base. The dropped write to a finished run was shown with a throwaway test that is not committed. With only the codec change reverted, the compaction case fails because the reason is lost.

Green:

  • node scripts/run-vitest.mjs src/infra/update-run-owed-step.test.ts src/cli/update-cli.test.ts src/cli/update-cli.already-current.test.ts src/cli/update-cli.finalizer.test.ts: 4 files, 75 tests passed. src/cli/update-cli.already-current.test.ts rerun after its last assertion was added: 21 passed.
  • Affected suites (ledger, compaction, report, record, update status, post-update, post-update repair, lifecycle, service, terminal outcome and authority, sentinel env, command runner, the already-current path, repair command): 20 files, 507 tests passed.
  • pnpm tsgo:all: exit 0.
  • node scripts/run-oxlint.mjs on the 16 changed source files: clean.
  • oxfmt --check on the 18 changed files and git diff --check: clean.
  • Test-lines ratchet: net +358 of 400. Mock-export ratchet: OK.
  • OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs: exit 0.
  • pnpm deadcode:exports fails on main-owned entries: 126 unused exports, none in a file this change touches.
  • Docs: pnpm format:docs:check, pnpm docs:check-mdx, pnpm docs:check-links (0 broken) and pnpm lint:docs on both pages pass. pnpm docs:check-links:anchors reports 3 broken fragments, none in the pages changed here.

Second commit (2f6b5b1cfbd):

  • CI on the first commit failed checks-fast-baseline-ratchets: the session identity ratchet, which reached main after this branch was cut, counts every runId comparison under src. The retry pass and openclaw update status compared update run ids in three places. They now group owed steps by the run that holds them and match the displayed run's steps by step id. node --import ./scripts/tsx.mjs scripts/check-session-identity-ratchet.mts --base origin/main --no-merge-base: OK.
  • New src/cli/update-cli/update-command-owed.test.ts: red against the first commit's update-command-owed.ts (expected [] to deeply equal [ { id: 'service-definition', … } ]), green on the head.
  • src/cli/update-cli.already-current.test.ts: the assertion that the earlier run's report stops saying owed after a takeover no longer matches the contract. It now checks that a settled step leaves the earlier report and a step still owed stays on it. 21 passed.
  • node scripts/run-vitest.mjs src/cli/update-cli/update-command-owed.test.ts src/infra/update-run-owed-step.test.ts src/cli/update-cli.test.ts src/cli/update-cli.finalizer.test.ts: all pass on the second commit's sources; with the already-current file, 5 files and 110 tests.
  • pnpm tsgo:all, oxfmt --check, node scripts/run-oxlint.mjs on the changed sources, the test-lines ratchet and OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs: pass. These ran before the last merge of main, which touches no update, ledger or ratchet file; only the session identity ratchet was rerun after it.

CI fixes after run 43996671701 on dc74b5e5bae (five red test files; each reproduced locally first):

  1. src/cli/update-finalization-output.process.test.ts, completion-hang: expected status: "ok", got "warning". Cause: this change made owed steps set the finalization status to warning. That status is the Doctor and plugin maintenance outcome: the test pins ok for a completion failure, and a parent updater reads the child's status as the plugin result. Fix: owed steps are reported in owedSteps and on stderr and no longer change status. The case now also asserts owedSteps lists shell-completion. Red before, green after (1 passed).
  2. test/scripts/update-restart-module-outcome.test.ts: Unexpected dependency call: ./update-command-owed.js:retryOwedUpdateSteps. Cause: the harness evaluates the real post-update modules and stubs everything else; the new module was not in its list. Fix: update-command-owed and update-run-owed-step run as real modules, and the harness ledger reports no earlier owed step. Red before, green after (19 of 19 inner cases).
  3. src/cli/update-cli.windows-lifecycle.test.ts: SpawnBrokerError … EEXIST: file already exists, mkdir '.'. Not caused by this change, and not fixed here. Locally the file fails the same 17 of 27 cases with this branch's production files restored to main. Cause on main: fix: keep native resource startup responsive on slow filesystems #200216 (775be7a709f) makes the broker child create dirname(endpoint); when a test mocks process.platform to win32, the parent passes a \\.\pipe\… endpoint to a POSIX child, whose dirname is .. The file passed 27 of 27 in the CI of fix(update): --no-restart update fails when the Gateway restarts itself during Doctor's stop #200181 (job 133541759038), which ran just before fix: keep native resource startup responsive on slow filesystems #200216 merged. main's own push CI skips the Node test shards, so it does not show this.
  4. src/cli/update-cli/update-command-post-update.test.ts, five runs deferred Doctor inspections after the restart … cases: an unexpected owed shell-completion advisory in the result. Cause: three earlier cases in the file fail completion on purpose and shared the worker's ledger with later cases. With the second commit a step stays owed until something settles it, so the later cases took it over. It did not show on the first commit, where a run that took a step over settled the earlier row; I did not trace which case ended that chain. Fix: the three cases that fail completion on purpose use their own ledger, and one of them now asserts the owed step. The completion failure in those cases is intended; no expectation was weakened. Red before (5 failed), green after (94 passed).
  5. test/scripts/eager-import-closure.test.ts: scripts/pr-lib/wrapper-components.txt did not list src/infra/update-run-owed-step.ts, which the codec imports. Fix: the module is added to the inventory. It is dependency-free apart from a helper the codec already imports, and keeping the import keeps the retention rule tied to the one owner of the row name. Red before, green after.

CI run 44014872215 on c2ead8e6692: 80 checks pass. The one failing test job, checks-node-changed-compact-large-4-1, fails only the 17 update-cli.windows-lifecycle.test.ts cases from item 3, and the openclaw/ci-gate aggregate fails with it. The jobs behind items 1, 2, 4 and 5 pass.

Every update test file under src/cli and src/infra whose name starts with update, plus the two script tests: 441 files listed, 439 run on 03796b070e9 (the two not run are a .live. and an .e2e. file the runner excludes). 5,986 tests passed. 38 failed in 9 files, none caused by this change:

  • update-cli.windows-lifecycle.test.ts (17): item 3 above.
  • update-command-database-rollback.test.ts (3) and update-doctor-migration-attribution.test.ts (2): 120 s timeouts while the machine was at load 38; both files pass alone (64 tests).
  • update-startup.campaign-apply-error.test.ts (8), update-startup-cached.test.ts (1), update-candidate-state.result.test.ts (2), update-command-rollback.test.ts (1), update-command-handoff.test.ts (3), update-command-node-engine-preflight.test.ts (1): each fails the same cases with this branch's production files restored to main. None of them failed in CI run 43996671701.

On 03796b070e9: pnpm tsgo:all exit 0; oxfmt --check on 22 changed files and node scripts/run-oxlint.mjs on 20 changed sources clean; OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 node scripts/check-changed.mjs exit 0. main was then merged twice more (it brought a dependency bump, #200366 in the package swap and spawn broker changes). After the first of those merges, on d21ced0d940: dependencies reinstalled; pnpm tsgo:all and check-changed exit 0 again; the five files above plus the owed-step, finalizer, already-current, terminal-outcome and update-cli.test.ts files rerun, 226 tests passed, and update-cli.windows-lifecycle.test.ts still fails the same 17. On the pushed head: test-lines ratchet +399 of 400, session identity ratchet OK, and the wrapper inventory case passes; the last merge touches no update file.

Test audit: every touched test file was read in full, including update-finalization-output.process.test.ts, update-command-post-update.test.ts and the update-restart-module-outcome.mjs harness in this round; nothing in them was dead or redundant, and nothing was removed. keeps update completion refresh best-effort when profile install fails was replaced by owes a shell completion refresh whose profile install fails, which keeps its two assertions and adds the report and status checks. uses the installed Git CLI when service env refresh cannot complete became a two-case test that also runs the success path, which had a fixture but no test. Nothing else was removed.

Not proven.

  • No published-updater × candidate update was run; the process table is from source.
  • src/cli/update-cli.windows-lifecycle.test.ts is red on main since fix: keep native resource startup responsive on slow filesystems #200216 and stays red here; see the CI notes above.
  • The second service producer (definition still outside the updated installation after a successful install) and the proven-absent settle in repair have no test.
  • A ledger read or write failure inside the retry pass is handled in code but not tested.
  • No live shell, launchd, systemd or Windows service was exercised; the service and completion commands are the suite's fixtures.
  • The autoreview helper cannot run on this machine. A fresh agent did an independent read-only review instead; its findings are resolved or listed above.

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: L labels Nov 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The PR records failed completion and service-definition refreshes in update history and retries or rechecks them during later updates and repairs.

Example: Shell-profile refresh fails with EACCES during an otherwise successful update.

  • Before: The update prints a warning, but later update status forgets the failure.
  • After: The update records shell-completion as owed and status displays its reason and retry guidance.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful direction and meaningful integration coverage, but incorrect settlement blocks correctness and the new update_runs.steps_json semantics lack published-release upgrade proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Successful updates can forget optional maintenance failures, leaving users without a persistent warning or reliable recovery path.
Reason: The maintainer-authored direction gives unfinished maintenance a visible, recoverable outcome without making optional work fail an otherwise successful update.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this maintainer-authored PR open: the maintenance recovery improvement is useful, but two paths can incorrectly clear outstanding work.

Priority: P2
Reviewed head: 6b917db72acd6f5a1bb3634433b92619bba266b5

Before merge

  • Preserve earlier debt until its replacement run succeeds (P2) - If a successful earlier run owes service-definition refresh, a later update whose installer fails records the debt on its still-running row and immediately completes the earlier row here. If Gateway verification then fails and the later run becomes failed or rolled-back, selectUpdateOwedSteps excludes that replacement row. Neither row now reports the still-unfinished refresh, and future retries forget it. Keep the earlier obligation intact until replacement ownership survives terminal settlement, or let the existing ledger terminal owner preserve it on failure.
  • Verify an owed profile installation before settling it (P2) - An interactive update can accept enabling completion and then fail installing the previously absent shell profile with EACCES, recording shell-completion as owed. A later already-current JSON update only refreshes the cache; repair also performs no interactive profile installation. The missing profile has usesSlowPattern=false, so this check returns undefined and settles the obligation although completion remains uninstalled. Distinguish cache debt from failed profile installation sufficiently to retain the latter until the profile exists, without enabling completion for users who never requested it.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Preserve earlier debt until its replacement run succeeds — src/cli/update-cli/update-command-owed.ts:48-49
  • [P2] Verify an owed profile installation before settling it — src/cli/update-cli/update-command-owed.ts:120-122

Tests

  • Missing end-to-end proof: Provide redacted installed-CLI output showing failed completion and service refreshes remaining visible and later settling, including an upgrade from v2026.11.4 with existing settings and history preserved.
Agent review details

How this fits together

The update CLI coordinates optional maintenance, stores its outcomes in the shared update-run ledger, and exposes outstanding work through update reports, status, and repair.

flowchart TD
  A[Update CLI] --> B[Completion and service maintenance]
  B --> C[Update run ledger]
  C --> D[Owed step selection]
  D --> E[Status and reports]
  D --> F[Later update or repair]
  F --> C
Loading

Technical review

Best possible solution:

Keep the existing ledger owner, preserve earlier debt through unsuccessful replacement runs, and settle shell-profile debt only when the requested profile installation is present.

Do we have a high-confidence way to reproduce the issue?

Current-main source drops completion-refresh failures after reporting them, and the introduced source exposes both incorrect-settlement paths; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Reusing existing update steps is appropriate, and the added modules have distinct shared responsibilities, but settlement must reflect completed maintenance rather than replacement bookkeeping or cache success alone.

Full review comments:

  • [P2] Preserve earlier debt until its replacement run succeeds — src/cli/update-cli/update-command-owed.ts:48-49
    If a successful earlier run owes service-definition refresh, a later update whose installer fails records the debt on its still-running row and immediately completes the earlier row here. If Gateway verification then fails and the later run becomes failed or rolled-back, selectUpdateOwedSteps excludes that replacement row. Neither row now reports the still-unfinished refresh, and future retries forget it. Keep the earlier obligation intact until replacement ownership survives terminal settlement, or let the existing ledger terminal owner preserve it on failure.
    Confidence: 0.99
  • [P2] Verify an owed profile installation before settling it — src/cli/update-cli/update-command-owed.ts:120-122
    An interactive update can accept enabling completion and then fail installing the previously absent shell profile with EACCES, recording shell-completion as owed. A later already-current JSON update only refreshes the cache; repair also performs no interactive profile installation. The missing profile has usesSlowPattern=false, so this check returns undefined and settles the obligation although completion remains uninstalled. Distinguish cache debt from failed profile installation sufficiently to retain the latter until the profile exists, without enabling completion for users who never requested it.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 687dc6c99a32.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • node scripts/run-vitest.mjs src/infra/update-run-owed-step.test.ts src/cli/update-cli.test.ts src/cli/update-cli.already-current.test.ts src/cli/update-cli.finalizer.test.ts
  • pnpm tsgo:all
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 56689a9 adds src/cli/update-cli/update-command-service.ts:509 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 56689a9fd666; files: src/cli/update-cli/update-command-service.ts)
  • Jason (Json): Raw commit 97c7b35 adds src/cli/update-cli/update-command-post-update-maintenance.ts:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 97c7b3593392; files: src/cli/update-cli/update-command-post-update-maintenance.ts)
  • Finn763: Raw commit b607355 adds src/cli/update-cli/update-command-service.ts:108 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: b6073553b799; files: src/cli/update-cli/update-command-service.ts)

PR surface

Source +437, Tests +358, Docs +54. Total +849 across 18 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 11 485 48 +437
Tests 5 365 7 +358
Docs 2 54 0 +54
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 904 55 +849

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Optional update maintenance can remain unfinished while its durable warning disappears; core update readiness remains separately enforced.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 16, 2026, 8:02 PM ET / November 17, 2026, 01:02 UTC.

A run that still owes a step now records its own row and leaves the earlier
run's row unchanged. The newest run that kept its result decides, so the
earlier run owes the step again if the later run fails or rolls back. Before,
the later run settled the earlier row when it took the step over, and a
failure after that dropped the step without a record.

The retry pass and `update status` group and match owed steps by key instead
of comparing update run ids.
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

CI failure attribution for #200331

  • Prepared head: c2ead8e
  • CI run 44014872215, attempt 1 (completed, conclusion failure)
  • Tested merge: 6a94efa = merge of the head into main f27bc24
  • Operator instruction (Jason, maintainer, 2026-11-16): "close the adoption gap first ..., then proceed with the rest", with standing direction to land the update-plan PRs on the reviewer's recommendation. The run is not green; the one failure is attributed below as inherited from main.

One test job failed, plus the gate: 62 jobs passed and 25 were skipped.

Job 133811016490, checks-node-changed-compact-large-4-1

src/cli/update-cli.windows-lifecycle.test.ts failed 17 of 27 cases. Every failure is
SpawnBrokerError: Spawn broker failed before readiness: EEXIST: file already exists, mkdir '.'
(task sqliteSnapshotStaging.task) or an assertion that received that error. No other test file
failed in the job. The gate's table classes the job "unknown" (no matching job on main), so it was
investigated:

  • node scripts/run-vitest.mjs src/cli/update-cli.windows-lifecycle.test.ts on unmodified main
    f27bc24, the main parent of the tested merge: 17 failed, 10 passed.
  • The same command on the tested merge 6a94efa: 17 failed, 10 passed.
  • The 17 case names are identical in the CI job, on main and on the tested merge
    (ci-failed-cases.txt, base-f27bc24-windows-lifecycle.cases.txt,
    merge-6a94efa-windows-lifecycle.cases.txt).
  • The test file, src/process/spawn-broker/ and packages/worker-runtime/ are identical on
    main and in the tested merge (source-paths-diff.txt is empty). This PR changes 23 files under
    docs/cli/update, scripts/pr-lib, scripts/tests, src/cli and src/infra, none of them
    in the spawn broker.
  • Cause on main: fix: keep native resource startup responsive on slow filesystems #200216 (775be7a) moved creation of the private socket directory into the
    broker child, which derives the directory from the endpoint using its own platform. These tests
    set the parent's process.platform to win32, so the parent selects a named-pipe endpoint and
    the POSIX child takes dirname of it, gets ., and mkdir fails. The file passed 27 of 27 in
    the CI of fix(update): --no-restart update fails when the Gateway restarts itself during Doctor's stop #200181 (job 133541759038) before fix: keep native resource startup responsive on slow filesystems #200216 merged. Main's push CI does not run the
    Node test shards, so main shows green.

It is attributed as a failure that exists on main independently of this change. The job was not
rerun. A separate fix for the spawn broker regression is in progress.

Scoped checks on the tested merge

  • src/infra/update-run-owed-step.test.ts, src/cli/update-cli/update-command-owed.test.ts,
    src/cli/update-cli.finalizer.test.ts, src/cli/update-finalization-output.process.test.ts,
    test/scripts/update-restart-module-outcome.test.ts, test/scripts/eager-import-closure.test.ts:
    6 files in 4 shards, all passed (scoped-owed-6a94efa.log).
  • The four CI jobs that failed on earlier heads for reasons caused by this PR pass in run
    44014872215.

@fuller-stack-dev
fuller-stack-dev merged commit 89924a8 into openclaw:main Nov 17, 2026
157 of 160 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 17, 2026
Upstream openclaw#200331's mockCompletionCacheRefresh matched argv[2]. The fork
forwards the parent's reviewed V8 flags to OpenClaw-owned Node children, so
under Node (CI) the command sits after them and the fixture missed it.
Use the fork's flag-tolerant isCliCommand, as the other update fixtures do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
…is never retried after an update (openclaw#200331)

* fix(update): a failed shell completion or service definition refresh is never retried after an update

* fix(update): keep a step owed when the update that took it over fails

A run that still owes a step now records its own row and leaves the earlier
run's row unchanged. The newest run that kept its result decides, so the
earlier run owes the step again if the later run fails or rolls back. Before,
the later run settled the earlier row when it took the step over, and a
failure after that dropped the step without a record.

The retry pass and `update status` group and match owed steps by key instead
of comparing update run ids.

* fix(update): report owed steps without changing the finalization status

* test(update): keep deliberately owed completion steps out of the shared ledger
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…is never retried after an update (#200331)

* fix(update): a failed shell completion or service definition refresh is never retried after an update

* fix(update): keep a step owed when the update that took it over fails

A run that still owes a step now records its own row and leaves the earlier
run's row unchanged. The newest run that kept its result decides, so the
earlier run owes the step again if the later run fails or rolls back. Before,
the later run settled the earlier row when it took the step over, and a
failure after that dropped the step without a record.

The retry pass and `update status` group and match owed steps by key instead
of comparing update run ids.

* fix(update): report owed steps without changing the finalization status

* test(update): keep deliberately owed completion steps out of the shared ledger

(cherry picked from commit 89924a8)

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 10f65fb6bddfad042a845bbe88fdb26cd3e91b5f)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…whole update back (#200507)

* fix(update): a plugin convergence failure rolls back an update that could keep its result

After a core update, plugin convergence that throws before publishing any record or config, or an updater failure around a started post-plugin Doctor, no longer rolls the package back. The update keeps its result, records the step as owed with its reason, exits 0, and the next update or repair retries it. Config refusals, Doctor refusals, unsettled package state, lost authority and Gateway readiness still fail the update.

* fix(update): owe plugin convergence only when its rollback restores the previous plugin set

Review follow-up. Plugin convergence is owed only when a plugin cohort deferred every package and record change, the pass carries no channel config that only this update can restore, and publication has not started. Already-current updates and repair commit installs plugin by plugin, so they keep failing as before. A plugin phase that ends in error owes nothing.

* test(update): prove blocking convergence failures still fail with a healthy cohort

Review follow-up. Adds rows for a refused config write, a revoked requester and an unsettled child, makes the no-cohort row replace a package for real, and corrects the docs on what the first update from an older updater does.

* docs(update): say the owed Doctor pass starts after plugin convergence

* fix(update): a plugin phase deferred by a config conflict settles no owed plugin step

* docs(update): a config-conflict deferral settles no owed plugin step

(cherry picked from commit c48b829)

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 c7e8a882e3e1503b3091ef079730d881462c10e2)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
`openclaw update repair` prepared uncertain-handoff recovery in the default per-user lease store, while package settlement then entered the lease store pinned by the package activation journal. When that journal pinned an existing historical store (such as the legacy /tmp/openclaw store) holding a stale uncertain triage lease, ordinary admission refused with "Another update executor owns this installation", so repair could never settle. Repair now reads the journal through the same reader settlement uses, runs its existing recovery checks against the pinned store, and reuses the admitted claim for settlement. Recovery checks and ordinary admission are unchanged; without a pinned store, repair behaves as before.

Fixes #200508
Reported-by: @garrietv

Co-authored-by: steipete <[email protected]>
(cherry picked from commit ae31ea3)

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 8d8ace39e6d59c2017d197ac460dc4d489c95a84)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…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)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…s stop (#200569)

During a Control UI update, the candidate Doctor admits its SQLite capture before stopping the supervised predecessor Gateway. The predecessor's graceful shutdown releases its gateway-owner lease in state/openclaw.sqlite, so the predecessor stop receipt then refused with "source changed after update capture". The whole update was reported as failed even though the new version served.

Writes made between capture admission and the receipt owner's exclusive maintenance custody now follow the existing initial-staleness policy: one warning, Doctor continues from current state, and automatic restoration of the stale backup stays permanently disabled. Changes made under custody or after the receipt are still refused.

Accepted edge case: a foreign write during the pre-custody stop interval also continues forward, with rollback disabled.

Fixes #198072
Fixes #200022
Reported-by: @zzs12345-web, @damzaru, @Lifaguang

Co-authored-by: steipete <[email protected]>
(cherry picked from commit 3447bee)

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 79efce43c9d1b2e3e4ee0e0781d360238a89a293)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
… be removed (#200579)

Switching a Git checkout to a package install removes the `openclaw` wrapper the installer wrote for the checkout. When that removal failed and no Gateway restart had been verified (`--no-restart`, or no Gateway service), the update exited 1, rolled the package back and reported that recovery could not prove a runnable installation. With a verified restart the same failure was already a warning.

The package install is now kept in both cases, with one warning that names the path. A wrapper owned by a system package still fails the update and rolls the package back, and an update that lost its authority still stops before it removes the wrapper.

The warning is not an owed step. Update history has no field for the wrapper path, so no later command could prove the wrapper is gone.

Update behavior: this step runs in the updater that started the update, so a switch started by an already installed version behaves as before. The change applies to switches started by a version that contains it.

(cherry picked from commit 176f2ff)

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 32f16217a1c4935ed90d5910d56afe9b204ba39a)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…taged package (#200595)

Candidate Doctor checked dependency targets imported by the private rehearsal copy of user-installed plugins only against that private copy. On Windows npm-global installs, the private host links resolve into the staged candidate package, so its own nested node_modules/typebox was rejected as "outside the temporary update copy" and every update rolled back.

Dependency targets imported from the private copy may now resolve into the canonical staged candidate package as well. Plugin entries and repair writes stay private-only. Candidate-sourced references keep main's unchecked scope. Targets in the serving installation or user directories are still rejected.

Fixes #200573
Reported-by: @desksk

Co-authored-by: steipete <[email protected]>
(cherry picked from commit dab086c)

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 4f2b2ed830c31eb7b6647bfbb3b3f197b52f62ec)
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 19, 2026
Carried to the pure candidate (stage 2) from the chain. Upstream
openclaw#200331's mockCompletionCacheRefresh, now merged, matched argv[2]. The
pure candidate carries #1546, which forwards the parent's reviewed V8
flags to OpenClaw-owned Node children, so under Node the command sits
after them and the fixture missed it. Use the fork's flag-tolerant
isCliCommand, as the other update fixtures do.

Under Node 24.21.0 at f8ee3d2: 3 of 74 red across update-cli,
update-cli.already-current and update-cli.finalizer (the owed
completion-refresh advisory missing). With the carry: 74 of 74.

Refs openclaw#129388

(cherry picked from commit bb4098e)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant