Repository navigation
Studio: stop offscreen reasoning transcripts listening to thread scroll - #13046
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0dc2fee43a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| : new IntersectionObserver( | ||
| (entries) => | ||
| setNearby(entries.at(-1)?.isIntersecting ?? nearby.current), | ||
| { root: scroll, rootMargin: "100% 0px" }, |
There was a problem hiding this comment.
Reseed transcripts when hidden folded rounds reopen
When a long FoldedReasoningRound is closed, reasoning.tsx deliberately keeps it mounted under className="hidden", so this observer eventually calls setNearby(false) and detaches its offset listener. Reopening that round only changes the ancestor's class; it neither scrolls nor reruns this layout effect, leaving the virtualizer on its old offset until this IntersectionObserver reports asynchronously. If the user scrolled while the round was hidden, the first reopened frame can therefore contain stale or blank rows. The reopen path needs to synchronously remeasure and reseed the offset rather than relying solely on this observer.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not introduced here. Hiding a visible transcript's container with display: none, scrolling 1500px, then reopening it and sampling the first frame before paint from a later ResizeObserver: main shows 15 of 32 transcript samples blank, this branch 12 of 28, both settle by 500ms. A synchronous reseed on the reopen resize made it worse (55 of 55), so it was not kept. The jump watcher now ignores zero-height (closed) rounds in e1111a4.
| : new IntersectionObserver( | ||
| (entries) => | ||
| setNearby(entries.at(-1)?.isIntersecting ?? nearby.current), | ||
| { root: scroll, rootMargin: "100% 0px" }, |
There was a problem hiding this comment.
Match the vertical margin to the jump threshold
The fresh evidence beyond the earlier jump report is that IntersectionObserver resolves the vertical 100% root margin against the root's width, whereas onViewportJump compares each delta with half of clientHeight. On a 320×900 viewport, for example, a transcript can be detached just over 320 px below the viewport and a 400 px programmatic or scrollbar jump can land inside it without meeting the 450 px jump threshold; the observer then wakes it only after the stale range has painted. Use a height-based pixel margin or derive the jump threshold from the observer's actual vertical lookahead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
IntersectionObserver resolves a vertical rootMargin percentage against the root's height, not its width. Measured on a 320x900 root with rootMargin '100% 0px': rootBounds.height is 2700 in Chromium, Firefox and WebKit, and a target 400px below the viewport reports isIntersecting true. The observer margin and the half-screen jump threshold are both height-based already.
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…ts by their size change A far transcript stops following the thread's scroll, so TanStack's stored offset freezes. Its size correction (offset + adjustments - scrollTop) then threw a scrolled-up reader back to where that transcript went far, e.g. from reply 24 to reply 1 on a window resize. Shift by the size change instead.
…the reader A frozen offset can land in the middle of a far transcript once content above it moves (a reflow on resize, rows prepended above), so TanStack mounts and measures rows a live offset never would and the reader drifts. Park it above or below the transcript instead, where the live offset keeps the range.
|
Offscreen reasoning traces no longer listen to the chat's scroll. In a saved chat of 30 replies with long Thinking expanded, the thread viewport goes from 63 scroll listeners on main to 8, with the same visible text and position. At 4x CPU throttle on a 60-reply chat, the p95 frame gap during wheel scrolling went from 483-633 ms on main to 300-350 ms. The machine was shared and heavily loaded, so treat those numbers as a direction, not absolutes. What changed
The frontend tests (11018) pass, and typecheck, build and bundle check pass on One gap remains. Narrowing the window enough to reflow the column (1280 to 700 px) still moves a scrolled-up reader by about two screens at one of three tested positions where main keeps it, and main loses the place at another. Fork CI is running: Etherll#241 main ( |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…elease (unslothai#13046) and the bounded live tail (unslothai#13086) to the chunked transcript

Part of #12025 (long conversations lag on scroll).
Since #11522, every expanded reasoning trace longer than the transcript threshold mounts a
ReasoningTranscript. Each one adds two scroll listeners to the shared thread viewport:flushSync.getBoundingClientRectand a reading-anchor scan that walks every text node of the mounted rows.All of these run for every transcript in the thread, including ones far offscreen. A chat with 200 such replies had 201 scroll listeners on the viewport.
This change watches each transcript's distance from the viewport with an
IntersectionObserver(root = the thread viewport, one screen of margin):display: none) stay asleep.Seeded long thread, production build, headless Chromium at 4x CPU throttle. Wheel up and down over the chat; median of 5 runs, arms alternated.
mainis listed twice (A/A) to show noise.Scrollbar-style jumps: 60 instant jumps to random positions in a thread of 100 expanded long traces. The table counts sampled points in the viewport that land on a transcript with no row painted.
Checks:
tests/reasoning-transcript-offscreen-scroll.test.tsfails 4/4 on main and passes here.npm testpasses (11017) andnpm run typecheckis clean.tests/studio/reasoning-transcript-checks.jsgives the same results on main and on this branch: every check passes except "threshold activation moved the reading passage", which fails on both in headless Chromium here, and "latest reasoning is missing", which is intermittent on both. The checks cover saved trace bounds, copy, collapse and reopen, streaming anchor, resize anchor, long prompt reflow, selection, resume following, narrow code and list continuation.scrollHeighton main and this branch.Not covered here: the separate, older cost of scrolling a long chat with the pointer over the messages. It is the same before and after #11522, and comes from per-message assistant-ui subscriptions. Also not tested on Windows WebView2 or with real GPU raster.
Studio built from main (BEFORE) and from this PR (AFTER), two separate installs. Each shows the same saved thread of 20 replies, each with a 28k-character reasoning trace, with Thinking set to always expanded, scrolled to the middle. The visible transcript text, its position and the thread height are identical on both sides; only which transcripts listen to scroll changed.