Skip to content

fix(update): preserve recovery receipts across progress updates - #156298

Merged
fuller-stack-dev merged 92 commits into
mainfrom
openclaw/durable-update-recovery-receipts-20260923
Sep 23, 2026
Merged

fuller-stack-dev merged 92 commits into
mainfrom
openclaw/durable-update-recovery-receipts-20260923

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Related: #144005 and #145169

What Problem This Solves

Fixes recovery receipts being discarded or altered when a later update-ledger mutation rewrites a run, while preventing private recovery details from leaking through public update history and JSON output.

User Impact

Existing recovery evidence remains intact across ledger updates and reopen. Public status/history and final CLI JSON retain their existing wire contract without exposing private capture receipts. Malformed or oversized operational receipts refuse before replacing the stored row; no database migration or operator action is required.

This is only the durable-receipt persistence and private/public projection predecessor. It does not implement capture production, newer-data generation, restoration, installed update acceptance, or completion of the original Atomic update program.

Why This Change Was Made

The ledger now validates and preserves typed operational receipts separately from expendable, redacted diagnostics within the existing 16 KiB origin budget. A shared pure projection removes private receipts at all affected public presentation boundaries without changing the retained record.

This narrow extraction (ten product/test files plus one required wrapper-inventory entry) preserves the original source ancestry and credits Peter Steinberger's capture design from #144005. The remaining generation/capture/restore outcomes stay with their dedicated existing owners, including #145169.

Evidence

  • 76 distinct affected cases passed on the exact source: receipt persistence/refusal/reopen (12), existing ledger integration (27), gateway status/history (15), and CLI progress/JSON (22).

  • Both new public-consumer regressions failed with a deliberate raw-export control and passed with projection. Tests cover retained row equality, malformed and oversized refusal, zero/one-byte remaining budgets, and the closed public wire schema.

  • Complete audits and independent API review covered production, every test/helper/setup/teardown in all three touched test files, and the source-resolution/private-helper setup boundary. No actionable P0–P2 findings remained; no old tests were removed, skipped, or weakened.

  • Physical SQLite-open instrumentation verified task-private handoff and state/coordinator paths across actual parent/helper processes. No live Gateway or live update store was used.

  • Affected native TypeScript, formatting, and lint passed. Hosted CI 35835138214 passed on 748ef9efdf132b24c0c5729d52be8fcd112719dc (137 successful jobs, 17 skipped). The local dependency graph was not full lockfile qualification; the hosted run supplies that check.

  • Recorded wall time: receipt file 2.77 s; both full consumer files 14.84 s. The new gateway case took 3.568 s to exercise the real ledger/reader-worker and drain path; the CLI presentation case took 0 ms. CI timing will be recorded when available.

  • CI repair: the extracted-wrapper test exposed a missing source-inventory entry for the new receipt schema. Added that single entry without changing any product/test source or assertion. The production extraction, pinned dependency materializer, and full runtime-import closure failed before the fix and passed afterward (4.50 s red / 6.54 s green; 1,363 resolved files, zero SQLite opens). Independent API review found no actionable P0–P2 defects in the repair. The repaired-head CI run above passed, including the previously failing wrapper check; exact-head ClawSweeper review also found no actionable findings.

Reconcile pending markers against terminal update outcomes and retain unresolved sets after their owners exit. Restore declared database inventories while leaving live SQLite sidecars under the online restore owner, and expose recovery guidance in update status.
Reconcile pending markers against terminal update outcomes and retain unresolved sets after their owners exit. Restore declared database inventories while leaving live SQLite sidecars under the online restore owner, and expose recovery guidance in update status.
Jason Sy added 4 commits September 22, 2026 23:40
Extract receipt schemas and codec from the retained atomic-update capture design.
Preserve operational evidence without exposing it in public status/CLI exports.
Original capture design: afaf382.
Shared receipt contract observed sha256 6b96f176c84bc36be59ed0d836cdd26b8f97a885108d842a3571fd28c3e6b383.
@clawsweeper

clawsweeper Bot commented Sep 23, 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.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 23, 2026 07:16
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: L labels Sep 23, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 4:22 AM ET / 08:22 UTC (Revision 2).

ClawSweeper review

What this changes

Preserves private update recovery receipts across ledger writes and removes them from public status, history, and final CLI JSON output.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded prerequisite absent from current main. No introduced correctness or security defect was found, and the wrapper-inventory repair preserves the previously reviewed product code.

Priority: P2
Reviewed head: 748ef9efdf132b24c0c5729d52be8fcd112719dc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful storage and projection regressions and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Reported SQLite persistence/reopen and Gateway/CLI boundary checks match the changed owners; inspected optional-field compatibility and existing-row regressions support no migration for this leaf. Full installed capture/restore acceptance is not claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Reported SQLite persistence/reopen and Gateway/CLI boundary checks match the changed owners; inspected optional-field compatibility and existing-row regressions support no migration for this leaf. Full installed capture/restore acceptance is not claimed.
Evidence reviewed 8 items Pinned introduction and review continuity: Reviewed the merge-base-to-head delta. Comparing the earlier reviewed head with this head shows only the required recovery-schema entry in the wrapper inventory; product and test files are unchanged.
Receipt preservation and bounded writes: The codec separates operational receipts from redacted diagnostics, validates receipts, and preserves their exact values within the existing 16 KiB origin budget. The existing writer encodes before executing the row update, so validation and size refusals precede replacement.
Public projection and security boundary: The shared projection removes the private receipt without mutating the retained record. Gateway status, get—including committed drain—and list use it, as do CLI status and final JSON. Watcher events already select only public progress fields. The patch adds no recovery execution or authorization consumer.
Findings None None.
Security None None.

How this fits together

The update ledger stores progress and recovery information from update processes in SQLite. Gateway history requests and CLI reports read that ledger through public projections.

flowchart TD
  A[Update progress and recovery receipts] --> B[Validate and bound ledger data]
  B --> C[Private SQLite update ledger]
  C --> D[Internal recovery readers]
  C --> E[Remove private receipts]
  E --> F[Gateway status and history]
  E --> G[CLI JSON output]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +143, Tests +396, Other +1. Total +540 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 158 15 +143
Tests 3 396 0 +396
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 11 555 15 +540

Review metrics

Metric Value Why it matters
Production versus test growth Production +143; tests +396; tooling +1 net lines Production growth chiefly defines the typed receipt contract; the added tests protect persistence, refusal, and public-output boundaries.

Stored data model

Persistent data-model change detected: database schema: src/infra/update-recovery-receipt-schema.ts, migration/backfill/repair: src/infra/update-recovery-receipt-schema.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep receipt persistence in the existing ledger and public filtering in one shared projection, while leaving capture and restoration execution with their separate owners.

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

Yes, at the storage boundary: seed a valid receipt in origin_json and mutate unrelated progress; current main's schema drops the unrecognized receipt. This was source-verified, not executed during review.

Is this the best way to solve the issue?

Yes. Extending the existing codec and using one public projection addresses the loss and exposure paths without a parallel store or public protocol expansion.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded update-ledger reliability improvement without evidence of a currently widespread user outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Reported SQLite persistence/reopen and Gateway/CLI boundary checks match the changed owners; inspected optional-field compatibility and existing-row regressions support no migration for this leaf. Full installed capture/restore acceptance is not claimed.

Evidence

What I checked:

  • Pinned introduction and review continuity: Reviewed the merge-base-to-head delta. Comparing the earlier reviewed head with this head shows only the required recovery-schema entry in the wrapper inventory; product and test files are unchanged. (scripts/pr-lib/wrapper-components.txt:802, 748ef9efdf13)
  • Receipt preservation and bounded writes: The codec separates operational receipts from redacted diagnostics, validates receipts, and preserves their exact values within the existing 16 KiB origin budget. The existing writer encodes before executing the row update, so validation and size refusals precede replacement. (src/infra/update-run-codec.ts:103, 748ef9efdf13)
  • Public projection and security boundary: The shared projection removes the private receipt without mutating the retained record. Gateway status, get—including committed drain—and list use it, as do CLI status and final JSON. Watcher events already select only public progress fields. The patch adds no recovery execution or authorization consumer. (src/infra/update-run-record.ts:100, 748ef9efdf13)
  • Existing-state compatibility: The private receipt is optional within the existing origin_json column; SQL layout, schema version, and public wire schema remain unchanged. Inspected regressions cover ordinary receipt-free records, an already-stored receipt surviving unrelated mutation, SQLite reopen, exact receipt equality, and unchanged rows after malformed or oversized writes. The PR reports these checks passed; this read-only review did not execute tests. (src/infra/update-run-capture-receipts.test.ts:115, 748ef9efdf13)
  • Current main still lacks the change: Fetched main retains the prior codec, which reserves exact bytes only for driver identities. The affected production files have no intervening changes between the pinned merge base and fetched main; the receipt preservation is still unique to this branch. (src/infra/update-run-codec.ts:103, 01457af6876f)
  • Latest-release check: The v2026.9.5 ledger schema also lacks updateRecoveryCapture, so the latest supplied release does not contain this implementation. (src/infra/update-run-schema.ts, ec9c1a13db89)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-23T07:24:03.213Z sha 3b48a01 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 23, 2026
@fuller-stack-dev
fuller-stack-dev enabled auto-merge (squash) September 23, 2026 08:41
@fuller-stack-dev
fuller-stack-dev merged commit 44b5df1 into main Sep 23, 2026
220 of 221 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/durable-update-recovery-receipts-20260923 branch September 23, 2026 08:52
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

fuller-stack-dev added a commit that referenced this pull request Sep 23, 2026
Integrate the read-only status consumer extracted from original #145169 source f6feb6b, retaining Peter Steinberger capture design provenance from #144005 (afaf382). Compose landed receipt schema #156298, retain the corrected parser import, validate durable identity even with terminal outcomes, and include the shared driver schema in native wrapper materialization.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…claw#156298)

* fix(update): restore pre-migration state during rollback

* fix(update): preserve recovery admission and import boundaries

* fix(update): preserve recovery sets and restore directory state

Reconcile pending markers against terminal update outcomes and retain unresolved sets after their owners exit. Restore declared database inventories while leaving live SQLite sidecars under the online restore owner, and expose recovery guidance in update status.

* fix(update): retain transaction-scoped recovery captures

* fixup! fix(update): restore pre-migration state during rollback

* fix(update): clear copied process leases after state restoration

* fix(update): protect finalization and settle recovery owners

* fix(update): align recovery handoff and lifecycle proof

* test(update): assert native rollback supervisor stops

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fix(update): restore pre-migration state during rollback

* fix(update): preserve recovery admission and import boundaries

* fix(update): preserve recovery sets and restore directory state

Reconcile pending markers against terminal update outcomes and retain unresolved sets after their owners exit. Restore declared database inventories while leaving live SQLite sidecars under the online restore owner, and expose recovery guidance in update status.

* fix(update): retain transaction-scoped recovery captures

* fixup! fix(update): restore pre-migration state during rollback

* fix(update): clear copied process leases after state restoration

* fix(update): protect finalization and settle recovery owners

* fix(update): align recovery handoff and lifecycle proof

* test(update): assert native rollback supervisor stops

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fixup! fix(update): align recovery handoff and lifecycle proof

* fix: preserve newer state before update rollback

* test: declare recovery fixture authority receiver

* fix(update): defer migrated recovery terminal publication

* fix(update): clear recovery claims after failed settlement

* fix(test): load finalization fixture stubs from files

* fix(update): preserve finalizer failure through recovery settlement

* wip: parked capture-series working tree (2026-09-12)

* fix(update): stop capture retirement when executor ownership ends

Pass the filesystem owner current authority at every final removal effect.
Prove revocation preserves the next artifact with real executor leases.
Remove unused integration exports and keep bridge tests on public inputs.

* style(update): align integrated recovery code with lint rules

* fix(update): carry recovery authority through current config owners

* test(update): preserve fixture and recovery schema ownership

* refactor(config): retain guard and test ownership within CI limits

* fix(update): preserve recovery through published-driver and terminal boundaries

* test(update): bind deferred completion to private current runtime

* test(update): declare runtime prerequisites and preserve terminal recovery

* fix(update): preserve captures through legacy Doctor finalization

* fix(update): reuse capture after migrated driver adoption

* fix(update): protect managed cutover and settle legacy capture retirement

* fix(state): use worker-thread loader for source lease heartbeats

* fix(update): retain restoration failures and align process fixtures

* test(sqlite): align worker custody and snapshot cleanup fixtures

* fix(state): preserve lease renewal through transient contention

Integrate the reviewed allocation prerequisite and align update transport, cutover, and executable Windows cleanup fixtures with their current owners.

* fix(update): complete retained package transaction only once

Reconcile the child-owned package-completion correction qualified in combined candidate c0640f4f. Keep early failure retention before service recovery and skip duplicate terminal completion. Preserve original child/predecessor ancestry; SQLite predecessor corrections remain with their existing owner.

* fix(update): keep caller-owned SQLite snapshots private

Reconcile the openclaw#144005 b425cc predecessor against immutable c064 correction:
retain earlier live-owner admission, bypass single-flight only for explicit
worker staging, and keep staging out of the asynchronous-token API.

The three e93/openclaw#145169 process-cleanup branding hunks remain child-owned;
context-adjusted composition reconstructs c064 SQLite exactly. Pinned backup
generation unchanged. Source-only; no standalone landing or runtime claim.

* fix(update): refuse restored-field collisions during no-loss preparation

Retain candidate-owned Workshop fields rather than overwriting acknowledged
facts with baseline attribution. Add three collision regressions and pin
test-private coordinator and state selectors. Native SQLite leaf regression:
three collision failures before, five controls pass after. Full exported
preparation and installed/native qualification remain separate gates.

* fix(state): refuse Workshop row identity shadowing during recovery

* test(state): keep recovery lifecycle coordinators task-private

* fix(state): remove owned migration scratch after authority loss

* fix(update): include recovery receipt schema in wrapper extracts

---------

Co-authored-by: Peter Steinberger <[email protected]>
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L 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.

2 participants