Repository navigation
fix: restore default-profile backup archives - #123504
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 14, 2026, 4:31 AM ET / 08:31 UTC. ClawSweeper reviewWhat this changesThe PR omits regenerated plugin-skill links from new backups, validates archive symlinks, and improves restore cleanup error reporting. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked by patch quality or review findings - 7 items remain Keep this PR open: its prior P1 remains. The new verifier rejects every absolute symlink, so a default-profile archive created before this PR still fails before restore even though that generated index is fully OpenClaw-owned and regenerable. Priority: P1 Review scores
Verification
How this fits togetherBackup create packages profile state, verify checks the archive before any writes, and restore extracts it into a fresh staging directory. Plugin skills are published as generated links under the profile state directory. flowchart LR
A[Profile state] --> B[Backup create]
B --> C[Archive verification]
C --> D[Restore extraction]
D --> E[Restored profile]
C --> F[Archive safety error]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +90, Tests +126, Docs +6. Total +222 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Recognize the manifest-derived plugin-skill index as regenerable, omit it before extraction for old and new archives, and continue rejecting every other absolute or archive-escaping link. Do we have a high-confidence way to reproduce the issue? Yes, by source: create an archive containing the manifest-derived plugin-skill index with its generated absolute target, then restore it; the proposed verifier rejects it before extraction. Is this the best way to solve the issue? No: omitting the index from newly created archives is sound, but rejecting every such link leaves already-created default-profile archives unrestored. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c500ab7cc0d7. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
a19c98e to
bf1ae58
Compare
|
Merged via squash.
|
* fix(backup): make default-profile backups restorable * fix(backup): preserve restore cleanup context * refactor(backup): drop preserve-caught-error suppression via hoisted cleanup error * refactor(backup): hoist restore failure handling out of catch scopes
What Problem This Solves
Fixes an issue where
openclaw backup restorefailed for default profiles afterbackup createandbackup verifyhad succeeded. Fresh profiles publish absolute generated links underplugin-skills/; node-tar rejected those during strict extraction, and cleanup then raced still-pending writes, leaving operators with only anENOTEMPTYcleanup error instead of the restore cause.Why This Change Was Made
Backup creation now reports and omits the OpenClaw-owned, regenerable
plugin-skills/symlink index. Verification retains legitimate relative symbolic links whose resolved targets stay inside the archive root, rejects absolute and archive-escaping targets before extraction, and reports the checked symlink count.Restore keeps node-tar's warning-as-error behavior without its early-rejection race: it captures every recoverable extraction warning, waits for extraction to close, then rethrows the first warning. If cleanup also fails, an
AggregateErrorpreserves the extraction error as the primary cause and retains the cleanup error as the second error.The node-tar 7.5.22 contract behind the failure is
dist/esm/unpack.js'sSTRIPABSOLUTEPATHguard (lines 213-257), which emitsTAR_ENTRY_INFO: stripping / from absolute linkpath;dist/esm/warn-method.jslines 13-25 turns that warning into anerrorin strict mode; anddist/esm/extract.jslines 24-26 rejects onerrorbefore the latercloseevent.AI-assisted: yes (Codex). No agent transcript is included.
User Impact
Operators can create, verify, and restore normal default-profile archives successfully. Unsafe absolute or escaping symlinks fail during verification with the offending entry and target named, incomplete extraction is actually removed before failure returns, and restore output explains how to regenerate plugin-skill links with
openclaw skills listor a normal agent session.Production LOC: +91/-13 (net +78) | Tests: +131/-5 (net +126) | Docs: +10/-4. The production growth implements the create/verify/restore ownership and security contracts; it does not add compatibility or retry paths.
Evidence
br1created and verified a 47-entry archive, then restore failed withBackup restore failed and the incomplete target could not be cleaned ... ENOTEMPTYwhile the originalTAR_ENTRY_INFOrejection was swallowed.plugin-skillsreported asregenerable; verify returnedsymlinkCount: 0; restore completed;openclaw skills listrecreated both generated links from current plugin metadata.Archive symbolic link target must be relative ...and did not create the target directory.node scripts/run-vitest.mjs src/commands/backup-restore.test.ts src/commands/backup-verify.test.ts— 35 passed, 1 platform skip.node scripts/run-vitest.mjs src/infra/backup-create.test.ts --testNamePattern 'preserves noncanonical symlinked SQLite paths without dereferencing them'— targeted symlink contract passed.pnpm docs:check-mdx && pnpm docs:check-links— passed; 6,493 internal links checked, 0 broken.node scripts/check-changed.mjs— passed in Blacksmith Testbox; https://github.com/openclaw/openclaw/actions/runs/31773078705.agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output— clean after the final error-contract adjustment; no accepted/actionable findings.