Skip to content

fix: SQLite snapshots fail in EFS-encrypted Windows caches - #190087

Merged
roboclaw-bot merged 1 commit into
mainfrom
loop/contributor-pr-169159
Nov 1, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
loop/contributor-pr-169159

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Supersedes #169159, thanks @JasonBuildAI.

Related: #169157.

What Problem This Solves

Fixes SQLite snapshot reads and Doctor migration detection failing when Windows EFS-encrypted cache directories reject same-directory renames with EXDEV.

User Impact

Affected Windows users can inspect SQLite state without relocating their cache or disabling encryption. Other rename errors still fail visibly; no configuration or migration is required.

Why This Change Was Made

Copy directly into the existing partial snapshot instead of promoting an intermediate first file. At final publication, fall back only on EXDEV to the existing guarded, exclusive file-copy primitive, flush the destination, and remove the staged file. The family stays private until preparation returns, so publication does not require an atomic rename. Existing cleanup owns failed copies.

Production delta: +21/−8, net +13. Removed the intermediate file, its redundant rename, and its cleanup branch. The remaining growth is the required durable fallback; no new module, wrapper registration, or policy owner. Legacy first artifacts remain recognized for abandoned-snapshot cleanup after upgrades. Test delta: +44, with a dedicated allocation for the three preparation paths and the distinct non-EXDEV failure control.

Evidence

  • Candidate: 9af7ded4487eb38dce6401b46d89b2e4f491d2f9.
  • Base: c32d920dab6bcb2eb55251bc71665816bb04f809, current main at investigation. Both unhandled runtime renames were still present. fix(tooling): handle Windows paths in repository checks #190069 (c9569e415c92416497f25d2352dac69282a852b2) only normalizes repository-check paths and does not repair runtime snapshot publication.
  • Red on unchanged main production code: all three simulated EXDEV cases fail (synchronous copy, asynchronous copy, online backup); the EPERM control passes. Tests exercise real SQLite reads, source preservation, private file permissions, and cleanup.
  • Green: primary snapshot suite, 30 passed (10.56 seconds wrapper wall time, 8.84 seconds Vitest duration). Copy and cleanup suites also pass (39 existing tests plus the four regressions before their move to the primary suite; 36.86 seconds wrapper wall time including compilation).
  • Focused TypeScript check, lint, formatting, test-line and source-line ratchets, and git diff --check passed.
  • Local Codex autoreview of the complete final candidate against the pinned base: scoped-clean for P0–P2; no findings. Reviewer did not independently execute tests. Hosted ClawSweeper review of the same head also found no actionable defects; its native Windows evidence gap matches the limitation below.
  • pr-simplify: removed the redundant staging step and kept the fallback in the existing publication owner.
  • Linux proof simulates the filesystem error; native Windows EFS execution remains unverified here. The contributor head was read only with gh pr view/gh pr diff, never checked out or executed.
  • Current-head PR CI: all 72 planned jobs completed successfully; 465 seconds overall, 5,502 aggregate job seconds. Required CI and security statuses are green.
  • Merged as 8662c66b9050fb9328ad291fa2d198cca449df99; verified the landed commit retains the human co-author trailer.

Remove the redundant first-file promotion. Use the existing guarded copy only when final private publication rejects rename with EXDEV, preserving fsync and cleanup.

Co-authored-by: JasonBuildAI <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 1, 2026 04:33
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Remove an intermediate snapshot rename and copy private snapshot files when final publication fails with EXDEV.

Example: Run openclaw doctor with an EFS-encrypted LOCALAPPDATA/openclaw cache on Windows 11.

  • Before: A same-directory snapshot rename throws EXDEV and stops Doctor.
  • After: The snapshot is copied into place, flushed, and returned for inspection.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with no actionable findings; current-candidate validation uses injected filesystem errors rather than a native EFS product run.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor proof gate; its current-candidate evidence is reported in-process SQLite fault injection, while JasonBuildAI's linked native Windows snapshot and Doctor output covers the earlier implementation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Doctor and SQLite inspection stop when an encrypted Windows cache rejects same-directory renames.
Reason: The collaborator-authored direction restores an existing inspection contract without adding configuration or changing cache placement.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a concrete Windows failure still present on main, and no actionable introduced defect was found.

Priority: P1
Reviewed head: 9af7ded4487eb38dce6401b46d89b2e4f491d2f9

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The current candidate has no native Windows EFS snapshot-and-Doctor replay; linked Windows output exercises the earlier contributor implementation.
Agent review details

How this fits together

Doctor and other inspection callers send SQLite sources to the snapshot owner, which returns a consistent private database location and its cleanup operations.

flowchart TD
  A[Doctor or inspection caller] --> B[Snapshot source owner]
  B --> C[Isolated preparation worker]
  C --> D[Verified private snapshot files]
  D --> E[Rename or EXDEV copy]
  E --> F[Reader and cleanup owner]
Loading

Technical review

Best possible solution:

Land the focused repair in the existing snapshot owner while preserving source bytes, private ownership, cleanup, and non-EXDEV failures.

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

The reporter's Windows EFS traces match both unhandled current-main renames; this review inspected source and supplied evidence without executing a reproduction.

Is this the best way to solve the issue?

This is the smallest complete repair: remove the unnecessary intermediate promotion and handle EXDEV once in the existing private-family publication owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Private user-cache staging keeps the original intent (c7f70f3: Move large snapshots away from quota-constrained shared temporary storage while retaining secure staging and source-preservation responsibilities.)
  • Intermediate copy and promotion changes intended behavior with a stated reason (140b602: The infrastructure simplification retained verified private-copy and persistent-state semantics; direct copying into the partial file preserves those checks while eliminating the failing promotion.)
  • Copy acquisition and generation digest binding keeps the original intent (9a01463: Share unchanged recovery pages where supported while retaining coherent source-family checks; later digest binding from 9c87c4e remains intact.)
  • Publication and failed-attempt cleanup keeps the original intent (76894b3: The surviving staging owner retains directory and token retirement while failed attempts discard known payload files; the new fallback remains inside that ownership.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 9c87c4e adds src/infra/sqlite-readonly-location-cleanup.ts:466 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9c87c4e82620; files: src/infra/sqlite-readonly-location-cleanup.ts)

PR surface

Source +13, Tests +44, Other +2. Total +59 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 21 8 +13
Tests 1 44 0 +44
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 67 8 +59

Root-cause cluster

Relationship: same_root_cause
Canonical: #169157
Summary: The reported EFS rename failure and both repair PRs concern the same private SQLite snapshot publication path.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P1: The deterministic filesystem failure blocks Doctor and SQLite inspection on affected Windows installations.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: The deterministic filesystem failure blocks Doctor and SQLite inspection on affected Windows installations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Replay snapshot inspection and openclaw doctor on an EFS-encrypted Windows cache using this candidate.

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.

Reviewed November 1, 2026, 12:38 AM ET / 04:38 UTC.

@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) November 1, 2026 04:41
@roboclaw-bot
roboclaw-bot merged commit 8662c66 into main Nov 1, 2026
215 checks passed
@roboclaw-bot
roboclaw-bot deleted the loop/contributor-pr-169159 branch November 1, 2026 04:42
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
…claw#190087)

Remove the redundant first-file promotion. Use the existing guarded copy only when final private publication rejects rename with EXDEV, preserving fsync and cleanup.

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

Labels

P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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