Repository navigation
[mirror] Studio: three-state Thinking and Tool calls visibility in Display (#11433) - #199
wasimysaid wants to merge 9 commits into
Conversation
The Display section carried two "collapse by default" switches plus a fold switch, and between them there was no way to say "keep it open". Each boolean only chose between collapsed and the automatic behaviour, so reasoning always snapped shut when its stream ended and tool cards closed as soon as the answer started, whatever the user wanted. Replaces both switches with one dropdown each: Thinking Collapsed / Expand while streaming / Always expanded Tool calls Collapsed / Expand while running / Always expanded Always expanded keeps blocks open in every phase, streaming included, and a block collapsed by hand stays collapsed. Each block keeps a single override that is null until the trigger is clicked, so a manual toggle wins for the rest of the round and changing the setting hands every block back to it, including messages already on screen. "Fold tool calls into Thinking" hides calls behind a Thinking block, which cannot coexist with keeping them all open. Always expanded wins: the row is disabled and says why, and the stored preference survives so switching tool calls back to collapsed or auto restores the grouping. Renamed to "Group tool calls under Thinking", which describes what it does. Stored preferences migrate: collapseThinkingByDefault and collapseToolActivityByDefault map true to collapsed and false to auto, so no upgrading install lands on always expanded by surprise. An unknown value falls back to the default instead of blanking the select. The two rows are now labelled with what they are rather than what one state of them does, so settings search gains keywords to keep "collapse" and "expand" finding them. All twelve locales updated.
The Thinking row read "Expand while streaming" and the Tool calls row read "Expand while running", two labels for one state on two adjacent dropdowns that are otherwise identical. Folds both into a shared settings.chat.visibility.auto and keeps "Expand while running", which is the plainer of the two and reads correctly for reasoning as well.
smoke-tool-activity-main.tsx still called setCollapseToolActivityByDefault and read collapseToolActivityByDefault, so the browser-smoke step would have thrown a TypeError on its first __setPreference call, before any scene ran. The harness now reads and writes toolVisibility. Its scenes keep the boolean vocabulary, which maps exactly onto the two settings they exercise: true is collapsed, false is auto. Always expanded has no scene here and stays covered by tests/tool-activity-preference.ts. tsconfig.app.json never included this file, which is why typecheck stayed silent on a call to a method that no longer exists. Added it, and confirmed it now reports the error the old code would have produced.
Three surfaces never received a live activity signal, so the auto setting could not act on them. All three predate this PR, where the old boolean read `defaultOpen && !collapseByDefault` and was false for the same reason, but the new label is an explicit promise, so they are worth keeping. - Uncontrolled cards and groups now track `active` alongside the setting, so a card that mounts while its call runs closes again when the call ends. It used to open once and stay open, because an unchanged setting returned the state untouched. A manual open still survives: only a setting change clears the override, activity changing on its own does not. - The generic and MCP card passed no defaultOpen at all, so it mounted collapsed even while running. It now reads its own status. - A multi-call group passed none either, so an ordinary running group with no live output and no pending approval stayed collapsed, hiding child cards that had correctly opened. It now reports whether its own calls are still running, scoped to its own parts so it goes quiet once they all have results rather than waiting for the rest of the turn. Adds reducer coverage for the close-on-finish path and for a manual open surviving it, plus AST tests pinning both defaultOpen wirings, each confirmed to fail when the wiring is removed.
Live-Studio verification of unslothai#11433 (head
|
| Build under test | PR head f3d3e821e41533219ebf46448a4089194a4d08e4 (this branch, byte-identical to upstream) |
| Comparison build | merge-base bba7890 install on a separate port |
| Model | Qwen3.8-27B-GGUF · UD-Q4_K_XL via llama.cpp |
| Driver | Playwright (Chromium), 1440×900, real clicks and a real typed prompt |
| Tools | Web search on, real tool call executed by the model |
The sped-up walkthrough (2× — raw recording is 32.8 s)
Scenes, in order: (1) the two new Display dropdowns and the fold row disabling itself, (2) a real
Qwen3.8-27B turn with a web-search tool call under Expand while running, (3) flipping both rows to
Always expanded and watching the messages already on screen re-open, (4) collapsing one block by
hand and watching it stay collapsed.
Before → after
Left is merge-base: three overlapping switches — Collapse Thinking by default, Collapse tool
activity by default, Fold tool calls into Thinking. Right is this PR: two dropdowns, each with
Collapsed / Expand while running / Always expanded, plus the fold switch.
1. The fold conflict resolves honestly
With both rows on Always expanded, the fold switch disables itself and explains why:
Group tool calls under Thinking — Unavailable while tool calls are set to Always expanded, which keeps them on their own rows.
Its stored value is untouched: switching Tool calls back to Collapsed restores the normal
description without re-checking the box (observed live, not inferred).
2. Real tool call: open while running, no snap-shut
Prompt: "Search the web for what Unsloth Studio is, then answer in one sentence with a source."
Recorded block states during the turn (.aui-reasoning-root / tool card data-state):
| Setting | During stream | After turn finished |
|---|---|---|
| Expand while running | reasoning open, open · cards open, open |
reasoning closed ×4 · cards closed, closed |
| Always expanded | — | reasoning open, closed, open, open, closed, open · cards open, open |
| Always expanded, then one manual click | — | that block closed, everything else stays open |
The Always expanded row is the point of the PR: the setting changed blocks that were already
rendered, in a finished turn. The manual collapse proves the per-block override still wins.
3. Choices survive a reload
Read back after a full page reload: Thinking = Always expanded, Tool calls = Always expanded,
fold row still disabled / aria-checked=false.
Machine-readable facts
pr11433-verification.json
holds the raw state arrays quoted above, plus the model's actual answer and the tool/source chips
the turn produced.
Scope note: this is a mirror of upstream unslothai#11433 pinned to its head commit — no code changes here.
Evidence covers the Display rows, the fold conflict, live streaming/tool behaviour under all three
states, the manual override, and persistence across reload. Upstream CI was not re-run for this
mirror; this PR exists so the media renders.
A card using useToolActivityOpen stored only the open boolean, so under
"Expand while running" the first hasText=true update fell through the auto
arm and closed a card the user had just opened. The uncontrolled cards and
groups already keep an override for this, so the four controlled cards
(web search, knowledge base, skill reads, code execution) disagreed with
the behaviour they are meant to match.
Track the override in the hook and let resolveToolActivityOpen honour it,
clearing it only when the setting changes, which is the one thing that
outranks a click.
Reproduced before the change: resolveToolActivityOpen returned false for
{currentOpen:true, visibility:"auto", isRunning:false, hasText:true} after
the same card had been opened by hand.
Switching Tool calls from "collapsed" to "Expand while running" passed a
signal that had already been killed by the message's own text, so a card
whose call was still running stayed shut until something else changed. The
unchanged-visibility path already lets the running call win, and the
uncontrolled cards take a live running state, so the setting-change path
now uses the same rule for the same reason.
Reproduced before the change: resolveToolActivityOpen returned false for
{visibility:"auto", previousVisibility:"collapsed", isRunning:true,
hasText:true} while the call was still running.
|
@codex review |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Regenerate reuses the assistant message's parts, so the card that rendered round one's call renders round two's as well, and the override it kept for "the rest of its round" outlived that round. Under Expand while running a card closed in the old response stayed closed for the new call, and one opened by hand stayed pinned open, which is the opposite of what the setting says should happen when the call starts again. The reasoning block already meets this case and clears its override on the render streaming resumes (reasoning.tsx:944); the tool cards now do the same with the activity signal they have. startsNewToolRound is the shared rule, and the hook clears the override and re-resolves on the render it fires, not in a later effect, so no stale open reaches the DOM. Reproduced at the previous head before the change: with an override carried over, resolveToolActivityOpen returned false for a running call under "auto" while the same call with no override returned true.
|
@codex review |
One conflict, in SETTINGS_SEARCH_KEYWORDS: main dropped the "When context fills" setting (and with it the settings.chat.compactionStyle row), while this branch added keyword rows for the new Thinking and Tool calls visibility controls. Kept this branch's three visibility rows and took main's removal of compactionStyle, which was never added here.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43bda09493
ℹ️ 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".
| open: defaultOpen && !collapseByDefault, | ||
| visibility, | ||
| active, | ||
| override: current.visibility === visibility ? current.override : null, |
There was a problem hiding this comment.
Reset uncontrolled tool overrides when a new round starts
When regeneration reuses an uncontrolled terminal, generic/MCP card, or tool group, its active value transitions from false back to true while visibility remains unchanged. This branch therefore preserves the previous round's manual override: under auto, a card closed in the old response stays closed while the new call runs, and under expanded a prior manual collapse also survives into the new round. Clear the override on the false-to-true activity transition, as the controlled hook already does, so a new round starts from the selected visibility policy.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed, fixed in 01da0d9f7 — and you're right that the controlled-card reset did not reach these: the generic, MCP, Terminal and Python cards keep their own state through syncToolActivityPreference rather than the hook.
The same startsNewToolRound rule now decides whether an override carries there too, so a regenerated run starts where the setting puts it.
Reproduced at 43bda09 first: syncToolActivityPreference kept override: false across the false-to-true activity transition, so toolActivityOpen stayed false for a running call under auto. Regression covers both directions plus the case that must not change — activity moving on its own without the call restarting still keeps a manual open. tools 41 / pass 41.
The generic, MCP, Terminal and Python cards keep their own state through syncToolActivityPreference instead of the hook, so they never saw the round reset the controlled cards got: a regenerated run reuses the card, and the override it kept for "the rest of its round" outlived the round. Under auto a card closed in the old response stayed shut while the new call ran, and under collapsed a card opened by hand stayed pinned open. The same startsNewToolRound rule now decides whether an override carries, which is the condition the uncontrolled path already had for a setting change. Reproduced at the previous head first: syncToolActivityPreference kept override false across the false-to-true activity transition, so toolActivityOpen stayed false for a running call under auto.
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |






[mirror] Studio: three-state Thinking and Tool calls visibility in Display
Verbatim copy of unslothai#11433 for local review — the branch here is the upstream
PR head commit itself, so the diff is byte-identical to upstream (29 files, +1060 / −465).
f3d3e821e41533219ebf46448a4089194a4d08e4Qwen3.8-27B-GGUF(UD-Q4_K_XL) on llama.cpp, real Studio buildNo code changes were made here. This PR exists only so the live-Studio verification evidence
(screenshots + sped-up video) can be attached in a comment with GitHub-rendered media.
What the upstream PR does
Always expandedkeeps blocks open in every phase, including after a turn ends, and a manualcollapse still wins. When Tool calls is
Always expanded, the Group tool calls under Thinkingswitch disables itself with an explanation instead of silently contradicting the dropdown.