Skip to content

Studio: bound a live Thinking block to its newest lines - #13086

Merged
danielhanchen merged 8 commits into
mainfrom
studio-bounded-thinking
Oct 12, 2026
Merged

danielhanchen merged 8 commits into
mainfrom
studio-bounded-thinking

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #11703. Part of #12025 (point 2: "Thinking no longer rendered in its own collapsible panel").

Problem

With the default Thinking setting (auto), a block opens while it streams and closes when the answer starts. While it streams it is inline at full height, so a long trace pushes the whole thread down token by token: on a 24K character trace the thread grows by about 11,500 px during the stream, on a 250K one by about 127,000 px.

Approach

This builds on the #11522 transcript and follows the conditions from the #11704 review:

#11704 review this PR
cap only while streaming Bounded only when the auto setting is what holds the block open, and auto only opens it for its stream. Saved and finished traces are never boxed.
lift the cap when the block is expanded Opening the block by hand, the new "Show full thinking" control (the same thing), or the expanded setting show the full trace, exactly as today.
keep scroll writes going through the thread controller No inner scroller. The box is max-h-[min(18rem,40vh)] flex flex-col justify-end overflow-hidden: the newest lines sit at the bottom and older ones are clipped at the top under a fade, so the box never grows and the thread never moves for it. While bounded, the transcript skips its adjustAbove corrections (size changes above the viewport, threshold anchoring, width-change anchor), since rows that grow upward inside a fixed box did not move the thread. "Show full thinking" calls the same detachFromBottom() as a hand open.
a test that fails on main tests/reasoning-live-tail.test.ts: 0/3 on main, 3/3 here.

While bounded, the transcript also mounts the rows that fill the end of the trace (twice the box height). Its measured offset lags a fast-growing trace by a frame, which on main can leave the viewport briefly blank and, in a 288 px box, would leave the box blank more often.

Fold mode (opt-in) is unchanged: the lead's box could not hold the rounds folded after it.

Results

Repo reasoning smoke harness (real Thread, reasoning-only stream), Chromium 1280x900, auto setting unless noted:

scenario main this PR
24K trace streaming: thread growth during the stream 11,488 px 0 px (box 288 px)
250K trace (windowed transcript): thread growth 127,154 px 0 px (box 288 px)
newest line visible, 24K / 250K samples 11/12, 12/16 13/13, 16/16
thread scroll position changes once the box is full n/a 0
end of stream block closes block closes
"Show full thinking" mid-stream: header position n/a 176 px before and after, 0 px drift while the stream continues; trace start mounted
expanded setting: thread growth 11,488 px 11,488 px (unchanged)

Firefox and WebKit, same scenarios: thread growth during the stream 12,052 / 128,281 px (Firefox) and 12,050 / 127,913 px (WebKit) on main, 0 px here; newest line visible on every sample here; Show full keeps the header at 176 px with 0 px drift; expanded unchanged.

tests/studio/reasoning-transcript-checks.js (expanded, every check reported, 3 runs per side): the same pre-existing failures on both sides ("threshold activation moved the reading passage" 3/3 on each; "latest reasoning is missing" 3/3 on main, 2/3 here), nothing new.

Tests

  • tests/reasoning-live-tail.test.ts: the cap truth table over every setting x hand state x streaming (bounded only for auto, untouched, streaming); the box clips instead of scrolling and writes no scroll position; Show full is a hand open; a bounded transcript makes no thread correction and mounts the tail.
  • Full frontend suite: 11025 / 11025. npm run typecheck clean. Biome: no new errors (the 10 in these files are on main too).

Screenshots

Real Studio, both builds fed the same scripted stream (a 21K character trace held open before its answer), default Thinking setting.

Mid-stream. Before: the live trace runs at full height and the Thinking header has scrolled away. After: the header stays in view above a 288 px box with the newest steps (Step 135 to 139, fading at the top) and Show full thinking under it; the thread is 1,000 px tall instead of 8,661 px.

Live reasoning mid-stream, main vs this branch

After the answer: identical. Both collapse to "Worked for 9s" above the same answer.

Settled turn, main vs this branch

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review 🔄 Running since 2026-10-08T15:51:13.496774Z ea2788b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T03:50:52.719916Z a619dce Manual request
🔒 Security Review ⚠️ Failed 2026-10-08T15:51:16.644912Z ea2788b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: ea2788bbf0

ℹ️ 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".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 8, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 8, 2026
Resolve the reasoning.tsx import conflict with #13059: keep main's import list
(isRenderableRenderHtmlToolPart moved to message-derived) and add reasoningTailCapped.
…inking

The button unmounts with the cap, so focus fell back to the page body. Hand it to
the block's trigger first (no scroll), and give the button a visible focus ring.
…lines

Links in the clipped top of the live box stayed in the tab order but could never
be scrolled into view. Focusing one now lifts the cap, the same as Show full
thinking, so the focused link sits under the header.
@Etherll

Etherll commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

With the default Thinking setting, a live Thinking block now keeps its newest lines in a fixed box with "Show full thinking" under it, so the thread stops growing while a long trace streams. The branch also has two keyboard fixes and is merged with main.

What changed

  • Pressing "Show full thinking" from the keyboard removed the focused button, so focus fell back to the page body. Focus now moves to the block's Thinking header without scrolling, and the button has a visible focus ring.
  • Links in the clipped top of the box stayed in the tab order but could not be scrolled into view. Focusing one now opens the full trace the same way "Show full thinking" does, so the link shows up under the header.
  • The merge with main resolved the reasoning.tsx import conflict with Studio: keep typing and streaming fast in long chats #13059.

On a scripted 24K and 250K trace, the merge base grew the thread by 11,753 and 129,022 px. 5041cdf8f grew it by 0 px inside a 288 px box, and the newest line was visible in every sample. expanded and fold mode are unchanged. Chrome 147, Edge 151 and Firefox 157 show the same result; Safari was not run. The frontend suite passes (11,268 tests) and typecheck is clean. One limit remains: in-page find can still count a match in the clipped lines while the trace streams. Fork CI is running: Etherll#239

Live Thinking block mid-stream, merge base vs this branch

Real Unsloth Studio, CPU only, Qwen3-0.6B Q4_K_M at temperature 0, same prompt on both sides, captured mid-stream at about 4,150 reasoning characters. Left: main at bcdc3d2b2 (thread grown by 4,806 px, header scrolled away). Right: 5041cdf8f (header in view above the 288 px box).

@danielhanchen danielhanchen self-assigned this Oct 11, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f29635d654

ℹ️ 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".

}}
className={cn(
capped &&
"flex max-h-[min(18rem,40vh)] flex-col justify-end overflow-hidden [&>*]:shrink-0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reveal matches inside the capped reasoning tail

When an auto trace has overflowed and the user searches for text in the clipped older lines, Studio's find index still includes that DOM text, but find-dom.ts's scrollsAxis only reveals through ancestors using auto, scroll, or overlay. This overflow-hidden wrapper is therefore neither expanded nor repositioned, and scrolling the outer thread cannot move the match through the wrapper's clip, leaving the reported active match invisible. Lift the cap when a find match targets this region or otherwise exclude clipped text from the index; note that overflow: hidden is still defined as a scroll container, not a non-scrollable clip.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this one: the cap only exists while the auto setting holds a block open for its live stream, find still counts the match, and Show full thinking directly under the box lifts it (the block closes once the answer starts). The match text is not lost or altered, so this stays a known limitation rather than a change to find-dom's scroller rules.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: f29635d654

ℹ️ 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".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 8a6a53f0bb

ℹ️ 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".

# Conflicts:
#	studio/frontend/src/components/assistant-ui/reasoning-transcript.tsx
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: a619dce228

ℹ️ 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add a collapsible, fixed-height Thinking panel in Unsloth Studio chat

3 participants