Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Fix SQLite client locking defaults - #7162

Merged
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults
Aug 9, 2026
Merged

Fix SQLite client locking defaults#7162
tim-smart merged 3 commits into
mainfrom
agent/sqlite-client-defaults

Conversation

@tim-smart

@tim-smarttim-smart commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a configurable SQLite busy timeout to the Node and Bun clients, defaulting to 5 seconds
  • clamp infinite and oversized durations to SQLite's maximum timeout
  • start explicit SQLite transactions with BEGIN IMMEDIATE to avoid snapshot upgrade failures
  • cover the timeout default, override and infinity, immediate transaction locking, and readonly transactions
  • document the synchronous busy-wait and transaction-serialization trade-offs and add a patch changeset

Why

Concurrent workflow runner and control-plane clients can contend for the same SQLite store. A zero busy timeout fails ordinary lock contention immediately, while deferred transactions can fail when upgrading a read snapshot to a writer. Waiting for locks and acquiring the write lock at transaction start avoids both failure modes.

Because both SQLite drivers are synchronous, busy waits block the event loop. The configurable timeout lets applications choose a shorter wait, while the 5-second default preserves safe out-of-the-box behavior. Immediate transactions on writable connections serialize behind other writers even when they only read; clients opened with readonly: true are unaffected.

Validation

  • pnpm vitest run --project @effect/sql-sqlite-node (60 tests)
  • bun node_modules/vitest/vitest.mjs run --project @effect/sql-sqlite-bun (4 tests)
  • package typechecks for @effect/sql-sqlite-node and @effect/sql-sqlite-bun
  • pnpm lint
  • pnpm changeset status

Closes EFF-577
Closes#6179

@changeset-bot

changeset-botBot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4eda0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
NameType
@effect/sql-sqlite-bunPatch
@effect/sql-sqlite-nodePatch
effectPatch
@effect/ai-anthropicPatch
@effect/ai-openaiPatch
@effect/ai-openai-compatPatch
@effect/ai-openrouterPatch
@effect/atom-reactPatch
@effect/atom-solidPatch
@effect/atom-vuePatch
@effect/docgenPatch
@effect/doctestPatch
@effect/openapi-generatorPatch
@effect/opentelemetryPatch
@effect/platform-browserPatch
@effect/platform-bunPatch
@effect/platform-denoPatch
@effect/platform-nodePatch
@effect/platform-node-sharedPatch
@effect/sql-clickhousePatch
@effect/sql-d1Patch
@effect/sql-libsqlPatch
@effect/sql-mssqlPatch
@effect/sql-mysql2Patch
@effect/sql-pgPatch
@effect/sql-pglitePatch
@effect/sql-sqlite-doPatch
@effect/sql-sqlite-react-nativePatch
@effect/sql-sqlite-wasmPatch
@effect/vitestPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-slopcopeffect-slopcopBot added 4.0 bug Something isn't working labels Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth documenting.

Reviewed changes — reviewed PR #7162, which hard-codes a 5-second SQLite busy timeout and BEGIN IMMEDIATE transaction start into the Node and Bun SQLite clients, adds client-level regression tests for both defaults, and ships a patch changeset.

  • busy timeout defaultPRAGMA busy_timeout = 5000 runs at connection setup in both clients, before WAL mode is enabled.
  • immediate transactions — both clients now pass beginTransaction: "BEGIN IMMEDIATE" to the shared SqlClient.make, so withTransaction acquires the write lock at transaction start, avoiding deferred-snapshot upgrade failures.
  • regression tests — "uses a 5 second busy timeout" and "starts transactions immediately" in each client; the latter contends two clients on one file using a 1ms busy timeout to fail fast.
  • changeset — patch bump for both packages.

Validated on this checkout: the full @effect/sql-sqlite-node suite (59 tests) passes, and the "starts transactions immediately" test fails when BEGIN IMMEDIATE is reverted, confirming it genuinely pins the new behavior. I also probed node:sqlite directly: BEGIN IMMEDIATE succeeds on read-only connections (no readonly regression) and contended lock acquisition honors busy_timeout.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment threadpackages/sql/sqlite-node/src/SqliteClient.ts
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File NameCurrent SizePrevious SizeDifference
basic.ts6.92 KB6.92 KB0.00 KB (0.00%)
batching.ts9.72 KB9.72 KB0.00 KB (0.00%)
brand.ts6.60 KB6.60 KB0.00 KB (0.00%)
cache.ts10.59 KB10.59 KB0.00 KB (0.00%)
config.ts20.91 KB20.91 KB0.00 KB (0.00%)
differ.ts19.77 KB19.77 KB0.00 KB (0.00%)
http-client.ts21.52 KB21.52 KB0.00 KB (0.00%)
logger.ts10.81 KB10.81 KB0.00 KB (0.00%)
metric.ts8.86 KB8.86 KB0.00 KB (0.00%)
optic.ts6.68 KB6.68 KB0.00 KB (0.00%)
pubsub.ts14.86 KB14.86 KB0.00 KB (0.00%)
queue.ts11.54 KB11.54 KB0.00 KB (0.00%)
schedule.ts10.71 KB10.71 KB0.00 KB (0.00%)
schema-class.ts19.48 KB19.48 KB0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts29.41 KB29.41 KB0.00 KB (0.00%)
schema-representation-roundtrip.ts25.63 KB25.63 KB0.00 KB (0.00%)
schema-string-transformation.ts13.55 KB13.55 KB0.00 KB (0.00%)
schema-string.ts11.09 KB11.09 KB0.00 KB (0.00%)
schema-template-literal.ts15.38 KB15.38 KB0.00 KB (0.00%)
schema-toArbitrary.ts21.52 KB21.52 KB0.00 KB (0.00%)
schema-toCodeDocument.ts24.00 KB24.00 KB0.00 KB (0.00%)
schema-toCodecJson.ts18.74 KB18.74 KB0.00 KB (0.00%)
schema-toEquivalence.ts18.57 KB18.57 KB0.00 KB (0.00%)
schema-toFormatter.ts18.43 KB18.43 KB0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts22.59 KB22.59 KB0.00 KB (0.00%)
schema-toRepresentation.ts19.08 KB19.08 KB0.00 KB (0.00%)
schema.ts18.73 KB18.73 KB0.00 KB (0.00%)
stm.ts12.59 KB12.59 KB0.00 KB (0.00%)
stream.ts9.67 KB9.67 KB0.00 KB (0.00%)

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta of the prior Pullfrog review (3a59c29701d95f, "Address SQLite client review"):

  • configurable busyTimeout — both SqliteClientConfigs gain a busyTimeout?: Duration.Input option, applied at connection setup via PRAGMA busy_timeout = ${Duration.toMillis(...)}; defaults stay at 5 seconds. Duration.toMillis accepts Duration.Input, so string/number durations type-check and run correctly.
  • documented trade-offs — module and make() JSDoc in both clients now state that busy waits block the event loop (sync drivers) and that BEGIN IMMEDIATE makes read-only transactions serialize behind other writers; the prior review's request to call this out explicitly is addressed, and the concurrency consequence now has an escape hatch.
  • regression tests — the "uses a 5 second busy timeout" tests now also pin the override (busyTimeout: "1 second"[{ timeout: 1000 }], which would fail if the knob weren't wired), a new node "supports transactions on readonly clients" test guards the readonly + BEGIN IMMEDIATE interaction, and the bun readonly test gained a withTransaction read.
  • changeset — description expanded to reflect the configurable timeout and the event-loop/serialization trade-offs.

Validated on this checkout: the full @effect/sql-sqlite-node Client suite (8 tests) passes, including the new override and readonly-transaction tests. The prior feedback thread is resolved.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot]
pullfrogBot approved these changes Aug 9, 2026

@pullfrogpullfrogBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — re-reviewed #7162 against the delta since the prior approved Pullfrog review (701d95fe4eda0b, "Handle infinite SQLite busy timeouts"):

  • clamped busy timeout — both Node and Bun clients now clamp busyTimeout via Math.min(MAX_BUSY_TIMEOUT, Math.max(0, Math.round(Duration.toMillis(...)))), mapping Duration.infinity, negative, and oversized durations to SQLite's signed-32-bit maximum 2_147_483_647.
  • JSDoc — both SqliteClientConfig docs note that Duration.infinity is clamped to SQLite's maximum timeout.
  • regression tests — the node and bun "uses a 5 second busy timeout" tests now also assert busyTimeout: Duration.infinity[{ timeout: 2_147_483_647 }].

Validated on this checkout: the @effect/sql-sqlite-node Client suite (8 tests) passes. I also probed node:sqlite directly: without the clamp, PRAGMA busy_timeout = Infinity silently parses to 0 (no waiting at all), while 2147483647 round-trips — so the new test genuinely pins the clamp and the change fixes a real silent-misconfiguration edge case for Duration.infinity.

Pullfrog⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@tim-smart
tim-smart merged commit c30386d into mainAug 9, 2026
20 checks passed
@tim-smart
tim-smart deleted the agent/sqlite-client-defaults branch August 9, 2026 22:07
@effect-boteffect-bot mentioned this pull request Aug 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite-backed workflow runner storage becomes unhealthy under concurrent runner/control-plane access

1 participant

@tim-smart