Skip to content

fix(update): original-state capture warning hides its cause and says to retry an update that continues - #170396

Closed
RomneyDa wants to merge 1 commit into
mainfrom
fix/170332-capture-diagnostics
Closed

RomneyDa wants to merge 1 commit into
mainfrom
fix/170332-capture-diagnostics

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Closes #170332

What Problem This Solves

Fixes: when the pre-update original-state capture cannot seal (for example, the running Gateway writes during capture), the warning hid the cause behind [redacted-diagnostic], named the wrong phase and path ("shared database discovery … scope: 1 source paths"), and told the operator to "retry the update" while the update continued and succeeded.

User Impact

User impact: the warning now says the update continues without the original capture, that an active writer such as the running Gateway is an expected cause, and that database rollback uses the pre-migration snapshots taken after the Gateway stops. It names the step that failed ("database generation verification") and the database paths it checked. Capture stays best effort with no retry; update flow, exit codes, and rollback are unchanged.

Why This Change Was Made

  • The inspection worker labeled every non-version mode as shared database discovery with a hard-coded state database path; each mode now has its own label and reports its real inputs.
  • "SQLite file generation changed while reading" / "did not stabilize" are fixed phrases with no private data, so they join the closed set of public causes (paths stay out of the public summary).
  • The storage/retry advice is kept for restore and Doctor checks, and dropped only for the best-effort original capture.

Product decision: no bounded retry was added. A Gateway writing continuously would rarely seal a capture, and continuing is the documented contract.

Update behavior: the installed CLI composes this warning before staging, so the new text appears for updates driven from a release containing it.

Evidence

  • src/infra/update-candidate-state.schema.test.ts: a real database-generations worker with a preload that writes between its two reads reproduces the issue's exact message before the fix; after, it reports the right phase and paths. 9/9, 34s wall.
  • src/cli/update-cli/update-command-fresh-preview.test.ts: full updateCommand with the capture rejected; asserts the recorded and printed continue-warning. Failed before. 32/33, 218s wall. The one failure ("Doctor sees an already-current update's completed history after original-state capture") times out at 120s on this host with the change reverted as well.
  • src/logging/diagnostic-support-redaction.test.ts: 57/57, 5s. Adjacent update-candidate-state.diagnostics.test.ts and update-database-backup.test.ts (23/23) pass.
  • Lint, tsgo:core, tsgo:core:test, oxfmt, git diff --check clean.

Label isolated database generation verification by its own phase and
actual source paths, promote fixed SQLite concurrent-write causes to
the public summary, and drop retry guidance from best-effort capture
failures. The update warning now says it continues without the
original-state capture and that pre-migration snapshots remain the
database rollback point.

Fixes #170332
@clawsweeper

clawsweeper Bot commented Oct 12, 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: S labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reports accurate capture phases, source paths, and SQLite causes while explaining that the update continues without the optional original-state capture.

Example: A running Gateway changes state/openclaw.sqlite during an update's original-state capture.

  • Before: The warning reports shared database discovery, hides the public cause, and advises retrying while the update continues.
  • After: The warning identifies database generation verification, preserves the fixed SQLite cause, and explains best-effort continuation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused diagnostic repair with no identified defect; confidence is supported by source inspection and reported harness results rather than installed-update evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor-proof gate; supplied evidence exercises the generation worker and CLI warning through tests, with no post-change installed-update trace.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A successful update tells the operator to retry while obscuring why its optional original-state capture failed.
Reason: The maintainer-authored PR explicitly retains best-effort continuation and corrects its misleading diagnostics without adding configuration or changing recovery policy.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs misleading update diagnostics still present on main; no actionable correctness or security defect was found.

Priority: P3
Reviewed head: a7c36ee7a9600ffb4a2a115d6223c01af208ce49

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied CLI test reaches an already-current no-op; it does not demonstrate an installed update continuing after a real capture failure.
Agent review details

How this fits together

The installed update CLI captures original state through isolated database workers, then turns capture failures into bounded warnings printed to stderr and recorded in update history.

flowchart TD
  A[Installed update CLI] --> B[Original state capture]
  B --> C[Database backup and generation workers]
  C --> D[Inspection diagnostics]
  D --> E[Bounded CLI warning and history]
  E --> F[Continue update]
Loading

Technical review

Best possible solution:

Use the existing diagnostic owners to explain optional-capture failure accurately while preserving continuation and required migration safeguards.

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

The reported beta transcript and current-main warning, worker-phase, and redaction paths establish the diagnostic defect; no target code or tests were executed during this read-only review.

Is this the best way to solve the issue?

Changing diagnostic composition at its existing owners is preferable to rewriting error strings afterward, and the maintainer-authored decision preserves the established best-effort policy.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Original-state capture continuation keeps the original intent (e47d0ce: Retain originals before direct updates while allowing optional capture failures to remain warnings.)
  • Worker phase, source scope, and retry guidance changes intended behavior with a stated reason (feb2c81: Identify failing sources and phases and provide recovery guidance; this PR explains why retry advice must be omitted for callers that continue.)
  • Signal-specific diagnostics keeps the original intent (058de57: Distinguish worker termination from storage failures; the patch retains the signal explanation.)
  • Closed public diagnostic causes keeps the original intent (f3b6fec: Preserve recognized causes while excluding private paths and arbitrary prose; the added SQLite alternatives remain fixed phrases.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit d417b52 adds src/infra/update-database-backup.ts:347 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-database-backup.ts)

PR surface

Source +34, Tests +116, Docs +6. Total +156 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 45 11 +34
Tests 3 116 0 +116
Docs 1 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 168 12 +156

Review metrics

Metric Value Why it matters
Production versus test changes Production +45/-11 lines; tests +116/-0 lines. Production growth carries diagnostic context through existing owners; tests cover worker diagnostics, CLI warning persistence, and public redaction as distinct contracts.

Root-cause cluster

Relationship: same_root_cause
Canonical: #170332
Summary: This PR addresses the reported diagnostic contradiction more fully than the overlapping draft, which rewrites the final warning text.

Members:

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

Labels

Label changes:

  • add P3: The reported update succeeds; this change corrects confusing recovery guidance without changing update execution.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: The reported update succeeds; this change corrects confusing recovery guidance without changing update execution.
  • 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.

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 12, 2026, 7:49 PM ET / 23:49 UTC.

@RomneyDa

Copy link
Copy Markdown
Member Author

Closing in favor of #170380 (DonnieFi), which now carries this fix on top of its branch.

@RomneyDa RomneyDa closed this Oct 13, 2026
@RomneyDa
RomneyDa deleted the fix/170332-capture-diagnostics branch October 13, 2026 01:56
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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.

[Bug]: beta update continues after the live state database changes during original-state capture

1 participant