Repository navigation
Cache compiled SQL for static thread event reads - #8369
Merged
Merged
Conversation
scowalt
pushed a commit
to scowalt/bb
that referenced
this pull request
Dec 1, 2026
🚨 **SLOP COP** 🚨 · `new-issue-autopilot` ## Human comments ## What was wrong Six stable thread-event read paths rebuilt Drizzle queries and prepared synchronous SQLite statements on every invocation instead of using the existing per-connection compiled-query cache. An investigator-authored regression reproduces this on trusted main in two clean checkouts: six preparation-budget failures, with the already-cached sequence lookup passing as a control. [Reproduction and root-cause report](https://get-bb.github.io/reports/issues/8362.html) ## What changed - Reuse parameterized statements for singleton high-water marks and accepted-input reads, active-turn branches, earlier-stop branches, no-exclusion provider identity reads, and unfiltered request-row ordering variants. - Preserve multi-thread batching, non-empty provider exclusions, and non-null request filters on their existing dynamic paths. - Add real-SQLite coverage for fresh results after writes, changing thread bindings, populated branches, and reuse across transactions. - Change only the database subsystem: **2 files, 435 changed text lines** (346 additions + 89 deletions). No dependency, schema, stored-data, protocol, permission, packaging, or release-process changes. ## How you verified - Before: `pnpm exec turbo run test --filter=@bb/db -- --testNamePattern='reuses compiled.*fresh bindings'` fails on six intended preparation assertions and passes the cached control; repeated in a second clean checkout at `a8c32288cf24894fbe85cb3a9ca0469c7a997ed6`. - After: the focused regression passes all seven cases; `pnpm exec turbo run test typecheck --filter=@bb/db` passes **73 test files, 769 tests**, plus typechecking and the query-plan guard. - Empty-thread measurement: each affected path drops from 500 preparations for 500 calls to one preparation. Absolute timings are environment-specific; see the report artifacts. - `git diff --check` passes; `git diff --numstat origin/main` verifies the line count and absence of binary changes. - The broad monorepo build encountered pre-existing missing plugin SDK runtime artifacts in the GitHub plugin; the relevant database checks pass. Fixes get-bb#8362 > AGENT GENERATED <!-- slopcop:rule=new-issue-autopilot run=run_6gc7f9pnmx27hm5c sha=issue-8362 kind=summary --> Co-authored-by: SawyerHood <[email protected]>
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.
🚨 SLOP COP 🚨 ·
new-issue-autopilotHuman comments
What was wrong
Six stable thread-event read paths rebuilt Drizzle queries and prepared synchronous SQLite statements on every invocation instead of using the existing per-connection compiled-query cache. An investigator-authored regression reproduces this on trusted main in two clean checkouts: six preparation-budget failures, with the already-cached sequence lookup passing as a control.
Reproduction and root-cause report
What changed
How you verified
pnpm exec turbo run test --filter=@bb/db -- --testNamePattern='reuses compiled.*fresh bindings'fails on six intended preparation assertions and passes the cached control; repeated in a second clean checkout atb0ddaad731565d7e4de68d824120d802fc78f7d5.pnpm exec turbo run test typecheck --filter=@bb/dbpasses 73 test files, 769 tests, plus typechecking and the query-plan guard.git diff --checkpasses;git diff --numstat origin/mainverifies the line count and absence of binary changes.Fixes #8362