Repository navigation
fix(backup): preserve literal repository and restore paths - #195644
Leon-SK668 wants to merge 3 commits into
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: blocked before merge. What this changesPreserves leading and trailing whitespace in backup repository, snapshot, restore-target, and scratch paths. Example: Run openclaw backup git init --repository '/private/backup ' --json.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR fixes wrong-directory selection still present on current main, and no actionable code defects were found. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherBackup CLI arguments flow through shared path resolution into Git and SQLite snapshot owners, which validate filesystem safety and create repositories or restore destinations. flowchart TD
A[Backup CLI arguments] --> B[Shared path resolution]
B --> C[Git backup owner]
B --> D[SQLite snapshot owner]
C --> D
D --> E[Guarded directory creation]
E --> F[Identity pins and durable publication]
Technical reviewBest possible solution: Preserve literal whitespace through the existing shared resolver, snapshot directory owner, and Git path-output boundary while retaining their safety checks. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the trimming path, and supplied baseline/head built-CLI traces demonstrate wrong-directory selection and its correction; this review executed no target code. Is this the best way to solve the issue? The patch repairs the three demonstrated trimming boundaries using existing owners and dependency APIs, with no unnecessary production machinery or parallel policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d3f4f94fbb46. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -4, Tests +30, Docs +1, Other +2. Total +29 across 7 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 HistoryReview history (1 earlier review cycle)
Reviewed November 15, 2026, 10:47 AM ET / 15:47 UTC (Revision 2). |
|
@clawsweeper re-review Refreshed head |
|
🦞👀 Re-review progress:
|
|
Thanks for the work here. We're closing this along with the other open PRs that apply the same change one call site at a time. This series changes symlink, physical-path and literal-path handling at each command separately; path resolution policy belongs in one shared owner and needs a maintainer decision. Please open one issue (or one PR at the shared owner) that covers the whole pattern, with a reproduction of real user-visible harm, instead of separate per-site PRs. Further per-site variants of this pattern will be closed. |
What Problem This Solves
Backup commands silently trim quoted filesystem paths.
backup git init --repository '<parent>/backup 'initializes the differently named<parent>/backup; SQLite listing likewise reports the trimmed repository.Why This Change Was Made
Preserve each original nonblank path through the existing owner chain: shared backup argument resolution, snapshot directory creation via fs-safe's absolute-path API, and Git repository-root readback that removes only the terminating newline.
Existing-solutions preflight: reuse current home expansion and pinned fs-safe0.27.1 APIs; no new path library or global normalizer. Direct dependency implementation confirms absolute directory creation retains literal components and guards directory identities. Existing ancestor canonicalization, private modes/ACLs, directory pins and durable publication remain at their current owners.
This refresh merges main
4f592f12c35c631c857c206d71177f420c30ff9cwithout rewriting contributor/upstream history. It resolves the shared-resolver conflict by retaining main'sExpectedCliErrorblank validation alongside this PR's literal path resolution. Backend production code and its added regressions are unchanged from the previously reviewed head038885153418fff113651caa105b6933a44eba38.User Impact
User impact: quoted repository, snapshot, restore-target and scratch paths retain their leading/trailing spaces. Blank required inputs keep their existing rejection and structured remedy. The Backup CLI reference explains the literal-path contract.
Relative to merged main: 7 files, production +27/-31 (net -4), tests +37/-7, docs +4/-3, existing test-allocation metadata +2. Main's inherited changes are not part of this PR's seven-file repair. No dependency, config/default, database/schema, backup-format, remote-push, permission or compatibility-fallback change.
Evidence
48b92409887ac4e7b8c67883918a3fee2d9250c9at 2026-11-15T15:08:09.617Z; GREENadc987b8fc64b12ed4174c2c81ef4d16c8c97883at 2026-11-15T15:35:23.747Z. Final native build commit equals the refreshed contributor head.statand nativegit rev-parse --absolute-git-dirconfirm the intended metadata, and both neighbor sentinels remain unchanged.OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/commands/backup-shared.test.ts src/commands/backup-git.test.ts src/commands/backup-sqlite.test.ts src/commands/backup-schedule.test.ts --maxWorkers=1 --reporter=dot: 65 passed, exit0,294.76s Vitest/307.43s wrapper. Tests ran against the prepared merged tree, which was verified identical to the committed tree.tsgo, typedoxlint,oxfmtandgit diff --checkpass. Exact-headnode --import ./scripts/tsx.mjs scripts/build-all.mts sourcePerformancebuild passes in260.1s, not full release/package validation.Not tested: remote Git push, production backup data, native end-to-end restore/schedule, Windows/macOS, full repository suite, full release packaging or current upstream CI. Directory safety beyond the exercised scenarios retains the unchanged owner/dependency contracts and prior focused coverage.
Exact-head proof receipt
Captured native before/after readback
Only the temporary fixture prefix is replaced by
<fixture>.{ "before": { "phase": "red", "at": "2026-11-15T15:08:09.617Z", "runtime": "v24.22.1", "head": "48b92409887ac4e7b8c67883918a3fee2d9250c9", "build": { "version": "2026.11.3", "commit": "48b92409887ac4e7b8c67883918a3fee2d9250c9", "builtAt": "2026-11-15T12:56:22.377Z", "buildId": "2026.11.3-48b92409887a-2026-11-15T12-56-22.377Z" }, "ownerSha256": "637f69ce2b43a905edf22c641e4274ff674ad9df9332e07428b3bc4f6f49344f", "fixture": "<fixture>", "commands": [ { "args": [ "backup", "git", "init", "--repository", "<fixture>/git absolute ", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"repositoryPath\": \"<fixture>/git absolute\"\n}\n", "stderr": "" }, { "args": [ "backup", "git", "init", "--repository", " relative git ", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"repositoryPath\": \"<fixture>/relative git\"\n}\n", "stderr": "" }, { "args": [ "backup", "sqlite", "list", "--repository", "<fixture>/sqlite repository ", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"ok\": true,\n \"repositoryPath\": \"<fixture>/sqlite repository\",\n \"snapshots\": []\n}\n", "stderr": "" }, { "args": [ "backup", "git", "init", "--repository", "<fixture>/plain", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"repositoryPath\": \"<fixture>/plain\"\n}\n", "stderr": "" }, { "args": [ "backup", "git", "init", "--repository", " ", "--json" ], "code": 1, "signal": null, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"Missing required --repository value.\"\n }\n}\n", "stderr": "Missing required --repository value.\n" } ], "observations": [ { "boundary": "backup git init", "argument": "<fixture>/git absolute ", "expected": "<fixture>/git absolute ", "actual": "<fixture>/git absolute", "exactMetadataExists": false, "neighborHasMetadata": true, "sentinelIntact": true }, { "boundary": "backup git init", "argument": " relative git ", "expected": "<fixture>/ relative git ", "actual": "<fixture>/relative git", "exactMetadataExists": false, "neighborHasMetadata": true, "sentinelIntact": true }, { "boundary": "backup sqlite list", "argument": "<fixture>/sqlite repository ", "expected": "<fixture>/sqlite repository ", "actual": "<fixture>/sqlite repository", "snapshots": [] } ], "pass": true, "limits": "Isolated local repositories only. No remote push, production state or database format change." }, "after": { "phase": "green", "at": "2026-11-15T15:35:23.747Z", "runtime": "v24.22.1", "head": "adc987b8fc64b12ed4174c2c81ef4d16c8c97883", "build": { "version": "2026.11.3", "commit": "adc987b8fc64b12ed4174c2c81ef4d16c8c97883", "builtAt": "2026-11-15T15:29:52.960Z", "buildId": "2026.11.3-adc987b8fc64-2026-11-15T15-29-52.960Z" }, "ownerSha256": "ccac5208f8a344e349bc31bb9a8a1501c35823cb58bbbca9e9db4cbf05563000", "fixture": "<fixture>", "commands": [ { "args": [ "backup", "git", "init", "--repository", "<fixture>/git absolute ", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"repositoryPath\": \"<fixture>/git absolute \"\n}\n", "stderr": "" }, { "args": [ "backup", "git", "init", "--repository", " relative git ", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"repositoryPath\": \"<fixture>/ relative git \"\n}\n", "stderr": "" }, { "args": [ "backup", "sqlite", "list", "--repository", "<fixture>/sqlite repository ", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"ok\": true,\n \"repositoryPath\": \"<fixture>/sqlite repository \",\n \"snapshots\": []\n}\n", "stderr": "" }, { "args": [ "backup", "git", "init", "--repository", "<fixture>/plain", "--json" ], "code": 0, "signal": null, "stdout": "{\n \"repositoryPath\": \"<fixture>/plain\"\n}\n", "stderr": "" }, { "args": [ "backup", "git", "init", "--repository", " ", "--json" ], "code": 1, "signal": null, "stdout": "{\n \"ok\": false,\n \"error\": {\n \"type\": \"cli_error\",\n \"message\": \"Missing required --repository value.\"\n }\n}\n", "stderr": "Missing required --repository value.\n" } ], "observations": [ { "boundary": "backup git init", "argument": "<fixture>/git absolute ", "expected": "<fixture>/git absolute ", "actual": "<fixture>/git absolute ", "exactMetadataExists": true, "neighborHasMetadata": false, "sentinelIntact": true }, { "boundary": "backup git init", "argument": " relative git ", "expected": "<fixture>/ relative git ", "actual": "<fixture>/ relative git ", "exactMetadataExists": true, "neighborHasMetadata": false, "sentinelIntact": true }, { "boundary": "backup sqlite list", "argument": "<fixture>/sqlite repository ", "expected": "<fixture>/sqlite repository ", "actual": "<fixture>/sqlite repository ", "snapshots": [] } ], "pass": true, "limits": "Isolated local repositories only. No remote push, production state or database format change." } }Complete frozen native proof driver
Use the supported Node runtime against independently built checkouts:
node replace-four-backup-path-proof-20261109.mjs CHECKOUT red OUTPUTorgreen.The output receipt includes its temporary fixture prefix; replace that prefix before sharing.
AI-assisted implementation and author audit. Independent model review was waived by the contributor; no independent-review claim. No unsafe mixed/private agent logs are attached. Reproducible proof driver and sanitized readback are included above.