Skip to content

Studio: keep the live generation line from moving the branch picker, and update it during short replies - #16449

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
oobabooga:studio-live-line-footer
Nov 2, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
oobabooga:studio-live-line-footer

Conversation

@oobabooga

@oobabooga oobabooga commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

A review of #14909 reported that the reply footer "looks buggy" while a reply streams, with Generation details on. A screen recording shows two separate defects.

Problem

  1. The branch picker moves. While a regenerated reply streams, the < 2/2 > picker shifts right when the live line appears, shifts further as the line grows, and snaps back to the left when the reply finishes. In a narrow chat column the line pushes the picker onto a second row.
  2. The live count is stale. A reply of a second or two shows "1 token" for the whole reply, or for a full second before the next figure.

Cause

  1. The footer renders AssistantMessageTime, LiveGenerationLine, BranchPicker, AssistantActionBar in that order, so the growing live line sits before the picker.
  2. _PrefillProgressSignal sends a decode frame at most once per _LIVE_DECODE_FRAME_INTERVAL_S = 1.0, and the first sample goes out at once. That sample is llama-server's first token, which has no decode rate yet, and it holds the line until the interval runs out. The next sample's rate covers one decode step, which with Studio's default draft model reads about 10x low.

Fix

  • thread.tsx: the live line renders after the picker, in the slot the hidden action bar leaves while streaming, so its text never moves the picker. The footer's picker takes the row's 32 px height (h-8), so it also stays put when the live line wraps onto a row of its own.
  • routes/inference.py: a pass's first decode sample opens the interval instead of being sent, and samples without a rate are dropped, so the first frame goes out one interval into decoding with a measured rate. A new prompt pass (the next round of a tool loop) starts its own wait. The interval drops from 1.0 s to 0.25 s, the stall poll's period.

Behavior boundaries

  • The finished footer retains its controls and timing badge. The picker uses a 32 px height throughout, so a narrow footer whose action bar wraps can gain up to 8 px in that row compared with the former 24 px picker.
  • The prompt-progress label gives way to "Working..." when the first decode frame arrives: at least 0.25 s after the first token, once llama-server reports a decode rate, instead of at the first token. This only shows for a reply that decodes with nothing visible yet, such as a tool call being written.
  • Durable runs store up to four decode frames a second instead of one, next to one stored chunk per streamed token.

Verification

Live A/B with Playwright on fresh Studio homes, gemma-3-270m-it UD-Q4_K_XL on the CPU, Generation details on; main was d8efd157ab for the measurements and 6401ceda29 for the screenshots. Each run regenerated a reply so the picker shows.

  • Live frames on a 300-word reply: main at 0.20 s ("1 token"), 1.22 s and 2.10 s; this PR from 0.39 s ("22 tokens · 83.6 tok/s"), then every 0.2 to 0.35 s. A one-second poem showed "1 token" throughout on main, and four updates here.
  • Decode speed, the same prompt alternated four times: main averaged 124.3 tok/s, this PR 129.9 tok/s.

Tests:

  • New: the first decode frame waits one interval past the first token, per prompt pass (backend), and the footer order is picker, live line, action bar (frontend; these suites render no DOM). Both fail on main. Three existing backend tests now expect the held first frame.
  • The backend suites touching live progress and the SSE frame paths: 1088 passed, 1 skipped. generation-details and reply-times-preference: 25 passed. Typecheck passes; ESLint has no new findings.

The contributor's original checks did not cover GPU hosts, macOS or Windows. Additional takeover checks: 111 targeted backend tests and 25 frontend tests passed locally; scoped staging ran 11 backend and 21 frontend tests successfully on each of Linux, macOS and Windows. An exclusive remote Tesla T4 tiny-model run exercised the production live-progress callback: greedy outputs matched in all 15 runs, peak allocated memory was equal, and the 1.51% median decode change was within repeated-base variation. This measures callback overhead during inference, not full Studio HTTP/persistence throughput. Chromium, Firefox and Edge each reproduced the base layout defect and stable head picker; the WebKit scripted-stream fixture failed on base with access-control errors, so no WebKit pass is claimed. The switchboard finished at exact head 9fcbf6b750 with CURRENT / NO_REGRESSION: 66 SAME, 4 DOM_ONLY_DIFF, 1 FAIL_BOTH and 2 FLAKY. The shared failure is the compaction notice not appearing after six turns on both arms; no compaction correctness claim is made. The remote model journeys ran on a Colab T4-HM.

Screenshots

The footer while the reply streams, 0.6 s and 1.6 s after the live line appears, then finished:

Reply footer while streaming, before and after

The same at 400 px:

Reply footer at 400 px, before and after

Verified footer layout

Fresh, isolated Studio builds at merge base 6401ceda29 and functional PR head 9fb03a89a, with the same scripted reply and progress frames. The later commits through 9fcbf6b750 change comments and an internal docstring only, verified by the comment-only AST checks. This image verifies layout; backend timing is covered separately by the base/head progress tests.

The picker moves 347.8 to 467.1 px to the right as the live text grows on the base, and stays at x=0 on the PR. At 400 px the base puts the picker below the wrapped live line; the PR keeps it above the line at y=0. Both replies contain exactly "A short reply for the footer check."

Before and after: branch picker stays above a wrapped live generation line

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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 ⚠️ Failed 2026-11-02T04:09:22.185015Z
We couldn’t complete this review. Comment @codex review to try again.
9fb03a8 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

Review record for #16449, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#684.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror 26ab0a561b (this PR's bdac6c6bc)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 26ab0a561b

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 26ab0a561b (this PR's bdac6c6bc).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 2, 2026
@danielhanchen
danielhanchen merged commit 0102e22 into unslothai:main Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants