Skip to content

Studio: stop Expand thinking from restyling the whole trace - #13665

Merged
danielhanchen merged 4 commits into
unslothai:mainfrom
oobabooga:worktree-reasoning-tail-flexbox
Oct 14, 2026
Merged

danielhanchen merged 4 commits into
unslothai:mainfrom
oobabooga:worktree-reasoning-tail-flexbox

Conversation

@oobabooga

@oobabooga oobabooga commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Since #13545, opening a finished thinking trace by hand shows the bounded box, and the full trace is one "Expand thinking" click away. On a long trace that click and "Collapse thinking" each run as a single long task.

Root cause

ReasoningTail applied flex max-h-[...] flex-col overflow-hidden [&>*]:shrink-0 only while capped, and two of those classes restyle the whole trace when toggled:

  • flex: a display change on the box restyles and re-lays out the child subtree.
  • [&>*]:shrink-0: a child combinator with a universal subject invalidates the whole subtree in Blink.

Fix

  • [&>*]:shrink-0 stays on while the box is cappable. It has no effect outside a flex box.
  • flex flex-col stays on through Expand/Collapse of a finished trace. It drops only when a trace is expanded while still streaming, as before, because keeping it there shifted glyphs by a subpixel. The stream ending does not restore it, so the restyle does not move to the end of the stream.
  • max-h, overflow-hidden, justify-* and the mask still follow capped.

No visible change: the DOM, element rects, scroll metrics and screenshots match main in every cap state, streaming and finished.

Measurements

Chromium, 4x CPU throttle, 6 interleaved runs per build:

Interaction main this PR
Expand on a finished 100k trace 190 ms task, 6,175 elements restyled, 59 ms layout 29 ms task, 293 elements, 2 ms layout
Collapse 180 to 330 ms task 24 to 36 ms task
Hand-open then Expand, longest task 434 ms (239 ms before #13545) 243 ms

Streaming, Expand mid-stream until the stream ends, hand-open, and loading a long thread are unchanged within noise.

Testing

  • node --test tests/reasoning-live-tail.test.ts: 9/9 pass. The old class-string assertion now checks the split classes, and a new test drives reasoningTailFlexBox through the Expand, Collapse and stream-end transitions.
  • tsc -p tsconfig.app.json --noEmit: pass
  • Biome on reasoning.tsx: no new diagnostics against Studio: set thinking traces apart from the answer and give tool rows kind icons #13545's merge commit
  • Not run here: the full npm test suite and npm run build

Before / after (Studio, same bytes on both sides)

Two isolated Studio installs, main 3a6179b4a vs this branch 292cfeb9e, one scripted ~98k-character thinking trace ending in a list, hand-opened after the answer (Thinking = auto). Tail, text, button, answer and first, middle and last row rects are equal in the capped, expanded and re-capped states.

Capped, hand-opened finished trace:

Capped finished trace, before and after

After Expand thinking (the trace ends in a list, so this is the case where block and flex layout of the box could differ):

Expanded trace, before and after

Per toggle, Chromium 4x CPU throttle, 5 Expand/Collapse cycles, median (shared host, so indicative):

main this PR
Expand: layout 18.3 ms 3.9 ms
Expand: style recalc 40.8 ms 20.3 ms
Collapse: layout 31.9 ms 5.6 ms
Collapse: style recalc 63.7 ms 25.5 ms

The header token estimate and the reply timing differ between halves from run to run and are not from this change.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-14T13:53:47.989001Z 292cfeb Manual request
ℹ️ 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.

@oobabooga

Copy link
Copy Markdown
Member Author

Reached Codex review convergence at oobabooga#367.

# Conflicts:
#	studio/frontend/src/components/assistant-ui/reasoning.tsx
#	studio/frontend/tests/reasoning-live-tail.test.ts
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 292cfeb9e6

ℹ️ 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 14, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 14, 2026
@danielhanchen
danielhanchen merged commit 90586ae into unslothai:main Oct 14, 2026
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.

2 participants