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
Opening a thread fires ~19 API requests, including per-open environment git probes #1303
Found while profiling the mobile web frontend against a seeded database (pnpm seed:perf, #1300).
Numbers
Opening one thread at mobile width issued ~19 requests (StrictMode duplicates excluded): thread, timeline, tabs, interactions, queued-messages, prompt-history, default-execution-options, thread-storage file listing, two child-thread list queries (fork + parent), environment status, and environment pull-request.
Each response is small and fast locally (mostly <60 ms), but on mobile RTTs of 100-300 ms the waterfall serializes into seconds before the view settles.
environments/:id/status and environments/:id/pull-request each took ~200 ms even on a warm local daemon — they run git (and PR lookup) work on every thread open, including idle threads whose worktree hasn't changed.
Repro
pnpm seed:perf on a dev instance.
Open any seeded thread with the network panel open; count requests until settle.
Repeat with DevTools network throttling set to "Slow 4G" to feel the waterfall.
Suggested approach
Bundle the thread-open critical path (thread, first timeline page, tabs, interactions, queued messages, execution options) into one bootstrap response, mirroring sidebar-bootstrap.
Defer environment status, pull-request, and storage listing until the surfaces that show them are opened.
Cache environment status on the daemon with a short TTL and invalidate from file-watcher events instead of probing per open.
Real-device data point from a self-hosted instance, in case it helps prioritise this against #1301/#1304.
Setup: iPhone, Brave (WebKit), reaching bb over a self-hosted Cloudflare Tunnel rather than a LAN. bb.db is 135 MB — an ordinary personal instance, not a seeded one.
Measured: TTFB 529 ms (navigation timing), versus the 100–300 ms this issue assumes. At that RTT the ~19-request waterfall lands around ten seconds, which matches what I see: opening the sidebar or switching threads takes 3–15 s, and INP on thread routes ranged 840–6416 ms across an 8-minute session (Event Timing, foreground samples only).
The part that might matter for prioritisation: this reproduces on a small instance. The open thread showed ~4k DOM nodes — far from the 22k in #1301 — and taps still cost seconds. So the waterfall seems to dominate before timeline size does, at least for ordinary-sized histories.
Methodology note for anyone verifying a fix on a real iPhone: WebKit exposes no Long Tasks API, so longtask-based profiling silently reports nothing there (and reports 0, which reads as "fast", if you're not careful). Event-loop lag — how late a 250 ms timer actually fires — works on every engine and is what I'd use to confirm a fix on-device.
Root cause (short): ThreadDetailView mounts ~12-15 independent per-thread queries with nothing deferred, and useEnvironmentWorkStatus (staleTime 0, refetchOnMount "always") / useEnvironmentPullRequest (refetchOnMount, refetchOnWindowFocus "always") drive uncached server->daemon git and gh pr view probes (70-260 ms git, 1.1-1.6 s GitHub API) on every open, forming a 3-tier waterfall.
Proposed fix: (1) Cache workspace.status in the host daemon per environment, invalidated by the existing WatchManager work-status-changed/git-refs-changed events and daemon-owned mutations, with a short TTL and coalescing (daemon-internal, no protocol bump). (2) Stop probing GitHub per open: useEnvironmentPullRequest -> refetchOnMount false, drop refetchOnWindowFocus "always", refresh on git-refs-changed only, and memoize the last gh pr view result per branch in the daemon. (3) Gate status/PR queries, thread-storage listing, tabs, and fork/parent child-thread lists on the surface that renders them being ope…
Caveats: Measured in dev mode (Vite, StrictMode double-fires, HTTP/1.1 proxy) with a 1-message thread; distinct-URL counts (12-15) are slightly below the issue's ~19 and depend on the thread's tabs/panels. Mobile RTT was emulated via CDP in headless Chromium, not a real iPhone; the reporter's 3-15 s taps over a Cloudflare tunnel were not reproduced on-device. The pull-request timing used a scratch repo poi…
The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).
Closing as addressed by the thread-open request reductions in #1884, #1886, and #2672. These changes defer or cache several requests made when opening a thread. The maintainer has accepted these improvements as sufficient to close this issue. A fresh network census was not performed during this audit, so this closure does not assert a new measured request count.
Activity
MGrin commentedon Aug 11, 2026
Real-device data point from a self-hosted instance, in case it helps prioritise this against #1301/#1304.
Setup: iPhone, Brave (WebKit), reaching bb over a self-hosted Cloudflare Tunnel rather than a LAN.
bb.dbis 135 MB — an ordinary personal instance, not a seeded one.Measured: TTFB 529 ms (navigation timing), versus the 100–300 ms this issue assumes. At that RTT the ~19-request waterfall lands around ten seconds, which matches what I see: opening the sidebar or switching threads takes 3–15 s, and INP on thread routes ranged 840–6416 ms across an 8-minute session (Event Timing, foreground samples only).
The part that might matter for prioritisation: this reproduces on a small instance. The open thread showed ~4k DOM nodes — far from the 22k in #1301 — and taps still cost seconds. So the waterfall seems to dominate before timeline size does, at least for ordinary-sized histories.
Methodology note for anyone verifying a fix on a real iPhone: WebKit exposes no Long Tasks API, so
longtask-based profiling silently reports nothing there (and reports0, which reads as "fast", if you're not careful). Event-loop lag — how late a 250 ms timer actually fires — works on every engine and is what I'd use to confirm a fix on-device.SawyerHood commentedon Aug 18, 2026
Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1303.html
gh pr viewprobes (70-260 ms git, 1.1-1.6 s GitHub API) on every open, forming a 3-tier waterfall.The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at
16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).SawyerHood commentedon Sep 9, 2026
Closing as addressed by the thread-open request reductions in #1884, #1886, and #2672. These changes defer or cache several requests made when opening a thread. The maintainer has accepted these improvements as sufficient to close this issue. A fresh network census was not performed during this audit, so this closure does not assert a new measured request count.