Skip to content

Studio: keep long replies with escaped math streaming smoothly - #16490

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:streaming-replies-real-escaped-dollar
Nov 4, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:streaming-replies-real-escaped-dollar

Conversation

@NilayYadav

@NilayYadav NilayYadav commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Long replies that write math as $x$ made the chat stutter while streaming. Every new piece of text parsed the whole reply again to find that math, so the work grew with the reply. On a 60,000 character reply that parse took about 40 ms each time, far more than every other step of preparing the text.

While a reply streams, finished blocks are now remembered and only the end of the reply is parsed. The finished reply still gets one full parse, so the final text and math look exactly as before. While streaming, a few frames can briefly render math differently from a full parse until the next frame or the final parse.

Before After
Finished 60,000 character reply, unchanged before after

Streaming parity, merge base vs this branch

Both builds were fed the same scripted 60 section reply (math written as \$...\$, a $5 price in every section). The math renders the same while streaming and once finished: 60 math spans mid-stream and 120 at the end on both sides, no raw \$ left, identical rendered text.

Mid-stream Finished
mid-stream finished

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 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-11-04T07:42:00.439103Z 7106128 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 75970fee5c

ℹ️ 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 danielhanchen self-assigned this Nov 4, 2026
@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. More of your lovely PRs please.

Reviewed commit: 7106128f48

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