Repository navigation
Conversation
…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. Backport to release/2026.10.10. The production change and docs are as merged on main. main refactored both audit test files after the release branch was cut, so this keeps the release branch's state-migrations.audit-logs.test.ts and adds main's two missing-companion cases to state-migrations.audit-skips.test.ts, plus one case where the raw archive keeps its bytes and mtime under a new file identity. (cherry picked from commit 4a0ab09)
|
🦞👀 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. |
There was a problem hiding this comment.
🟡 Changes recommended
The file-replacement fixture does not reliably isolate identity changes, and missing-companion coverage does not verify refusal without importing unprocessed records or altering raw data and checkpoints.
2 open issues
What changed in this PR
Backports the audit-recovery fix to release/2026.10.10, allowing Doctor and update finalization to continue when a checkpointed archive loses its sanitized companion but has no records left to import.
Changes:
- Adds a warning-bearing skip for safe missing-companion cases while retaining refusal for unimported records.
- Adds regression cases for empty, already-imported, and changed-file-identity archives.
- Documents recovery behavior and moves archive hardening into the sanitized-archive module without changing its logic.
| File | Description |
|---|---|
src/infra/state-migrations.audit-skips.test.ts |
Adds missing-companion cases that check later repairs continue. |
src/infra/state-migrations.audit-sanitized.ts |
Houses the existing archive-hardening helper. |
src/infra/state-migrations.audit-logs.ts |
Classifies missing companions before importing records. |
docs/cli/update/repair-and-recovery.md |
Explains safe skips and backup-restoration requirements. |
Review effort: Balanced
roboclaw-bot
left a comment
There was a problem hiding this comment.
Reviewed the full four-file diff at 8b55f482b8288a1f87f0fcf014ac07955020461f against release base 1cdcfc00d84a63bd93954592a7778b7f3ab5d47c.
Verdict: the production backport is faithful to #186998, but the test coverage needs follow-up before release-owner acceptance.
- The stable patch-id for both production files plus the documentation is exactly
051fd155b6deec28256668172fd52b2c8de71ac9for this PR and main commit 4a0ab0928cc. This confirms the stated production-and-docs claim, rather than claiming the entire PR (including adapted tests) has the same patch-id. - Both release-base audit source blobs are identical to beta.4 and beta.5. They are not both identical to main's pre-fix files:
audit-logs.tson main additionally uses strict UTF-8 decoding and handlesUtf8InputError. The relevant checkpoint/recovery/record owners are identical between the release base and main's parent; the backported missing-companion guard still runs after raw-prefix validation and before SQLite insertion. - After reading the full diff, ran only
src/infra/state-migrations.audit-skips.test.tsandsrc/infra/state-migrations.audit-logs.test.tsthrough the repository wrapper with--maxWorkers=1, undertimeout 300, in a separate checkout with isolated state/temp directories. 51/51 tests passed, exit 0; wrapper wall time 220.51 s (Node 26.12.1, Linux). This verifies the focused Linux boundary; it is not a new macOS live-upgrade proof or an independent rerun of the author's red-on-base control.
Two concrete coverage gaps remain:
- P2 — missing-companion refusal is untested. The three new rows all expect a skip. Existing refusal/recovery tests exercise different states. They would not catch changing the new classification to skip unimported rows, or moving its check after
registerLegacyMany. Extend the Doctor-runner coverage with a checkpointed raw prefix, one unimported appended row, and an absent companion. Assert backup-restoration guidance, refusal and blocked later repairs, no new SQLite audit row, and unchanged raw bytes/checkpoint. This protects the explicit preservation/refusal contract in the PR description and docs. - P2 — the moved-file fixture does not establish its claimed precondition. At lines 66–72, unlinking before replacement permits inode reuse, while round-tripping mtime through
Datecan lose sub-millisecond precision. The test can pass by exercising the existing mtime-change case instead of the reported identity-only change. Keep the original inode allocated while creating the replacement, use a reproducible mtime, and assert changed identity with equal bytes, size, andmtimeMsbefore migration.
These agree with the two existing Copilot findings after checking the actual owner and sibling tests. The main PR's recorded negative CLI control is useful prior evidence, but it does not put that regression contract into this release branch's tests. No production correctness defect was found in the backported guard. I have not merged or enabled auto-merge; release-branch acceptance and merging remain with the release owner.
…-file case The moved-file case now writes its copy beside the original before renaming it over, so the copy cannot reuse the inode. It starts from whole-second timestamps so the mtime survives the utimes round trip exactly, and it asserts its own premise: a different inode with the same size and mtime. A Doctor-runner case covers the other half of the rule: with the sanitized companion gone and an unimported record appended to the raw archive, audit-logs refuses with the backup-restoration guidance, imports nothing, and leaves the raw bytes and checkpoint unchanged.
|
Codex review: ready, awaiting a maintainer decision. What this changesBackports warning-bearing skips for already-imported audit archives with missing sanitized companions while preserving refusal for unimported records. Example: A 423-byte config-audit raw archive changes inode after its records were imported, and its sanitized companion is removed.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision Keep this PR open: it faithfully backports a verified Doctor fix to a release branch that still lacks it, and no actionable code findings remain. Priority: P1 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor discovers legacy audit archives, verifies checkpointed bytes, compares their records with SQLite, and emits migration receipts that determine whether later repairs proceed. flowchart TD
A[Doctor or update] --> B[Legacy audit discovery]
B --> C[Raw checkpoint verification]
C --> D[SQLite record comparison]
D --> E[Missing companion classification]
E --> F[Warning skip or refusal]
F --> G[Later repairs]
Technical reviewBest possible solution: Carry the existing audit-owner repair into the release line selected by its owner while preserving recovery evidence and refusal for unimported records. Do we have a high-confidence way to reproduce the issue? Release-base discovery and recovery source establish the refusal after checkpointed archive identity changes and companion loss; the contributor supplies matching installed-package reproduction, which this read-only review did not rerun. Is this the best way to solve the issue? The narrow classification uses the existing migration owner before insertion, preserves prefix and companion-integrity checks, and follows the accepted upstream repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1d36d28610a4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +18, Tests +132, Docs +10. Total +160 across 4 files. Added test files: 0. 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. 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 HistoryReviewed November 9, 2026, 7:11 PM ET / November 10, 2026, 00:11 UTC (Revision 3). |
|
Both P2s are addressed in
52/52 pass. With the two production files reverted to the branch tip, 4 fail: the three skip cases get |
|
@clawsweeper re-review Added the installed-package upgrade proof to Evidence. npm |
|
🦞👀 Re-review progress:
|
|
@roboclaw-bot thanks for the review. Both test P2s are fixed in
For the release owner:
|
…panion refusal The refusal case now seeds legacy exec approvals and asserts that the exec-approvals step is refused as blocked by audit-logs and that its source file is untouched. Before this, a runner that kept going after audit-logs refused still passed the case: the "Doctor stopped" check reads only the audit-logs receipt. The moved-file case also asserts that the replacement keeps the original bytes, beside the new inode and the same size and mtime.
The empty, imported and moved-file shapes now run against the audit-logs step itself: a skipped outcome with the recovery warning on two passes, with the raw bytes, checkpoints and imported rows unchanged and the companion still absent. One Doctor-level row (imported) keeps proving that the skip lets later repairs run and that a second Doctor run leaves the archive in place. The refusal case is unchanged.
|
@roboclaw-bot pushed
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
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.
66f0339
into
openclaw:release/2026.11.4
Integrate the exact canonical release commit for #189935 before fresh qualification. Co-authored-by: RomneyDa <[email protected]>

Related: #186974
Backport of #186998 (
4a0ab0928cc) torelease/2026.11.4.Current target — updated November 12, 2026
Retargeted from release/2026.10.10 because 2026.10.10 was published on November 3, 2026. This PR now proposes the audit-recovery fix for the upcoming 2026.11.4 release, not a change to the already published 10.10 artifact. The existing contributor commits and source head are preserved.
The comparison against 11.4 contains only the four intended audit source/test/documentation files. The evidence below was collected on the original 10.10-based branch; it is retained as historical reproduction and validation, not claimed as validation of integration with 11.4. Fresh target-specific CI and integration qualification are still required before landing.
Historical problem and evidence (original contributor report)
What Problem This Solves
Fixes: on 2026.10.10 betas,
openclaw doctor --fix, and so an update, refuses at theaudit-logsmigration and blocks every later repair when an already-imported legacy config-audit archive is re-detected and its sanitized companion is gone.User Impact
User impact: a 2026.10.10 update on a host in that state finishes instead of refusing and rolling back. Real unimported records still refuse with the backup-restoration guidance, as on main.
Why This Change Was Made
#186998 fixed this on main on 10-28, after
release/2026.10.10was cut. It is not in beta.4, beta.5 or the branch tip1cdcfc00d84, by ancestry and by subject. The production change and docs here have the same patch-id as main's (051fd155b6deec28), and the release branch's two audit source files are identical to beta.4's, so they apply as is.main refactored both audit test files after the cut. This keeps the release branch's
state-migrations.audit-logs.test.tsand adds main's two missing-companion cases tostate-migrations.audit-skips.test.ts. It also adds a case for the shape I hit (same bytes, size and mtime under a new file identity), and a Doctor-runner case for the other half of the rule: an unimported record with the companion gone still refuses.Evidence
apns-registrations,exec-approvalsandmcp-oauthwere blocked the same way, and the update rolled back.migration.legacy-audit-raw) recordsdev 16777231, ino 19235396, size 478022, recordCount 0. The file now readsdev 16777230with the same inode, size and mtime, andconfig-audit.jsonl.migrated.sanitizeddoes not exist. Only the device number moved, so detection stopped matching and the step refused although nothing remained to import.Skipped config audit log recovery because its sanitized companion is missing and no records remain to import; left ~/.openclaw/logs/config-audit.jsonl.migrated.raw in place., ran every later step, and the update finished with rc 0 at 07:30Z.[email protected],8b18b55) to this branch's build at23e85739821. Run with an isolatedHOME,OPENCLAW_STATE_DIR,--profile upgradeproofand port 29789, anddoctor --fix --non-interactiveeach time. No launchd label or LaunchAgent was added on the host.logs/config-audit.jsonlof 3config.writerecords: exit 0,Migrated config audit log -> shared SQLite state (3 new row(s)). Afterwards the raw archive's sha256 isf6cc44861440c55a…, the checkpoint readsino 185071743, size 423, recordCount 0, theconfig-audithistory holds 5 rows (the 3 legacy rows hash toab40ca823113eea8…), andopenclaw.jsonhashes to2ccd48ad6b26cc54….185071743->185071842, same size and mtime_ns), and the sanitized companion is removed.audit-logs (step-refused): Skipped config audit log recovery because its sanitized archive is missing or truncated, andmanaged-outgoing-images,apns-registrations,exec-approvalsandmcp-oauthare blocked by the prior refusal.Skipped config audit log recovery because its sanitized companion is missing and no records remain to import; left <state>/logs/config-audit.jsonl.migrated.raw in place., andDoctor complete.A second run: exit 0, the same skip.openclaw.jsonhash.doctor --lintover that state ran 39 checks. Its 3 findings are environment warnings (browser cookie import, a Codex route for the default model, no gateway auth token); none concern state or migrations.59047d2f789(Node 26.12.1, Vitest on Node):OPENCLAW_VITEST_RUNTIME=node pnpm test src/infra/state-migrations.audit-skips.test.ts src/infra/state-migrations.audit-logs.test.ts --maxWorkers=2: 53 passed, 0 failed.state-migrations.audit-logs.tsandstate-migrations.audit-sanitized.tsreverted to the branch tip, 5 failed and 10 passed inaudit-skips. The three step-level skip rows and the Doctor skip row do not get a skip, and the refusal case gets the undifferentiated "sanitized archive is missing or truncated" message instead ofthe raw archive contains unimported records.exec-approvalsis refused withblocked-by-prior-refusaland its legacy file is untouched. It fails if unimported rows are classified as imported, if the guard moves afterregisterLegacyMany, or if the step runner continues afteraudit-logsrefuses.pnpm tsgo:allexited 0 at59047d2f789. oxlint and oxfmt are clean on the test file.pnpm test src/infra/state-migrations.audit-skips.test.ts --maxWorkers=1, Node 26.12.1, the release branch's local default, macOS arm64): 80.2 s and 81.9 s wall, 71.8 s and 72.1 s of tests over 15 tests, both warm. Before59047d2f789the same file ran 79.4 s of tests over 14 warm (87.5 s wall; 104.0 s on a cold worker cache). This PR's tests went from 21.0 s for 4 tests to 13.1 s for 5: the Doctor skip row 6.7 s, the refusal case 2.5 s, the three step-level rows 1.2 to 1.6 s each. CI: no run of this version yet; the previously pushed version took 73.1 s of tests in CI run 41263783798 (checks-node-changed-2).audit.migrate()layer: it calls the samemigrateLegacyAuditLogswith the same detection Doctor uses, and that is where the skip is decided. Each asserts a skipped outcome with the recovery warning on two passes, with raw bytes, checkpoints and imported rows unchanged. Two tests still go through Doctor (autoMigrateLegacyState), because only Doctor sequences the steps: one skip row (imported) shows the skip letsexec-approvalscomplete and a second Doctor run leaves the archive in place, and the refusal case showsexec-approvalsrefused asblocked-by-prior-refusal.st_dev, so the moved-file case changes the inode instead. The copy is written beside the original and renamed over it, so it cannot reuse the inode. The test asserts the premise: a different inode with the same size and mtime.