Repository navigation
fix(backup): diagnose invalid archive inputs - #124510
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 4:36 AM ET / 08:36 UTC. ClawSweeper reviewWhat this changesThe PR replaces misleading backup and CLI file-input errors with actionable validation diagnostics for invalid paths and archives. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer landing: the active maintainer PR repairs a source-backed diagnostic bug at the shared backup and file-input boundaries, with no blocking patch finding found. Priority: P2 Review scores
Verification
How this fits togetherBackup commands validate archive inputs before verification, restore, and post-create checks; config commands validate JSON5 files before mutation. These paths turn operator-provided files into command results and exit statuses. flowchart LR
A[Operator file path] --> B[Backup or config command]
B --> C[Shared input validation]
C --> D[Verification or mutation]
D --> E[Actionable result and exit status]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +56, Tests +100. Total +156 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one archive preflight shared by verify, restore, and post-create verification, and keep regular-file validation centralized in the config input reader. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main loses the tar invalid-archive warning and treats the resulting empty list as an empty backup; the PR body also supplies before/after CLI evidence. Is this the best way to solve the issue? Yes: the proposed preflight is at the shared verifier and config-reader owners, so direct verification, restore, post-create verification, and both config file modes do not need separate translations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b097aaab2061. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where operators running
openclaw backup verifyreceived raw Node filesystem errors for missing or directory inputs, while a non-tar garbage file was incorrectly reported as an empty backup. These diagnostics are especially risky immediately before a restore because they point the operator at the wrong failure.The original behavior came from #40163: archive listing discarded
tar's recoverableTAR_BAD_ARCHIVEwarning and then treated the resulting zero-entry list as proof of emptiness.Why This Change Was Made
verifyBackupArchivenow owns the archive preflight and wraps every verification failure with the resolved archive path, so direct verification,backup restore, andbackup create --verifyall share the same diagnostics. Archive listing preservesTAR_BAD_ARCHIVEevidence and reports zero-entry/unrecognized inputs as an invalid OpenClaw backup. A legal zero-entry tar and short garbage produce the same dependency signal, and neither can be a valid OpenClaw backup because the manifest is mandatory.The bounded filesystem-path sweep also fixes raw missing-path errors shared by SQLite snapshot verify/restore and centralizes regular-file validation for
config set --batch-fileandconfig patch --file. Existing correct backup Git initialization, SQLite listing, plugin path installation, and normal media validation paths were left unchanged.Production LOC: +86/-30 (net +56). Tests: +101/-1. The production growth is the operator-facing classification and recovery guidance at three existing owner boundaries; no compatibility layer, fallback, new public API, or new helper surface was added, and the shared config reader deletes duplicate caller-side error translation.
User Impact
Operators now see the archive path, the actual problem, and a concrete recovery step. Exit codes and successful text/JSON output are unchanged.
Examples after this change:
Evidence
Before, on macOS at
063ce57caf2:After, on the exact synced patch in Blacksmith Testbox
tbx_01m04swtd9nvpctnw0n8me38fd:backup create --verifycreated a real scratch-state archive;backup verifypassed with 1 asset and 3 archive entries;pnpm buildpassed;node scripts/check-changed.mjspassed;node scripts/run-vitest.mjs src/commands/backup-verify.test.ts src/commands/backup-sqlite.test.ts src/cli/config-set-input.test.ts src/cli/config-cli.test.tspassed: 242 tests, 1 skipped;Remote proof: https://github.com/openclaw/openclaw/actions/runs/31935737819
AI-assisted: yes. The implementation and observed behavior were reviewed and understood.