Skip to content

fix(backup): exclude private update captures from ordinary exports - #143799

Merged
fuller-stack-dev merged 2 commits into
mainfrom
fix/exclude-private-update-captures
Sep 10, 2026
Merged

fuller-stack-dev merged 2 commits into
mainfrom
fix/exclude-private-update-captures

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Related: #142770. Follow-up to #140339.

What Problem This Solves

Resolves a problem where selecting a workspace containing the managed private capture root includes raw capture files in an ordinary backup. Explicit capture-file inputs can also enter support exports, SQLite snapshots and Git backups. The accepted capture design requires this boundary before enabling capture creation.

Why This Change Was Made

Exclude the selected state's exact managed <stateDir>.update-captures/ root and another state's exact paired root through the existing backup inventory, archive traversal, named support inputs, and shared snapshot producer. Explicit nested workspace selection cannot override this exclusion. Config or database backup sources inside those roots are refused. Cross-state recognition checks only the selected path's lexical and canonical ancestors for an exact <owner>.update-captures directory paired with an existing <owner> directory. Similarly named and unpaired unrelated workspace directories stay included. This directory-layout rule is not writer authority and cannot identify moved, renamed or orphaned captures belonging to another state.

Accepted storage/privacy decision: #140339 (comment)

Accepted prospective transaction-scoped lifetime revision: #140339 (comment)

This is the independent privacy prerequisite. It does not create retained captures, change ordinary snapshot sanitization, add cleanup/pruning, implement replay, or touch #143750/#143752 package mutation ownership. Capture/reopen will follow separately on this boundary.

User Impact

Managed raw update artifacts cannot be included accidentally in ordinary backup and support exports through these paths. Existing ordinary config/workspace files and backup sanitization remain supported. This is not a guarantee for raw data manually copied outside the managed root.

Evidence

  • Seven new privacy controls fail on unchanged production source for the intended reason: parent/nested workspace archives, full/config-only backup source selection, SQLite/Git snapshot source selection, and support export inputs.
  • Final validation on 3d665e6a passes eleven archive/SQLite/Git controls and all thirteen support-export tests, including ordinary sanitization and healthy-error cases. Six cross-state regressions failed on the previous guard for the intended reasons and pass with this correction. The archive case reads real tar output, verifies the archive, preserves both healthy neighbors, and checks source bytes.
  • The existing transient-row sanitization/global-owner control also passes (one selected test; 65 unrelated cases skipped).
  • Archive tests read the real tar output and run the existing archive verifier. Snapshot controls use real canonical shared SQLite files. Fixtures retain source bytes.
  • The earlier P0/P1/P2 review is preserved. Fresh full-candidate review through P2 found one index-only P1 because the old guard was unstaged; staging the exact reviewed working-tree correction resolved it. The committed bytes match the reviewed candidate, with no unresolved findings. This is scoped review, not universal correctness.
  • node scripts/check-changed.mjs passed, including core/test typechecks, changed-file lint, formatting, dead-export scans, import-cycle and database/storage guards. Exact-head CI remains a landing gate; its current failures and pending jobs are tracked in the PR checks.
  • Scope: 10 files, +353/-4. The cross-state production correction is +32/-2 in the existing shared path guard; no CI, package-mutation or updater files are added.
  • Separate CI provisioning correction fix(ci): provision ripgrep for byte-path grep tests #143835 is owned independently. Publication does not depend on its source; green exact-head required checks remain necessary for landing. No CI bypass or whole-journey prerequisite is introduced.

Installed proof

  • The existing installed-proof owner verified five public archive cases and three offline support-export cases on exact head 754c650c, using one unchanged installed package. Source-family receipts and output archive hashes were checked.
  • The original include-reference case remains FAIL against its required privacy diagnostic. Its fixture referenced a sibling directory outside the config root without OPENCLAW_INCLUDE_ROOTS, so config confinement rejected it before the export guard.
  • Two local source controls confirm that diagnosis. The original layout produces the saved unresolved-graph error; the same layout with an explicitly allowed include root produces Private update captures are excluded from backups and support exports. Both publish nothing and preserve source bytes and identities. No product change was needed. Corrected installed confirmation remains with the same proof owner.
  • Six prepared explicit-input SQLite/Git API cases remain unrun because those APIs are not exported by the installed package. Local source tests are not claimed as installed coverage.

No live Gateway or production user data was modified. The installed tests used only synthetic task-owned files in the existing proof runtime. Historical evidence and the failed include assertion remain preserved. Earlier capture proofs and successful installed cases were not rerun.

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 10, 2026 07:05
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 4:01 AM ET / 08:01 UTC (Revision 4).

ClawSweeper review

What this changes

Exclude managed private update captures from backup archives, SQLite snapshots, Git backups, and diagnostic support exports, including cross-state paths and canonical aliases.

Merge readiness

✅ Ready for maintainer review

This privacy prerequisite remains necessary on current main. The updated guard addresses cross-state captures and canonical aliases; no actionable introduced defect was found. The accepted design and maintainer-authored status support retaining this PR.

Priority: P2
Reviewed head: 3d665e6a9a0e82137e7569a9de3baf451fc45ee6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful boundary tests and candid proof limits; no blocking patch defect was identified.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this MEMBER-authored PR, and the patch does not introduce an authority-bearing value. Earlier installed archive/support results remain credited to their recorded head; current cross-state coverage is reported source-test evidence, with installed include/API gaps explicitly preserved.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this MEMBER-authored PR, and the patch does not introduce an authority-bearing value. Earlier installed archive/support results remain credited to their recorded head; current cross-state coverage is reported source-test evidence, with installed include/API gaps explicitly preserved.
Evidence reviewed 8 items Pinned revision and introduction: The checkout and live PR head are 3d665e6. Its raw parent is 754c650. The GitHub commit patch confirms the latest correction adds paired-root recognition and cross-state controls. Endpoint drift and the stale test merge were not treated as introduced changes.
Shared exclusion boundary: The guard checks the selected state's lexical and canonical capture roots, then examines lexical and canonical ancestors for the documented paired-directory layout. Backup inventory and archive traversal apply this exclusion before ordinary inclusion overrides; explicit config and database inputs are refused.
Current-main necessity: Fetched main has no update-capture-paths.ts guard. Its shared snapshot producer still proceeds directly to validation and snapshot creation, and its support-export readers lack capture exclusions. The existing sanitizers therefore do not implement this location-based privacy contract.
Findings None None.
Security None None.

How this fits together

Backup and diagnostic exporters turn selected state, configuration, workspace, database, and log inputs into portable artifacts. The shared path guard excludes private update captures before those inputs enter ordinary exports.

flowchart TD
  A[Selected files and databases] --> B[Resolve lexical and canonical paths]
  B --> C{Managed capture location?}
  C -->|Yes| D[Skip workspace content or refuse explicit input]
  C -->|No| E[Existing backup and sanitization flows]
  E --> F[Archive, snapshot, Git backup, or support ZIP]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +113, Tests +221, Docs +15. Total +349 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 7 117 4 +113
Tests 2 221 0 +221
Docs 1 15 0 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 353 4 +349

Review metrics

Metric Value Why it matters
Production versus test growth Production +117/-4; tests +221/-0 Production growth centralizes the path rule and applies it at existing export boundaries; tests exercise excluded inputs, retained neighbors, and source preservation.

Technical review

Best possible solution:

Keep one shared capture-location exclusion across exporters while preserving ordinary sanitization and keeping capture creation, recovery, and retirement in their separately owned work.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: a workspace containing a managed capture root reaches ordinary archive traversal on main without a capture-specific exclusion. The branch supplies focused artifact-content controls; this review did not execute them.

Is this the best way to solve the issue?

Yes. A shared path predicate applied through existing inventory, export readers, and snapshot production is a narrow implementation of the accepted privacy contract; it adds no capture store or competing recovery mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 704a40190788.

Labels

Label justifications:

  • P2: This is a bounded, accepted privacy prerequisite for update captures, without evidence of an active shipped-user emergency.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this MEMBER-authored PR, and the patch does not introduce an authority-bearing value. Earlier installed archive/support results remain credited to their recorded head; current cross-state coverage is reported source-test evidence, with installed include/API gaps explicitly preserved.

Evidence

What I checked:

  • Pinned revision and introduction: The checkout and live PR head are 3d665e6. Its raw parent is 754c650. The GitHub commit patch confirms the latest correction adds paired-root recognition and cross-state controls. Endpoint drift and the stale test merge were not treated as introduced changes. (3d665e6a9a0e)
  • Shared exclusion boundary: The guard checks the selected state's lexical and canonical capture roots, then examines lexical and canonical ancestors for the documented paired-directory layout. Backup inventory and archive traversal apply this exclusion before ordinary inclusion overrides; explicit config and database inputs are refused. (src/infra/update-capture-paths.ts:40, 3d665e6a9a0e)
  • Current-main necessity: Fetched main has no update-capture-paths.ts guard. Its shared snapshot producer still proceeds directly to validation and snapshot creation, and its support-export readers lack capture exclusions. The existing sanitizers therefore do not implement this location-based privacy contract. (src/snapshot/openclaw-snapshot-copy.ts:53, 704a40190788)
  • Latest-release comparison: The v2026.9.3 shared snapshot producer likewise has no private-capture exclusion. No shipped implementation of this PR's boundary was established. (src/snapshot/openclaw-snapshot-copy.ts:53, 1391f7cd2d40)
  • Accepted scope and lifecycle separation: Read feat(update): retain compatible package rollback and safe recovery admission #140339 (comment) and feat(update): retain compatible package rollback and safe recovery admission #140339 (comment). They require backup/support exclusion before capture creation and explicitly separate this prerequisite from capture production, retirement, and package mutation. GitHub confirms that related rollback PR merged, but its scope does not replace this exclusion.
  • Regression coverage and proof boundaries: Inspected archive-content assertions, archive verification, retained source-byte checks, six SQLite/Git input cases, and support-export exclusion and healthy-path tests. The captured PR body reports 24 focused passes at the current head. Installed archive/support observations belong to 754c650; the corrected installed include diagnostic remains pending and six installed API cases remain unrun. These limitations were not relabeled as current-head installed passes. No tests or target code were executed during this read-only review. (src/commands/backup-capture-privacy.test.ts:74, 3d665e6a9a0e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-10T07:16:12.081Z sha 754c650 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-10T07:24:48.450Z sha 754c650 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-10T07:42:00.709Z sha 754c650 :: needs maintainer review before merge. :: none

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Review only the updated privacy PR at 3d665e6a9a0e82137e7569a9de3baf451fc45ee6. The cross-state finding is repaired with exact paired-root and canonical-alias recognition in the existing guard. Six new red/green controls and 24 final focused passes are described in the updated PR body. The original include diagnostic failure remains preserved as a fixture issue. No repair, CI changes, rebase, build or automerge is requested.

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@fuller-stack-dev
fuller-stack-dev merged commit 088b347 into main Sep 10, 2026
308 of 312 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/exclude-private-update-captures branch September 10, 2026 08:46
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…penclaw#143799)

* fix(backup): exclude private update captures from ordinary exports

* fix: exclude cross-state private update captures
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
…penclaw#143799)

* fix(backup): exclude private update captures from ordinary exports

* fix: exclude cross-state private update captures

(cherry picked from commit 088b347)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant