fix(sdk): skip node:sqlite fallback under Bun runtime#783
Open
khaliqgant wants to merge 1 commit intomainfrom
Open
fix(sdk): skip node:sqlite fallback under Bun runtime#783khaliqgant wants to merge 1 commit intomainfrom
khaliqgant wants to merge 1 commit intomainfrom
Conversation
The codex and opencode CLI-session collectors try better-sqlite3 first
and fall back to the Node 22+ node:sqlite builtin. Bun does not
implement node:sqlite; attempting the import rejects AND emits cosmetic
stderr noise ('error: Registry URL must be http:// or https://') that
leaks through the try/catch. Under cloud's Bun-driven standalone wrapper
this surfaces in runner.log after every successful workflow completion.
Detect the runtime via process.versions.bun and skip the fallback.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
xkonjin
reviewed
Apr 24, 2026
xkonjin
left a comment
There was a problem hiding this comment.
Code Review: fix(sdk): skip node:sqlite fallback under Bun runtime
Smart, targeted fix. Bun + node:sqlite impedance mismatch is a real annoyance, and the process.versions.bun guard is the cleanest approach.
What works:
- The
isBunRuntime()check is minimal, correct, and the right level of abstraction. - Reusing it in both codex and opencode collectors is DRY enough (these are separate modules with separate imports, so it makes sense).
- The try/catch already catches the thrown import, but the cosmetic stderr still leaked. This cuts it off at the source.
Nit:
- Consider adding a tiny test case or at least a comment that the
isBunRuntimeguard should be revisited once Bun implements node:sqlite. It's not a blocker, but it prevents a future dev from removing what looks like a redundant guard.
No security or functional issues found. Approve with the nit above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The codex and opencode CLI-session collectors (
packages/sdk/src/workflows/collectors/codex.ts,opencode.ts) trybetter-sqlite3first and fall back to the Node 22+node:sqlitebuiltin. Bun does not implementnode:sqlite— attemptingawait import('node:sqlite')(codex) orrequire('node:sqlite')(opencode) both reject, but Bun also emits cosmetic stderr diagnostic outputbefore the promise rejects. The try/catch catches the throw, but the stderr line has already been written.
Under cloud's Bun-driven
.relay-standalone-wrapper.mjs, this surfaces inrunner.logafter every successful workflow completion (between "PASSED" and the patch-generation step) and looks like a real error to anyone reading the logs.Fix
Detect the Bun runtime via
process.versions.bunand skip thenode:sqlitefallback when present. Under Bun, ifbetter-sqlite3isn't available the collector returns null (emptyCliSessionReport), which is the correct behavior — there's no other SDK path today that can read the state DBs from Bun.Example of the noise this fixes
From a prod cloud workflow run (
d4f9f0ab-80d2-4ab6-b426-26e14de11948), inrunner.log:After this PR + next SDK publish + bump in cloud, the two
error:lines go away.Test plan
🤖 Generated with Claude Code