Skip to content

Studio: keep lone asterisks and backticks in finished chat replies - #14391

Open
NilayYadav wants to merge 6 commits into
unslothai:mainfrom
NilayYadav:settled-reply-lone-markers
Open

NilayYadav wants to merge 6 commits into
unslothai:mainfrom
NilayYadav:settled-reply-lone-markers

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

Once a chat reply finished, a lone asterisk, double asterisk or backtick in ordinary text was deleted and the rest of the sentence was restyled: "Add .pyc to .gitignore." showed as "Add .pyc to .gitignore." in italics, and "Press the ` key" turned the rest of the line into code. When the reply ended with a line break, a stray "" or "**" was added at the end instead: "Use **kwargs to forward them." showed as "Use **kwargs to forward them. **". It stayed that way after reopening the chat, while Copy still gave the original text.

The repair that closes half-written Markdown now runs only on a reply that was cut short (Stop, the Max Tokens limit, or an error), right away and after a reload. A reply that finished normally is shown exactly as written.

Known limits, unchanged from before: a cut reply can still restyle a lone marker earlier in it, and thinking text over about 16,000 characters is still repaired piece by piece.

@NilayYadav NilayYadav self-assigned this Oct 20, 2026
[skip ci]
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-21T01:21:36.433946Z 25bbd70 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. Keep it up!

Reviewed commit: 269b572bf6

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

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: d51952aad8

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

NilayYadav added a commit to NilayYadav/unsloth-staging that referenced this pull request Oct 20, 2026
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: a9adca1fd5

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

@NilayYadav

NilayYadav commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

Review + reproduction evidence

Pinned review: 25bbd7047. Two findings, fixed in d51952aad and a9adca1fd; 25bbd7047 brings the change inside the startup bundle budget; no open findings.

I reproduced a normal chat with a connected OpenAI-compatible model on the merge base a6c1e06 (Linux, Chromium, 1280x1600): six prompts typed in the composer, then the thread reopened.

  • Before: Add *.pyc to your .gitignore file. shows as Add .pyc to your .gitignore file. in italics, Press the ` key to open the console. turns the rest of the line into inline code, and Use **kwargs to forward them. gets a stray ** appended. Same after reopening.
  • PR head: all three read exactly as written (no em, strong or code). A Max Tokens reply Then **bol and a reply stopped during a tool call still show bold bol, live and after reopening, same as before.

PR 14391 before/after

  • Fixed during review: finished replies had stopped escaping - >= 16 GB of RAM (rendered as a quote showing = 16 GB of RAM) and 5~10 minutes ... 20~30 GB (rendered as strikethrough); a reply stopped while a tool call ran showed a raw **bol until the chat was reopened. Both now match the merge base.
  • Startup bundle: a9adca1fd added 459 bytes to the eager startup JS, over the 160 bytes main leaves spare. 25bbd7047 trims it to 141 bytes merged with current main (19 bytes to spare) without raising the budget: the cut check is inlined, finished replies switch off only the bold, italic and inline-code completions, and the per-render link check is gone.
  • Frontend tests: the changed tests fail on the merge base sources at the new assertions and pass on head (80/80 with the neighbouring Markdown suites); typecheck clean; full frontend suite 12929 pass, 0 fail.
  • Repo tests (CPU, rest) and (Python 3.13, rest) failed on a9adca1fd for reasons outside this PR (a GPU check in a QAT test, test files read without encoding="utf-8", and hardware.py text I/O). Main has since fixed all three: QAT test: spoof CUDA in the unpickling child on GPU-less runners #14415, Tests: read checked-in sources as UTF-8 in three new test files #14414 and Studio: decode the Rosetta sysctl probe as UTF-8 #14419.

Conclusion: real defect on main, fixed; waiting only on the PR's CI run for 25bbd7047.

@danielhanchen

Copy link
Copy Markdown
Member

Frontend build + bundle sanity fails on the startup bundle budget:

eager startup JS: 6699.2 KB raw, 2017.2 KB transfer, 96 chunks
over the startup budget: raw 6699.2 KB > 6698.9 KB

That run merged into 4279fe4ae2, which already carries the latest budget (#14407), and main measured within it there. So the extra raw bytes come from this PR's changes to the eager chat markdown path. Either keep the new code out of the startup chunks, or raise BUDGET in studio/frontend/scripts/check-bundle-budget.ts in this PR, set to the merged build's measurement plus the same 160 B raw / 189 B transfer margin, with a comment entry like the others.

danielhanchen added a commit that referenced this pull request Oct 21, 2026
## Problem


`studio/backend/tests/test_text_io_encoding.py::test_text_io_names_its_encoding`
fails on main, so the `(Python 3.13, rest)` backend shard is red on
every PR built on top of #14374 (for example #14391):

```
AssertionError: Text I/O without an explicit encoding falls back to locale.getencoding(), ...
  hardware.py:165: subprocess(text = True) without encoding
```

#14374 added `_running_under_rosetta()`, which runs `sysctl -n
hw.optional.arm64` with `text = True` and no encoding. The guard is
right. Every other `subprocess` call in `hardware.py` names its
encoding, and a bare `text = True` decodes with the locale codec (ASCII
under a C or POSIX locale).

## Fix

Pass `encoding = "utf-8", errors = "replace"`, as the other probes in
this file do. The probe only reads `0` or `1`, so behaviour is
unchanged.

## Verification

- `studio/backend/tests/test_text_io_encoding.py`: fails on main (the
line above); with this change, 857 passed.
- `test_chat_only_reason.py`, `test_export_capability.py` and
`test_video_capability.py`, which exercise the Rosetta check: 64 passed.
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 25bbd70476

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

This branch has not been deployed

No deployments
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