Skip to content

fix(test): stop native SQLite worker teardown crashes - #114567

Merged
steipete merged 1 commit into
mainfrom
codex/fix-sqlite-threaded-test-crash
Jul 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-sqlite-threaded-test-crash

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where maintainers and CI running SQLite-backed session/model regression tests on supported Node 24 could intermittently hit FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal and abort with exit 134 even after all test assertions passed. Reproduced on two fresh Blacksmith Testbox machines during repeated live Gateway/model stress testing.

Why This Change Was Made

Keep native SQLite database lifetimes inside disposable forked processes by selecting the existing Vitest forks pool only for the runtime/config lane. Add a scoped-config regression assertion that prevents the lane from silently returning to threaded workers. No production behavior, database schema, migrations, provider configuration, or JSON state changes.

User Impact

Reliable SQLite-backed session, dynamic-model, and Gateway regression coverage without sporadic Node/V8 test-worker crashes. Production runtime and stored user data are unchanged.

Evidence

  • Before: threaded worker teardown reproduced exit 134 on two clean remote runners; all affected SQLite assertions themselves passed.
  • After: complete runtime/config lane: 211 files, 2,898 tests passed.
  • Vitest configuration and project routing: 354 regression tests passed, including the new fork-pool assertion.
  • Full Gateway baseline on the exact base: 4,116 core and 2,493 RPC tests passed; fresh production build and all 143 public SDK surfaces passed.
  • Latest model socket transport, self-archive, Gateway session identity, protocol, plugin manifest, Workboard, and chat regressions passed.
  • 16 default-config stress cycles: 3,824 repeated Gateway/model/SQLite/socket assertions passed with no V8 abort and no command-line pool override.
  • Live dev Gateway: 137 tests passed across openai/gpt-5.6, anthropic/claude-sonnet-4-6, anthropic/claude-haiku-4-5, and google/gemini-3.1-pro-preview; zero skipped models.
  • pnpm check:changed -- test/vitest/vitest.runtime-config.config.ts test/vitest-scoped-config.test.ts: passed, including formatting, lint, script declarations, dependency guards, and test-root typecheck.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted: clean; no accepted/actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 27, 2026
@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 8:27 AM ET / 12:27 UTC.

ClawSweeper review

What this changes

The PR routes OpenClaw’s runtime/config Vitest lane through forked workers to isolate native SQLite teardown and adds a regression assertion that preserves that worker-pool choice.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This is a focused test-infrastructure reliability fix with credible repeated Testbox evidence and a regression assertion for the selected worker pool. It remains an active, protected maintainer PR, so it should stay open for explicit maintainer review and the remaining CI completion.

Priority: P2
Reviewed head: 0a45a7e3b5fd0c76ca085e272960f64cf82f4370

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, regression-protected reliability patch with credible live stress evidence; final CI completion is the remaining merge gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies concrete before/after remote stress evidence for the native SQLite worker-teardown abort and reports repeated successful post-fix runtime/config execution; redact any environment-sensitive details if fuller logs are later attached.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies concrete before/after remote stress evidence for the native SQLite worker-teardown abort and reports repeated successful post-fix runtime/config execution; redact any environment-sensitive details if fuller logs are later attached.
Evidence reviewed 4 items Focused configuration change: The PR explicitly selects the existing forks worker pool for the runtime/config lane, leaving production runtime, database schema, migrations, provider configuration, and persisted state untouched.
Regression contract: The paired scoped-config test asserts that the runtime/config lane remains on the repository’s forked non-isolated runner contract.
After-fix behavior evidence: The PR body reports repeated remote Testbox reproduction of the V8 exit-134 teardown failure before the change and 16 post-change stress cycles comprising 3,824 Gateway/model/SQLite/socket assertions without an abort.
Findings None None.
Security None None.

How this fits together

OpenClaw’s scoped Vitest configurations choose execution settings for grouped test lanes. The runtime/config lane exercises SQLite-backed Gateway, session, and model tests; its worker pool controls how native database handles are isolated and torn down.

flowchart LR
  A[Runtime and config tests] --> B[Scoped Vitest configuration]
  B --> C{Worker pool}
  C -->|forks| D[Disposable child processes]
  D --> E[Native SQLite teardown]
  E --> F[Stable test and CI result]
Loading

Before merge

  • Resolve merge risk (P1) - The change changes isolation behavior for the complete runtime/config test lane; required CI should confirm that the targeted V8 teardown mitigation does not introduce lane-specific execution regressions after rebasing onto current main.
Agent review details

Security

None.

PR surface

Tests +7. Total +7 across 2 files.

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

Review metrics

Metric Value Why it matters
Worker-pool routing 1 scoped test lane set explicitly to forks This is the mitigation boundary for native SQLite worker teardown, so its CI behavior matters before merge.

Merge-risk options

Maintainer options:

  1. Validate the forked runtime/config lane (recommended)
    Refresh the branch on current main and let the remaining required CI lanes confirm that the explicit fork pool removes the teardown abort without disrupting the scoped test lane.
  2. Choose a different native teardown remedy
    Pause this PR only if maintainers determine that the runtime/config lane’s forked-process overhead is unacceptable and prefer an upstream or native-driver remedy.

Technical review

Best possible solution:

Merge the narrow fork-pool selection and regression assertion once the branch is refreshed against current main and required CI validates the affected lane, without expanding the change into production SQLite or configuration work.

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

Unclear: the PR gives a concrete repeated remote Testbox reproduction and after-fix stress path, but this read-only review did not independently rerun the intermittent Node/V8 teardown failure on current main.

Is this the best way to solve the issue?

Yes: the existing scoped Vitest configuration is the narrow ownership boundary, and explicitly selecting forks with a regression assertion addresses worker lifetime without changing production SQLite behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against dd77dd9acf5e.

Labels

Label changes:

  • add P2: The reported intermittent native-worker abort harms regression and CI reliability but does not alter production runtime behavior or stored user data.
  • add merge-risk: 🚨 availability: The change alters execution isolation for an entire test lane, and its stated purpose is preventing process aborts during worker teardown.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies concrete before/after remote stress evidence for the native SQLite worker-teardown abort and reports repeated successful post-fix runtime/config execution; redact any environment-sensitive details if fuller logs are later attached.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies concrete before/after remote stress evidence for the native SQLite worker-teardown abort and reports repeated successful post-fix runtime/config execution; redact any environment-sensitive details if fuller logs are later attached.

Label justifications:

  • P2: The reported intermittent native-worker abort harms regression and CI reliability but does not alter production runtime behavior or stored user data.
  • merge-risk: 🚨 availability: The change alters execution isolation for an entire test lane, and its stated purpose is preventing process aborts during worker teardown.
  • 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): The PR body supplies concrete before/after remote stress evidence for the native SQLite worker-teardown abort and reports repeated successful post-fix runtime/config execution; redact any environment-sensitive details if fuller logs are later attached.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies concrete before/after remote stress evidence for the native SQLite worker-teardown abort and reports repeated successful post-fix runtime/config execution; redact any environment-sensitive details if fuller logs are later attached.

Evidence

What I checked:

  • Focused configuration change: The PR explicitly selects the existing forks worker pool for the runtime/config lane, leaving production runtime, database schema, migrations, provider configuration, and persisted state untouched. (test/vitest/vitest.runtime-config.config.ts:11, 0a45a7e3b5fd)
  • Regression contract: The paired scoped-config test asserts that the runtime/config lane remains on the repository’s forked non-isolated runner contract. (test/vitest-scoped-config.test.ts:616, 0a45a7e3b5fd)
  • After-fix behavior evidence: The PR body reports repeated remote Testbox reproduction of the V8 exit-134 teardown failure before the change and 16 post-change stress cycles comprising 3,824 Gateway/model/SQLite/socket assertions without an abort. (0a45a7e3b5fd)
  • Review state: GitHub reports the PR as cleanly mergeable but behind current main; multiple required compact test lanes were still in progress in the supplied check snapshot. (0a45a7e3b5fd)

Likely related people:

  • steipete: Steipete authored the sole implementation commit and supplied the concrete Testbox reproduction and post-fix stress-validation context for this test-runtime path. (role: recent area contributor; confidence: medium; commits: 0a45a7e3b5fd; files: test/vitest/vitest.runtime-config.config.ts, test/vitest-scoped-config.test.ts)

Rank-up moves

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

  • Refresh the branch against current main if needed and wait for the in-progress required checks on the reviewed head.

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.

@steipete
steipete merged commit 8d6971e into main Jul 27, 2026
97 of 107 checks passed
@steipete
steipete deleted the codex/fix-sqlite-threaded-test-crash branch July 27, 2026 12:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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: XS 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