Skip to content

fix(update): unsealed original capture warning names the affected database - #169282

Merged
RomneyDa merged 2 commits into
openclaw:mainfrom
DonnieFi:docs/update-capture-diagnostics-plan
Oct 12, 2026
Merged

RomneyDa merged 2 commits into
openclaw:mainfrom
DonnieFi:docs/update-capture-diagnostics-plan

Conversation

@DonnieFi

@DonnieFi DonnieFi commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #169259

What Problem This Solves

Fixes: when an update's original-state capture cannot seal, the warning says only "Original database generation changed or could not be verified; capture is unsealed." It does not say which database failed or why.

User Impact

User impact: the existing Original state capture is unavailable warning now names each affected database, says whether it changed after its snapshot or never had a stable generation, and includes the backup step's own warning for that database (for example the SQLite error). Sealing safeguards, retained incomplete evidence, and best-effort update continuation are unchanged.

Update behavior: this code runs in the updater (driver) process, so the clearer warning appears once the installed updater contains it. Updates driven by 2026.10.5-beta.1 or earlier keep the old wording. No config, schema, or state changes.

Why This Change Was Made

The backup owner already records database-specific reasons, but the capture owner threw one combined error and returned those reasons only after a successful seal. The capture owner now builds one line per unverified database and appends only the backup warnings that mention those databases, inside the same exception the CLI already redacts (state dir and home) and caps at 1,000 characters. Per-database lines come first so they survive truncation.

A database generation is a hash of the file, so any write by the running Gateway during capture (a cron tick, for example) legitimately unseals it. That is documented active-writer behavior; this PR does not change it. The recovery docs now say what the warning contains.

Evidence

  • src/infra/update-database-backup.test.ts drives the real capture boundary with real SQLite:
    • The existing "database changes after its snapshot" test now asserts the exact per-database message.
    • A new test strips the source generation, emits the same warnings the real backup step produces plus an unrelated disk-space warning, and asserts the exact message (unrelated warning filtered). It also checks that no manifest.json is published and payloads are retained.
  • Fails before the fix: both tests fail against the original update-recovery-baseline-capture.ts.
  • Passes after: full file 20/20. node scripts/run-vitest.mjs src/infra/update-database-backup.test.ts --maxWorkers=1 took 89 s wall on a heavily loaded host. The new test takes about 3.8 to 4.9 s, the same as its existing sibling, because it runs a real capture; no cheaper layer covers the no-manifest and payload-retention boundary.
  • pnpm tsgo:core and the infra core-test typecheck graph pass. node scripts/check-changed.mjs: all ratchets, core typecheck, and 25 core test graphs passed before my local timeout stopped the last three UI graphs, which this change cannot affect.
  • An independent read-only review found no bugs. I applied its warning-filter and test-fidelity findings. I left two of its nits: Doctor's standalone log of this message is unredacted (local only, and the success path already logs the same paths), and created or removed databases are labeled "generation changed after its snapshot", which is still true.

Gaps:

Maintainer verification

Re-verified at head 93eacaf4d36 against origin/main 112c4900cf3 (merge-tree clean; main still emits the old bare warning, as does release/2026.10.5):

  • pnpm test src/infra/update-database-backup.test.ts --maxWorkers=1: 20/20 passed, 82 s wall (71 s Vitest) on a loaded host.
  • Fail-before: with src/infra/update-recovery-baseline-capture.ts restored to the merge base, both changed tests fail (-t "unsealed capture|names the database": 2 failed).
  • oxfmt --check and oxlint on the touched files: clean.
  • Autoreview (Codex, branch mode, P0–P2): scoped-clean, no findings.

Remaining gap, accepted for this diagnostic-only change: no installed published-driver × candidate update cell. The change only alters the text of an existing best-effort warning raised by the updater process; sealing conditions, retained evidence, and update continuation are unchanged and covered by the real-SQLite capture tests above.

Post-merge real update proof: updater with this fix × candidate, and published updater × candidate

Added after merge by the author. It fills the published-driver × candidate gap noted above; no code changed.

This fix runs in the updater, so the "after" run installs this branch's package as the updater. I ran the repository's published-driver Docker cell (scripts/e2e/published-driver-update-docker.sh) locally, using a local copy of its harness with three changes. The copy can install the updater from a tgz, relabel the candidate to a higher version (2026.10.1), and run a side process during the update. The side process creates a session and calls chat.inject through the serving Gateway about once a second for the first 90 s. That covers the original-state capture with real Gateway writes, the active-writer case from the docs. Everything else is the stock cell: managed Gateway through the systemd shim, synthetic durable and incognito sessions, openclaw update --tag <candidate.tgz> --yes --json, then run-record, readyz, version, and session checks.

The candidate in both runs is this branch (93eacaf4d36).

Before, with the published 2026.10.1 updater (stderr of openclaw update):

Warning: Original state capture is unavailable: Original update capture failed; evidence retained at $OPENCLAW_STATE_DIR.update-captures/9a94f03e-92e7-43b5-b422-2c8c46178f03 | Original database generation changed or could not be verified; capture is unsealed.

The published updater named no database, and this warning did not appear in the recorded run's steps.

After, with this branch as the updater (recorded run step warning:original-state-capture:1):

Original state capture is unavailable: Original update capture failed; evidence retained at $OPENCLAW_STATE_DIR.update-captures/ad2aaeeb-64a7-4649-aac7-ab625e5280b0 | Original database generation changed or could not be verified; capture is unsealed. | $OPENCLAW_STATE_DIR/agents/main/agent/openclaw-agent.sqlite: generation changed after its snapshot.

Both runs: 82 to 90 successful chat.inject calls during the window, then the update continued to status: "ok". The recorded run is finished / succeeded, readyz returns 200, the running version is verified, the managed service PID was replaced, durable session history is intact, incognito content is gone, and the seeded credentials sidecar is byte-identical. The incomplete capture was retained at the named path, as before.

PASS published 2026.9.9 → candidate 2026.10.1 (93eacaf4d362d96341785dfa68f57f58d179a069): finished, readyz=200, running version verified
PASS published 2026.10.1 → candidate 2026.10.1 (93eacaf4d362d96341785dfa68f57f58d179a069): finished, readyz=200, running version verified

("published 2026.9.9" is the cell's label for the updater version; that updater is this branch's package.)

@clawsweeper

clawsweeper Bot commented Oct 11, 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.

@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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR adds database names, verification categories, and relevant backup warnings to unsealed original-state capture diagnostics.

Example: The Gateway writes to /home/alex/.openclaw/state/openclaw.sqlite after its original snapshot.

  • Before: The warning reports only that the original database generation changed or could not be verified.
  • After: The warning also identifies $OPENCLAW_STATE_DIR/state/openclaw.sqlite and says its generation changed after the snapshot.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct and has useful capture-boundary regression coverage, but supplied tests do not satisfy this external PR's shipped-behavior proof gate; source inspection verifies that persisted formats and sealing decisions are unchanged.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An incomplete original-state capture warning does not identify the failing database or explain its verification failure.
Reason: The reporter explicitly narrowed the request to diagnostics, and this focused patch exposes reasons already produced by the backup owner without changing recovery policy.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR repairs a confirmed diagnostic gap still present on current main, preserves capture safeguards, and has maintainer engagement; no introduced correctness defect was found.

Priority: P2
Reviewed head: 93eacaf4d362d96341785dfa68f57f58d179a069

Before merge

  • Add real behavior proof - The supplied real-SQLite capture tests exercise the changed owner, including a later write and injected unavailable-generation evidence, but no after-fix installed CLI output or logs demonstrate its warning consumer. Provide redacted terminal output or logs showing database identification, verification reasons, retained incomplete payloads, and best-effort continuation, plus the repository-required published-driver × candidate cell; distinguish unchanged legacy-driver wording and redact IPs, API keys, phone numbers, and non-public endpoints. The PR body's acceptance statement supplies no runtime evidence or proof override. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Findings

None.

Tests

  • Missing end-to-end proof: No installed CLI scenario demonstrates the changed failure diagnostics, redaction, retained unsealed payloads, and continuation; the body reports both regressions failing before and passing after the fix.
Agent review details

How this fits together

The installed updater's capture owner consumes database snapshots and generation observations, then either publishes a sealed recovery manifest or retains incomplete payloads and sends a warning through the existing CLI diagnostic consumer.

flowchart TD
A[Installed updater] --> B[Original capture owner]
B --> C[Database backup owner]
C --> D[Snapshots and generation observations]
D --> B
B --> E[Sealed manifest or retained payloads]
B --> F[Redacted CLI warning]
Loading

Technical review

Best possible solution:

Keep the diagnostic repair in the existing capture owner while preserving sealing checks, incomplete evidence, and best-effort update continuation.

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

Current-main source shows database-specific backup warnings are lost when sealing throws the generic exception; the linked report observes that warning on an official beta, and no target code was executed during this review.

Is this the best way to solve the issue?

Changing the exception at the capture owner addresses the established diagnostic loss without weakening generation checks or inventing another recovery path.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Original-state capture sealing and failure diagnostics keeps the original intent (e47d0ce: Preserve original state before direct updates and Doctor repairs as manual recovery evidence, retaining incomplete captures without blocking ordinary updates.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e47d0ce adds src/infra/update-recovery-baseline-capture.ts:435 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e47d0ce424bc; files: src/infra/update-recovery-baseline-capture.ts)
  • Jason (Json): Raw commit d417b52 adds src/infra/update-recovery-baseline-capture.ts:157 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: d417b5202305; files: src/infra/update-recovery-baseline-capture.ts)

PR surface

Source +7, Tests +39, Docs +3. Total +49 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 15 8 +7
Tests 1 40 1 +39
Docs 1 4 1 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 59 10 +49

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #169259
Summary: This PR implements the diagnostic repair requested by the paired report, whose follow-up explicitly leaves false generation rejection unproven.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The diagnostic gap impedes investigation of incomplete recovery captures, but the reported update succeeded and no data loss or rollback failure is established.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Supply the installed CLI failure-path evidence described in realBehaviorProof.

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 (3 earlier review cycles)
  • reviewed 2026-10-11T18:58:35.133Z sha 4a75148 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T00:42:10.541Z sha 93eacaf :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T00:48:51.298Z sha 93eacaf :: needs real behavior proof before merge. :: none

Reviewed October 11, 2026, 10:07 PM ET / October 12, 2026, 02:07 UTC (Revision 4).

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S and removed size: XS labels Oct 12, 2026
@DonnieFi DonnieFi changed the title docs: plan actionable update capture failure diagnostics fix(update): unsealed original capture warning names the affected database Oct 12, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review October 12, 2026 02:00
@RomneyDa

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa merged commit 82c903c into openclaw:main Oct 12, 2026
214 of 217 checks passed
@RomneyDa

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…abase (openclaw#169282)

* docs: plan actionable update capture failure diagnostics

* fix(update): name databases that leave the original capture unsealed

Closes openclaw#169259
RomneyDa pushed a commit that referenced this pull request Oct 12, 2026
…abase (#169282)

* docs: plan actionable update capture failure diagnostics

* fix(update): name databases that leave the original capture unsealed

Closes #169259

(cherry picked from commit 82c903c)
RomneyDa pushed a commit that referenced this pull request Oct 13, 2026
…abase (#169282)

* docs: plan actionable update capture failure diagnostics

* fix(update): name databases that leave the original capture unsealed

Closes #169259

(cherry picked from commit 82c903c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Beta update original-state capture fails with an unsealed database generation

2 participants