fix(web): open turn folds no longer make each timeline update quadratic #32786
maria/redesign/2-composer-timeline fromrefs/pull/32786/head·opened View on GitHubProblem#
Row derivation gathers the work of every open turn fold so it can show that work under the fold. For each open fold, gatherOpenFoldWork searched the whole entry list for the fold's anchor, then filtered every entry before it. So each timeline update cost the thread's length times the number of open folds. Failed and usage-limited turns start open, and every turn the user expands joins them. With every turn open, an 8,600-item thread spent 18–26 ms of each new tool call's update here.
Change#
The entries are indexed by id once per update. Each open fold then looks up its anchor and its hidden entries in that index, and gathers them in timeline order, as before.
This is independent of #32756, #32769 and #32782. All four target this branch.
Scope and approval#
A focused, behavior-preserving performance fix in this branch's fold derivation, with no visible change. There's no prior issue. It's offered for the branch owner to take, or to fold into the stack.
Verification#
Behavior is unchanged. The fold tests in
MessagesTimeline.logic.test.tsandMessagesTimeline.browser.test.tsxpass, 186 in all. As a check that they cover this path: gathering the fold's entries in the wrong order fails one of them.Row derivation per new item, in Node, on synthetic threads where each run opens with a prompt, plus a live turn of 150 tool calls. These are two alternating rounds, with load-spike runs left out:
Items Every turn open Finished turns folded 4,301 5.0–7.4 → 2.4–3.3 ms unchanged (1.7–2.4 ms) 8,601 18–26 → 6.7–9.6 ms unchanged (3.3–4.4 ms) vp run check:changed origin/maria/redesign/2-composer-timelinepasses.
Claude Opus 5.5 via Claude Code, in T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
bb35adeMacroscope's review found this PR approvable — This optimizes open chat timeline folds by sharing an entry index instead of repeatedly scanning the timeline. The change is limited to display construction and leaves product defaults and stored data unchanged.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Note
Written by
claude-opus-5-5on behalf of MariaBase rebase merged#
maria/redesign/2-composer-timelinewas rebased, so this PR conflicted and showed 698 files. I merged the new base into the head with a merge commit (d5b85defa9), with no rebase.GitActionsControl.tsxtook the base side, which this PR never touched.MessagesTimeline.logic.tskept this PR's indexed fold lookup. The diff is back to that one file, +21/-7.Checks on a testbox:
vp run check:changedagainst the base passed, along with 142MessagesTimeline.logictests and 66MessagesTimelinebrowser tests.Agent context budgetfails because of the base branch, not this PR. The base hasmcpToolListJsonBytes48217 and main has 48131. #33892, also on the new base, fails the same way. It clears once the base branch takes current main.
Verified in a real dev environment#
verified functional behavior at
0b914c8856035503a25007b9385c2be0aeb97015on linux using the dev web client, repository Playwright, and/usr/bin/google-chrome. created a project pointing at a real git checkout through the app and ran real Codexgpt-6.1-solturns. no mocks or fixtures.three completed tool-bearing turns produced groups of 3, 3, and 5 commands. opened all three turn folds, expanded their command groups, collapsed and reopened a fold, and checked the explicitly sequential commands stayed in order. a fourth real turn completed with all three earlier folds open. reloading retained all four responses and the earlier tool groups.
ran main
4c361199f4first in a separate installed worktree, completed a real provider turn, and expanded its fold. stopped main before starting the exact pr head. the screenshots use the same project checkout, prompt, model, and reply marker; their different surrounding ui reflects the different branches.existing checks through blacksmith: 136 timeline logic tests and 52 timeline browser tests passed. the browser worker initially lacked chromium; installed it and reran successfully. the pr reports 29 successful ci checks. no source changes or pushes were needed.



Not verified#
the large-thread performance claim and original quadratic slowdown are unverified. today's main has a different fold implementation and no
gatherOpenFoldWork; the real thread exercised here is small. these captures prove functional behavior, not a measured speedup or the reported 8,600-item timings.native desktop/mobile clients, other providers, failed or usage-limited turns, dark theme, and remote/relay/tunnel connections were not exercised. this pass used the linux local web client and successful Codex turns.
This PR conflicts with
maria/redesign/2-composer-timeline. Rebase it or mergemaria/redesign/2-composer-timelineinto it. If it still conflicts after 7 days with no activity, it will be closed automatically.See the conflict window.
github-actions[bot](GitHub profile, opens in a new tab) added labelsneeds-rebase
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Closing. This PR conflicts with
mainin 47 files, which is more than we will review as a rebase. If the change still matters, open a fresh PR from currentmain.t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes