Skip to content

fix: avoid Doctor and Gateway failures during NFS snapshot cleanup - #195409

Merged
roboclaw-bot merged 5 commits into
mainfrom
roboclaw/pe-195396-nfs-snapshot-cleanup
Nov 9, 2026
Merged

roboclaw-bot merged 5 commits into
mainfrom
roboclaw/pe-195396-nfs-snapshot-cleanup

Conversation

@roboclaw-bot

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

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes Doctor and Gateway startup failures when NFS leaves busy SQLite snapshot cleanup directories behind, while preserving best-effort candidate update checks.

Fixes #195396.

User Impact

Verified snapshots can finish with a cleanup warning when NFS retains a busy directory. Doctor/Gateway preflight and strict snapshot callers still surface genuine cleanup failures. Candidate checks log cleanup hiccups separately, preserving their successful result or original read error.

Why This Change Was Made

Close the published target before removing staging. Recognize regular .nfs* aliases and defer only classified final-removal EBUSY/ENOTEMPTY after private snapshot retirement. Keep identity, content, integrity, publication, and backup validation intact.

Candidate shared-state reads, isolated rehearsal source cleanup, and their parent schema inspection staging explicitly select warning-only cleanup. The shared parent helper remains strict for Doctor callers; unconfirmed worker termination still fails and retains staging. A warning never claims that cleanup or retirement succeeded.

Evidence

  • Mechanical refresh onto fetched main ac26a0d7f1f8. GitHub's compare API confirms it contains 3fa60aed3456, the fix for the inherited legacy refusal-notice TS2345. All four existing code/test patches are identical through rebase; the refresh commit adds only an inherited-debt allocation record.
  • Re-ran exactly two focused files, separately: candidate cleanup 20 pass (49.91 seconds including cold worker preparation), snapshot transfer 23 pass (7.87 seconds). These cover warning-only candidate cleanup and strict snapshot errors with NFS filesystem faults. Before this mechanical refresh, all 88 focused tests and touched-file lint/typecheck/format checks passed. Existing tests and assertions are unchanged by the refresh.
  • The PR's own allocation remains exactly 215 test LF lines. Current main alone is 19 over its ceiling (6,586,741 / 6,586,722); the unadjusted PR carries the same 19-line debt with its own growth fully funded. A separate pe4-195409-base-debt.txt, labeled as inherited main debt, funds exactly 19. Final CI-equivalent merge-index ratchet passes: 6,586,956 / 6,586,956; zero slack. Whitespace checks pass.
  • Prior independent local autoreview, P0–P2, found no actionable findings in the code candidate. Range-diff preserves that patch through the mechanical rebase. The review included unchanged Doctor callers; it was static, and omitted unchanged staging-token source following the prior helper filename refusal. The implementation author inspected that source directly.
  • Native NFS live proof remains MISSING: the earlier Linux Testbox request exceeded ten minutes in queue and was stopped, with cancellation verified. Filesystem fault injection does not establish native NFS behavior.
  • Pushed and verified 7248c5cfe5fd with a lease pinned to a9f06f77b986. Published-head checks are pending, with no failures reported in the initial read. No merge or auto-merge is requested.

@clawsweeper

clawsweeper Bot commented Nov 8, 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 gateway Gateway runtime size: S labels Nov 8, 2026
@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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR closes verified snapshot handles before staging cleanup and defers temporary-file cleanup failures without discarding successful backups or schema reads.

Example: Doctor creates a verified SQLite backup on NFS, but removing its temporary directory returns ENOTEMPTY.

  • Before: Doctor rejects the backup and stops before migration.
  • After: Doctor retains the verified backup, warns about deferred cleanup, and continues.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source change is focused and supported by meaningful regression tests, but required real-product proof is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Existing NFS installations cannot complete Doctor maintenance or start the Gateway when temporary snapshot cleanup fails after otherwise successful work.
Reason: The maintainer-authored direction addresses a reported released failure and retains the advisory network-storage policy rather than introducing a filesystem prohibition.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a concrete released NFS failure, and source review found no discrete introduced correctness defect.

Priority: P1
Reviewed head: 24da1beb9f00a11bbbad30f52faa1886b894a701

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Show Doctor and Gateway succeeding on isolated NFS-backed state, including a stable-to-head upgrade and backup/restore with existing settings and database contents intact.
Agent review details

How this fits together

Doctor, updates, and Gateway preflight use shared SQLite snapshot owners to turn admitted database files into verified private images; publication returns verified backups while cleanup owners retain responsibility for temporary files.

flowchart TD
  A[Doctor and Gateway] --> B[Snapshot acquisition]
  B --> C[Integrity and content verification]
  C --> D[Exclusive publication]
  D --> E[Verified backup or read result]
  D --> F[Temporary cleanup owner]
  F --> G[Warning and deferred retry]
Loading

Technical review

Best possible solution:

Keep the repair in the existing snapshot publication and cleanup owners while preserving verification, private permissions, and retirement custody.

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

The reporter supplies a specific released-version NFS reproduction, and current main contains matching cleanup ordering and fatal cleanup paths; this read-only review did not execute the product or reproduce native NFS behavior.

Is this the best way to solve the issue?

The patch is a focused repair using existing owners: close the verified handle before directory removal, retain cleanup custody after recoverable removal failures, and preserve original read and verification failures.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Publication handle lifetime changes intended behavior with a stated reason (bf3f5dc: Verified snapshot publication established exclusive output, identity and content validation, and cleanup limited to operation-owned artifacts.)
  • Publication staging-directory cleanup keeps the original intent (b66471a: Prepared rollback images needed conservative cleanup that preserved recovery bytes and refused unexpected directory contents.)
  • Successful-read cleanup deferral changes intended behavior with a stated reason (c953758: Windows Bun could retain native resources after logical close; the original repair deferred only EBUSY on incapable runtimes while preserving other failures.)
  • Snapshot private-image cleanup policy changes intended behavior with a stated reason (38cfa9e: Update candidate reads alone opted into best-effort cleanup so leftover copies did not fail updates; this PR explains making snapshot creation own that policy for NFS backups.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Concrete affected-release report: The reporter in [Bug]: 2026.11.x can't run with the state directory on NFS — Doctor and Gateway fail on SQLite snapshot cleanup (rmdir ENOTEMPTY) #195396 identifies v2026.11.2, Node 26.12.1, VAST NFS v3, Doctor and Gateway failures, successful GPFS operation, and recovery with v2026.10.8.
  • Exact introduced change: The introduced diff closes the target before staging-directory removal, retains final identity and durability checks, broadens successful-read deferral to EBUSY and ENOTEMPTY, and moves private-image cleanup policy into snapshot creation. (src/infra/sqlite-snapshot.ts:462, 24da1beb9f00)
  • Current main still needs the repair: Fetched main retains directory removal before target close and the runtime-restricted cleanup policy; comparison against the merge base shows no intervening change to these production owners. (src/infra/sqlite-snapshot.ts:462, 98fad049dcae)
  • Conservative deferred publication cleanup: The cleanup helper leaves recognized NFS aliases untouched, rejects unexpected entries, and retries only empty-directory removal after matching the original directory identity. (src/infra/sqlite-snapshot-file.ts:154, 24da1beb9f00)
  • Distinct regression coverage: Added cases exercise publication handle lifetime, surviving busy/nonempty staging cleanup, surviving private-image cleanup, and capable-runtime preflight deferral; existing read, permission, native-close, and custody rejection cases remain. (src/infra/sqlite-snapshot.transfer.test.ts:97, 24da1beb9f00)
  • Proof explicitly remains incomplete: The fully read PR body reports base-failing fault injection and passing focused tests, but explicitly marks actual NFS/VAST execution, live Doctor/Gateway smoke, and stable-to-head upgrade/rollback proof as missing; discussion supplies no additional behavioral evidence. (24da1beb9f00)

Likely related people:

  • Peter Steinberger: Raw commit c953758 adds src/infra/sqlite-readonly-location-cleanup.ts:31 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c953758254f6; files: src/infra/sqlite-readonly-location-cleanup.ts)
  • Vincent Koc: Raw commit bf3f5dc adds src/infra/sqlite-snapshot.ts:511 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bf3f5dc532f0; files: src/infra/sqlite-snapshot.ts)
  • Jason (Json): Raw commit 38cfa9e adds src/infra/sqlite-readonly-location-cleanup.ts:195 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 38cfa9e27371; files: src/infra/sqlite-readonly-location-cleanup.ts)

PR surface

Source +28, Tests +86, Docs +1, Other +2. Total +117 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 50 22 +28
Tests 3 92 6 +86
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 10 145 28 +117

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus regression growth Production +28 lines; tests +86 lines Growth stays within existing owners and covers distinct publication-ordering, staging-cleanup, private-image, and preflight failures without adding a new module or configuration option.

Labels

Label changes:

  • add P1: The linked official-release report establishes a regression preventing Doctor maintenance and Gateway startup on an existing NFS deployment.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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 linked official-release report establishes a regression preventing Doctor maintenance and Gateway startup on an existing NFS deployment.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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.

  • Provide native NFS Doctor/Gateway and stable-upgrade evidence for the changed cleanup paths.

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 8, 2026, 4:37 PM ET / 21:37 UTC.

@roboclaw-bot
roboclaw-bot force-pushed the roboclaw/pe-195396-nfs-snapshot-cleanup branch from 24da1be to 97e222d Compare November 8, 2026 21:58
@roboclaw-bot
roboclaw-bot force-pushed the roboclaw/pe-195396-nfs-snapshot-cleanup branch from 97e222d to a9f06f7 Compare November 8, 2026 22:21
@roboclaw-bot
roboclaw-bot force-pushed the roboclaw/pe-195396-nfs-snapshot-cleanup branch from a9f06f7 to 7248c5c Compare November 8, 2026 22:40
@roboclaw-bot
roboclaw-bot merged commit 7c7a4d5 into main Nov 9, 2026
289 of 293 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/pe-195396-nfs-snapshot-cleanup branch November 9, 2026 00:44
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
…penclaw#195409)

* fix: tolerate NFS SQLite snapshot cleanup

* test: allow deferred NFS cleanup in discovery custody

* fix: defer only retired NFS snapshot removal errors

* fix: keep candidate snapshot cleanup best effort

* test: allocate inherited main test-line debt

---------

Co-authored-by: roboclaw-bot <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 16, 2026
Required minimal dependency of P1 NFS fix #195409. Preserve beta.4's
SqliteSnapshotCleanupError import while adding withPreparedSqliteSnapshot.
Focused cleanup regression: 2 passed; targeted lint/format and diff check passed.

(cherry picked from commit 38cfa9e)

Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 16, 2026
…195409)

Adapt the canonical repair to beta.4: retain its token/native-close lifecycle,
move the shared cleanup error to its existing lifecycle owner, and migrate
all internal imports. Use existing registerSqliteCacheExitClose for the ordered
best-effort exit retry instead of importing the broad #191842 migration.
Preserve PostgreSQL and read-only contracts. Omit main-only base-debt allocation.

Fixture adaptation: private ancestors and canonical staging-root resolution
keep injected cleanup failures inside the test fixture under umask 0002.
Baseline NFS publication regression failed; repaired staging transport,
publication, cleanup, custody, and update-worker regressions pass.

(cherry picked from commit 7c7a4d5)

Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 16, 2026
Remove two redundant compaction casts and its now-stale max-lines allowance.
Compare encoded cleanup paths so the Windows regression checks actual JSON logs.
Evaluate the macOS package matrix for diagnostic and release-gate requests
instead of retaining the pre-backport static-matrix expectation.

These are focused adaptations of #199561, #195409 and #198989, diagnosed by
stable-profile FRV 43794859705 on the frozen beta.4-based candidate.

Co-authored-by: RomneyDa <[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 gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

[Bug]: 2026.11.x can't run with the state directory on NFS — Doctor and Gateway fail on SQLite snapshot cleanup (rmdir ENOTEMPTY)

1 participant