Skip to content

fix(backup): keep Git backups working after opening the repository in Finder - #162706

Merged
RomneyDa merged 15 commits into
openclaw:mainfrom
oshaughnessy-junior:fix/backup-finder-metadata
Oct 13, 2026
Merged

RomneyDa merged 15 commits into
openclaw:mainfrom
oshaughnessy-junior:fix/backup-finder-metadata

Conversation

@oshaughnessy-junior

@oshaughnessy-junior oshaughnessy-junior commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

backup git create --all treats every entry under agents/ as a database scope and replaces entire scope directories. Finder's .DS_Store therefore trips the ownership check, while ordinary documents inside a valid scope can be deleted or committed by broad replacement/staging.

This fixes the ownership boundary rather than adding a Finder-format exception.

User Impact

Users can refresh and prune Git backups without losing unrelated documents, Finder metadata, or their exact staging. Old refs with extra files remain directly verifiable/restorable, including repositories produced by the current stable release. Historical restores keep their recorded supported schema; normal runtime/Doctor migration owns adoption by the current runtime.

Maintainer Decision

Accept artifact ownership. This intentionally replaces whole-scope ownership: manage only the manifest, schema, and declared tables, while preserving all unrelated working files, staging, and committed history, including Finder metadata and ordinary documents in legacy refs. This is the accepted scope of the maintainer-directed correction, not merely approval of Finder-content classification.

Actual artifact collisions, regular-file checks, pending Git-operation refusal, database identity/version admission, table hashes/counts, SQLite integrity, and fresh-target publication remain. Dedicated-repository guidance and the existing non-backup-ancestry push restriction remain. No history scrubbing is performed.

Why This Change Was Made

  • Refresh and stale-agent cleanup unlink only previously declared artifacts; directories are removed only when empty.
  • A private Git index overlays only successfully refreshed or pruned artifacts, preserving unrelated staged blobs. Degraded configured agents retain their previous committed scope and operator changes.
  • Restore materializes only declared artifacts. Extra files never become database content.
  • Remove Finder binary parsing, namesake classification, metadata-history scanning, and history scrubbing. Artifact preflight/refresh is cohesive; Git orchestration stays in the backend.

Current stable-data proof exposed two existing restore-codec problems: applying current global indexes to historical columns, and using current-only agent maintenance admission for old snapshots. Restore now uses the maintained historical schema-owner admission without migrating historical table data or version markers. Only canonical derived agent indexes are normalized in private staging. Current-runtime/source-copy admission is unchanged; normal runtime/Doctor owns upgrades.

There are no new dependencies, configuration, CLI options, schema definitions, or serialized backup-format changes.

CI Attribution

The original b9e178e baseline-ratchet failure was feature-owned, not inherited: two unchecked error assertions moved into new git-backup-artifacts.ts, exceeding its zero allowance. The job's actual base was 438e06c68838bbc304c5552ba1e371b243677a7c.

Contributor 9db7bccc533d replaced them with hasNodeErrorCode and removed the obsolete git-backup.ts allowance. Contributor 64e707500187 integrated current main and retained its reduced baseline. Both exact commits remain ancestors; no budgets were increased and no gates were exempted.

Evidence

Validated head: e2b0edf3d72bd2372e7f64e587b5916b9bb4e1ad, retaining the contributor's merge of main 73f640e406ce47c5dfface0f3bcec45519de7c53. The residual compatibility correction against 64e707500187 is three files.

Secretless Linux ARM64 Docker, Node 24.21.0, pnpm 12.9.0; synthetic state only, no live Gateway or host secrets. The current normal pnpm openclaw wrapper retains source-CLI admission.

The registry's current latest, [email protected] (b8952d4), creates complete global-20 / agent-24 data through its shipped setup, public SQLite SDK owner, and backup CLI. It successfully creates a backup, then reproduces the .DS_Store refusal after committed extras and different staged/working revisions are added. The candidate directly verifies/restores that unchanged historical ref before any current refresh.

Boundary Observed result
Direct stable-ref global verify and restore 104/104 declared tables match; recorded version 20 retained
Direct stable-ref agent verify and restore 44/44 declared tables match; recorded version 24 retained
Normal active-data upgrade Global 20 → 21; agent 24 → 26; int64/blob payload and SQLite integrity unchanged
Current refresh and no-change control Exact unrelated working bytes, staged blob OIDs/diff, and committed extras retained
Table and removed-agent pruning Only owned artifacts removed; nested extras/staging retained
Git-only collision and recovery Refusal preserves HEAD/index and writes no collision artifact; saved operator document survives successful recovery

Selected proof-driver assertions after supported CLI commands (full redacted terminal and independent observer are linked below):

{"case": "direct-stable-legacy-global", "losslessPayloadAndIntegrity": true, "passed": true, "restoredTableChecks": 104, "tableChecks": 104}
{"case": "direct-stable-legacy-main", "losslessPayloadAndIntegrity": true, "passed": true, "restoredTableChecks": 44, "tableChecks": 44}
{"agentSchemaUpgradedByDoctor": "24 -> 26", "case": "current-cli-normal-upgrade-loads-stable-data", "losslessPayloadAndIntegrity": true, "passed": true}
PUBLIC_CLI_PROOF_PASSED
  • 11/11 CLI behavior cases passed. Independent Node SQLite reads confirm 9223372036854775806 and blob 000102ff, recorded versions, and integrity. Historical refs were not rewritten.
  • Focused real Git/SQLite suites: 35 passed, 1 Windows-only skip across the ownership, backend, and codec tests.
  • Supported pnpm build qaRuntime, production types, affected canonical test types, seven-file type-aware lint, formatting, and scoped correction ratchets pass. Source hashes bind these results to the committed head.
  • Independent scoped Codex review through P2: no actionable findings. It was static review; runtime confidence comes from the CLI/tests above.

Reproducible, sanitized evidence: Manifest and SHA-256 inventory, reproduction README, redacted supported-CLI terminal. Downloaded readback matches all eight tested files byte-for-byte. Signed links expire around 2026-10-20 00:10 UTC; essential results are retained inline.

Native macOS/Windows and full release packaging were not run. Metadata-named files contain opaque bytes; this is artifact admission/preservation proof, not native Finder UI or binary-format recognition. Required hosted CI, ClawSweeper, and human review remain separate exact-head gates. The old stable-compatibility blocker recorded in the previous body is now reproduced and corrected, not waived.

@clawsweeper

clawsweeper Bot commented Oct 1, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR refreshes, prunes, commits, and restores only declared backup artifacts while preserving unrelated files, staging, and history.

Example: An operator opens a Git backup repository in Finder, creating agents/.DS_Store, then runs openclaw backup git create --all.

  • Before: Backup creation refuses agents/.DS_Store as a non-backup-owned scope.
  • After: Backup creation succeeds and leaves .DS_Store and unrelated staged documents unchanged.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The approved repair has supported-CLI and stable-upgrade evidence, meaningful Git/SQLite regressions, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Exact-head supported-CLI evidence in secretless Linux ARM64 Docker covers refresh, pruning, staging and working-file preservation, collision refusal, and direct stable-ref global/agent restore; RomneyDa confirms the linked evidence was downloaded and hash-verified, although this host cannot access its R2 domain.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Finder metadata stops Git backups, and whole-scope refresh can delete or commit unrelated documents.
Reason: The failure is confirmed, and RomneyDa explicitly approved the broader artifact ownership correction and historical restore behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a confirmed backup failure that remains on current main, follows the maintainer-approved ownership boundary, and has no actionable findings.

Priority: P2
Reviewed head: e2b0edf3d72bd2372e7f64e587b5916b9bb4e1ad

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Git backup backend receives selected SQLite snapshots, serializes declared artifacts into Git commits, and reconstructs verified databases from historical refs into fresh targets.

flowchart LR
  A[Backup CLI] --> B[SQLite snapshot owner]
  B --> C[Manifest and table codec]
  C --> D[Artifact preflight and refresh]
  D --> E[Private Git index and commit]
  E --> F[Historical ref materialization]
  F --> G[Schema admission and fresh restore]
Loading

Technical review

Best possible solution:

Land the approved artifact ownership implementation with historical restore admission delegated to the existing schema owners.

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

Current-main source shows agents/.DS_Store reaching the scope refusal, corroborated by obviyus's recorded supported-CLI reproduction; this review ran no target code.

Is this the best way to solve the issue?

Artifact ownership addresses the destructive directory boundary directly, preserves degraded-agent retention, and follows the recorded maintainer decision without introducing Finder-format heuristics.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Whole-scope replacement and staging changes intended behavior with a stated reason (37b4fc8: The original Git backend used dedicated repository scopes for deterministic versioned snapshots; configured-agent retention was subsequently added by the existing backup owner.)
  • Restore owner validation changes intended behavior with a stated reason (37b4fc8: Restore enforced database ownership, integrity, and table digest agreement; stable-data proof exposed current-schema admission rejecting valid historical representations.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +317, Tests +444, Docs +25, Other -1. Total +785 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 469 152 +317
Tests 3 491 47 +444
Docs 1 33 8 +25
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 8 993 208 +785

Review metrics

Metric Value Why it matters
Production versus test LOC Production +469/-152; tests +491/-47 Growth implements artifact-level preflight, private-index commits, historical admission, and real Git/SQLite preservation regressions.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: A confirmed Git backup failure and document-preservation problem affect a bounded operator workflow.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (8 earlier review cycles)
  • reviewed 2026-10-01T13:04:50.960Z sha 0419f78 :: needs real behavior proof before merge. :: [P2] Remove already committed Finder files from refreshed backup scopes
  • reviewed 2026-10-01T14:47:20.597Z sha f3a56c0 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T22:55:42.442Z sha f3a56c0 :: blocked before merge. :: none
  • reviewed 2026-10-09T12:33:22.683Z sha 2b8c75f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T03:20:00.911Z sha 919228a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T08:53:14.731Z sha b9e178e :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T22:37:13.384Z sha 9db7bcc :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T22:54:18.945Z sha 64e7075 :: needs real behavior proof before merge. :: none

Reviewed October 12, 2026, 8:30 PM ET / October 13, 2026, 00:30 UTC (Revision 9).

@oshaughnessy-junior

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 1, 2026
@obviyus

obviyus commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Maintainer verification found a data-safety decision and a legacy-restore gap; this is not ready for landing under a Finder-metadata-only scope.

Tested the supported pnpm openclaw --profile … backup git … CLI in secretless Linux Docker with isolated synthetic state, after integrating current main into the candidate (local ef3ea473f2deab2b46fda721ef4b2edeaab840d3; contributor head f3a56c01053e5469be7bc2611dbcf7f37dec5eeb). A valid binary .DS_Store was generated and read back using the ds_store library; this simulates Finder output, not a macOS Finder UI run.

On current main 60f7030049b9ad5092996ba7c8dde6f98393dd69, the initial backup succeeded, then adding the valid agents/.DS_Store made create --all fail twice (including one real retry) with Refusing to replace non-backup-owned path …/agents/.DS_Store. The baseline used the same source tree with the PR's sole production-file change reverted to that main revision, and the CLI rebuilt before execution.
Observed on the candidate:

  • Adding agents/.DS_Store permits create --all; global verify and restore both succeed, with all 99 table checks passing.
  • A previously committed ordinary text document at agents/.DS_Store is removed from the next backup commit: ls-tree HEAD contains it before refresh and does not afterward. Its bytes remain on disk. Preserving the working file is not the same as preserving backup contents. The selection at src/snapshot/git-backup.ts:423-442 on the contributor head checks Git mode and basename, not whether the content is Finder metadata.
  • A committed valid global/.DS_Store still makes backup git restore --global fail with Git backup ref contains an unexpected file: global/.DS_Store. Refreshing into a new clean commit is not restoration of the old commit; materializeGitBackupRef still rejects that old tree.

The global fixture was initialized through config set gateway.mode local; no agent database was seeded, so --all reported the expected missing-agent degradation warning. These results prove the global restore boundary and agents-root enumeration, not agent-database round trips.

Open decision: is the exact basename .DS_Store contractually reserved even when its bytes are an ordinary user document, or must only positively identified Finder metadata be untracked? The latter is required to preserve namesake user files in backup contents. Legacy refs with real Finder metadata also need a bounded restore policy. I am handing this off rather than silently widening backup-content policy.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. and removed 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 Oct 8, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L and removed size: M labels Oct 9, 2026
@oshaughnessy-junior

Copy link
Copy Markdown
Contributor Author

Pushed 2b8c75f795378f63c26c5d2da24cf5859105b5a1 adopting the recommended Finder-content boundary: ordinary .DS_Store namesakes remain protected in the working tree and committed history; only signature/bounds-confirmed regular Finder metadata is ignored or untracked. Legacy refs now verify/restore recognized metadata at the scope and tables/ roots without refreshing first.

Current isolated validation: 35 tests passed, 1 Windows-only test skipped; core types, type-aware lint, formatting, and diff checks passed. Both global and agent legacy round trips and namesake refusal/preservation are covered. Updated the PR description with test timings, review reasoning, and the additional shipped-CLI attempt's container service-manager limitation.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added the status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. label Oct 12, 2026
@oshaughnessy-junior

Copy link
Copy Markdown
Contributor Author

Published 9db7bccc533d and merge 64e707500187 without rewriting the maintainer's artifact ownership implementation. The actual assertion-safety CI failure is repaired with hasNodeErrorCode and the obsolete baseline allowance removed; the main conflict is resolved. Current hosted CI gate passes with no failed checks, and GitHub reports MERGEABLE.

Updated the PR body with exact-head validation: 33 passing focused tests, one Windows-only skip, assertion safety/types/type-aware lint/format checks, fresh scoped independent review, and the supported qaRuntime build. Supported current-schema CLI creation, refresh, pruning, exact staging/working-file preservation, and prior-ref plus current global/agent verification/restoration all passed in secretless isolation with synthetic data.

The requested latest-stable compatibility exercise uncovered real remaining failures. A backup actually created by published 2026.10.2 using its own global v20/agent v24 database owners fails candidate direct verification: global no such column: retention_id_prefix; agent rejects schema version 24 and asks for doctor --fix. These restore/schema-owner files are unchanged from current main (source comparison; I have not separately built/executed main). The passing current-schema CLI exercise does not clear this cross-version gate.

@RomneyDa: deferring to your artifact-boundary design. Should the historical restore path validate the original stable schema before a separate migration, or should the schema owner perform a supported upgrade while preserving the original manifest/hash contract? I have left the historical backup unchanged and have not broadened restore semantics merely to make proof pass. The explicit manifest-only ownership decision and stable-schema compatibility remain open before merge.

A review of the new head is already running automatically, so I am not sending a duplicate re-review command. No workflows were manually rerun for green.

@RomneyDa

Copy link
Copy Markdown
Member

Maintainer scope decision: accept artifact ownership for this PR.

Manage only manifest-declared artifacts and preserve every unrelated working file, exact operator staging, and existing committed history, including Finder metadata and ordinary documents in legacy refs. This deliberately replaces whole-directory ownership; it is not just approval of Finder-content classification. Keep actual artifact-collision checks, unfinished Git-operation refusal, database identity/version admission, hashes/counts/integrity, fresh-target publication, dedicated-repository guidance, and the non-backup-ancestry push restriction.

The correction at e2b0edf3d72bd2372e7f64e587b5916b9bb4e1ad retains both contributor commits and fixes the historical global/agent restore admission exposed by the stable-data proof. The updated PR body links the reproducible, downloaded-and-hash-verified evidence: 11 supported-CLI cases, 35 tests plus one Windows-only skip, and nine native checks passed. Stable global-20 / agent-24 refs restore directly; normal runtime/Doctor upgrades to 21 / 26 without changing the synthetic int64/blob payload or integrity. The original ratchet failure is classified as feature-owned and corrected without increasing allowances.

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Oct 13, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 13, 2026
@RomneyDa
RomneyDa merged commit 151cf8d into openclaw:main Oct 13, 2026
148 of 149 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
… Finder (openclaw#162706)

* fix(backup): keep Git backups working after opening the repository in Finder

* fix(backup): remove committed Finder metadata without disturbing operator staging

* fix(backup): identify Finder metadata and restore legacy refs

* test(snapshot): keep Finder coverage within file size limit

* fix(backup): refresh only manifest-owned Git artifacts

* fix(backup): narrow filesystem errors without unchecked casts

* fix(backup): shrink retired assertion allowance

* fix(backup): validate restored agents at their recorded schema

* fix(backup): normalize historical agent indexes in staging

* fix(backup): satisfy artifact assertion safety checks

* fix(backup): admit historical global snapshots without current indexes

---------

Co-authored-by: Richard O’Shaughnessy <[email protected]>
Co-authored-by: Dallin Romney <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL 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.

3 participants