You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
listActiveBackgroundTaskCountsByThreadIds throws 'too many SQL variables' at ≥16,377 visible threads, failing the thread-list route #1205
listActiveBackgroundTaskCountsByThreadIds (packages/db/src/data/events.ts) binds the caller's thread-id list twice — once in each CTE. SQLite's variable limit is 32,766. At 16,377 or more thread ids the query throws SqliteError: too many SQL variables (measured boundary: 16,376 works, 16,377 throws; the double-bound list plus the fixed parameters crosses the limit).
toThreadListEntryResponses calls this function with every listed thread id. So on an instance with ≥16,377 visible threads, GET /api/threads (and bb thread list) does not get slow — it fails outright. The projects-with-threads bootstrap fails the same way once the active thread count crosses the boundary.
Found while measuring #1131 at 26K visible threads; the thread-list route could not run at all until I capped the id list.
The probes run over the full-size events_thread_type_item_kind_sequence_idx, so cold cost scales with the events index, not with the number of background-task events. This is the same class of problem #1204 fixed for listLatestGoalEventRowsByThreadIds.
Suggested fix
Chunk the thread-id list (or use a temp table / JSON parameter) so the route survives any thread count.
Activity
Fix the #1131 cold stall at its source: index the latest-goal lookup,…
Fix thread list failure above SQLite variable limit (get-bb#1209)
Fix the get-bb#1131 cold stall at its source: index the latest-goal l…
Fix thread list failure above SQLite variable limit (get-bb#1209)