Repository navigation
fix: recover configured agents after deletion journal loss - #181804
Conversation
Restore verified configured stores through the existing agent owner after missing-journal reconstruction, including stores stamped by later upgrades. Preserve explicit recovery diagnostics and keep retained derived memory-index warnings from blocking unrelated Doctor repairs. Fixes #181765. Thanks @4140leal-cw for the detailed reproduction.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesThis PR restores verified configured agents after deletion-journal loss, preserves recovery diagnostics, and lets deferred memory-index imports remain advisory. Example: A configured main agent has a schema-26 database stamped 2026.10.6 and a missing-journal reconstruction hold.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR addresses a concrete recovery failure on an official release, and the pinned diff introduces no identified correctness defect. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor consumes configured database targets and deletion-recovery receipts, then delegates restoration to the existing agent owner before normal database and session migrations continue. flowchart TD
A[Doctor repair] --> B[Configured targets and recovery receipts]
B --> C[Ownership and deletion checks]
C --> D[Verified rollback backups]
D --> E[Existing agent restoration owner]
E --> F[Database and session migrations]
F --> G[Plugin repairs and recorded warnings]
Technical reviewBest possible solution: Restore verified configured stores through the existing agent owner after verified backups, preserving explicit deletion holds and actionable refusal messages. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically excludes 2026.10.6 and rewritten producer stamps and discards the recovery owner's diagnostic; the PR reports matching base failures and an after-fix package CLI run. Is this the best way to solve the issue? The diff is a small complete repair using existing restoration, backup, and migration-result owners, with no parallel recovery machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a150d8fed2fc. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -25, Tests +101, Docs +5. Total +81 across 10 files. Added test files: 0. View PR surface stats
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 October 23, 2026, 2:12 PM ET / 18:12 UTC. |
|
Landing note: the only red check on head b27d368 is |
…penclaw#181804) After an agent deletion journal was reconstructed, doctor --fix held every configured agent's store ('3 stores held back'), stopped later repairs, and suggested 'openclaw agents add', which is a no-op for existing agents. Doctor's restoration owner only accepted stores stamped by the current build, so upgraded stores could never be restored. It now restores configured agents' stores after verifying ownership and backups regardless of producer build stamp, the CLI preserves recovery diagnostics, and Memory Core retained-index warnings no longer stop later repairs. Mismatched owners, unconfigured agents and incomplete deletion records stay held. Fixes openclaw#181765, reported by @4140leal-cw.
…181804) After an agent deletion journal was reconstructed, doctor --fix held every configured agent's store ('3 stores held back'), stopped later repairs, and suggested 'openclaw agents add', which is a no-op for existing agents. Doctor's restoration owner only accepted stores stamped by the current build, so upgraded stores could never be restored. It now restores configured agents' stores after verifying ownership and backups regardless of producer build stamp, the CLI preserves recovery diagnostics, and Memory Core retained-index warnings no longer stop later repairs. Mismatched owners, unconfigured agents and incomplete deletion records stay held. Fixes #181765, reported by @4140leal-cw. (cherry picked from commit d75915e) Release adaptation: stable agents add still calls createAgent directly (no local-state-owner RPC), so only the already-exists message override was removed. Restore test cases were ported onto the stable fixture helpers; the memory sidecar case lives in a new trimmed state-migrations.plugin-doctor.memory.test.ts (the main file is not on stable). Update behavior: the post-update Doctor now restores configured, ownership-verified agent stores after a reconstructed deletion journal instead of holding them and refusing the update finalization.
#181356 resolves an API-key-only ChatGPT catalog row to the Platform contract, so the Codex PDF case seeds the OAuth login as main does. #181923 lets the K3 policy name hosted-catalog K3.1 rows the bundled manifest lacks. #181804 restores configured stores after journal loss, so Doctor refuses the legacy schema instead of holding them; the test takes main's expectations and its host-broker project (#181964). The Control UI locale artifacts are regenerated for the dropped restart summary string.
Adapt 21 audited fixes to release-native ownership and recovery. Retain strict temporary environment isolation and provider-only cooldowns. Original-source provenance and contributor credit: #179144 5a97c90 — Peter Steinberger <[email protected]> #180280 442c2f7 — Jason (Json) <[email protected]> #178596 63f386b — Braden Guliano <[email protected]> #181804 d75915e — Peter Steinberger <[email protected]> #181140 b4031b2 — Peter Steinberger <[email protected]> #182207 b8fae65 — Peter Steinberger <[email protected]> #180792 d2c70dd — Peter Steinberger <[email protected]> #179205 c08aa6d — Peter Steinberger <[email protected]> #179997 f178dd9 — mali <[email protected]> #181270 e204484 — Peter Steinberger <[email protected]> #179031 855b0aa — Peter Steinberger <[email protected]> #179726 3d51d00 — Peter Steinberger <[email protected]> #179249 b617d97 — Josh Avant <[email protected]> #182385 bb13bcd — Peter Steinberger <[email protected]> #182615 411bac2 — Peter Steinberger <[email protected]> #181300 765c2f1 — Peter Steinberger <[email protected]> #179549 09ba994 — Peter Steinberger <[email protected]> #179445 ac5587b — Peter Steinberger <[email protected]> #181127 25dde25 — Josh Lehman <[email protected]> #173209 ebccf57 — Peter Steinberger <[email protected]> #175289 e579f09 — Peter Steinberger <[email protected]> Proof: targeted owner/regression tests; Qwen15 and catalog pool13 pass. Final integrated lint/type/format pass remains pending under user direction. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Doctor repeatedly holds valid configured agent stores after deletion-journal reconstruction, and its suggested
agents addrecovery can hide the actual refusal behind “already exists.” A skipped Memory Core import can then stop unrelated repairs and update finalization.Fixes #181765. Thanks @4140leal-cw for the detailed report.
User Impact
openclaw doctor --fixautomatically restores configured stores whose database ownership and missing-journal provenance can be verified, even after an upgrade changed their producer stamp. It preserves a verified backup group first. Real deletion records, quarantined history, unconfigured stores, and mismatched owners retain their existing protections. Explicit recovery failures retain the owner's actionable diagnostic.Deferred derived memory-index imports leave their sources intact and no longer prevent independent Doctor repairs. No new options, dependencies, or database schemas.
Why This Change Was Made
The restoration owner required an unchanged creation stamp from a fixed version/schema allowlist, which excluded stable
2026.10.5/2026.10.6and upgraded stores. Configured physical ownership, matching database metadata, no deletion record, missing-table reconstruction provenance, and verified rollback backups provide the recovery decision instead. The existing agent-creation owner still performs restoration and releases only the selected holds.The CLI discarded that owner's diagnostic for every
already-existsresult. Separately, Memory Core returned an unclassified migration warning after preserving a derived index, causing the Doctor runner to treat it as a refusal. The fix stays in those owners; generic data-risk refusals are unchanged.Evidence
2026.10.6remained held; the CLI replaced a specific recovery refusal with “already exists”; a held Memory Core import returned no recoverable disposition.tsgo, scoped core/test/extensionoxlint, formatting,git diff --check, and Madge (0 cycles) pass. Fullcheck:changedSQLite inventory was omitted under the lane's local gate budget; PR CI supplies broad proof.node --import ./scripts/tsx.mjs scripts/build-all.mts cliStartup, then ranpnpm exec ./openclaw.mjs doctor --fix --non-interactive --no-workspace-suggestionsagainst three synthetic schema-26 stores (main,ayudante,contador) and a missing journal. Exit 0, “Doctor complete,” all three restored, zero remaining holds, and all original sentinel values preserved. All four rollback databases passed integrity checks; the shared backup retains the original three holds. Windows path behavior is injected; the live CLI host is macOS.Inherited Node failures reproduced separately on untouched base
95fecb2dafe4:state-migrations.test.ts: “previews and repairs the released audit ledger before other state migrations” expects six preview lines, while the current schema supplies eight (heartbeat and workspace-baseline migrations).agent-create.integration.test.ts: “stops delegated creation after authority closes during workspace-write preparation” reports missing native Darwin descriptor ACL inspection, followed byno such table: migration_sources.The opt-in PostgreSQL file is skipped without its external fixture. The inherited large migration file uses about 174.7 seconds of test time; the new restoration regression takes about 3 seconds. The restoration file takes about 36.4 seconds of test time. The process regression takes 48.13 seconds of test time (81.07 seconds file wall time): it reuses the built runtime and exercises two real Doctor processes with three historical databases, preserving the existing cross-process recovery contract. No timeout or retry increases. Setup and compilation account for additional wall time.
Simplification: removed the version allowlist and the CLI's duplicate diagnostic rewrite; reused existing restoration, backup, and migration-result contracts. Production: +22/−47 lines; tests: +176/−75; docs: +7/−2.