Repository navigation
fix(update): preserve original state before direct updates - #161044
Conversation
Retain manual recovery evidence before direct update initialization and Doctor state relocation, and carry the original reference through delegated Doctor calls. Reuse the existing capture format, maintenance custody and configuration reader, while deferring debug persistence until admission. Distinguish manual and incomplete captures, and report restoration only from evidence bound to the same manifest. Published legacy and inherited updaters retain their existing limits; this does not add automatic restore. Co-authored-by: Jason (Json) <[email protected]>
Keep fresh original-state capture out of self-contained recovery helpers, which consume retained evidence. Preserve the normal CLI and Doctor capture checks and forwarded references while integrating the landed history repair. Co-authored-by: Jason (Json) <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 29, 2026, 12:07 PM ET / 16:07 UTC (Revision 12). ClawSweeper reviewWhat this changesDirect updates and standalone Doctor repairs retain original configuration, SQLite databases, and declared resources, then report capture status and deferred HTTP tracing through the CLI. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: current main lacks the direct original-state capture path, and this branch has evidence of the intended update behavior. One confirmed recovery-status guidance defect remains before merge. Priority: P1 Review scores
Verification
How this fits togetherThe installed updater and Doctor receive the selected installation, configuration, and state directories. They retain recovery evidence before repair or update work, record the outcome, and present it through update status. flowchart LR
A[Direct update or Doctor repair] --> B[Maintenance admission]
B --> C[Original state capture]
C --> D[Private manifest and payloads]
B --> E[Update or repair]
D --> F[Run ledger and status]
E --> F
F --> G[Manual recovery guidance]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +1433, Tests +1114, Docs +36, Other +1. Total +2584 across 63 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the private capture and existing recovery owner, and give unresolved sets a safe manual path to preserve current state and inspect the retained manifest and payloads. Do we have a high-confidence way to reproduce the issue? Yes. On this PR head, a failed run with one sealed unresolved capture deterministically emits the same status command as its next action; the existing test asserts that value. This read-only review did not execute the test. Is this the best way to solve the issue? No. The capture boundary is appropriate, but unresolved recovery status needs safe inspection guidance rather than a command that repeats the same output. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 42700f9d92dc. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
|
The revision-3 visibility concern is addressed in Maintainer disposition: retain the documented updater-parent tracing limitation with that visible notice. The earlier proposal to resume immediately after a snapshot remains rejected: additive update-ledger admission permits legacy schemas and does not establish current-schema admission for debug-store writes. Doctor retains responsibility for resuming capture only after maintenance readiness succeeds and schema publication is not deferred. A separate Doctor process cannot release the parent's asynchronous scope. The original findings and their distinct dispositions remain visible. The tracing concern is resolved; current CI's separate history/refusal and session-retirement failures remain under repair and are not waived by this decision. |
Preserve the real SQLite contention and history assertions by supplying package-manager ownership in the existing fixture mock. Clarify why updater debug persistence remains deferred until Doctor has admitted the schema.
Carry preflight diagnostics through original-state capture and ledger admission, and retain structured capacity details when admission refuses. Use the existing database inventory for legacy path-only registrations without inventing ownership. Report configured updater tracing suppression through the existing warning path. Integrate current main's publication and predecessor-cleanup contracts, and align the affected CLI fixtures with the actual admission boundary. Co-authored-by: Jason (Json) <[email protected]>
Capture originals before admitting refused updates to history. Preserve managed installation context and structured pending diagnostics without finalizing an uncertain run. Keep JSON refusals and ledger-only repair consistent with the recorded outcome.
Tell operators to preserve current state, inspect the retained manifest, and consult the manual recovery guide instead of repeating update status. Extend the existing status regression without changing classification or recovery behavior. Follow-up to #161044.
…161044) * fix(update): preserve original state before direct updates Retain manual recovery evidence before direct update initialization and Doctor state relocation, and carry the original reference through delegated Doctor calls. Reuse the existing capture format, maintenance custody and configuration reader, while deferring debug persistence until admission. Distinguish manual and incomplete captures, and report restoration only from evidence bound to the same manifest. Published legacy and inherited updaters retain their existing limits; this does not add automatic restore. Co-authored-by: Jason (Json) <[email protected]> * test(update): admit contention fixture as an npm install Preserve the real SQLite contention and history assertions by supplying package-manager ownership in the existing fixture mock. Clarify why updater debug persistence remains deferred until Doctor has admitted the schema. * fix(tooling): include debug deferral in PR wrappers * fix(update): preserve early refusal history and diagnostics Capture originals before admitting refused updates to history. Preserve managed installation context and structured pending diagnostics without finalizing an uncertain run. Keep JSON refusals and ledger-only repair consistent with the recorded outcome. * refactor(update): isolate initialization admission types * fix(update): report tracing deferral during dry runs Warn on stderr when the selected update environment enables HTTP capture, while preserving tracing deferral and machine-readable JSON output. Extend the existing preview controls and align the capacity refusal assertion with the recorded failed-run contract. --------- Co-authored-by: Jason (Json) <[email protected]>
Tell operators to preserve current state, inspect the retained manifest, and consult the manual recovery guide instead of repeating update status. Extend the existing status regression without changing classification or recovery behavior. Follow-up to openclaw#161044.
Related: #144005 and #145169; both remain open. Follow-up to merged #160614, whose changes are excluded from this PR.
What Problem This Solves
Direct updates and Doctor repairs can change configuration or relocate state before retaining the originals needed to investigate a failed upgrade. Taking that capture before normal update admission must also preserve existing refusal history and diagnostics.
User Impact
The installed CLI attempts to retain original configuration/includes, SQLite databases, and declared plugin/Workshop resources before direct update initialization or standalone Doctor repair. Doctor continuations preserve the original reference across relocation. Update status distinguishes manual and incomplete captures and requires matching restoration evidence before reporting an original capture restored.
Early refusals retain their history, structured failure facts, and correct managed-installation context. If pre-admission ownership cannot be released, the command reports a pending error without writing the ledger. Configured updater-local HTTP tracing stays deferred. Fresh updates and dry runs report that deferral; dry-run notices go to stderr so JSON output remains parseable. Doctor may enable its own capture after schema readiness.
Captures are manual recovery evidence, not an atomic snapshot across active stores or an automatic legacy/full-state rollback. Capture failures can remain warnings. Older installed updaters and inherited update paths retain their stated limitations.
Why This Change Was Made
Reuse the existing v2 manifest, raw database backup, inventory, executor, maintenance, and update-ledger owners. Capture does not invent ownership for legacy registry entries, and delayed admission does not discard preflight diagnostics. No new restoration controller or tracing owner is introduced.
Thanks to Jason (Json), @fuller-stack-dev, for the original recovery work.
Follow-up #161292 landed as
f70c61dba0c1fa82b75fe46609cd2fcba345bd0e, resolving the remaining status-guidance finding. Unresolved captures now name the retained manifest, ask operators to preserve current state, and link the existing manual recovery documentation. This finding concerned guidance; no data, recovery, or authority defect was identified. The follow-up records its focused proof and the independently attributed pre-existing CI fixture failures.Evidence
The published refusal repair at
1904ffc8543f4b840e37b8808944bc7ce0535abepassed 171/171 tests across six full files in 387.724 s, with no filtered cases, and fresh independent P2 review was scoped-clean. Earlier complete selected checks passed in 778.396 s; the later delta separately passed production/CLI types, scoped lint, line-cap, assertion-safety, and whitespace checks in 86.664 s. These separate receipts are not presented as one final full-check run. The successordd1f009d230ca437e734c91af592a02e8390c053moves only the shared admission type: both cycle checks, core/CLI types and scoped lint passed in 81.018 s, with fresh scoped-clean review. Exact hashes bind those three checked files to the published successor; runtime statements are unchanged.Causal tests exposed missing refusal history, the redirected capture's wrong installation root, and incorrect repair classification of nonmutating capture diagnostics before the owning fixes. The fresh installed metadata-refusal cell passed on that source (run). The unmodified installed CLI returned the expected exit 1 with
target-registry-metadata; status exited 0 and identified the same finished, failed run with no active update. The sealed capture retained the exact prior history row, while live history contained that unchanged row plus one new failed row. Original configuration, resource bytes and raw application/plugin rows remained exact; no candidate or Doctor update steps ran. The refusal took 13.194 s, status 4.455 s, and the full package/proof wrapper 803.192 s. Independent raw audits verified the package, manifest and all five payloads. The capture listing remained ambiguous because setup Doctor had also retained a manual capture; no restoration was claimed.The executed package was built from
1904ffc8543f4b840e37b8808944bc7ce0535abe, SHA-256fe6005a71cd4c2e9aec05ce1023007fedf1966078923ab47c4fc9019d380e11a. This is applicable runtime evidence for the type-onlydd1f009dsuccessor, not a package execution of that later head. The final notice correction adds dry-run stderr output; applicability of this installed proof is limited to the unchanged mutation, refusal, and upgrade paths. The new dry-run behavior has separate owner-test evidence below. Its lease is stopped.The prior
1904ffc8CI was cancelled after its Madge type-import cycle failure; that cycle is now repaired. The previous-head CI run fordd1f009dwas cancelled after a queued-registration test failure. The affected group recorded 58 failed tests and 34 unhandled errors, including a missing mocked read-context export. The first failure was the unchanged queued-registration fixture omittingcaptureOpenClawStateReadContext. All 11 relevant source inputs match the tested main baseline, and a separate main-only reproduction established the same defect. The fixture-only repair is on main at9e4f20185d77a9ac3e054a4ed22f21f9ed490cc1; it independently passed 62/62 cases and its 30-file, 515-case group. Those results are not a rerun of this PR’s 29-file Linux job, and the 77 cancelled jobs are not passing coverage. That exact-head failure evidence is retained, but it is not a CI exception for the newe00db124commit. Current-head CI run, attempt 1 fore00db124, was cancelled after one failure inconfig-model-validation.runtime.test.ts: preparing the uncataloged fixture provider reachedShared-state admission requires the host broker. Its CLI group recorded 2,029 passed, 1 failed, 23 skipped across 103 files in 187.61 s. The run has 40 successful, 101 cancelled, 17 skipped, and 2 failed jobs, including the downstream aggregate. Compared with the tested main baseline, the failing test and production inputs are unchanged. Independent source/routing inspection attributes the failure to main’s async-metadata migration in #161201, which omitted this test from the host-broker inventory. This PR’s two unrelated inventory additions do not change its membership. The canonical fixture repair is on main at313f6211d406aeda2b8b1108883713e1e5f97d5e. Native verification of the exact pre-existing failure and live authority/security/review gates passed; the 101 cancelled jobs remain unrun coverage. The native workflow retired the auto-merge request and merged the same reviewed head as e47d0ce4 through the explicitly authorized pre-existing CI exception. Failed and cancelled CI remains recorded as such; no current-head CI success is claimed. The separate earlier session-retirement main regression was fixed by28885d3f8745f51e39ecb54389283dc391c15381.The final notice correction is published at
e00db124b77c4266c35a9b487279d2278c51bb3c. The regression first failed both configured-tracing JSON and text previews while the disabled row passed (103.212 s). The complete preview owner now passes 10/10 cases in 49.477 s, with no filtered or skipped cases. The four-file delta adds four production lines, extends existing preview assertions, documents tracing deferral, and corrects a stale capacity-refusal history expectation. The initial already-current run retained 31 passing / 1 failing cases: the stale assertion expected no new row after the earlier refusal-history repair. Its replacement requires exactly one finished, failedsnapshot-capacity-insufficientrow, the matching JSON run ID, unchanged prior history, and the existing no-staging assertions. The corrected complete already-current owner passed 32/32 cases in 112.277 s, with no filtered or skipped cases. Core and CLI test types, scoped lint, four-file formatting, runtime cycles, line limits, assertion safety, and whitespace checks all passed in 124.680 s with unchanged source hashes. Fresh independent P2 review was scoped-clean with no findings; its sandbox lacked unchanged repository files, which the maintainer inspected directly. The four committed file blobs match the proof and review freeze. Existing-profile dry-runs can record diagnostic ledger history; fresh-state previews still avoid creating the database.Qualified installed evidence
A published 2026.9.6 updater driving candidate source
a4a9e950passed on Crabbox/Blacksmith Testbox (run): 13/13 core steps succeeded, two genuine Cron histories and their transcripts survived, approvals remained exact, and Doctor reported 37 checks run, 30 skipped, zero findings. Update wall time was 209.644 s; the single scenario took 497 s, and the full wrapper including package/registry preparation took 1,164.892 s. Independent raw-artifact audits qualified that source and candidate tarball SHA-256950b27751cc39cc9cac0ea475604dc58cf1f491f286afc3cfb632621ded73821. This is historical execution, not an execution of the later refusal repair.That cell used a mock provider and isolated service-manager fixture with actual process replacement. It does not establish live-provider behavior or host-native service deployment. Backup restoration was a separate operation into staging, not automatic failure rollback. Its lease is stopped.
The earlier direct-capture matrix at source
f31ac629also passed (run and environment):Audits checked hashes, large rowids, opaque text, BLOB/NULL values, and real history created by an installed dry-run. These were synthetic same-schema package targets with a read-only Doctor observer. Automatic artifact collection failed after product assertions passed; required evidence was recovered and audited separately, so the linked run is not described as green CI. No inherited/helper capture, installed default-directory relocation, inference, or automatic full-state recovery claim is made. Raw diagnostics remain private.
Earlier failed and interrupted runs remain distinct from passing evidence: an incomplete installation fixture, wrapper inventory omission, strict diagnostic-step assertions, refusal-history loss, and the separate main regression were investigated rather than rerun to obtain green.
Other measured focused proof
Single-worker wall time includes runtime preparation. These earlier groups retain their original scope and source bindings.