[Bug]: Thread opens completely blank when its newest item is a large checkpoint (initial history window exceeds 1 MB byte budget)
Version
Desktop "T3 Code (Beta)" 0.1.5 (macOS) with a local 0.1.5 server; same result in the mobile app connected to that server.
What happens
Opening an existing thread shows an empty conversation: no messages, no turns. The content only appears after pressing "Load earlier turns". The server side is fine: t3_thread_read returns all 15 runs / 195 items, and the server trace has no errors for the thread (subscribeThread succeeds; it's only interrupted when the user navigates away).
Root cause (from v0.1.5 source)
apps/server/src/orchestration-v2/threadHistoryPaging.ts:
THREAD_HISTORY_PAGE_POLICY.maxEncodedBytesis1_048_576.projectedRowBoundedSnapshotEncodedBytescharges local items twice (row +row.item).
The newest item in the thread is the checkpoint of the last turn. Its payload_json is ~744 KB because files lists 5,406 paths. Counted twice that's ~1.5 MB, so even the single newest item doesn't fit, and the initial window comes back empty. The timeline would skip the checkpoint anyway (session-logic.ts: if (item.type === "checkpoint") continue;), so the user sees a blank thread with nothing that explains why.
How a checkpoint gets that large
This is a long-lived thread in a busy shared repo. The thread sat idle for 6 days while other sessions committed thousands of files, so the checkpoint of the next turn covers everything that changed in the repo since the previous checkpoint (5,406 files, nearly all from other sessions). In our database other threads have checkpoints of 1.5-2.3 MB (10k-15k files), so any of them would hit this once that checkpoint is their newest item.
Steps to reproduce
- In a git repo, run a turn in a thread.
- Outside the thread, change/commit a few thousand files (enough that the checkpoint item serializes to >~520 KB).
- Run another short turn in the thread and let it complete.
- Switch away and reopen the thread: it's blank until "Load earlier turns".
Expected
The initial window always includes at least the latest user turn and assistant messages. Possible fixes:
- Always admit at least one row/turn even when it exceeds the byte budget, or
- Exclude or truncate
checkpoint.filesin the history window (the timeline doesn't render checkpoints; the changed-files card could fetch them on demand), or - Have the client auto-load the next page when a window yields zero renderable entries.
Diagnostic query (read-only)
SELECT ordinal, type, length(payload_json)
FROM orchestration_v2_projection_turn_items
WHERE thread_id = '<thread>'
ORDER BY length(payload_json) DESC LIMIT 5;
Thanks for the precise report. Your diagnosis is correct for v0.1.5, and this is already fixed on main by 7f39a860d9 (https://git.cafe/pingdotgg/t3code/pulls/27110, "huge checkpoints ship up to 75x smaller to clients"), which first shipped in v0.1.6-nightly.20261030.3904 and v0.1.6-preview.20261030.3948.
That change caps a checkpoint's file list at 200 entries (plus a filesTotal count) when the thread projection is prepared for the wire. The cap now runs before the history window applies its byte budget, so a checkpoint with thousands of files no longer pushes the turns out of the initial window.
What I ran, following your steps, with each server on a fresh database. The driver ran a turn, committed 6,000 files from outside the thread, then ran a second turn, so the newest item was a 1,057,057-byte checkpoint:
| Build | GET /api/orchestration/threads/:id/bounded |
Opened thread in the web client |
|---|---|---|
v0.1.5 (6d450a4284) |
1,076,309 bytes, visibleTurnItems: ["checkpoint"], hasMoreHistory: true |
Blank, only "Load earlier turns" (reproduces your report) |
main (cadf7d5fe3) |
65,101 bytes, all 8 items, hasMoreHistory: false |
Both turns and the "6,000 changed files" card |
main, third turn after 9,000 more files (1,585,057-byte checkpoint) |
111,182 bytes, all 11 items | All three turns |
Mobile and desktop load the initial window through the same server endpoint, so they get the same result. Closing as fixed on main. Please reopen if a v0.1.6 build still opens a thread blank.