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
conversation-outline rebuilds 2-3 MB on almost every open of a long, busy thread (0.49.0): key includes outlineSequence and status, no incremental build #7399
On bb 0.49.0, opening a long thread shows the skeleton for 1–4 s. GET /api/v1/threads/:id/conversation-outline rebuilds the whole outline of the thread on the event loop whenever the stored copy does not match, and for a busy thread it almost never matches.
This is the same class of problem as #1972 (closed 2026-08-20), still present with the stored projection that replaced the in-memory cache.
Why the stored outline rarely hits (0.49.0 bundle, loadThreadConversationOutline)
buildThreadConversationOutlineProjectionKey puts outlineSequence and thread.status in the key ([version, rewriteGeneration, outlineSequence, providerId, providerDisplayName, status, title, titleFallback, completedTurnDisplay, includeClearedContextHistory]). Any new outline-relevant event, or a status change, makes the stored row stale.
shouldMaterializeThreadConversationOutline only stores when the thread is idle or error, so a thread that is working is rebuilt in full on every request.
On a miss the rebuild is one runEventLoopWorkSync("conversation-outline <id>") over the whole history; nothing is appended to the previous result.
Coordinator threads that receive child notifications all day are the worst case: each click rebuilds 2–3 MB.
Measured (one Linux server, bb 0.49.0, through bb connect)
Stored outlines (thread_conversation_outlines.items_json), largest four: 3.13 MB (thread with 140,688 events), 2.45 MB, 2.40 MB (115,317 events), 2.24 MB. 64 rows in total.
conversation-outline requests since the server started on 0.49.0 (957 requests, originTtfbMs from the connect plugin's log line, so server time only):
ms
p50
68
p90
793
p99
2,535
max
3,796
151 of 957 took more than 0.5 s and 71 more than 1 s. The slowest eight are all the four or five largest threads (2.6–3.8 s each, 140–410 kB compressed response). In the same period the event-loop stall log's longest synchronous work is conversation-outline <thread> or timeline-build <thread> for those threads.
Expected
Opening a long thread should not cost a full rebuild.
Suggested direction
Incremental outline: keep the stored items and append/patch only what changed after the stored outlineSequence, instead of rebuilding from sequence 0. Take status (and other header-only fields) out of the key so a status flip does not invalidate the items.
And/or paginate: return the last N turns first and load older ones on scroll, as the timeline already does with its window.
Materialize for active threads too (or keep the last stored items as the base for 1).
Related: #7281 (single cascade DELETE blocks the server), #6859, #1972.
More data from the same server (bb 0.49.0, about 19 h since the server started on it), for the "Loading latest messages…" state that stays on screen for a long time on these threads.
Measured, from the server's own Event loop stalled log lines (threshold 500 ms):
1,397 stalls: p50 778 ms, p90 1,483 ms, max 3,685 ms, 1,288 s stalled in total (about 2% of wall time).
1,345 of them are stallAttribution: unattributed. Only 31 carry a candidate, all conversation-outline <thread>.
longestSynchronousWork in the stalled interval:
longest tracked sync work
stalls
its wall time, summed
stall time, summed
ws:daemon heartbeat
661
1.0 s
544 s
timeline-build <thread>
544
69.7 s
514 s
conversation-outline <thread>
157
158.4 s
190 s
ws:daemon host-rpc.response
21
0.04 s
26 s
So for the outline rows the tracked work explains the stall. For the other ~1,200 stalls the longest tracked work is far shorter than the stall (a 1 ms heartbeat inside a 0.8 s stall): the time is spent in work that runEventLoopWorkSync does not wrap.
lastCompletedWork of the stalled intervals: POST /internal/session/events 453, plugin:provider-codex experimental_thread.events handler 150, POST /api/v1/plugins/automations/cli 106, GET /api/v1/projects 80.
Only 385 of the 1,397 stalls have a Slow DB query line in the 5 s before them.
Reported by the same user on the client (not re-measured here):GET /timeline itself answers in 20–70 ms (150–490 kB) for these threads; the banner is the thread detail's catching-up state, whose refetch waits behind the stalls above.
Inferred: most of the unattributed stall time is synchronous JS on the server while it ingests session events for threads with 75k–180k events (projection / outline / JSON work), not SQLite.
Ask: a CPU profile of the server while one or two threads of that size are streaming would show it directly. If there is a supported way to capture one on a production install (a flag or an env var for --cpu-prof / inspector), I can run it here and attach the result.
Verdict: PARTIALLY REPRODUCED · Confidence: High for the measured replay paths · Label:partial-repro.
Root cause: Status changes invalidate incremental checkpoints; manager-message-only history never advances its turn-based checkpoint. Incremental completed-turn appends already work.
Verification: Both clean checkouts reproduced full reads of 3,000 rows after a status change and 1,001 rows after a manager-message append. The incremental append control selected six rows; 38 existing tests passed. Production latency and payload-size claims remain unverified.
No PR: Removing status alone risks stale projected content; a safe status-aware, turn-free checkpoint design was not established within the simple-fix constraints.
Activity
lucascastellanibr commentedon Nov 10, 2026
More data from the same server (bb 0.49.0, about 19 h since the server started on it), for the "Loading latest messages…" state that stays on screen for a long time on these threads.
Measured, from the server's own
Event loop stalledlog lines (threshold 500 ms):stallAttribution: unattributed. Only 31 carry a candidate, allconversation-outline <thread>.longestSynchronousWorkin the stalled interval:ws:daemon heartbeattimeline-build <thread>conversation-outline <thread>ws:daemon host-rpc.responseSo for the outline rows the tracked work explains the stall. For the other ~1,200 stalls the longest tracked work is far shorter than the stall (a 1 ms heartbeat inside a 0.8 s stall): the time is spent in work that
runEventLoopWorkSyncdoes not wrap.lastCompletedWorkof the stalled intervals:POST /internal/session/events453,plugin:provider-codex experimental_thread.events handler150,POST /api/v1/plugins/automations/cli106,GET /api/v1/projects80.Slow DB queryline in the 5 s before them.Reported by the same user on the client (not re-measured here):
GET /timelineitself answers in 20–70 ms (150–490 kB) for these threads; the banner is the thread detail's catching-up state, whose refetch waits behind the stalls above.Inferred: most of the unattributed stall time is synchronous JS on the server while it ingests session events for threads with 75k–180k events (projection / outline / JSON work), not SQLite.
Ask: a CPU profile of the server while one or two threads of that size are streaming would show it directly. If there is a supported way to capture one on a production install (a flag or an env var for
--cpu-prof/ inspector), I can run it here and attach the result.bb-slop-cop commentedon Nov 10, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotthreads,perf.partial-repro.Give the timeline and outline caches one revisioned-slot cache, and c…
Keep the conversation outline checkpoint across status and title changes
Keep the conversation outline checkpoint across status and title chan…