Skip to content

fix(update): failed updates that never activated keep their capture forever - #185223

Merged
fuller-stack-dev merged 2 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-never-activated-capture
Oct 27, 2026
Merged

fuller-stack-dev merged 2 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-never-activated-capture

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Related: #185178

What Problem This Solves

Fixes: a failed openclaw update that stopped before activation keeps its original-state capture forever. update cleanup reports it as protected / unresolved-failed-update, although the installation and state never changed. On one large installation, two such failures left 22 GB captures each while the Gateway kept serving the previous version.

User Impact

User impact: when an update fails before repair or activation, it now retires its own capture as soon as the failure is recorded. Captures left by earlier failures of this kind become candidate / never-activated-update-capture, so openclaw update cleanup removes them without waiting for a later successful update. openclaw update status reports these sets as stale and points to cleanup instead of manual recovery. Failures that reached repair or activation keep their capture as the manual recovery source, as before.

Why This Change Was Made

The capture only matters when the update could have changed something. The ledger already records each phase the update enters, and those phase receipts are required history. One predicate decides that a failed run never activated. The run must have its admission receipt and its own original-state-capture receipt, no repairing/activating/restarting/verifying phase, no repair attempt, no data-at-risk or rollback outcome, and no Doctor config writes. Only the update command takes that capture, and in that flow activating is recorded before the service stop or any install or state mutation. Runs that never took a capture (finalize, repair, Gateway-driven children) never qualify, and a capture receipt lost to history compaction keeps the capture protected. Cleanup classification, the failed run's terminal step, and update status all use that predicate.

The failed run reuses the existing automatic recovery cleanup, with the same state-owner custody, Gateway routing, and revalidation that successful updates already use. The only relaxation is the guard that keeps the triggering run's own capture, and it applies only to such a run. Other artifacts keep their existing eligibility rules. A run without these receipts, such as older or synthetic history, is never treated as unchanged.

Evidence

  • Red on origin/main f25249704a8b: with only the new tests applied, update cleanup classifies a failed staging/validating run's capture as protected / unresolved-failed-update (4 failing cases across current and pre-migration locations). The failed run's terminal leaves its capture in place. Separately, with only the status change reverted, update status reports the set as unresolved.
  • Green: update-command-capture-cleanup.test.ts 6/6, update-automatic-cleanup.test.ts 15/15, status.recovery.test.ts 16/16. Negative controls: a failure with an activating receipt, one with a repair attempt before activation, and one without a capture receipt all stay protected/unresolved, and an earlier successful update's capture is not superseded by the failure. Removing only the capture-receipt requirement makes the last control fail (4 cases).
  • Fixture change: the existing "protected failed capture" fixtures previously finished a run straight from requested. Under this rule that is a never-activated failure, so they now record staging/validating/activating to keep covering an activated failure.
  • Checks: pnpm tsgo:core, pnpm tsgo:core:test, oxlint, oxfmt. The 25 related files pass (385 tests): terminal outcome/record/publication/triage/authority/unreported, failure recovery, run, recovery, cleanup recovery, execution validation, activation, already-current, the ledger and recovery suites, update-repair triage, the Doctor fleet preflight, the eager-import closure, and the upgrade-survivor no-op suite.
  • Existing data: no stored schema changes. Every update_runs row from a real installation's ledger (87 runs written by released 2026.10.x builds) decodes with this branch. Exactly 2 qualify as never-activated: the two failed git updates that stopped at updater-runtime-retention while validating. None of the 6 activated failures, the 24 failed runs without a capture receipt, or the 55 succeeded/skipped runs qualify.
  • Harness: scripts/tests/update-restart-module-outcome.mjs stubs the new failedBeforeActivation call with false, since its cases all fail after the swap (e51ff2d). Without the stub it fails with CI's error; with it, it passes.
  • Review: independent Codex autoreview (P0–P2) was scoped-clean. It couldn't see the unchanged update paths, so I checked mutation ordering by hand. The immutable path creates no update run. Migrated finalization runs after activation. In update-command-execution.ts, everything before recordPhase("activating") only inspects, validates candidate copies, takes backups, or retains the runtime, and the service stop and mutationStarted come after that receipt. The 32 commits main gained during this work include fix(update): enter maintenance before repairing source artifacts #180356 (update finalize maintenance ordering), which doesn't affect this flow.

🤖 Generated with Claude Code

…orever

A failed update that stopped before repair or activation left its
original-state capture protected as unresolved-failed-update, although the
installation and state never changed.

isNeverActivatedFailedUpdate proves this from required ledger phase
receipts. Cleanup classifies such captures as never-activated-update-capture
candidates, the failed run's terminal runs the existing automatic recovery
cleanup (releasing only its own capture guard), and update status reports
leftover sets as stale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 27, 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 commands Command implementations size: M labels Oct 27, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Retire captures from failed updates whose recorded history establishes that repair and activation never began.

Example: A git update fails during validating at updater-runtime-retention, leaving a 22 GB capture.

  • Before: Cleanup protects the capture as unresolved-failed-update indefinitely.
  • After: The failed update attempts automatic retirement, and manual cleanup can remove any remaining never-activated-update-capture.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused implementation with meaningful integration controls and released-data compatibility evidence; the changed behavior has no supplied shipped-entry-point demonstration.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied evidence covers production-path integration tests and decoding released ledger rows, rather than a shipped-CLI failure run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Failed updates that never changed the installation leave large captures that supported cleanup refuses to reclaim.
Reason: The maintainer-authored direction addresses observed disk accumulation using existing receipts and cleanup owners without adding configuration or storage formats.

Merge readiness

✅ Ready for maintainer review

This PR addresses a current capture-retention bug with a focused shared predicate. The prior restart-harness finding is fixed, and no new actionable defect was found; current-head CI remains pending.

Priority: P2
Reviewed head: e51ff2dcf83d87caf371ec9bdfc5662e0343401b

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied shipped-CLI run demonstrates automatic retirement after a real pre-activation failure; reported red/green integration tests and released-row decoding cover the underlying classification and terminal path.
Agent review details

How this fits together

The updater records lifecycle receipts in its ledger; cleanup and status consume those receipts to classify captures, while the existing state owner controls deletion.

flowchart TD
  A[Update execution] --> B[Ledger receipts]
  B --> C[Never activated predicate]
  C --> D[Terminal cleanup]
  C --> E[Manual cleanup inventory]
  C --> F[Recovery status]
  D --> G[State owner retirement]
  E --> G
Loading

Technical review

Best possible solution:

Use one conservative ledger predicate across automatic cleanup, manual classification, and status while preserving existing retirement custody.

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

Current-main classification directly protects a sealed failed capture even when its receipts stop at validation; the PR reports matching released runs and red-on-base integration cases, but this review executed no target code.

Is this the best way to solve the issue?

The change is focused: it shares one decision across the affected consumers, reuses existing cleanup machinery, and retains captures when mutation or incomplete history prevents a safe conclusion.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Failed-capture eligibility changes intended behavior with a stated reason (4f1158a: Protect unresolved failed captures as manual recovery sources until restoration or forward repair.)
  • Automatic retirement and terminal bookkeeping changes intended behavior with a stated reason (fb9e117: Retire eligible superseded recovery after durable success and executor settlement without changing the update outcome.)
  • Recovery status guidance changes intended behavior with a stated reason (fix(update): inspect retained recovery sets safely #156366: Expose unresolved recovery sets safely; later guidance directs unresolved failures to their retained manifests for manual inspection.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit fb9e117 adds src/commands/update-automatic-cleanup.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fb9e117745a7; files: src/commands/update-automatic-cleanup.ts)
  • Ayaan Zaidi: Raw commit 4f1158a adds src/commands/update-capture-cleanup.ts:53 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4f1158a559a3; files: src/commands/update-capture-cleanup.ts)

PR surface

Source +69, Tests +118, Docs +9. Total +196 across 14 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 84 15 +69
Tests 4 133 15 +118
Docs 2 13 4 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 230 34 +196

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Pre-activation failures can retain large recovery copies indefinitely, creating avoidable disk pressure without breaking the currently serving installation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Demonstrate a real pre-activation update failure through the shipped CLI, showing its capture removed while activated-failure recovery remains retained.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-27T00:20:17.093Z sha 2e35602 :: blocked before merge. :: [P2] Update the restart-outcome harness for the new failure predicate

Reviewed October 26, 2026, 8:32 PM ET / October 27, 2026, 00:32 UTC (Revision 2).

The terminal now asks whether a failed run never activated before running
its own recovery cleanup. Every case in this harness fails after the swap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 27, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Both items are addressed.

  • [P2] Restart-outcome harness: fixed in e51ff2d, after the reviewed head. scripts/tests/update-restart-module-outcome.mjs now supplies failedBeforeActivation: () => false, since every case in that harness fails after the swap. Its package-backup and original-failure assertions are unchanged. Locally, test/scripts/update-restart-module-outcome.test.ts fails with the same Unexpected dependency call: ./automatic-cleanup.js:failedBeforeActivation without the stub and passes with it.
  • Data-model compatibility: this PR changes no stored schema; it only reads existing update_runs rows. As proof I exported every row from a real installation's ledger, 87 runs written by released 2026.10.x builds, and decoded each one with this branch's decodeRun and isNeverActivatedFailedUpdate:
    • 87/87 decode, 0 failures;
    • exactly 2 qualify as never-activated. These are the two failed git updates that stopped at updater-runtime-retention in the validating phase (steps requested, original-state-capture, staging, validating, …, gateway recovery observation): the failures that motivated this PR;
    • the 6 failed runs that reached a repairing/activating/restarting/verifying phase do not qualify;
    • the 24 failed runs without an original-state-capture receipt (Gateway-driven or finalize runs) do not qualify;
    • none of the 30 succeeded or 25 skipped runs qualify.

The remaining CI failure, checks-node-changed-compact-small-35, is the inherited main failure in update-command-candidate-authority.process.test.ts (healthy, doctor-owner-replaced), tracked in #185090.

@clawsweeper re-review

🤖 Addressed by Claude Code

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@fuller-stack-dev
fuller-stack-dev merged commit a9c4f63 into openclaw:main Oct 27, 2026
161 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/update-never-activated-capture branch October 27, 2026 15:26
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…orever (openclaw#185223)

* fix(update): failed updates that never activated keep their capture forever

A failed update that stopped before repair or activation left its
original-state capture protected as unresolved-failed-update, although the
installation and state never changed.

isNeverActivatedFailedUpdate proves this from required ledger phase
receipts. Cleanup classifies such captures as never-activated-update-capture
candidates, the failed run's terminal runs the existing automatic recovery
cleanup (releasing only its own capture guard), and update status reports
leftover sets as stale.

* test(update): stub never-activated check in the restart outcome harness

The terminal now asks whether a failed run never activated before running
its own recovery cleanup. Every case in this harness fails after the swap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant