Repository navigation
fix(doctor): quarantine changed audit archives and continue repairs - #150425
Conversation
|
🦞👀 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: needs maintainer review before merge. Reviewed September 17, 2026, 12:09 AM ET / 04:09 UTC (Revision 2). ClawSweeper reviewWhat this changesDoctor preserves changed legacy audit archives in quarantine, continues repairs, and excludes quarantined raw data from portable backups while retaining sanitized history. Merge readiness✅ Ready for maintainer review This remains a useful fix beyond the earlier merged recovery change. The prior backup privacy finding and its rank-up request are addressed; no blocking defects were found. Priority: P1 Review scores
Verification
How this fits togetherDoctor repairs legacy audit files into OpenClaw’s SQLite state. The backup subsystem combines sanitized legacy files with database snapshots to produce portable archives. flowchart TD
A[Legacy audit archives] --> B[Doctor integrity check]
B -->|Valid append| C[Sanitized history and SQLite]
B -->|Changed archive| D[Local quarantine]
D --> E[Warning and continued repairs]
C --> F[Portable backup filter]
D -->|Excluded| F
F --> G[Portable archive]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +5, Tests +207, Docs +18, Other 0. Total +230 across 16 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep recovery with Doctor and raw-file exclusion with the shared backup classifier, preserving local evidence and portable sanitized history. Do we have a high-confidence way to reproduce the issue? Yes: current-main source establishes that a malformed rewrite reaches parsing before checkpoint rejection, and an empty checkpointless raw archive can replace its sanitized companion. This review did not execute those paths. Is this the best way to solve the issue? Yes: the patch repairs the existing recovery owner and shares backup classification across its consumers without adding another import path or changing database schemas. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b2e5694f50ea. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Keep the append-only integrity check ahead of parsing, preserve mismatched raw archives beside themselves, and continue later repairs with a recoverable warning. Preserve sanitized history when a checkpointless raw archive is empty, and keep existing SQLite audit rows and operator backups intact. Reported by an Ubuntu operator on Discord. Verified with 38 focused tests, the changed-file gate, and the published 2026.9.3 Doctor finalization driver invoking the built candidate.
b17adfa to
3e45921
Compare
|
Merged via squash.
|
…penclaw#150425) Doctor now quarantines a config-audit archive that changed other than by append and continues later repairs. Check checkpoint integrity before parsing, preserve existing SQLite rows and sanitized history, and keep repeat runs quiet. Empty checkpointless raw archives cannot erase retained sanitized companions. Portable backups exclude quarantined raw bytes and their derivatives through the shared audit-path classifier, preserving local originals and sanitized archive content. This completes the backup privacy boundary across discovery, tar exclusion, and volatile filtering. Reported by an Ubuntu operator on Discord using OpenClaw 2026.9.3. Related: openclaw#145376. Validation: exact-head CI passed; 135 focused tests, changed checks, and build passed in the fix lane. Published 2026.9.3 driver proof demonstrated exit 1 to exit 0, preserved history, later repairs, and quiet repeats. The fix lane's broad local backup-suite diagnostic was incomplete; hosted CI is the completed full gate. The scoped Codex review and current-head ClawSweeper review have no actionable findings.
What Problem This Solves
Fixes Doctor stopping on malformed rewrites of legacy audit archives, repeating mismatch warnings, or erasing a sanitized companion beside an empty checkpointless raw archive. Reported by an Ubuntu operator on Discord using 2026.9.3. The quarantine path also needs to preserve the existing backup privacy boundary: its retained raw arguments must not enter portable archives.
Related: #145376, which already made valid-JSON archive mismatches recoverable warnings on main.
User Impact
Doctor and update finalization preserve mismatched raw archives beside themselves with a dated quarantine suffix and continue later repairs. The operator note names the quarantine once; subsequent runs stay quiet. Existing SQLite rows, sanitized history, and operator backups remain intact.
Portable backups omit quarantined raw files and their derivatives while leaving the local originals untouched. Sanitized companions and normal sanitized replacements for recoverable audit sources remain included.
Why This Change Was Made
The raw file is a checkpointed append landing pad for older writers. Doctor now checks its prefix before parsing and quarantines mismatches without importing changed bytes. Empty checkpointless raw files cannot overwrite retained sanitized history.
The backup cutover has one lightweight owner,
backup-audit-paths.ts. Discovery, tar exclusion, and volatile/stat-cache filtering use its predicate. Quarantined names inherit the original basename's classification; there is no second quarantine regex. The volatile adapter preserves its normalized state anchor before native path interpretation. Migration discovery continues to ignore quarantines so they cannot be re-imported.The related audit-export tests now live together in
backup-create.audit.test.ts, with shared real-tar inspection helpers. No coverage was removed to satisfy the existing file-size gate. The assertion baseline shrinks exactly from 2 to 1 after replacing the moved error cast with the existing errno guard.Evidence
.quarantined-*entry.pnpm check:changed: passed, including types, formatting, lint, and runtime/import guards. No nested-checkout extension-lint substitution was needed.OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 pnpm buildpassed. The rebased worktree was restored withpnpm install --frozen-lockfile; no dependency pin or lockfile changed. Rebuilding removed stale pre-rebase runtime chunks that forced native mode off. Results from those mixed-version diagnostic runs are not used as final proof.--mode branch --base origin/main --max-priority P1.ClawSweeper follow-up
Applied the P1 correction and the sole Rank-up move from the reviewed-head comment: the backup owner excludes the complete raw audit family, and a real Doctor-to-archive regression verifies absence of a synthetic sensitive argument while retaining local originals. No Rank-up move was skipped.
Rebased onto
90b421ae252before final validation. Follow-up head:3e459215e6c9bc9ae160e4fd927f69729782fe52. Follow-up LOC: production +68 / -63 (net +5); tests/support +420 / -294 (net +126); docs +8. The only baseline change is the exact shrink described above.Original stop chain and sanitized terminal excerpts
In 2026.9.3,
state-migrations.audit-logs.ts:380returned failure,state-migrations.messages.ts:66classified the warning as a refusal,state-migrations.doctor.ts:2867blocked later steps, andstate-migrations.messages.ts:107threw the stop. An empty raw archive is shorter than its checkpoint; rewritten bytes fail the prefix hash..bakfiles are not recovery inputs. A missing raw file is not selected for recovery.Published 2026.9.3, before:
Published driver invoking the candidate, after (empty raw):
The deleted-line case quarantined 222,957 bytes against the same 223,098-byte checkpoint. Both repeats completed without a mismatch warning.