Skip to content

fix(update): name the next step for interrupted state restores - #188304

Merged
steipete merged 2 commits into
mainfrom
fix/update-repair-refusal-next-step
Oct 30, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/update-repair-refusal-next-step

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

When a .openclaw-restore-* directory sits beside the shared state database, every update command (update, update repair, rollback, finalize, unwind, and the rest) refuses with:

Interrupted shared-database publication is read-only while full-state recovery is deferred

That message names no directory and no action. openclaw update repair --yes exited 1 in text mode with nothing to try next, and JSON mode added only a generic Doctor hint, so the operator was stuck. This dead end was found in the wave-20 update/repair QA lane.

Why This Change Was Made

The refusal itself is correct and stays unchanged. An interrupted checkpoint restore moves the original database into .openclaw-restore-<id>-<n>/displaced, so that directory may hold the only copy of the operator's state, and OpenClaw has no automatic full-state recovery for this boundary yet. docs/reference/team-immutable-update-design.md records that generalizing it is gated on a storage design checkpoint. Changing recovery policy is out of scope here.

What was missing was the next step. assertUpdateRecoveryDirectoryAdmission (src/infra/update-run-recovery-admission.ts, from 000af98) now names the blocking directory, says it may hold the only copy of the original database, and links a new repair-and-recovery#interrupted-state-restore section. The message follows the same "preserve, then see docs" pattern as update-recovery-backup-status.ts. The docs give the supported path:

  1. Keep the directory.
  2. Stop the Gateway and copy the whole state directory.
  3. Restore a verified backup into a fresh directory with openclaw backup restore and activate it per Restore a full archive.
  4. Without a backup, get support with the refusal text and a directory listing.

Nothing suggests deleting or moving the family.

User Impact

Operators who hit this state now see which directory blocks updates, that it must be kept, and a documented way forward, instead of a bare refusal. Read-only behavior, exit codes, and recovery policy are unchanged.

Evidence

  • Live, built CLI against isolated HOME/OPENCLAW_STATE_DIR with a restore family beside the state DB: openclaw update repair --yes exits 1 and prints the new refusal with the exact path and docs link in both text and --json modes; the family directory is untouched.
  • src/cli/update-cli/update-command-run.test.ts "blocks admission when publication has no canonical DB" (displaced, replacement, both, unreadable) now asserts the path and docs anchor. All four cases fail on the previous message and pass after. update-command-run.test.ts 32/32, update-command-terminal-record.test.ts 26/26.
  • Docs anchors verified: #interrupted-state-restore matches the new heading; /install/backups#restore-a-full-archive and /help/support exist.
  • Production +3/−3 LOC (message and family lookup), tests +4/−2, docs +20.

Update commands refused an interrupted shared-database publication with text that named no next action. The refusal now names the blocking .openclaw-restore-* directory, says it may hold the only copy of the original database, and links a new repair-and-recovery section: keep the directory, copy the state directory, restore a verified backup into a fresh directory, or get support. Recovery policy and read-only behavior are unchanged.
@clawsweeper

clawsweeper Bot commented Oct 30, 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 labels Oct 30, 2026
@steipete
steipete marked this pull request as ready for review October 30, 2026 11:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T11:53:34.465106Z 39eb338 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) October 30, 2026 11:56
@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. 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. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR names the interrupted restore directory and links instructions for preserving state and recovering from a verified backup.

Example: An operator runs openclaw update repair --yes with /srv/openclaw/state/.openclaw-restore-example-0 present.

  • Before: The command refuses without identifying the directory or explaining the next step.
  • After: The refusal identifies that directory, warns that it may contain the original database, and links recovery instructions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The narrow implementation respects recovery ownership, but exact-head CI exposes incomplete consumer-test updates and the reported CLI run has no inspectable output.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored PR reports a built CLI exercising update repair in isolated state, with text and JSON refusals and unchanged restore artifacts; no terminal artifact accompanies that report, and no authority boundary changes.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An interrupted restore blocks update repair without naming the retained state directory or explaining a safe next action.
Reason: The maintainer-authored direction improves an existing error contract without changing recovery permissions, persistence, defaults, or automatic recovery policy.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR provides useful recovery guidance while preserving the intentional safety refusal, but its changed message breaks two existing consumer test groups.

Priority: P2
Reviewed head: 39eb338125d30bfc1e24ff1afec6166a83be9093

Before merge

  • Update the remaining consumers of the old refusal text (P2) - Replacing this message leaves update-repair-history.test.ts:138 and update-command-pending-recovery.test.ts:467 expecting "full-state recovery is deferred". Their retained-restore fixtures now receive the new refusal, causing checks-node-changed-10 and checks-node-changed-6 to fail on the reviewed head. Update both expectations to the new diagnostic contract while retaining their history, configuration, and retained-state preservation assertions.

Findings

  • [P2] Update the remaining consumers of the old refusal text — src/infra/update-run-recovery-admission.ts:35

Tests

  • Missing end-to-end proof: The body reports built-CLI text and JSON verification, but supplies no inspectable terminal output; the ordinary contributor proof gate does not apply to this maintainer-authored PR.
Agent review details

How this fits together

Update admission inspects the shared database directory before opening update state; interrupted restore artifacts produce a read-only refusal consumed by repair, finalization, rollback, and reporting paths.

flowchart TD
  A[Update or repair command] --> B[Recovery admission]
  B --> C[Inspect database directory]
  C --> D[Interrupted restore found]
  D --> E[Refusal with path and recovery link]
  C --> F[Continue existing admission]
Loading

Technical review

Best possible solution:

Keep the existing read-only admission owner and recovery guidance, and update both remaining consumer assertions to the new refusal contract.

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

Current-main source deterministically emits the unhelpful refusal when a matching restore entry exists; exact-head CI independently reproduces the stale consumer assertions after the message change.

Is this the best way to solve the issue?

Changing the existing refusal and documenting safe recovery is the smallest complete diagnostic fix; automatic restore recovery would expand the intentionally deferred storage contract.

Full review comments:

  • [P2] Update the remaining consumers of the old refusal text — src/infra/update-run-recovery-admission.ts:35
    Replacing this message leaves update-repair-history.test.ts:138 and update-command-pending-recovery.test.ts:467 expecting "full-state recovery is deferred". Their retained-restore fixtures now receive the new refusal, causing checks-node-changed-10 and checks-node-changed-6 to fail on the reviewed head. Update both expectations to the new diagnostic contract while retaining their history, configuration, and retained-state preservation assertions.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Interrupted shared-database recovery admission keeps the original intent (000af98: The original merged recovery PR intentionally preserves unsupported checkpoint records and refuses mutable updates while full-state replay remains deferred.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/cli/update-cli/update-repair-history.test.ts src/cli/update-cli/update-command-pending-recovery.test.ts
  • pnpm test src/cli/update-cli/update-command-run.test.ts src/infra/update-run-recovery-admission.test.ts
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 267d36e adds src/infra/update-run-recovery-admission.ts:26 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 267d36eea325; files: src/infra/update-run-recovery-admission.ts)
  • Jason (Json): Raw commit 0335033 adds src/infra/update-run-recovery-admission.ts:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0335033725e1; files: src/infra/update-run-recovery-admission.ts)

PR surface

Source 0, Tests +2, Docs +20. Total +22 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 3 0
Tests 1 4 2 +2
Docs 1 20 0 +20
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 27 5 +22

Labels

Label changes:

  • add P2: This is a focused diagnostic improvement for an exceptional recovery state, with a narrow repair needed for diff-caused CI failures.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a focused diagnostic improvement for an exceptional recovery state, with a narrow repair needed for diff-caused CI failures.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • 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 October 30, 2026, 8:07 AM ET / 12:07 UTC.

@steipete
steipete disabled auto-merge October 30, 2026 12:20
@steipete
steipete merged commit 74546e4 into main Oct 30, 2026
121 checks passed
@steipete
steipete deleted the fix/update-repair-refusal-next-step branch October 30, 2026 14:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…law#188304)

* fix(update): name the next step for interrupted state restores

Update commands refused an interrupted shared-database publication with text that named no next action. The refusal now names the blocking .openclaw-restore-* directory, says it may hold the only copy of the original database, and links a new repair-and-recovery section: keep the directory, copy the state directory, restore a verified backup into a fresh directory, or get support. Recovery policy and read-only behavior are unchanged.

* test(update): assert the interrupted restore refusal wording
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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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