Repository navigation
fix(backup): keep Nix-managed config symlinks in verified archives - #136486
NianJiuZst wants to merge 1 commit into
Conversation
Canonicalize config/credentials coverage so an in-state absolute symlink to an external store file is declared as a backup asset, rewrite only those links to portable relative archive targets, and leave arbitrary absolute links rejected. Co-authored-by: Cursor <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed September 2, 2026, 2:08 PM ET / 18:08 UTC. ClawSweeper reviewWhat this changesThe PR declares resolved Nix-managed config or credentials targets as backup assets and rewrites eligible absolute archive symlinks to portable relative links. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain The patch is a coherent fix for the linked backup failure and current main still has the failing planning/guard combination. No code defect was found in the introduced change, but this external PR needs real installed-layout proof before merge. Priority: P1 Review scores
Verification
How this fits togetherThe backup CLI turns configured state, config, credential, agent, and workspace paths into declared archive assets, then writes and verifies a tar archive. This PR changes the handoff from asset planning to symbolic-link safety validation. flowchart LR
A[Configured state and config paths] --> B[Backup planner]
B --> C[Declared archive assets]
C --> D[Tar archive writer]
D --> E[Symbolic-link safety guard]
E --> F[Verified backup archive]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +46, Tests +64, Docs 0. Total +110 across 4 files. 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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep this canonical planning-and-remapping design, preserve the declared-asset guard, and land only after redacted installed-layout proof confirms create and verify behavior. Do we have a high-confidence way to reproduce the issue? Yes in source: current main omits the external target from declared assets and then rejects the absolute link; the added direct and chained fixtures encode that layout. This read-only review did not execute the regression. Is this the best way to solve the issue? Yes, subject to real behavior proof: canonical asset coverage followed by archive-relative rewriting immediately before the existing shared guard is the narrow owner-boundary repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1212f991db46. 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
|
|
Thanks for independently validating the chained-link and documentation gaps. I incorporated that follow-up into the earlier #136343 branch, credited you as co-author, removed its unrelated Codex-profile exclusion from the final diff, and added the missing real Nix-store |
|
Thanks for consolidating this. I confirmed that #136343 includes the chained-link and documentation follow-up, removes the unrelated Codex-profile exclusion, preserves co-author credit, and supplies the requested real Nix-store |
Closes #136326
What Problem This Solves
Fixes an issue where operators using NixOS or Home Manager could not create a native OpenClaw backup when
openclaw.jsonwas an absolute symlink to an immutable store file.Why This Change Was Made
Backup coverage now uses canonical paths, so a lexically in-state config or credentials link that resolves outside the state directory becomes a declared backup asset. During archive write, an absolute symbolic link is rewritten to a portable relative archive link only when its real target is contained by a declared asset. The remapper canonicalizes first-hop
readlinkvalues so a chained store symlink still maps onto that declared asset. Arbitrary absolute links still fail closed at the existing archive guard.Related: #136343
User Impact
Nix-managed installations can create and verify native backups without replacing the managed config link. Undeclared or escaping symbolic links remain rejected.
Evidence
Archive symbolic link target must be relative) for both a direct absolute config symlink and a two-hop absolute chain.node scripts/run-vitest.mjs src/infra/backup-create.test.ts: 96 passed.node scripts/run-vitest.mjs src/commands/backup-verify.test.ts: 47 passed, 1 skipped.node scripts/check-changed.mjs --base upstream/main -- src/commands/backup-shared.ts src/infra/backup-create.ts src/infra/backup-create.test.ts docs/cli/backup.md: conflict markers, max-lines, assertion SAFETY, format, typecheck core, and typecheck core tests passed. The dead-export Knip scan could not prepare its pnpm dlx cache in this environment.oxlinton the changed TypeScript files passed.--mode local --base upstream/main --max-priority P2): scoped-clean, patch judged correct at 0.86 confidence.Real NixOS/Home Manager CLI create-and-verify remains a user-owned proof lane; the regressions use the same layout (in-state absolute symlink to an external file) and call
backupVerifyCommandon the published archive.