Skip to content

Studio: keep a chat's own settings when its send waits on a model load - #17565

Merged
danielhanchen merged 14 commits into
unslothai:mainfrom
oobabooga:studio-run-settings-across-model-load
Nov 12, 2026
Merged

danielhanchen merged 14 commits into
unslothai:mainfrom
oobabooga:studio-run-settings-across-model-load

Conversation

@oobabooga

@oobabooga oobabooga commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

A message sent while a model is loading waits for the load inside the chat adapter. If you open another chat during that wait, the first chat's turn runs with the other chat's settings: permission mode, tool toggles, system prompt, sampling and RAG. With chat A on "Ask for approval" and chat B on "Auto", chat A's Python tool call ran without asking.

After the wait, createOpenAIStreamAdapter re-reads useChatRuntimeStore to pick up the model that just loaded. Queued sends merge their own snapshot over that read, but a direct send took the whole store, which by then held chat B's settings.

  • If the store no longer shows the run's chat after the wait, the direct send now takes its chat-scoped settings and the permission fields tied to them from the runtime it had before the wait (withRunThreadScopedSettings). Model fields and installation-wide settings still come from the live store.
  • If the run's chat is still on screen, nothing changes, so model-load adjustments and edits made to that chat during the load still apply.
  • The settings read before the model wait, after the adapter's short hydration, flush and pairing awaits, is unchanged.

Verification

Live A/B in Chromium (Playwright) against a local Studio with Qwen3-8B-GGUF. Chat A: Ask, temperature 0.3, top_p 0.81. Chat B: Auto, 1.4, 0.55. Send in A with no model loaded, then switch to B while the model loads. The /api/inference/load request was held until B was on screen, so the switch always lands inside the wait. Values are from chat A's run request:

Build Scenario Chat A's run Python tool call in A
main switch to B auto, 1.4 / 0.55, B's system prompt ran without asking
this PR switch to B ask, 0.3 / 0.81, A's system prompt waits for approval
this PR stay on A ask, 0.3 / 0.81, A's system prompt not tested (plain prompt)

Chat A after the switch, on main (the tool ran):

chat_a_after_switch_main

With this PR (waiting for approval):

chat_a_after_switch_this_pr

  • tests/run-keeps-chat-settings-across-model-load.test.ts runs the adapter's own post-wait selection block, taken from the adapter source. It checks another chat on screen, the same chat, a first send, and a pending settings read; the cases with a different chat or a pending read fail on main. It also covers every chat-scoped key, a chat-only Full access grant, and, using the real store setters, Full access with Code switched off: Code stays off after another chat picks Ask.
  • node scripts/typecheck.mjs --tests passes, and the related store and settings tests pass (130). Full npm test was run before the Full access Code-off fix: 10 files fail, and they fail the same way on main.

Before / after (two isolated Studio installs)

BEFORE is merge base ecf4aaf595, AFTER is the merged head ae95a860b, each built and launched as its own Studio home with an offline HF cache holding only unsloth/Qwen3.5-0.8B-MTP-GGUF (UD-Q4_K_XL, real weights, CPU llama-server). Chat A: Ask for approval, temperature 0.3, top_p 0.81, "You are chat A.". Chat B: Approve for me, 1.4, 0.55, "You are chat B.". Chat A sends with no model loaded, the auto-load's /api/inference/load is held until chat B is on screen, then released. The table is read from chat A's real /api/inference/chat-runs request body on each side; the shot is chat A 20 s after returning to it (its permission pill reads "Ask for approval" at 1 s, 5 s and 20 s on both sides; nothing persisted to either chat changed).

pr17565_evidence

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T14:33:26.733815Z ae95a86 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[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: fc8b180f96

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 597c3f0982

ℹ️ 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 added a commit that referenced this pull request Nov 12, 2026
…ck (#17571)

## Summary

`studiobench CI` (`Real-path session, every action ran`) has failed on
main since #17504, and so have `Merge base vs head` and `Merge base vs
itself, the null` on PRs that touch the thread (e.g. #17565):

```
thread_reopen: ran EXPECT FAILED -- the reopened thread never reached a ready state: the thread was not ready in windowed mode: pin_settled (mounted 8 of 25; aria-setsize 25; aria-posinset 18..25 on 8 of 8 rows, 8 distinct; last row 'assistant'; 0px from the bottom)
```

#17504 switched these jobs to the windowed readiness gate
(`--windowed-arm`), which is the only mode that checks `pin_settled`.
That condition read "the autoscroll is still pinning" as
"`--aui-scroll-stabilizer` is set on the viewport". But
`use-intent-aware-autoscroll.tsx` leaves the stabilizer's last value in
place as residual padding once the follow window ends, and drops it only
when the user scrolls up ("Drop residual stabilizer padding once the
user scrolls up so the bottom stays flush"). So a thread that has
finished pinning can keep the property for as long as the reader stays
at the bottom, and the gate times out on a page that is otherwise ready
(in the log above, every other condition held for the whole wait).

This is not caused by the windowing itself. The null control on #17504
ran the merge base (fully mounted, before #17504) on both sides and
failed the same way:

```
cell FAILED: ThreadNotReady: the thread was not ready in windowed mode: pin_settled (mounted 18 of 18; aria-setsize None; ...; 0px from the bottom)
```

The app behaves as designed, and #17504 is right to run the windowed
gate. The gate's reading of the stabilizer is what is wrong.

## Change

- `tests/studio/studiobench/runtime/readiness.py`: the probe also
returns the stabilizer's value. `pin_settled` holds when the property is
absent, or when it carries the same value as on the previous probe and
the page has settled (same mounted count, element count and scroll
height). A value that is still changing, or a page whose height is still
moving, still counts as mid-pin, and the gate still needs its
consecutive settled samples before it passes.
- `INTERFACES.md`: the `pin_settled` row says the same.
- No app code changes, so nothing changes for Studio or Desktop users.

## Guard

New `test_residual_stabilizer_padding_settles_the_pin` in
`test_studiobench_readiness_live.py`:

- residual padding unchanged across two settled probes passes;
- the first probe, a changed value, or a moving scroll height does not
pass;
- a cleared stabilizer passes.

With the old `pin_settled` line, the test fails.

## Testing

- `test_studiobench_readiness_live.py` (including its live browser
cases), `test_studiobench_thread_reopen_gate.py`,
`test_studiobench_windowed_parity.py`,
`test_studiobench_completeness_gate_rows.py`: 142 passed.
- This PR's own `studiobench CI` run is the end-to-end check.
@danielhanchen

Copy link
Copy Markdown
Member

The three red checks here are not from this PR:

@danielhanchen danielhanchen added affects UI# codex-converged# important# security# Moves a security boundary: sandbox, allowlist, permission or network guard labels Nov 12, 2026
@danielhanchen danielhanchen self-assigned this Nov 12, 2026
@unslothai unslothai deleted a comment from oobabooga Nov 12, 2026
@unslothai unslothai deleted a comment from oobabooga Nov 12, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 12, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: ae95a860b9

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

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

Labels

affects UI# codex-converged# important# security# Moves a security boundary: sandbox, allowlist, permission or network guard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants