Repository navigation
fix(matrix): keep explicit recovery available during deferred migration - #200805
Conversation
Register manifest-declared recovery subtrees from the separate Doctor contract when pending state migration withholds ordinary plugin entrypoints. Reuse the Matrix recovery owner, explicit account/rollback consent, and snapshot safeguards; leave migration settlement to Doctor or update repair. Fixes #200790 Co-authored-by: steipete <[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. What this changesThis PR exposes Matrix’s explicit recovery commands through its Doctor contract while pending migrations block ordinary plugin loading. Example: The default Matrix account has an unsafe crypto store and a pending deferred migration.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this PR addresses a confirmed recovery deadlock, but introduces a store-type incompatibility that needs repair. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe plugin CLI loader combines manifest metadata, migration admission, and Doctor artifacts into registered commands; Matrix’s existing recovery owner performs snapshot validation and guarded state writes. flowchart TD
A[Operator CLI request] --> B[Plugin CLI loader]
B --> C[Pending migration admission]
C --> D[Doctor recovery artifact]
D --> E[Shared Matrix recovery commands]
E --> F[Snapshot validation and exclusive lock]
F --> G[Crypto guard and SQLite seal]
Technical reviewBest possible solution: Keep the Doctor-owned recovery route and align its store capability types without changing consent, locking, snapshot validation, or migration settlement. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the circular dependency, and the supplied regression targets it directly; no target code was executed during this read-only review. Is this the best way to solve the issue? A narrow recovery surface in the existing Doctor and CLI owners is appropriate; the helpers should accept their actual store capabilities rather than relabeling a legacy opener as V2. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ae6b903359e3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +202, Tests +396, Docs +68. Total +666 across 25 files. Added test files: 3. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 17, 2026, 4:50 PM ET / 21:50 UTC. |
Use the bounded snapshot read/seal capability shared by Doctor and normal Matrix recovery, retaining V2 runtime requirements for recovery-key CAS. Validate the recovery registrar without a cast while preserving its managed callback identity. Co-authored-by: steipete <[email protected]>
Merge b60b114 into the existing recovery branch. Preserve both the Matrix recovery contract and upstream package-scan diagnostics in docs/install/updating.md. Recovery production and test files remain byte-identical to b33cfb3. Co-authored-by: steipete <[email protected]>
|
Merged via squash.
|
…on (openclaw#200805) * fix(matrix): keep explicit recovery available during deferred migration Register manifest-declared recovery subtrees from the separate Doctor contract when pending state migration withholds ordinary plugin entrypoints. Reuse the Matrix recovery owner, explicit account/rollback consent, and snapshot safeguards; leave migration settlement to Doctor or update repair. Fixes openclaw#200790 Co-authored-by: steipete <[email protected]> * fix(matrix): narrow recovery snapshot state requirements Use the bounded snapshot read/seal capability shared by Doctor and normal Matrix recovery, retaining V2 runtime requirements for recovery-key CAS. Validate the recovery registrar without a cast while preserving its managed callback identity. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]>
* fix(update): include cold archives in candidate snapshots Co-authored-by: steipete <[email protected]> * fix(update): preserve file archives in rehearsal snapshots Co-authored-by: steipete <[email protected]> * fix(update): preserve source WAL state during archive inventory Classify cold archive SQL under its existing candidate-state subprocess owner. Preserve incomplete WAL source families so header inspection retains private cleanup custody. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]> Release adaptation: the baseline does not contain the #195487 header-cleanup suite. Keep that unrelated suite absent; carry the new incomplete-WAL inventory assertions into the existing inventory suite instead. Add a per-change 214-line allocation for the source regression, chunk fallback, and WAL preservation tests. No schema, updater protocol, authority, or archive-integrity changes. Companion audit at 9e917f0: - #200733 is selected as the next dependency-closure repair: missing archives must warn instead of blocking updates, and Windows copies must not share live read-only inode attributes. Do not qualify this intermediate checkpoint alone. - #200076 and #200930 are independent cold-history performance changes, not prerequisites for this snapshot repair. - #201009, #200994, #200866, #200577, #200805, #200802, and #200732 overlap only adjacent update documentation and independent repair flows; not prerequisites. Proof on base 309067b: - New production-subprocess regression: 4/4 fail before, 4/4 pass after. - Cold archives, chunks, and inventory: 31/31 pass after. - Additional budget/cleanup/import siblings: 46/47 pass. Configured-cache containment fails identically on the unchanged base at budget.test.ts:737; retained as an independent failure, not weakened or repaired here. - Targeted lint and format, documentation links, SQLite worker ratchet, and test-line ratchet pass. SQLite T1 counts remain 170; compatibility 15. - Worker typecheck was blocked at dependency custody, without guard bypass. Parent canonical core typecheck, typed lint (five files), and formatting passed with its owned dependencies. Full installed-upgrade/FRV proof remains pending the assembled candidate, including selected companion #200733. (cherry picked from commit 802e3f7) Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
…on (#200805) Backport a1940e0 to release/2026.11.6. Register manifest-declared recovery subtrees from the separate Doctor contract when pending state migration withholds ordinary plugin entrypoints. Reuse the Matrix recovery owner, explicit account/rollback consent, and snapshot safeguards; leave migration settlement to Doctor or update repair. Use the release branch's synchronous source-owned Doctor setup loader instead of future-main asynchronous Doctor preparation. Keep its existing private registry interfaces and unrelated manifest/update behavior unchanged. Keep the declaration predicate in the existing contract module to respect the release registry file line cap without adding an exemption. Include the 397-line regression allocation for the source's Matrix CLI, admission/lifetime, declaration-validation, and recovery-consumer tests. Fixes #200790 (cherry picked from commit a1940e0) Co-authored-by: steipete <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
…Claw process is writing (#200742) * fix(state): keep lease release waiting through ordinary SQLite writer contention A state lease's release gave up after 2 s of SQLite lock contention and, for worker-cleanup leases, threw the raw lock error. Doctor maintenance steps that had already committed their work (media persistence, plugin session repair, transcript directives) then failed with a bare "database is locked", leaving updates post-update-failed and sometimes the Gateway stopped. The unreleased lease also blocked the next acquirer until its stored expiry. Lock contention during release now waits the same 5 s busy bound every shared-state writer uses, and a release that still loses to a writer is retried in the background like offline-maintenance contention. Refs #197083 * test(state): restore the renewal test close after rebase Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit b1ec281) Release adaptation: keep the maintenance-line native/worker lease owner and existing-schema admission behavior; import only its existing busy-timeout constant. Resolve the append-only contention-test conflict without unrelated renewal tests. Retain the branch native best-effort fallback; exact-worker failed cleanup remains with the existing resource owner. No schema, SDK, config, or dependency changes. Companion audit: no later same-path commits or PR-number follow-ups for #200742 through main 74e5127. #200328 is already implemented at cef3501, with predecessor-stop custody retained; do not duplicate it or the separately owned #200659/#200805. The 97-line allocation covers two distinct real-SQLite regressions: completed work survives ordinary contention and failed release cannot strand its lease. Proof: both new regressions fail on 0678cec; all 19 selected lease tests pass after repair. The four #200328 owner suites pass 94 tests (3 skipped). Formatting and git diff --check pass. Targeted lint/type wrappers refuse shared symlinked dependencies; final isolated checks and full release validation remain with the release owner. No live Gateway or installed state was modified. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
…on (#200805) * fix(matrix): keep explicit recovery available during deferred migration Register manifest-declared recovery subtrees from the separate Doctor contract when pending state migration withholds ordinary plugin entrypoints. Reuse the Matrix recovery owner, explicit account/rollback consent, and snapshot safeguards; leave migration settlement to Doctor or update repair. Fixes #200790 Co-authored-by: steipete <[email protected]> * fix(matrix): narrow recovery snapshot state requirements Use the bounded snapshot read/seal capability shared by Doctor and normal Matrix recovery, retaining V2 runtime requirements for recovery-key CAS. Validate the recovery registrar without a cast while preserving its managed callback identity. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]> (cherry picked from commit a1940e0) Co-authored-by: RomneyDa <[email protected]> Release adaptation: retained only the Matrix recovery paragraph from the updating documentation conflict; omitted unrelated newer-main surrounding documentation. Follow-up disposition: bounded pinned-main same-path audit recorded in the lane report; cross-lane changes remain parent-owned. (cherry picked from commit 7bfcb9bc01b0a89fccd3eb62207135891c6f6f02)
…aw#194058) Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139. Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact. Co-authored-by: TorstenW <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: steipete <[email protected]> (cherry picked from commit 7c702c3) Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression. Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109) Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd) (cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
Fixes #200790
What Problem This Solves
After an unsafe Matrix crypto shutdown, a pending plugin migration could hide the documented recovery commands. Doctor and update repair required that recovery first, leaving operators unable to proceed through the supported CLI.
User Impact
Operators can run
openclaw matrix doctor inspect [--json]andopenclaw matrix doctor recover --account <id> --accept-snapshot-rollbackwhile a pending migration withholds Matrix. Recovery still requires explicit rollback consent, exactly one blocked account store, exclusive crypto ownership, and a valid replayable snapshot. Then runopenclaw update repair(oropenclaw doctor --fix) before restarting the Gateway.Other Matrix commands remain withheld. Doctor/update repair and
--fix,--yes, or--forcenever authorize snapshot rollback. The host CLI and plugin need this change together; upgrading the plugin alone does not add the route to older CLIs.Why This Change Was Made
An optional
doctorContract.recoveryClideclaration mounts exact subtrees under the plugin's existing CLI roots through the separate Doctor artifact. The existing CLI owner selects it only for the matching enabled plugin's structured migration refusal, preserving normal-root precedence and disabled, denied, quarantined, and ordinary-load-failure behavior. Registration receives a mounted Commander subtree and narrow plugin-bound state context, using existing source preparation and callback lifetime.Both routes share the Matrix registrar and crypto recovery owner. The recovery helper no longer depends on full Matrix runtime access; no new state, migration ledger, lock, or crypto policy is introduced. The existing full/metadata loader gate remains intact. Production changes add 217 net lines; tests add 397 and docs add 68. The growth supplies the optional contract, admission, and owning-boundary regression proof.
Evidence
Current head:
bfc5f3ef4fbc4ce4c7075d386d84472bcd7d8e6e. Merged main:b60b11474606ed85297eceae4a0a001ece69cd90. Prior tested head:b33cfb39f9cae8b174f413f9e6cf4081b40c6e27.The merge resolved only
docs/install/updating.md: both the exact Matrix recovery paragraph and all upstream document content are retained. All 20 PR production/test files remain byte-identical to the prior tested head. This is a documentation-only conflict resolution; no trust boundary or API semantics changed.unknown command 'matrix'after synthetic state, obligation, and Doctor-detector setup succeeds. On the candidate it produces the actual inspect result and recovers a valid synthetic SQLite snapshot only with explicit consent. Inspect/refusals preserve the guard and obligation; recovery leaves deferred settlement to Doctor/update repair. No homeserver, real account, credentials, or real keys are used.4 > 3and verifies repaired3 <= 3; the full ratchet remains CI proof. Total test growth is 397 net lines, within the 400-line budget. Earlier export synchronization/check and inventory generation produced no additional changes.18e2da0b01373655c87729b7399f7460618c3bf6with the store and callback owners supplied, completingscoped-cleanwith no findings. This supplements the initial full-candidate review and is self-reported evidence, not CI attestation.The new head's first CI run is pending. Full production/test type lanes, extension package declarations, and the full ratchet must validate this head in PR CI. Build/package generation, full SDK declaration/API diff, native/live Matrix behavior, and stable-upgrade testing were not run on the production Gateway host. Focused source/synthetic proof does not establish those results. No live state or Gateway service was changed.
Reported by @nikolay-bratanov
Work sessions
Linked for team reference; these sessions aren’t public.