Repository navigation
fix(doctor): skip config audit recovery when its sanitized companion is gone and nothing remains to import - #186998
Conversation
Preserve verified raw audit archives and record a warning-bearing skip when their sanitized companion is gone and every record is already imported. Keep unimported data refusing with backup restoration guidance so independent Doctor repairs and update finalization can continue safely. Fixes #186974. Thanks @AlyaKoni for the report.
|
🦞👀 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 changesDoctor skips missing-companion audit recovery when all raw records are already imported, while preserving recovery inputs and refusing unimported records. Example: A checkpointed config-audit archive contains 56,180 whitespace bytes and its sanitized companion is absent.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it addresses a verified Doctor and update-finalization failure that remains on current main, and the pinned patch has no identified code defects. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor discovers retired audit files, verifies their checkpoints, and reconciles records with shared SQLite state; migration receipts determine whether later repairs and update finalization continue. flowchart TD
A[Doctor or update finalization] --> B[Legacy audit discovery]
B --> C[Checkpoint and raw verification]
C --> D[Existing SQLite record keys]
D --> E[Missing companion classification]
E --> F[Warning skip or refusal receipt]
F --> G[Continue or block later repairs]
Technical reviewBest possible solution: Retain this narrow classification in the existing audit migration owner, preserving raw evidence and refusing recovery whenever an unimported record remains. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the refusal after discovery selects a verified checkpointed archive with a missing companion; the PR supplies matching regression fixtures and reports before/after source-CLI results, which this read-only review did not rerun. Is this the best way to solve the issue? The patch fixes the decision at its existing owner before database insertion, retains checkpoint, parsing, restoration, and companion-integrity checks, and introduces no competing state or recovery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against db6efe4ecc2b. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +18, Tests 0, Docs +10. Total +28 across 5 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:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 28, 2026, 4:05 PM ET / 20:05 UTC. |
…is gone and nothing remains to import (openclaw#186998) On 2026.10.8, openclaw update and doctor --fix refused permanently at the audit-logs migration when a legacy raw-archive checkpoint existed but its sanitized companion file was missing, blocking every later migration step and update finalization although nothing remained to import. When the raw archive still matches its checkpoint and no records remain unimported, the step now records a warning-bearing skip, keeps the raw file and checkpoint, and lets later repairs run; real unimported records still refuse with backup-restoration guidance. Fixes openclaw#186974. Thanks @AlyaKoni.
…is gone and nothing remains to import (openclaw#186998) On 2026.10.8, openclaw update and doctor --fix refused permanently at the audit-logs migration when a legacy raw-archive checkpoint existed but its sanitized companion file was missing, blocking every later migration step and update finalization although nothing remained to import. When the raw archive still matches its checkpoint and no records remain unimported, the step now records a warning-bearing skip, keeps the raw file and checkpoint, and lets later repairs run; real unimported records still refuse with backup-restoration guidance. Fixes openclaw#186974. Thanks @AlyaKoni. (cherry picked from commit 4a0ab09) Carry note (v2026.10.10-beta.4): the production change applies unchanged. main had refactored state-migrations.audit-logs.test.ts and audit-skips.test.ts well past beta.4, so both keep beta.4's versions and the new state-migrations.audit-missing-companion.test.ts pins the case that refused mac-mini's deploy: a raw archive re-detected after its file identity moved (st_dev 16777231 -> 16777230, same ino, mtime and size), its sanitized companion gone, every record already imported.
Upstream head 59047d2 targets release/2026.10.10 (base 1cdcfc0). Its first commit 8b55f48 is the release-branch cherry-pick of openclaw#186998; the branch already carries openclaw#186998 through the fork's 419ff41, and the two are patch-identical outside tests (git patch-id --stable over audit-logs.ts, audit-sanitized.ts and docs: 051fd155b6de for both). So only the PR's tests are carried: - 8b55f48's missing-companion rows in audit-skips.test.ts, as reshaped by 23e8573 (the moved-file copy is written beside the original and renamed over it, so it cannot reuse the inode, and the case asserts that premise), c34352c (the refusal case: with an unimported record left in the raw archive, audit-logs refuses, imports nothing, and exec-approvals is refused blocked-by-prior-refusal with its file byte-identical) and 59047d2 (the empty, imported and moved-file shapes run against the audit-logs step twice; one Doctor row keeps proving later repairs run). audit-skips.test.ts and audit.test-support.ts on this branch are byte-identical to the PR's base, so the PR's test diff applies as is. Removed: src/infra/state-migrations.audit-missing-companion.test.ts, the fork's single test from 419ff41. It is the moved-file shape above (re-detected raw archive, companion gone, every record imported, skip with a warning), and it recreated the file with rm + writeFile, which can reuse the inode it means to change; the carried row asserts the new inode and checks more (two passes, checkpoints, imported rows). Proof (M4, Node 26.12.1, --maxWorkers=1): - audit-skips.test.ts and audit-logs.test.ts: 2 files, 53 tests passed (the PR reports 53 at its head on its own base). - Red-before, the openclaw#186998 source hunks of audit-logs.ts and audit-sanitized.ts reverse-applied: audit-skips.test.ts 5 failed, 10 passed of 15 (the Doctor imported row, the three step rows and the refusal case), the same split the PR reports on its base.
…189935) Backport #186998 to release/2026.11.4. Preserve checkpointed raw audit archives when their sanitized companion is missing and no records remain to import; retain refusal for unimported records. Includes missing-companion and blocked-later-repair regressions by Alex Mittell. Original implementation by Peter Steinberger; backport and regression coverage by Alex Mittell. Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Refresh the complete v2026.11.3..09aa644 history: 99 in-range PRs, 35 issues, and direct-commit editorial coverage. Preserve all 62 prior contribution records and original main PR credits. Include typed Telegram callbacks, worker-heartbeat lease renewal, and the narrow large-store startup adaptations without claiming post-ready recovery. Source product: 09aa644 Source tree: f10a88c Main metadata: 3577724 Notes tooling: 514a224 Release provenance: 3768440 -> openclaw#194840, openclaw#179219, openclaw#196984, openclaw#196337 Release provenance: 00275d2 -> openclaw#194362 Release provenance: 66f0339 -> openclaw#186998 Release provenance: 915956a -> openclaw#186998 Co-authored-by: vincentkoc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Fixes #186974
What Problem This Solves
Doctor and update finalization permanently refuse when a checkpointed legacy config-audit raw archive has lost its sanitized companion, even though the raw bytes still match the checkpoint and no records remain to import. Thanks @AlyaKoni for the report and preserved-history evidence.
User Impact
Doctor now records a warning-bearing skip, preserves the raw archive and checkpoint, and continues later repairs when there are zero records or every raw record already exists in SQLite. A missing companion with unimported records still refuses before importing, with instructions to restore the named companion from a verified backup and rerun Doctor against the same state directory. Truncated or modified companions retain their existing checks.
Why This Change Was Made
The audit migration owner already verifies the checkpointed raw prefix and parses records. It now uses its existing pre-write SQLite keys to classify the missing companion before attempting recovery. Existing migration receipts carry the warning through Doctor and update finalization. This complements #145376 and #150425 without reconstructing historical bytes or changing the schema, retention, configuration, dependencies, or CLI options. The candidate must include this fix; the installed update driver needs no change.
The existing archive-hardening function moved unchanged into the neighboring sanitized-archive module to meet the 700-line owner limit. Shared checkpoint-control setup was consolidated and exec-approvals verification now reads the production store instead of querying its SQL layout. Production: +42/-24 (net +18); tests: +71/-71 (net 0); docs: +10.
Evidence
refusedinstead ofskipped. Frozen final source: 84 tests passed, one Windows-only test skipped, across both selected projects; total wrapper wall time 223.48 s.HOME,OPENCLAW_STATE_DIR, profile, and port;pnpm openclaw doctor --fix --non-interactive. Before: exit 1,audit-logsstep-refused, and later migrations blocked. After: exit 0, “Doctor complete,” warning surfaced, exec-approvals JSON removed, and SQLite policy isallowlist.5f80de1ad2afd477ce838f2d636b374c922bffb9d31ada53ac3343874bfe1290; the raw file and checkpoint remained unchanged, and the companion stayed absent.node scripts/run-vitest.mjs src/infra/state-migrations.audit-backup.test.ts src/infra/backup-create.audit.test.ts src/infra/state-migrations.audit-logs.test.ts src/infra/state-migrations.audit-skips.test.ts src/infra/state-migrations.audit-logs.windows.test.ts test/scripts/ci-changed-node-test-plan.selection.test.ts --maxWorkers=1. The changed Doctor file used 110.34 s of test time; audit owner tests used 29.05 s; the slowest individual test was 16.18 s. CI timings are pending.git diff --checkpassed. Documentation audit: 16,114 internal links, zero broken. Fullcheck:changed/SQLite inventory was skipped under the campaign's local gate budget; PR CI is the broad proof.1b356b487d8e7eb5946af999eb4fe9517eaee2ef, P0–P2: scoped-clean, no actionable findings. Local ClawSweeper was unavailable because its shared checkout was dirty; marking this PR ready requests the hosted review.Proof limitations: no installed-package upgrade was run. The isolated source CLI fixture reported the host's pre-repair recovery-copy warning because its external-volume staging ancestor permits replacement by another user; the archive preservation and later migration assertions above passed. No operator state, Gateway, or production data was used. Windows-only proof is left to CI.