Repository navigation
Description
Summary
GET /api/v1/threads/<id>/thread-storage/files/<path> answers a Range request with 200 and the
whole file, and never sends Accept-Ranges. A <video> pointing at a stored mp4 therefore cannot
seek, and Safari (macOS and iOS), which requires byte-range responses for video, does not play it.
Agents routinely render videos into thread storage (e.g. a Remotion render); the natural way to
show one is a <video src> at this route.
Versions and environment
bb 0.43.4 desktop, macOS; source checked on main at 6984eba875135252cb203cfe363bfecfeeeb8ce0.
Steps to reproduce
- Put any mp4 in a thread's storage (here 4,032,142 bytes).
curl -s -o /dev/null -D - -H 'Range: bytes=0-99' http://127.0.0.1:38886/api/v1/threads/<id>/thread-storage/files/clip.mp4
Expected vs actual
Expected 206 Partial Content, Content-Range: bytes 0-99/4032142, Accept-Ranges: bytes.
Actual:
HTTP/1.1 200 OK
content-length: 4032142
content-type: video/mp4
Evidence
The route passes only If-None-Match through; the file is read whole over host RPC:
bb/apps/server/src/routes/threads/data.ts
Lines 275 to 295 in 6984eba
| async function serveThreadStorageRawFile( | |
| deps: LoggedWorkSessionDeps, | |
| threadId: string, | |
| rawPath: string, | |
| ifNoneMatch: string | undefined, | |
| ): Promise<Response> { | |
| const filePath = parseSafeRelativeRoutePath(rawPath); | |
| const target = await requireThreadStorageTarget(deps, { threadId }); | |
| return serveDaemonFileContent( | |
| deps, | |
| { | |
| hostId: target.hostId, | |
| ...(!isHtmlPreviewPath(filePath.relativePath) ? { ifNoneMatch } : {}), | |
| path: path.join(target.storagePath, filePath.relativePath), | |
| rootPath: target.storagePath, | |
| }, | |
| (result) => | |
| createRawFilePreviewResponse(result, filePath.relativePath, ifNoneMatch), | |
| ); | |
| } |
and
bb/apps/server/src/routes/threads/data.ts
Lines 728 to 735 in 6984eba
| get(routes.storageFile, async (context) => | |
| serveThreadStorageRawFile( | |
| deps, | |
| context.req.param("id"), | |
| context.req.param("filePath"), | |
| context.req.header("if-none-match"), | |
| ), | |
| ); |
Inference: because the whole file crosses the host RPC, the daemon's read cap (25 MiB for
non-image files, measured on 0.42.1) also bounds any video served here. A ranged read would lift
that for media as well.
What you ruled out
Not content-type (it is video/mp4), not caching (If-None-Match absent). Searched issues for
"Range", "206", "video", "seek" — nothing relevant; #3700 (PDF download) and #3439 (inline
previews) are adjacent.
Suggested priority and effort
Small, contained. Affects anyone viewing an agent-made video from storage, and bb's own previews if
they use this route. I can PR it once approved.
AGENT GENERATED
Activity
BartSoj commentedon Sep 25, 2026
Live evidence from bb Connect (bb 0.43.4,
<handle>.getbb.app), 2026-09-25. The same stored4,032,142-byte H.264 mp4 opened directly at
/api/v1/threads/<id>/thread-storage/files/<name>.mp4— top-level navigation, signed in, so thesession cookie is sent:
Every WebKit client refuses it and the one Blink client plays it — the pattern expected when a
server answers
Rangewith200and noAccept-Ranges(measured in the issue). Chrome on macOS plays thesame file from the same URL, so it is not the encoding.
Why loopback hides it (measured the same day from the signed-in Connect tab, same-origin
fetch):over Connect the response carries no
Content-Length— the body is re-streamed — and aRange: bytes=0-99request still gets200and all 4,032,142 bytes. On loopback the response hasContent-Length, and WebKit falls back to the whole-file200and plays. WithoutContent-Lengthand without206, WebKit fails with MediaError 4, which is what every iOS browsershows. A branch that answers single ranges with
206plays and seeks in WebKit in that streamedcase: https://github.com/BartSoj/bb/tree/fix/thread-storage-range
Stream thread-storage files through bounded daemon reads (#4351)
Fix byte ranges for thread-storage videos (get-bb#4343)
bb-slop-cop commentedon Sep 25, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotPreserved Bug · Medium priority · High effort · threads.
ALREADY FIXED · high root-cause confidence. The former whole-file handler discarded Range; current main forwards the request to bounded, range-aware streaming. Both clean checkouts passed 121 route/stream tests, including
206,Content-Range, andAccept-Ranges. Safari/Connect playback was not tested.Reproduction and root-cause report · reproduction label:
no-repro.No new PR: the fix is already merged in #4343 and present on trusted main.