[Bug]: Long threads load and synchronize slowly #26018
Loading and synchronizing long T3 Code threads can be extremely slow. I do not yet have a timing measurement or trace for a failed load.
Reproduction#
- Open an existing thread with a long conversation or a large agent turn.
- Wait for the thread to load and synchronize.
- Compare the delay with a short thread on the same connection.
Related fixes and release status#
Two relevant performance changes have merged:
- #24589 avoids loading a whole long agent turn when a thread opens.
- #24899 reduces the amount of data loaded when opening a thread.
Both are included in v0.1.4-nightly.20261027.3770. Neither is in v0.1.2, which is the version of my connected server. The browser client's exact build is unknown. This version difference means the report does not establish a performance regression in the latest nightly.
The server runs Ubuntu 24.04.5 x86_64. A repeat measurement on the newer server is still needed before attributing the remaining delay to another code path. No additional performance fix is claimed here.
The separate scroll-position problem remains unresolved for me and is tracked in #26016.
juliusmarminge added labelsneeds more info
Two open PRs cut client-side timeline derivation cost on long threads, in case remaining slowness after #24589 and #24899 is on the client: #26688 (turn-fold rows, 5.4k entries 91 ms to 5.2 ms) and #26693 (tool and status updates, 11 ms to 0.29 ms). Both are Node benchmarks, not browser traces, and neither addresses server-side load or sync. Not claiming these fix this report.
juliusmarminge removed labelsneeds more info
Re-checked on current main (
9826dbb990), which since the last check also includes https://git.cafe/pingdotgg/t3code/pulls/26240 (long thread history loads in bounded pages). Against a real server, the 900-row agent-turn fixture returns its bounded snapshot in 20–29 ms and each older history page in 14–19 ms, and the v2 transport performance checks (vp run test:perf:v2-wire, 265 tests) pass. Your server is onv0.1.2, which has none of these changes, so we still cannot tell what remains slow for you.Once your server is on
v0.1.4-nightly.20261027.3770or later, please share for one slow open:- how long it takes, and whether the server is reached over LAN, Tailscale, or T3 Connect
- the size of
~/.t3/userdata/statev2.sqliteand roughly how many turns the thread has - if you can, the durations of
http.orchestration.loadThreadSnapshotWindow,ProjectionStore.readCanonicalProjectionandclientRuntime.state.fetchEnvironmentBoundedThreadSnapshotfrom~/.t3/userdata/logs/server.trace.ndjson(names and durations only)
juliusmarminge added labelsneeds more info
juliusmarminge removed labelsneeds more info
Checked again on current main (
29f33af7d7, which now includes https://git.cafe/pingdotgg/t3code/pulls/26727) as the real web app on a fresh database, with one 150-turn thread (1,051 timeline rows, 450 messages, 28 MB database) and a one-turn thread on the same server:short thread 150-turn thread bounded snapshot (6 fetches, loopback) 35–58 ms, 38 KiB 78–102 ms, 383 KiB switching to the thread in the app until its latest message renders (4 runs) 244–288 ms 368–374 ms server http.orchestration.loadThreadSnapshotWindow37–58 ms A new turn sent to the long thread while it was open rendered 113 ms after the server created the message. The full unbounded snapshot of that thread is 5.3 MiB; opening it sends 383 KiB and loads older rows on scroll.
The slow path on
v0.1.2(opening a thread shipped its whole latest turn) was fixed in 553203c57b (https://git.cafe/pingdotgg/t3code/pulls/24589), and main has since added abd9d9f970 (https://git.cafe/pingdotgg/t3code/pulls/24899), d2429f733c (https://git.cafe/pingdotgg/t3code/pulls/26240) and 29f33af7d7 (https://git.cafe/pingdotgg/t3code/pulls/26727). Since none of the three checks on main has reproduced a slow load or sync, I'm closing this as fixed. If a server onv0.1.4-nightly.20261027.3770or later is still slow for you, please reopen with how long one open takes, the connection type (LAN, Tailscale or T3 Connect), and the durations of the spans named above from~/.t3/userdata/logs/server.trace.ndjson.juliusmarminge closed this
Sign in to join this conversation.
I tried to reproduce this on current main (
dc84b0962e) and onv0.1.2(044f07257c), each as the real web app on a fresh database, with the same synthetic threads seeded through the server: one thread whose last agent turn has 900 rows, and one 59-turn conversation where every turn carries an 879 KiB MCP result.Opening a thread fetches its bounded snapshot (
/api/orchestration/threads/<id>/bounded). Here it is, fetched 6 times per row from the app's own page over loopback:On
v0.1.2, opening a thread whose latest turn is long ships the whole turn. Over LAN, Tailscale or a tunnel, that easily takes seconds per open. Main sends the latest 75 rows and loads older rows when you scroll up (https://git.cafe/pingdotgg/t3code/pulls/24589). With the client cache cleared, a full cold load of that thread on main took 404 ms in the app, against 1,240 ms onv0.1.2. I could not get main into the multi-second range on either thread.To narrow down whatever is still slow for you, could you share the following?
v0.1.4-nightly.20261027.3770or later~/.t3/userdata/statev2.sqliteon the server, and roughly how many turns the slow thread has~/.t3/userdata/logs/server.trace.ndjson, in particularhttp.orchestration.loadThreadSnapshotWindow,ProjectionStore.readCanonicalProjectionandclientRuntime.state.fetchEnvironmentBoundedThreadSnapshot(names and durations only, no thread content)