Repository navigation
fix(backup): state-only backup fails on files under a shared workspace base - #139598
Conversation
Workspace discovery collects effective agent workspaces only. With an explicit roster the agents resolve to subdirectories of agents.defaults.workspace, so the base itself is never in that set: <base>/main is excluded while <base> is walked. An ordinary file beneath the base, such as an absolute venv symlink in its tmp subtree, then fails a --no-include-workspace backup. Add the configured base to the excluded set. This is done where includeWorkspace is known rather than in collectWorkspaceDirs, because that helper also supplies the archive set for --include-workspace; adding the base there would newly archive the base's scratch contents and hit the same symlink that breaks the state-only run today. The existing guard dropping excluded aliases that are or contain the state root still applies, so pointing the base at the state directory cannot drop ordinary state, config, or credential files from the archive.
|
🦞👀 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 5, 2026, 10:42 PM ET / September 6, 2026, 02:42 UTC. ClawSweeper reviewWhat this changesExclude the configured shared workspace base from state-only backups while preserving nested agent state and partial backups of invalid configurations. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and the latest release retain the reported gap. The supplied CLI proof covers successful backup creation and recovery controls, and no blocking patch defects were found. Priority: P2 Review scores
Verification
How this fits togetherThe backup planner combines configuration, workspace paths, and durable state ownership into an archive inventory. Archive creation uses that inventory to skip workspace content, preserve nested state, and validate included symbolic links. flowchart TD
A[Configuration and local state] --> B[Backup scope selection]
B --> C[Workspace exclusion discovery]
C --> D[Durable state inventory]
D --> E[Filtered archive traversal]
E --> F[Symbolic link validation]
F --> G[Verified backup archive]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +27. Total +35 across 3 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep workspace exclusion discovery in the backup planner and reuse the existing inventory to preserve durable owners and archive containment. Do we have a high-confidence way to reproduce the issue? Yes: current source supports the explicit-roster/shared-base symlink reproduction, and the supplied CLI comparison records the failure. This read-only review did not execute it. Is this the best way to solve the issue? Yes: adding the missing exclusion at backup discovery preserves full-backup and cleanup behavior while reusing established nested-owner protection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 95f963e342ab. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Added the CLI proof the review asked for. Same fixture on both sides, in an isolated home: explicit roster,
Worth noting for the record: the earlier unit test asserted the planner, this asserts the command. I kept both, since the unit test is what fails on reverted source and pins the reason. |
|
landpr-approve-unrelated-red Using the standing approval for proven unrelated CI failures. The completed run has 137 successful jobs, 17 skipped jobs, and one failed child, check-additional-boundaries. The aggregate CI status reports that same failure. The child fails only because the services test group contains 721 roots, above its unchanged limit of 720. PR #139592, authored and merged by @steipete as This run executed merge The repaired backup CLI, independent archive-content acceptance, 164 focused tests, full changed-file checks, and final exact-head review passed. |
|
landpr-approve-unrelated-red |
|
Thanks @ayaangazali! Proof: The real backup CLI reproduced the failure on main, then produced verified state-only archives with the repair. Independent source-blind checks inspected archive contents and confirmed all 57 retained fixture files kept their original bytes. Focused backup and cleanup tests: 164 passed.
Full-backup selection, cleanup discovery, overlapping state paths, and included-state link rejection were also verified. CI exception: Run 34006942063 completed with 137 successful and 17 skipped jobs. Its only failed child was check-additional-boundaries, which reported services 721 test roots above the unchanged 720 limit; the aggregate gate reports that failure. PR #139592, authored and merged by @steipete as This CI run tested merge |
* origin/main: fix(ci): rebalance services test roots below the memory bound (openclaw#139645) fix(backup): exclude shared workspace files from state-only archives (openclaw#139598) fix(config): preserve plugin secret references in Settings saves (openclaw#139536) fix(ui): retain real-Gateway browser proof across reruns (openclaw#134274) fix(browser): preserve node filenames in proxy media (openclaw#139559) fix(qa): give hot-reload maintenance proofs their own budgets (openclaw#139580) fix(streaming): preserve assistant items and settled output (openclaw#139507) fix(android): reconnect secondary gateways after rapid lifecycle changes (openclaw#139319) fix(gateway): restart inside a marker-less LaunchAgent no longer kills its caller (openclaw#139628)
* commit '5b099995413589f41904cef1413c62239542aa7c': fix(ci): rebalance services test roots below the memory bound (#139645) fix(backup): exclude shared workspace files from state-only archives (#139598) fix(config): preserve plugin secret references in Settings saves (#139536) fix(ui): retain real-Gateway browser proof across reruns (#134274)
…penclaw#139598) Exclude the configured shared workspace base only for state-only backups with a validated configuration. Preserve nested state owners and invalid-config partial recovery without changing full-backup selection, cleanup discovery, or link containment. Fixes openclaw#139549. Verified with real CLI archives, independent source-blind acceptance, and focused backup and cleanup regression tests. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes #139549.
openclaw backup create --no-include-workspace --verifycan fail before writing an archive when an explicit multi-agent roster shares a workspace base containing an absolute symlink. Ordinary scratch files beneath that base also leak into state-only archives.Why This Change Was Made
State-only backup discovery now excludes the configured shared base as well as effective agent workspaces. It reads the base only from a valid configuration snapshot, preserving partial backups for invalid configurations. The existing inventory continues to preserve nested agent state, active configuration, and credentials.
Full-backup selection, destructive cleanup discovery, and archive link containment keep their existing behavior.
User Impact
Operators can create a verified state-only backup without removing unrelated workspace files. Explicit nested owners remain included, and invalid configurations retain their recovery path.
Evidence
4da5d447f695def5c1d5ac9c81479710a46e45e1: the real CLI rejects the shared-base absolute link, exits 1, and writes no archive. A separate link-free run includes unwanted scratch content.verified: true; extracted archives omit ordinary workspace content and retain state, active configuration, credentials, and nested agent state.Original shared-base repair by @ayaangazali; maintainer validation and recovery correction are AI-assisted.