Skip to content

fix: keep moved capture directories out of exports - #143899

Merged
fuller-stack-dev merged 4 commits into
mainfrom
fix/update-capture-marker
Sep 10, 2026
Merged

fuller-stack-dev merged 4 commits into
mainfrom
fix/update-capture-marker

Conversation

@fuller-stack-dev

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

Copy link
Copy Markdown
Member

Related: #143799

What Problem This Solves

Fixes an issue where backups or support exports could include private update-capture files after the original state directory was removed or a retained capture directory was relocated. The paired-root exclusion introduced in #143799 cannot identify those paths on its own.

Why This Change Was Made

The existing shared export guard now recognizes a fixed, versioned, exclusion-only marker in a selected directory or its ancestors. It checks lexical and canonical paths, reads only the bounded regular marker file without following marker symlinks, and rejects malformed, unreadable or changed markers. It never parses workspace manifests or scans other state roots. Archive planning checks original lexical selections and their canonical targets before deduplication, including managed-skill target promotion. Archive traversal errors are carried through to a publication refusal after tar settles.

The producer contract is .openclaw-private-update-capture containing exactly openclaw-private-update-capture-v1\n. Producers must durably write it before raw data in each independently movable container. Producer creation, capture/reopen, lifecycle eligibility and deletion are separate work. The marker grants exclusion only, not ownership or authority. This patch creates no captures and changes no retention policy.

User Impact

Marked directories remain excluded after owner removal, relocation or copying with their markers intact. Explicit SQLite/Git inputs and support-export aliases get the same protection. Healthy siblings, similarly named directories and ordinary manifest files remain usable. Unmarked files copied out of protected directories are outside this classification rule.

Evidence

  • Six new real-caller regressions failed on the original guard: enclosing/nested archive selection, malformed-marker publication refusal, explicit SQLite/Git inputs, and support config/log/stability inputs.
  • Nine new reader controls failed on the original guard: malformed/type/version/size cases, unreadable marker, FIFO refusal without opening it, and identical-byte replacement during a bounded read.
  • Initial marker candidate: 32 affected archive/snapshot/support tests plus ten reader controls passed. The subsequent lexical-admission correction passed all 22 archive/privacy cases plus three healthy managed-skill archive controls. The unchanged reader/support results remain applicable and were not replayed. Original failure logs are preserved.
  • Initial P0/P1/P2 review found one short-circuit inconsistency. It was reproduced in three additional controls and fixed by validating full marker ancestry before legacy exclusion. The original finding is preserved. The unused-export gate also required moving the shared constants into a format-only module with a real production consumer. Final required changed-source checks passed, including core/test typechecks, unused-export scans, lint and repository guards. Exact-head CI is required before native landing.
  • Later ClawSweeper review found lexical workspace ancestry lost before canonical deduplication. Four real-archive regressions reproduced that issue and the same planner's managed-skill target-promotion route. The correction checks both original and resolved selections before deduplication, excludes marked outward aliases, refuses malformed marked selections even with duplicate canonical targets, and preserves independently selected healthy targets. That candidate received a scoped-clean P0/P1/P2 review; the subsequent selector correction is reviewed separately below. The required changed-source checks passed, including core/test types, unused-export scans, lint and repository guards. Exact-head CI and native landing remain mandatory.
  • Tests use disposable synthetic data. No installed artifact was built here; the existing installed-proof owner retains that separate job. No historical/manual capture or evidence was deleted.

Selector review correction

Head 1d52df6ac822bf7a22e46a2cbc53e795c88b2850 also checks original agent roots and global/agent SQLite/Git database paths before canonicalization. Best-effort outcome recording cannot reopen a rejected private global database. This keeps the same exclusion-only marker contract and does not modify producer or lifecycle code.

Six new actual archive/SQLite/Git command cases fail before the correction and pass after it. They verify refusal without repository publication or source-byte mutation for valid and malformed marked selectors, then healthy operation for the same ordinary alias after removing only its disposable fixture marker. The existing 22 archive cases were not rerun for this addition; earlier reader/support/skill passes are preserved. A first attempt exposed a fixture runtime-cache mistake and a first repair exposed outcome-recording source mutation; both failures are preserved. Two missing test-loop braces found by lint were fixed mechanically without production or behavioral changes.

Fresh full-candidate review through P2 reported one --only-config finding. The original config path is already guarded before that early return. Two actual public createBackupArchive({onlyConfig:true}) controls, with valid and malformed markers, both refuse with the expected diagnostic, no archive and unchanged sources. The finding is rejected with this evidence; the raw findings verdict is retained, not relabeled as a clean review. No actionable finding remains from that review. Exact-head CI and native preparation/merge gates remain mandatory.

Current measured scope: 10 files, +636/-21. No raw capture creation, retention change, historical deletion or installed build.

@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.

@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
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 10, 2026 09:16
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 10, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Exact-head CI found an unrelated existing failure: check-lint-core-2 reports ui/src/components/desktop/desktop-panel.ts at 703 counted lines against the 700-line limit. Failed job.

The file is blob-identical on this PR and its base. Existing #143896 fixes that precise lint error (+1/-5 in the desktop file); no duplicate UI change is being added here. Original failure logs are preserved. Privacy local checks, 42 focused tests and native review validation passed. Required CI is not green, so preparation/merge remain unstarted.

@fuller-stack-dev
fuller-stack-dev force-pushed the fix/update-capture-marker branch from fa58307 to 25264b7 Compare September 10, 2026 09:30
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

The required lint failure is addressed by already-merged #143889 (7b6287b2), so this PR is now rebased onto that exact correction at 25264b710a8e56f4688159efc9c17f7f8e027879. No duplicate desktop fix was added.

All seven privacy source SHA256 hashes and the +364/-7 diff match the reviewed/tested candidate. The 42 focused passes and required local checks remain applicable; original failures are preserved. Successor exact-head CI is pending, and native review is being refreshed. No raw capture creation, retention change, cleanup or installed build was introduced.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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, 6:31 AM ET / 10:31 UTC (Revision 4).

ClawSweeper review

What this changes

Extends backup and support-export exclusions to marked private capture directories after relocation, preserving checks through path aliases and refusing malformed markers.

Merge readiness

✅ Ready for maintainer review

The PR remains useful: current main lacks moved-directory marker recognition. The prior lexical-selection findings are addressed, and this review found no remaining blocking defect.

Priority: P2
Reviewed head: 1d52df6ac822bf7a22e46a2cbc53e795c88b2850

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-owner repair with meaningful caller coverage and the prior actionable findings resolved.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply. Reported archive and database-command regressions cover the changed guard; installed proof remains separate and was not claimed or executed here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply. Reported archive and database-command regressions cover the changed guard; installed proof remains separate and was not claimed or executed here.
Evidence reviewed 9 items Current main still needs this change: The fetched main revision recognizes selected-state and paired capture roots but contains no privacy-marker reader. The merged prerequisite #143799 explicitly leaves moved and orphaned captures outside its layout rule.
Latest-release check: The shared capture-exclusion module does not exist in the supplied latest release, v2026.9.3; current-main inspection separately confirms that the proposed marker implementation remains absent.
Prior finding resolved: The selector correction checks original agent roots and global/agent database selections before canonicalization, and guards best-effort outcome recording against reopening a rejected global database. GitHub’s commit patch independently verified the correction after a local historical-blob read failed.
Findings None None.
Security None None.

How this fits together

OpenClaw’s export guards screen selected config, workspace, and database paths before producing backup archives, SQLite/Git snapshots, or support bundles. This change extends their shared private-capture classification.

flowchart TD
  A[Selected files and directories] --> B[Lexical and canonical paths]
  B --> C[Shared capture exclusion guard]
  C --> D[Exclude marked captures]
  C --> E[Refuse malformed markers]
  C --> F[Ordinary export processing]
  F --> G[Backup or support artifact]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +117, Tests +486, Docs +12. Total +615 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 6 134 17 +117
Tests 3 487 1 +486
Docs 1 15 3 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 636 21 +615

Review metrics

Metric Value Why it matters
Production versus test growth Production +117 net lines; tests +486 net lines Production growth supports bounded marker validation and caller admission; tests cover distinct export and alias failure paths.

Technical review

Best possible solution:

Keep one shared exclusion guard across export paths, preserve ordinary unmarked inputs, and retain capture creation and lifecycle authority with their existing owners.

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

Yes, from source: selecting a relocated marked directory outside the managed or paired layout bypasses current main’s classification. The PR supplies caller regressions, but this review did not execute them.

Is this the best way to solve the issue?

Yes. Extending the existing shared guard preserves one classification owner, and the corrected callers retain lexical selections before resolving aliases.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0669f6b2c5be.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply. Reported archive and database-command regressions cover the changed guard; installed proof remains separate and was not claimed or executed here.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded privacy-exclusion repair for backup and support exports, without evidence of an urgent deployed regression.
  • 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 author is a repository MEMBER, so the external-contributor proof gate does not apply. Reported archive and database-command regressions cover the changed guard; installed proof remains separate and was not claimed or executed here.

Evidence

What I checked:

  • Current main still needs this change: The fetched main revision recognizes selected-state and paired capture roots but contains no privacy-marker reader. The merged prerequisite fix(backup): exclude private update captures from ordinary exports #143799 explicitly leaves moved and orphaned captures outside its layout rule. (src/infra/update-capture-paths.ts:39, 0669f6b2c5be)
  • Latest-release check: The shared capture-exclusion module does not exist in the supplied latest release, v2026.9.3; current-main inspection separately confirms that the proposed marker implementation remains absent. (src/infra/update-capture-paths.ts, 1391f7cd2d40)
  • Prior finding resolved: The selector correction checks original agent roots and global/agent database selections before canonicalization, and guards best-effort outcome recording against reopening a rejected global database. GitHub’s commit patch independently verified the correction after a local historical-blob read failed. (src/commands/backup-shared.ts:580, 48957843b34a)
  • Reader and publication safeguards: The marker reader validates regular-file type, exact bounded contents, and descriptor/path mutation fingerprints across both path spellings. Archive traversal captures guard failures and rejects the prepared archive before publication. (src/infra/update-capture-paths.ts:16, 1d52df6ac822)
  • Dependency contract signal: The introduced marker reader calls openRootFileSync and readFileDescriptorBoundedSync through this adapter, which delegates to @openclaw/fs-safe; package.json pins version 0.8.5. This establishes the relevant filesystem dependency boundary, with no Codex-runtime dependency. (src/infra/boundary-file-read.ts:3, 1d52df6ac822)
  • Pinned filesystem dependency inspected: Verified repository ownership and resolved v0.8.5 to this commit. Its root-file opener defaults to rejecting symlinks and hardlinks; pinned opening checks file identity and size, and bounded reading consumes at most the limit plus one byte. (src/root-file.ts:72, eb2294eeb6af)

Likely related people:

  • Jason (Json): Raw commit 088b347 adds src/infra/update-capture-paths.ts:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 088b3471adaf; files: src/infra/update-capture-paths.ts)

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-10T09:46:15.303Z sha 25264b7 :: blocked before merge. :: [P2] Check lexical workspace paths before canonical deduplication
  • reviewed 2026-09-10T10:08:32.268Z sha bfb7491 :: blocked before merge. :: [P2] Preserve lexical admission for agent and database selections
  • reviewed 2026-09-10T10:15:09.962Z sha bfb7491 :: blocked before merge. :: [P2] Preserve lexical admission for agent and database selections

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

The lexical-admission finding is fixed at bfb749125126addca6dedb3b565cf9ad14fb33bf. Archive planning now validates the original selection and resolved target before canonical deduplication. Managed-skill promotion checks the lexical skill path before adding an external target.

Four real-archive cases failed before correction. The final run passed all 22 archive/privacy cases and three healthy managed-skill controls, including malformed-marker refusal with a duplicate canonical selection and healthy independent-target inclusion. The fixed marker reader, constants and support code are unchanged. Fresh full-candidate P0/P1/P2 review found no actionable findings. Original red results and the earlier green CI are preserved; new exact-head CI is required for this correction.

The PR remains exclusion-only: no producer edits, capture enablement, lifecycle authority or deletion.

@clawsweeper re-review

@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

Copy link
Copy Markdown
Member Author

Addressed the agent/database selector finding in 48957843b34abf17e06c02b8f670068b9936f25b; current head 1d52df6ac822bf7a22e46a2cbc53e795c88b2850 adds only the fixture brace-lint correction.

Original agent roots and SQLite/Git database selections are admitted before realpath; best-effort outcome recording also refuses marked state rather than reopening it after rejection. Six real-command regressions have preserved red/green results, including no archive/repository publication, unchanged source bytes, and healthy ordinary alias use.

Full-candidate local review through P2 raised only a config-only bypass already blocked by the existing original-path assertion before the early return. Two real --only-config archive controls verify valid/malformed marker refusal without publication or source changes; the raw finding and evidence-based rejection are retained. Constants, producer-before-raw ordering and exclusion-only authority are unchanged. Required exact-head checks and native landing remain in progress.

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 10, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 0670cd2 into main Sep 10, 2026
189 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/update-capture-marker branch September 10, 2026 10:48
@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
* fix: keep moved capture directories out of exports

* fix: preserve lexical privacy admission before archive deduplication

* fix: guard original backup database selections before canonicalization

* test: satisfy backup privacy fixture brace lint
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
* fix: keep moved capture directories out of exports

* fix: preserve lexical privacy admission before archive deduplication

* fix: guard original backup database selections before canonicalization

* test: satisfy backup privacy fixture brace lint

(cherry picked from commit 0670cd2)
necromman pushed a commit to necromman/openclaw that referenced this pull request Sep 16, 2026
배치 A 체리픽이 이 포크에 없는 중간 리팩터링에 걸린 지점을 포크 코드에 맞춰 정리했다.

- 문자열 이스케이프 복구: attempt-prompt-build.ts, attempt-prompt-context.test.ts
- openclaw#140859: session-accessor.entry-mutation.ts 의 transcript 헤더 import 복원
- openclaw#141247: runs.ts 에서 포크에 없는 projectSessionActive 조건 제거
- openclaw#141471: execute-plugin.test-support.js 가 없어 native-bash 테스트 파일 제거
- openclaw#141960: quickjs-wasi 3.6.0 의 MAX_STACK_SIZE 를 쓸 수 없어 되돌림(포크는 3.5.0 핀)
- openclaw#142130: agents.ts 의 assertCurrent 호출 제거, cleanup-utils 는 선택 인자로 유지
- openclaw#142158: manifest-planner.ts 의 remoteModelIds·manifestModelsById 복원
- openclaw#143308: simple-completion-runtime.ts 에 acquireSimpleCompletionModelForAgent 래퍼 추가
- openclaw#143899: src/infra/file-descriptor.ts 의 fingerprint 비교 헬퍼 이식, backup-shared 의 configCapture 참조 제거

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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: L 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