Skip to content

fix: avoid update failures when header snapshot cleanup is denied - #195487

Merged
roboclaw-bot merged 3 commits into
mainfrom
roboclaw/pi-candidate-header-cleanup
Nov 9, 2026
Merged

roboclaw-bot merged 3 commits into
mainfrom
roboclaw/pi-candidate-header-cleanup

Conversation

@roboclaw-bot

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

Copy link
Copy Markdown
Collaborator

Related: #195409, #195396

What Problem This Solves

Fixes candidate update checks and rehearsals failing when a nested SQLite header probe reads successfully but cannot remove its private snapshot.

User Impact

Candidate updates continue with a warning for disposable header-snapshot cleanup failures. Read, acquisition, validation, identity, and native read-close errors still fail; Doctor and other default callers retain strict cleanup. Persistent cleanup failures can leave temporary directories for later cleanup.

Why This Change Was Made

Pass the existing candidate-only cleanupFailure: "warn" policy through both nested header probes. Reuse the existing warning logger and directory owner, retaining bounded removal retries and later cleanup custody. Cleanup warnings preserve the successful result or original read error.

Header inspection now lives in a small sibling module, with all callers and mocks migrated. Snapshot preparation stays within its local size budget: 660 counted lines against a 700-line limit. The shared source-read timeout remains 30 seconds. Both candidate operations load this inspector lazily at their execution boundary, avoiding mixed static/dynamic imports in production bundles.

Evidence

  • Real non-shared SQLite regression: before the fix, version inspection, rehearsal snapshot, and original-read-error cases failed; the strict-default control passed. All four now pass. The fixture forces private-header preparation, checks the warning and retained directory, then proves registered cleanup succeeds after clearing the fault. The read-error case narrows the outcome and checks exact identity with toBe(original).
  • On this head, all 30 affected focused tests pass, one named file per command: header cleanup 4 (38.67s, mostly compiled-worker preparation), shared import isolation 6 (2.20s), candidate cleanup 20 (17.35s). The PI2 extraction was previously checked by 65 focused tests at e06817494243; those results are earlier-head evidence.
  • Touched-file lint/typecheck, formatting, and git diff --check pass with normal local size enforcement. No tests or limits were weakened. The snapshot-preparation module remains 660 counted lines.
  • No test/allocation changes in this repair. The separate allocation remains exactly this PR's +122 test LF lines; its input-equivalent ratchet passed with GIT_NO_LAZY_FETCH=1 (6,588,953 lines / 6,589,023 ceiling). No inherited-debt grant or scalar change.
  • All three failures in prior CI run were PR-caused runtime build failures, before their tests: the extracted header inspector had mixed static/dynamic production imports, rejected by the existing INEFFECTIVE_DYNAMIC_IMPORT build guard. Main's latest full run is still active; the last completed full run passed PostgreSQL 2/3 and compact-small-20, and its UI failure was an unrelated motion assertion. The guard and build configuration are unchanged.
  • pr-simplify completed: this repair moves one existing import into the snapshot operation (+1 production line, no test growth or new machinery). Whole PR: +44 net production / +122 test lines.
  • Fresh independent Codex autoreview of e06817494243121291f8fb43a87b77848269b6f0 to the final staged repair committed as 1c5c7427851a42d332241d2d214f012667c6ca81 completed P0–P3, scoped-clean, no actionable findings. Static review; CI subsequently passed the runtime-build step. Local ClawSweeper is unavailable; no hosted review comment was requested.
  • Broad proof belongs to this PR's exact-head CI. Native NFS/VAST and a full live Gateway upgrade were not exercised; filesystem fault injection proves the specified candidate-operation boundary. Earlier-head CI is historical evidence.
  • New exact-head CI run: preflight passed, and compact-small-20 passed the previously failing Build Node test runtime step and reached tests. PostgreSQL and UI suites are still running, not certified green. No manual rerun or dispatch was requested.

@clawsweeper

clawsweeper Bot commented Nov 9, 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.

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 9, 2026 00:53
@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. P2 Normal backlog priority with limited blast radius. 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 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes nested candidate SQLite header probes preserve their result when disposable snapshot cleanup fails.

Example: Candidate inspection reads user_version 7 from a closed WAL database, but removing its private header snapshot returns EACCES.

  • Before: The cleanup error fails the candidate state check or rehearsal.
  • After: The candidate operation continues with a warning, and the existing cleanup owner retains the directory for retry.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with meaningful boundary regressions; supplied validation remains at the harness layer.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR; supplied evidence exercises real SQLite candidate owners through an in-process filesystem-fault harness, without a shipped CLI or live upgrade run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A candidate update can stop after successfully reading a database solely because its disposable header snapshot cannot be deleted.
Reason: The maintainer-authored direction completes an established candidate-only policy and preserves strict behavior for other consumers.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR closes a concrete gap in candidate update cleanup policy, and source review found no introduced correctness defect.

Priority: P2
Reviewed head: 8cf4721ea6a4d64dbf8b19ec47c3278027c2a506

Before merge

None.

Findings

None.

Tests

  • Low-value test src/infra/update-candidate-state.shared-imports.test.ts: Remove the newly added cleanupFailure call-shape assertion: the real header-cleanup regression independently verifies that behavior; retain the existing import-isolation coverage.
  • Missing end-to-end proof: No shipped update flow or latest-stable upgrade demonstrates nested header cleanup denial with settings and data preserved; the body reports red/green boundary tests but no native NFS execution.
Agent review details

How this fits together

Candidate update workers inspect existing databases and prepare rehearsal copies; SQLite header readers return version metadata, while the snapshot owner handles private-file cleanup and retries.

flowchart TD
  A[Candidate update worker] --> B[Version inspection or rehearsal]
  B --> C[SQLite header probe]
  C --> D[Private snapshot when required]
  D --> E[Read metadata and close database]
  E --> F[Existing cleanup owner]
  F --> G[Result and warning]
  F --> H[Retained cleanup retry]
Loading

Technical review

Best possible solution:

Carry the existing candidate-only cleanup policy through both header probes while preserving strict defaults, fatal read failures, and existing retry custody.

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

Current-main source directly exposes the fatal cleanup path, and the supplied regression uses a closed WAL database plus EACCES removal injection; this read-only review executed no target code.

Is this the best way to solve the issue?

This is a focused completion of the existing candidate policy: it changes the owning header consumer and its two candidate callers without adding another cleanup owner or weakening validation.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Private header cleanup changes intended behavior with a stated reason (087769b: Schema inspection preserved read and cleanup failures while retaining retry ownership.)
  • Candidate best-effort cleanup keeps the original intent (38cfa9e: Disposable candidate copies should not fail updates; warnings and later cleanup retain responsibility.)
  • Mixed-engine header probes keeps the original intent (8a2935f: Header inspection distinguishes versioned SQLite stores from zero-version PostgreSQL anchors before engine-specific handling.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8a2935f adds src/infra/update-candidate-state.shared.ts:93 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8a2935fbfe45; files: src/infra/update-candidate-state.shared.ts)
  • Jason (Json): Raw commit 38cfa9e adds src/infra/update-candidate-state.ts:123 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/update-candidate-state.ts)
  • RoboClaw: Raw commit 7c7a4d5 adds src/infra/update-candidate-state.ts:129 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7c7a4d5db4ad; files: src/infra/update-candidate-state.ts)

PR surface

Source +32, Tests +119, Other +2. Total +153 across 7 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 36 4 +32
Tests 2 120 1 +119
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 7 158 5 +153

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 +32 lines; tests +119 lines Growth reuses existing owners and covers the two candidate paths plus strict-default, original-error, and cleanup-custody contracts.

Labels

Label changes:

  • add P2: A concrete candidate update failure remains when a nested private-header snapshot cannot be removed, with limited filesystem-dependent reach.
  • 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:

  • P2: A concrete candidate update failure remains when a nested private-header snapshot cannot be removed, with limited filesystem-dependent reach.
  • 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.

  • Record a packaged update from the latest stable release with nested header cleanup denied, showing successful completion and preserved settings and database contents.

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, 8:10 PM ET / November 9, 2026, 01:10 UTC.

@roboclaw-bot
roboclaw-bot merged commit a35b92c into main Nov 9, 2026
142 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/pi-candidate-header-cleanup branch November 9, 2026 02:08
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 9, 2026
…enclaw#195487)

* fix: keep candidate header cleanup failures warning-only

* refactor: isolate SQLite header inspection

* fix: load candidate header inspector lazily

---------

Co-authored-by: roboclaw-bot <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 18, 2026
* fix(update): include cold archives in candidate snapshots

Co-authored-by: steipete <[email protected]>

* fix(update): preserve file archives in rehearsal snapshots

Co-authored-by: steipete <[email protected]>

* fix(update): preserve source WAL state during archive inventory

Classify cold archive SQL under its existing candidate-state subprocess owner. Preserve incomplete WAL source families so header inspection retains private cleanup custody.

Co-authored-by: steipete <[email protected]>

---------

Co-authored-by: steipete <[email protected]>

Release adaptation: the baseline does not contain the #195487 header-cleanup
suite. Keep that unrelated suite absent; carry the new incomplete-WAL inventory
assertions into the existing inventory suite instead. Add a per-change 214-line
allocation for the source regression, chunk fallback, and WAL preservation tests.
No schema, updater protocol, authority, or archive-integrity changes.

Companion audit at 9e917f0:
- #200733 is selected as the next dependency-closure repair: missing archives
  must warn instead of blocking updates, and Windows copies must not share live
  read-only inode attributes. Do not qualify this intermediate checkpoint alone.
- #200076 and #200930 are independent cold-history performance changes, not
  prerequisites for this snapshot repair.
- #201009, #200994, #200866, #200577, #200805, #200802, and #200732 overlap only
  adjacent update documentation and independent repair flows; not prerequisites.

Proof on base 309067b:
- New production-subprocess regression: 4/4 fail before, 4/4 pass after.
- Cold archives, chunks, and inventory: 31/31 pass after.
- Additional budget/cleanup/import siblings: 46/47 pass. Configured-cache
  containment fails identically on the unchanged base at budget.test.ts:737;
  retained as an independent failure, not weakened or repaired here.
- Targeted lint and format, documentation links, SQLite worker ratchet, and
  test-line ratchet pass. SQLite T1 counts remain 170; compatibility 15.
- Worker typecheck was blocked at dependency custody, without guard bypass.
  Parent canonical core typecheck, typed lint (five files), and formatting
  passed with its owned dependencies. Full installed-upgrade/FRV proof remains
  pending the assembled candidate, including selected companion #200733.

(cherry picked from commit 802e3f7)

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
Backport of a35b92c.

Release adaptation: keep inspection in existing readonly-location module; thread cleanupFailure warn to both candidate callers, retain strict default and source recovery behavior. Exclude module relocation, snapshot-policy move and allocation metadata.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 2a531caf36c15180522cfca9c9b41eebb310b297)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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