Skip to content

fix(test): guard WAL recovery against the parent settlement barrier - #155009

Merged
steipete merged 2 commits into
mainfrom
upd/flake-wal-checkpoint-recovery-tests
Sep 21, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/flake-wal-checkpoint-recovery-tests

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Related: #154302, #154543

What Problem This Solves

Adds deterministic regression coverage for session-history cleanup blocking its own post-vacuum WAL checkpoint. The production repair is already on main in bef4401; this PR now changes only the existing WAL-budget test (+144/-0).

Why This Change Was Made

The transaction case forces the real worker vacuum COMMIT to overlap the parent's native settlement transaction, then verifies that the forced barrier executed before checking recovery. A missing parent-release join reproduces the original checkpoint-incomplete failure. The iterator remains an ordinary control, and main's monotonic-clock and stale-observation checks remain intact.

The original deferral, retained-archive, physical-byte and recovery assertions are unchanged. No retry, sleep, polling assertion, timeout increase, or tolerance is added. Production is byte-identical to pinned origin/main d3b90d0.

Evidence

The forced regression previously failed 5/5 on the pre-fix owner. It now passes 5/5 on main with no production delta, including removal of the proposed authority-check additions. Each run passes both WAL-budget cases and records one verified native barrier with settlement observed inside it.

Main run Cases Barrier verified Command wall
1 2/2 passed yes 30.416s
2 2/2 passed yes 12.799s
3 2/2 passed yes 12.861s
4 2/2 passed yes 12.584s
5 2/2 passed yes 11.752s

Main-only proof: Blacksmith Testbox tbx_01m32wtbydvhx3qdxd5n50hbpe, run, Node 24.19.0, two Vitest workers. First-run wall includes shared compiler preparation.

At tests-only head 82cb951, the six required suites pass 33/33 tests in 35.75s command wall: WAL budget (2), eviction lifecycle (6), reclamation commit (14), reclamation WAL (4), reclamation maintenance (6), mutation-worker runtime (1). WAL-budget file execution is 3.648s. Fresh validation lease: tbx_01m32xavrk3xcasa7rxnrqwqn3, run.

Full node scripts/check-changed.mjs --base origin/main -- src/config/sessions/session-history-wal-budget.test.ts passed in 202.598s, including the affected agents-sessions type graph, all selected guards, dead-export scans, formatting and lint (0 warnings / 0 errors).

The +144 regression patch is byte-for-byte unchanged from the reviewed candidate. The maintainer explicitly authorized reuse of that review for this tests-only result. Production LOC: 0. Tests: +144/-0.

@clawsweeper

clawsweeper Bot commented Sep 21, 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.

@steipete
steipete marked this pull request as ready for review September 21, 2026 16:48
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 5:37 PM ET / 21:37 UTC (Revision 4).

ClawSweeper review

What this changes

Adds a regression that forces SQLite cleanup to overlap the parent’s settlement lock and verifies that cleanup subsequently recovers.

Merge readiness

✅ Ready for maintainer review

Keep open: the production fix is on main, but this PR adds distinct regression coverage through the session-history cleanup entrypoint. No actionable patch defects were found.

Priority: P2
Reviewed head: 82cb9510ee510e921f9ee5d0939621731430f037

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused regression with meaningful native-boundary evidence and no actionable correctness findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied Node 24.19.0 Testbox evidence exercises the real session-history budget owner and native SQLite worker, forces the COMMIT/parent-lock overlap, verifies that the barrier ran, and reports recovery passing five times after the production repair. This review inspected the fixture and supplied results without re-executing them.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Supplied Node 24.19.0 Testbox evidence exercises the real session-history budget owner and native SQLite worker, forces the COMMIT/parent-lock overlap, verifies that the barrier ran, and reports recovery passing five times after the production repair. This review inspected the fixture and supplied results without re-executing them.
Evidence reviewed 6 items Pinned introduced scope: The merge-base-to-head diff changes only the WAL-budget test. It preserves existing assertions and adds native-worker synchronization without production, dependency, configuration, or schema changes.
Real boundary and retained assertions: The fixture subclasses the real Worker, intercepts native SQLite COMMIT for the selected database, and verifies settlement occurred while the parent held its transaction. The budget entrypoint still checks archive preservation, unchanged blocked WAL bytes, stale-observation rejection, and successful recovery.
Production owner already repaired: The production settlement owner waits for the parent-release acknowledgment, and the real mutation worker invokes it before the post-commit checkpoint. Commit bef4401 records this repair at 2026-09-21T12:07:06-07:00. Current-main inspection shows the added forced-overlap fixture is still absent; no release containing the production repair was established.
Findings None None.
Security None None.

How this fits together

Session-history cleanup enforces disk budgets using a SQLite worker. After reclaiming database pages, the worker must wait for the parent’s settlement lock to release before checkpointing the write-ahead log.

flowchart TD
  A[Session disk budget] --> B[History cleanup]
  B --> C[SQLite worker reclaims pages]
  C --> D[Parent settlement lock]
  D --> E[Wait for lock release]
  E --> F[Checkpoint and report recovery]
  G[Test forces lock overlap] --> C
  G --> D
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +144. Total +144 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 144 0 +144
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 144 0 +144

Review metrics

Metric Value Why it matters
Regression execution cost 3.648 seconds reported for the WAL-budget file The native-lock regression extends existing cases and remains below the repository’s five-second test-time target in the supplied run.

Technical review

Best possible solution:

Retain main’s production repair and add this entrypoint-level regression to guard the native settlement interleaving.

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

Not applicable to a remaining current-main bug: production is already repaired. The supplied evidence reports a deterministic pre-fix failure and successful recovery with the forced native overlap.

Is this the best way to solve the issue?

Yes. Extending the existing budget test exercises the production worker wiring while retaining the original preservation and recovery assertions.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This guards a concrete cleanup recovery regression without changing production behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Supplied Node 24.19.0 Testbox evidence exercises the real session-history budget owner and native SQLite worker, forces the COMMIT/parent-lock overlap, verifies that the barrier ran, and reports recovery passing five times after the production repair. This review inspected the fixture and supplied results without re-executing them.
  • proof: sufficient: Contributor real behavior proof is sufficient. Supplied Node 24.19.0 Testbox evidence exercises the real session-history budget owner and native SQLite worker, forces the COMMIT/parent-lock overlap, verifies that the barrier ran, and reports recovery passing five times after the production repair. This review inspected the fixture and supplied results without re-executing them.

Evidence

What I checked:

  • Pinned introduced scope: The merge-base-to-head diff changes only the WAL-budget test. It preserves existing assertions and adds native-worker synchronization without production, dependency, configuration, or schema changes. (src/config/sessions/session-history-wal-budget.test.ts:113, 82cb9510ee51)
  • Real boundary and retained assertions: The fixture subclasses the real Worker, intercepts native SQLite COMMIT for the selected database, and verifies settlement occurred while the parent held its transaction. The budget entrypoint still checks archive preservation, unchanged blocked WAL bytes, stale-observation rejection, and successful recovery. (src/config/sessions/session-history-wal-budget.test.ts:400, 82cb9510ee51)
  • Production owner already repaired: The production settlement owner waits for the parent-release acknowledgment, and the real mutation worker invokes it before the post-commit checkpoint. Commit bef4401 records this repair at 2026-09-21T12:07:06-07:00. Current-main inspection shows the added forced-overlap fixture is still absent; no release containing the production repair was established. (src/config/sessions/session-accessor.sqlite-reclamation-commit.ts:116, bef4401fbc5d)
  • Supplied native regression evidence: The captured PR body reports five pre-fix failures and five main-based passes with the native barrier verified, followed by 33/33 owner and sibling tests at the reviewed head. Reported WAL-budget execution is 3.648 seconds; the full changed-file gate passed. The linked Testbox backing workflow is cancelled, which does not independently establish or invalidate the reported command results. No tests were executed in this read-only review. (82cb9510ee51)
  • Related work and review continuity: fix: stop session cleanup from amplifying a blocked WAL #154302 merged the broader blocked-WAL preservation behavior. fix(sessions): resume cleanup after WAL checkpoint recovery #155022 closed unmerged after production overlap with main, so it is not a replacement landing candidate. The previous review projection contains no findings or published rank-up moves. The earlier reviewed commit could not be retrieved for a byte-for-byte comparison; this review independently inspected the current introduced patch.
  • Current-main routing history: Current-main history connects Peter Steinberger to the WAL preservation and settlement repairs, and Vincent Koc to the recovery-failure diagnostics. Missing historical blobs prevented exact source-line introduction verification; these are routing candidates, not causal attribution. (src/config/sessions/session-history-wal-budget.test.ts, 5cdc987d2339)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-21T16:56:24.818Z sha a9f5210 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T17:14:07.603Z sha 7b46740dcfb44a1425d2f23bdc99af50d5b03bed :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T18:58:04.134Z sha 0ca077c :: needs maintainer review before merge. :: none

@steipete
steipete enabled auto-merge (squash) September 21, 2026 16:57
@steipete
steipete force-pushed the upd/flake-wal-checkpoint-recovery-tests branch from 7b46740 to 0ca077c Compare September 21, 2026 18:50
Join the parent's native settlement barrier before post-commit page work so
that the parent's own writer lock cannot create a fresh busy checkpoint.
Preserve authority checks, abrupt-exit confirmation, and committed results.

Force the real vacuum/settlement interleaving in the existing WAL-budget
regression. It fails five times before the owner fix and passes five times
after it, with the original recovery and preservation assertions intact.

Related: #154302, #154543
@steipete
steipete force-pushed the upd/flake-wal-checkpoint-recovery-tests branch from 0ca077c to 82cb951 Compare September 21, 2026 21:28
@steipete steipete changed the title fix(state): resume history cleanup after WAL recovery fix(test): guard WAL recovery against the parent settlement barrier Sep 21, 2026
@steipete
steipete merged commit 1de81ce into main Sep 21, 2026
103 of 104 checks passed
@steipete
steipete deleted the upd/flake-wal-checkpoint-recovery-tests branch September 21, 2026 21:45
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…penclaw#155009)

* fix(state): resume history cleanup after WAL recovery

Join the parent's native settlement barrier before post-commit page work so
that the parent's own writer lock cannot create a fresh busy checkpoint.
Preserve authority checks, abrupt-exit confirmation, and committed results.

Force the real vacuum/settlement interleaving in the existing WAL-budget
regression. It fails five times before the owner fix and passes five times
after it, with the original recovery and preservation assertions intact.

Related: openclaw#154302, openclaw#154543

* test(state): rely on main WAL settlement repair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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