Repository navigation
Studio: a setting that folds a turn's tool calls into its Thinking block - #11377
shimmyshimmer merged 12 commits into
Conversation
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. |
A turn that calls tools hundreds of times fills the thread with rows nobody reads. Settings, Chat, "Fold tool calls into Thinking" hides them: the round's Thinking header is all that is left, and it says how many calls it is holding. Open the header and they are all there. Off by default, so the thread looks exactly as it does today until the setting is turned on. Each Thinking block owns the run of tool calls that follows it, and a message with several rounds folds each one separately. The parts are grouped by type, so the calls render beside the block rather than inside it; the block publishes its open state in a layout effect and the calls read it before the frame is painted, so nothing flashes on screen. Never folded away: a call awaiting an allow or deny, and the calls that hold their own output (canvases, Python, anything that wrote a file), which is the same carve-out the collapse preference already makes. Tool calls with no Thinking before them, or after the answer has started, have no block to fold under and stay where they are. A folded run is hidden, not unmounted, so its cards keep their state and any output still streaming into them.
fbc9843 to
14c6b5d
Compare
|
Reworked the fold so a turn collapses to a single Thinking block instead of one header per round. Later thinking rounds and the tool calls between them now render inside the lead block and follow its open state, and the lead keeps working through them so its clock covers the whole run-up. Also brought the block in line with the plain header style: no icon or box, shimmer while working, body text for the thoughts, and one 16px gap between every part in a reply. Description updated. |
…side it With "Fold tool calls into Thinking" on, a turn with several rounds still showed a header per round, so a long tool loop was a column of "Worked for" lines. Now the first Thinking block of a turn heads everything before the answer. Collapsed, the turn is one line that says how long it worked and how many calls it holds. Open it and the thoughts, the tool calls and the later thinking are all there, in order. Later reasoning groups in that span render as plain rounds inside the lead and follow its open state, the same way the tool groups do. The lead stays active through them, so its clock and its shimmer cover the whole run-up rather than the first round only. Tool calls after the answer, calls with no thinking before them, calls awaiting an approval and calls that hold their own output stay where they are, as before. The block itself is now a plain header line with no icon or box, a shimmer while it works, and the thoughts in body text under it. Every part in a reply, text, thinking, tool groups and single tool rows, sits on the same 16px rhythm, owned by the message body instead of by each part. The header label no longer clips its descenders.
5e4e5a2 to
9da72d2
Compare
|
@codex review |
|
The fold itself is self-contained and stays off by default, but this branch also restyles the Thinking block for everyone through the variant, icon, colour and spacing changes in reasoning.tsx. Could you split that presentation change out so the setting lands on its own, and retarget once #11373 is in? |
Five things the fold got wrong once a turn had more than the plain case in it. The header counted every call in the span, including runs the thread keeps visible: canvases, Python, calls that wrote files, calls awaiting an approval. A closed block could say "2 tool calls" over two cards sitting right under it. The rule for what stays visible now lives in one place, tool-fold-exemptions.ts, and both the tool group and the header ask it, so the count only names calls that are hidden. The count vanished while the block was still working, which is exactly when a closed block hides the most. It sits outside the label now, so "Thinking" and "Worked for" both carry it. A run that gained or lost an exemption switched between the hidden wrapper and the bare group, and React remounted its cards. The wrapper now stays for as long as the run is under a block, and an exemption only changes whether it is visible. Copy on the lead stopped at the lead's own parts, though the later rounds shown under the same header have no Copy of their own. It now reaches to the end of the folded span. A later round rendered its raw children, so a long one lost the paging that protects a long trace. Paging and the body that renders it are one hook and one component now, used by the lead and by every folded round.
|
@codex review |
An image_generation call has no image part of its own: the picture, its preview and its Edit and Download controls live only in the tool card. Folding that card under a closed Thinking block took the turn's result with it. It now counts as holding its own output, like canvases, Python and calls that wrote files, so it stays where it is.
|
@codex review |
An MCP tool can answer with text and images, and the fallback card is the only place those images are shown. Folding that card under a closed Thinking block hid the previews. A result in that shape now counts as holding its own output, next to canvases, Python, generated images and calls that wrote files.
|
@codex review |
A reply saved before per-round timing has only the last round's duration. The folded total gave up as soon as one round was unknown, so after a reload the single header said "Worked for 0s" where the old last-round header used to show the real number. Unknown rounds are now left out of the sum instead of zeroing it, and the total is undefined only when no round is known at all.
|
@codex review |
Opening a block pushed its label down by a few pixels: the Copy button's wrapper was an inline span in the flex header, so it took the paragraph line-height and grew the row. It is a flex item now and the row stays 20px either way. When the answer follows the trace directly, a thin rule now closes the trace, so the two do not read as one text. It goes on whatever is last under the header, the block itself, a folded round or a folded tool run, and hides with it. The thoughts sit at three quarters of the text colour, a shade lighter than the answer, so the eye can tell them apart without the rule.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
At the bottom of a thread the viewport follows content growth, so opening a Thinking block counted as new content and the bottom stayed pinned: the trace took the screen and the header slid up out of view. A click that opens a block, a tool group or a tool card now detaches from the bottom first, the way scrolling up does, so the block grows downward under a header that does not move. Scrolling back down re-attaches as before. A stream still follows, since its auto-open is not a click.
|
@codex review |
070c392 to
5e4d3a2
Compare
Rows under a tool group header sat 4px apart, tighter than anything else in a reply. They sit 12px apart now, with the same 12px above the first row, and a card's own content sits 8px under its row. The thoughts go back to the answer's colour: the rule at the end of the trace already separates the two.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0fe940735
ℹ️ 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".
| if (open && !isReasoningStreaming) { | ||
| detachFromBottom(); |
There was a problem hiding this comment.
Detach manual opens even while the response is streaming
When a user opens a Thinking block during an active response—for example after closing it manually or with “Collapse Thinking by default” enabled—isReasoningStreaming is true, so this skips detaching and the autoscroller pins the viewport to the bottom, pushing the clicked header upward as the block expands. Automatic opening does not invoke onOpenChange, so the callback can detach on every open without disabling stream following; the equivalent messageRunning guards in the tool-group and tool-card handlers have the same problem.
Useful? React with 👍 / 👎.
Two shapes slipped past the fold. A provider can leave a newline between a closed think block and its tool call, and that whitespace arrives as a text part; the fold read it as the answer starting and left the calls outside. Continue seeds the new message with the previous reply as a leading text part; the fold saw an answer before any thinking and never started. The fold now works in spans: a run of thinking, tool calls and blank text, led by its first reasoning group, ended only by text with something to read. A message can hold several spans, each folded under its own lead, so a continuation's new round folds like a fresh one and a reply with two answers folds twice. The rule that closes a trace skips trailing blank text and never sits on a blank part.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
3c11548
into
studio-sidebar-drag-and-project-rows
…11373) * Studio: drag sidebar rows into place, and make a project row do more Reordering the sidebar was two menu items, Move up and Move down, one slot per click. They are gone. Every chat and project row drags now, in Recents, in Pinned, and inside a project, with an insertion line showing where the row will land. A chat can be dragged onto a project to file it there, or into Pinned to pin it exactly where it is dropped. The drag source is held outside React state. A dragover can fire in the same frame as its dragstart, before the state commits, so the first gesture after picking a row up was read as a drag of nothing and refused. That is what made rows feel undraggable. Also here: - Manual order and the other sorts say what they do in the sort menu, and dropping a row in a sorted list switches that list to Manual rather than dropping the row back where it was. - A folder in Pinned is reachable from anywhere in its block of chats, instead of from its own row alone. - The project Edit dialog groups the source folders into one card with per-folder rows and an Add folder row. - The Projects page reveals a project's chats inline and pins or unpins in one click. - A chat row renames on double click, marks unread from its own menu, and shows its pin on hover. - Pin project and Pin chat are both just Pin, and a section's chevron appears on hovering anywhere in the section. - Chat rows use a plain message bubble without the dots inside it. - The reasoning header reads "Worked for 2m 5s" instead of "Thought for 125 seconds". * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: one read-or-unread item, and the same action order in both headers Mark as unread only ever added the dot: on a row that already carried one the item was disabled, so there was no way to take it off again. It is now one item that goes the way the row is not, Mark as read or Mark as unread, in the row menu and in the selection menu. Both carry an eye, open once the row is read and crossed out while it is not. Projects and Recents also carried the same pair of header actions in opposite orders. Both now put their own action first, new project or new chat, with the menu after it. * Studio: one planner for every sidebar drop, and Pinned takes folders too Every sidebar drop now goes through planSidebarDrop in lib/sidebar-drag.ts: the row being carried plus the spot under the pointer gives what the drop does, what to paint, and the effects to run. The four interleaved branches in the sidebar's row handlers are gone, and use-sidebar-drag.ts owns the native events, the lifted row and the cue. New drops: a folder dragged into Pinned is pinned in the slot it lands on, and back into Projects is unpinned there. A pinned chat dragged out is unpinned. Section headers take drops while collapsed, and a closed folder or section opens under a resting pointer. Pinned shows itself to a drag that could pin even while empty, so a first pin has somewhere to land. A hint beside the cursor says what the drop will do: Pin, Unpin, Reorder, Move to a folder, or Move to Recents. Three preferences in the Organize menu: show the hint, whether reordering a sorted list switches it to Manual order, and whether folders open while hovering. The document-level listener that moves the hint and clears a stale cue needs every dragover, so zones mark the event they answered instead of stopping propagation. Tests: sidebar-row-drag.test.ts now covers the planner directly. * Studio: keep Pinned out of a drag, and reach the first row from its header Pinned no longer appears while a chat or folder is dragged. It is on screen only when it has rows, as before. The ring drawn around a folder or section is now inset. A ring sits outside its box otherwise, and the first row's box ends exactly where the section's collapsible clips, so the top edge was cut off. The gap between a section header and its first row read as dead space: the pointer left the row, the cue went, and dropping above the first row felt impossible. The header now stands for the top of its first row for a drag of the same kind, so a folder dragged over the Projects header lands above the first folder, and a chat over the Recents header lands above the first chat. A chat over the Projects header still does nothing. * Studio: review fixes for the sidebar drag and the project rows - A pinned chat dropped into a folder or Recents is unpinned only after the move has gone through. A failed move used to leave it unpinned in place. - Touch browsers start no native drag, so their row menus keep Move up and Move down. Both paths share one reorder and the same sort rule. - Projects page: a comparison's two threads are one row that opens on the compare route; a project's chat list reloads when chat history changes; Enter or Space on the chevron or pin button no longer opens the project. - Edit project: Ctrl or Cmd + Enter in the name field saved twice. * Studio: debounce the project chat reload, and drop responses a newer load overtook The Projects page reloaded every open project's chats on every chat history event, and a streaming chat fires one per chunk. It now reloads once per quiet window, in place, with the rows kept on screen. Each project's load carries a sequence number, so a slow response that a later load overtook is discarded instead of putting a moved or deleted chat back. * Studio: a closed project's pending chat load cannot refill its cache The history refresh dropped a closed project's cached chats but left its in-flight load alone, so that load could land afterwards and the reopened row would keep the stale list. The refresh now advances every closed project's sequence, and the late answer is dropped. * Studio: a failed project chat load says so and retries A load that failed was cached as an empty list, so the row read "No chats" and reopening it never asked again. A failed first load now shows "Could not load chats. Retry", reopening the row loads again, and a failed reload keeps the rows already on screen. * Studio: project chat loads retry from the right state, and touch means any touch Closing a project row after a failed load started a request the reopen then waited on; only opening a row loads now. A silent reload that overtook a pending first load and failed left the row on its skeleton with nothing to retry; it now becomes the retryable error unless rows are already showing. The Move up and Move down fallback keyed off the primary pointer, so a laptop with a touchscreen and a trackpad lost it. It keys off any-pointer. * Studio: Pinned is one list, and a drop draws a line where the row lands Pinned kept folders first and chats after, in two orders, and a drop at the very top of it lit the whole section instead of showing where the row would go. Pinned is one interleaved list now. Every drop in it draws a single line, at the top included, and folders and chats land in the order they were dropped. Filing a chat into a pinned folder still works from the folder's chats or the lower half of its row. * Studio: a row over its own slot paints nothing instead of aiming at the last slot Lifting a row a little kept the pointer over the row itself, which had no answer, so the section body answered with its last slot and the line jumped to the bottom of the list at once. A row over its own slot, or an edge it already sits on, now claims the drag and paints nothing, and a drop there does nothing. * Studio: the gap between sidebar rows belongs to the row above it The menu keeps a 1px gap between rows. A pointer resting on it hit the section instead, whose only answer is its last slot, so the line jumped to the bottom of the list mid drag. Each draggable row's box now reaches over the gap below it, and a folder block's own rows (Show more, an empty folder) aim below that folder rather than at the last slot. * Studio: keep the Projects nav row put when a page borrows its section The row steps aside into More while the Projects section lists the folders, and comes back when that section is gone. It read that off whether the section was on screen, and Train, Recipes and Export list their runs where the folders go. Walking to Train pinned the row back to the top, which reads as a row the user had put away turning itself on, and walking back turned it off again. It now reads the setting behind the section, whether the sidebar is set up to list folders at all, so a route that borrows the section leaves the row where it was. The icon rail still keeps the row, since it hides the section without unmounting it and the row is the only way to reach projects there. * Studio: Pinned chords, folder moves and empty folder reloads follow the rows The chords walked Pinned as folder chats then top-level chats, which no longer matches a list where a chat can sit between folders; they now walk the rows as drawn. A pinned folder moved with alt + arrow or the touch menu carried no sort, so a Pinned list on Priority or Last updated wrote an order it never showed; it now switches to Manual or refuses, as a drop does. On the Projects page an empty folder whose reload failed kept saying No chats; it now offers Retry, since the reload may have been for its first chat. * Studio: a moved chat takes its slot after the move, and a stale folder says so A chat dropped into a folder or Recents had its slot written into that list's manual order before the move ran, so a failed move parked the chat in a list it never reached. The slot now waits for the move, as the pin already did. On the Projects page a folder whose reload failed kept its rows without a word and never asked again; it now says Could not refresh chats with Retry, and its next open asks again with the rows staying on screen. * Studio: a moved chat takes its slot in the list as it stands when the move lands The slot a dropped chat takes in its new list was written from the order snapshot taken at the drop, so a move slow enough to be overtaken by a reorder of that list wrote the snapshot over the newer order. The landing now carries its target row too, and once the move lands the chat is placed against that row in the list as it stands, keeping the reorder. An untouched list still takes the snapshot. * Studio: a setting that folds a turn's tool calls into its Thinking block (#11377) * Studio: a setting that folds a turn's tool calls into its Thinking block A turn that calls tools hundreds of times fills the thread with rows nobody reads. Settings, Chat, "Fold tool calls into Thinking" hides them: the round's Thinking header is all that is left, and it says how many calls it is holding. Open the header and they are all there. Off by default, so the thread looks exactly as it does today until the setting is turned on. Each Thinking block owns the run of tool calls that follows it, and a message with several rounds folds each one separately. The parts are grouped by type, so the calls render beside the block rather than inside it; the block publishes its open state in a layout effect and the calls read it before the frame is painted, so nothing flashes on screen. Never folded away: a call awaiting an allow or deny, and the calls that hold their own output (canvases, Python, anything that wrote a file), which is the same carve-out the collapse preference already makes. Tool calls with no Thinking before them, or after the answer has started, have no block to fold under and stay where they are. A folded run is hidden, not unmounted, so its cards keep their state and any output still streaming into them. * Studio: one Thinking block per turn, tool calls and later thinking inside it With "Fold tool calls into Thinking" on, a turn with several rounds still showed a header per round, so a long tool loop was a column of "Worked for" lines. Now the first Thinking block of a turn heads everything before the answer. Collapsed, the turn is one line that says how long it worked and how many calls it holds. Open it and the thoughts, the tool calls and the later thinking are all there, in order. Later reasoning groups in that span render as plain rounds inside the lead and follow its open state, the same way the tool groups do. The lead stays active through them, so its clock and its shimmer cover the whole run-up rather than the first round only. Tool calls after the answer, calls with no thinking before them, calls awaiting an approval and calls that hold their own output stay where they are, as before. The block itself is now a plain header line with no icon or box, a shimmer while it works, and the thoughts in body text under it. Every part in a reply, text, thinking, tool groups and single tool rows, sits on the same 16px rhythm, owned by the message body instead of by each part. The header label no longer clips its descenders. * Studio: fold review fixes, the header, the copy and the rounds it holds Five things the fold got wrong once a turn had more than the plain case in it. The header counted every call in the span, including runs the thread keeps visible: canvases, Python, calls that wrote files, calls awaiting an approval. A closed block could say "2 tool calls" over two cards sitting right under it. The rule for what stays visible now lives in one place, tool-fold-exemptions.ts, and both the tool group and the header ask it, so the count only names calls that are hidden. The count vanished while the block was still working, which is exactly when a closed block hides the most. It sits outside the label now, so "Thinking" and "Worked for" both carry it. A run that gained or lost an exemption switched between the hidden wrapper and the bare group, and React remounted its cards. The wrapper now stays for as long as the run is under a block, and an exemption only changes whether it is visible. Copy on the lead stopped at the lead's own parts, though the later rounds shown under the same header have no Copy of their own. It now reaches to the end of the folded span. A later round rendered its raw children, so a long one lost the paging that protects a long trace. Paging and the body that renders it are one hook and one component now, used by the lead and by every folded round. * Studio: keep generated images out of the fold An image_generation call has no image part of its own: the picture, its preview and its Edit and Download controls live only in the tool card. Folding that card under a closed Thinking block took the turn's result with it. It now counts as holding its own output, like canvases, Python and calls that wrote files, so it stays where it is. * Studio: keep results that carry images out of the fold An MCP tool can answer with text and images, and the fallback card is the only place those images are shown. Folding that card under a closed Thinking block hid the previews. A result in that shape now counts as holding its own output, next to canvases, Python, generated images and calls that wrote files. * Studio: a folded turn keeps the round durations it does know A reply saved before per-round timing has only the last round's duration. The folded total gave up as soon as one round was unknown, so after a reload the single header said "Worked for 0s" where the old last-round header used to show the real number. Unknown rounds are now left out of the sum instead of zeroing it, and the total is undefined only when no round is known at all. * Studio: a steady header, a rule before the answer, lighter thoughts Opening a block pushed its label down by a few pixels: the Copy button's wrapper was an inline span in the flex header, so it took the paragraph line-height and grew the row. It is a flex item now and the row stays 20px either way. When the answer follows the trace directly, a thin rule now closes the trace, so the two do not read as one text. It goes on whatever is last under the header, the block itself, a folded round or a folded tool run, and hides with it. The thoughts sit at three quarters of the text colour, a shade lighter than the answer, so the eye can tell them apart without the rule. * Studio: opening a block by hand grows it downward, the header stays put At the bottom of a thread the viewport follows content growth, so opening a Thinking block counted as new content and the bottom stayed pinned: the trace took the screen and the header slid up out of view. A click that opens a block, a tool group or a tool card now detaches from the bottom first, the way scrolling up does, so the block grows downward under a header that does not move. Scrolling back down re-attaches as before. A stream still follows, since its auto-open is not a click. * Studio: room between tool rows, and the thoughts back in body colour Rows under a tool group header sat 4px apart, tighter than anything else in a reply. They sit 12px apart now, with the same 12px above the first row, and a card's own content sits 8px under its row. The thoughts go back to the answer's colour: the rule at the end of the trace already separates the two. * Studio: a fold is a span, ended only by answer text with something in it Two shapes slipped past the fold. A provider can leave a newline between a closed think block and its tool call, and that whitespace arrives as a text part; the fold read it as the answer starting and left the calls outside. Continue seeds the new message with the previous reply as a leading text part; the fold saw an answer before any thinking and never started. The fold now works in spans: a run of thinking, tool calls and blank text, led by its first reasoning group, ended only by text with something to read. A message can hold several spans, each folded under its own lead, so a continuation's new round folds like a fresh one and a reply with two answers folds twice. The rule that closes a trace skips trailing blank text and never sits on a blank part. --------- Co-authored-by: Unsloth <[email protected]> * Studio: a chat dropped again before its move lands keeps only the latest drop A chat's row stays on screen while its move is written, so it could be dropped into a second folder before the first move landed. Both moves ran at once and each wrote its slot and pin on its own, so the earlier drop could land after the later one, or park its order in a folder the chat never finally joined. Moves of one chat now run one after another, and only the latest drop commits its slot and pin. --------- Co-authored-by: Unsloth <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…nslothai#11373) * Studio: drag sidebar rows into place, and make a project row do more Reordering the sidebar was two menu items, Move up and Move down, one slot per click. They are gone. Every chat and project row drags now, in Recents, in Pinned, and inside a project, with an insertion line showing where the row will land. A chat can be dragged onto a project to file it there, or into Pinned to pin it exactly where it is dropped. The drag source is held outside React state. A dragover can fire in the same frame as its dragstart, before the state commits, so the first gesture after picking a row up was read as a drag of nothing and refused. That is what made rows feel undraggable. Also here: - Manual order and the other sorts say what they do in the sort menu, and dropping a row in a sorted list switches that list to Manual rather than dropping the row back where it was. - A folder in Pinned is reachable from anywhere in its block of chats, instead of from its own row alone. - The project Edit dialog groups the source folders into one card with per-folder rows and an Add folder row. - The Projects page reveals a project's chats inline and pins or unpins in one click. - A chat row renames on double click, marks unread from its own menu, and shows its pin on hover. - Pin project and Pin chat are both just Pin, and a section's chevron appears on hovering anywhere in the section. - Chat rows use a plain message bubble without the dots inside it. - The reasoning header reads "Worked for 2m 5s" instead of "Thought for 125 seconds". * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: one read-or-unread item, and the same action order in both headers Mark as unread only ever added the dot: on a row that already carried one the item was disabled, so there was no way to take it off again. It is now one item that goes the way the row is not, Mark as read or Mark as unread, in the row menu and in the selection menu. Both carry an eye, open once the row is read and crossed out while it is not. Projects and Recents also carried the same pair of header actions in opposite orders. Both now put their own action first, new project or new chat, with the menu after it. * Studio: one planner for every sidebar drop, and Pinned takes folders too Every sidebar drop now goes through planSidebarDrop in lib/sidebar-drag.ts: the row being carried plus the spot under the pointer gives what the drop does, what to paint, and the effects to run. The four interleaved branches in the sidebar's row handlers are gone, and use-sidebar-drag.ts owns the native events, the lifted row and the cue. New drops: a folder dragged into Pinned is pinned in the slot it lands on, and back into Projects is unpinned there. A pinned chat dragged out is unpinned. Section headers take drops while collapsed, and a closed folder or section opens under a resting pointer. Pinned shows itself to a drag that could pin even while empty, so a first pin has somewhere to land. A hint beside the cursor says what the drop will do: Pin, Unpin, Reorder, Move to a folder, or Move to Recents. Three preferences in the Organize menu: show the hint, whether reordering a sorted list switches it to Manual order, and whether folders open while hovering. The document-level listener that moves the hint and clears a stale cue needs every dragover, so zones mark the event they answered instead of stopping propagation. Tests: sidebar-row-drag.test.ts now covers the planner directly. * Studio: keep Pinned out of a drag, and reach the first row from its header Pinned no longer appears while a chat or folder is dragged. It is on screen only when it has rows, as before. The ring drawn around a folder or section is now inset. A ring sits outside its box otherwise, and the first row's box ends exactly where the section's collapsible clips, so the top edge was cut off. The gap between a section header and its first row read as dead space: the pointer left the row, the cue went, and dropping above the first row felt impossible. The header now stands for the top of its first row for a drag of the same kind, so a folder dragged over the Projects header lands above the first folder, and a chat over the Recents header lands above the first chat. A chat over the Projects header still does nothing. * Studio: review fixes for the sidebar drag and the project rows - A pinned chat dropped into a folder or Recents is unpinned only after the move has gone through. A failed move used to leave it unpinned in place. - Touch browsers start no native drag, so their row menus keep Move up and Move down. Both paths share one reorder and the same sort rule. - Projects page: a comparison's two threads are one row that opens on the compare route; a project's chat list reloads when chat history changes; Enter or Space on the chevron or pin button no longer opens the project. - Edit project: Ctrl or Cmd + Enter in the name field saved twice. * Studio: debounce the project chat reload, and drop responses a newer load overtook The Projects page reloaded every open project's chats on every chat history event, and a streaming chat fires one per chunk. It now reloads once per quiet window, in place, with the rows kept on screen. Each project's load carries a sequence number, so a slow response that a later load overtook is discarded instead of putting a moved or deleted chat back. * Studio: a closed project's pending chat load cannot refill its cache The history refresh dropped a closed project's cached chats but left its in-flight load alone, so that load could land afterwards and the reopened row would keep the stale list. The refresh now advances every closed project's sequence, and the late answer is dropped. * Studio: a failed project chat load says so and retries A load that failed was cached as an empty list, so the row read "No chats" and reopening it never asked again. A failed first load now shows "Could not load chats. Retry", reopening the row loads again, and a failed reload keeps the rows already on screen. * Studio: project chat loads retry from the right state, and touch means any touch Closing a project row after a failed load started a request the reopen then waited on; only opening a row loads now. A silent reload that overtook a pending first load and failed left the row on its skeleton with nothing to retry; it now becomes the retryable error unless rows are already showing. The Move up and Move down fallback keyed off the primary pointer, so a laptop with a touchscreen and a trackpad lost it. It keys off any-pointer. * Studio: Pinned is one list, and a drop draws a line where the row lands Pinned kept folders first and chats after, in two orders, and a drop at the very top of it lit the whole section instead of showing where the row would go. Pinned is one interleaved list now. Every drop in it draws a single line, at the top included, and folders and chats land in the order they were dropped. Filing a chat into a pinned folder still works from the folder's chats or the lower half of its row. * Studio: a row over its own slot paints nothing instead of aiming at the last slot Lifting a row a little kept the pointer over the row itself, which had no answer, so the section body answered with its last slot and the line jumped to the bottom of the list at once. A row over its own slot, or an edge it already sits on, now claims the drag and paints nothing, and a drop there does nothing. * Studio: the gap between sidebar rows belongs to the row above it The menu keeps a 1px gap between rows. A pointer resting on it hit the section instead, whose only answer is its last slot, so the line jumped to the bottom of the list mid drag. Each draggable row's box now reaches over the gap below it, and a folder block's own rows (Show more, an empty folder) aim below that folder rather than at the last slot. * Studio: keep the Projects nav row put when a page borrows its section The row steps aside into More while the Projects section lists the folders, and comes back when that section is gone. It read that off whether the section was on screen, and Train, Recipes and Export list their runs where the folders go. Walking to Train pinned the row back to the top, which reads as a row the user had put away turning itself on, and walking back turned it off again. It now reads the setting behind the section, whether the sidebar is set up to list folders at all, so a route that borrows the section leaves the row where it was. The icon rail still keeps the row, since it hides the section without unmounting it and the row is the only way to reach projects there. * Studio: Pinned chords, folder moves and empty folder reloads follow the rows The chords walked Pinned as folder chats then top-level chats, which no longer matches a list where a chat can sit between folders; they now walk the rows as drawn. A pinned folder moved with alt + arrow or the touch menu carried no sort, so a Pinned list on Priority or Last updated wrote an order it never showed; it now switches to Manual or refuses, as a drop does. On the Projects page an empty folder whose reload failed kept saying No chats; it now offers Retry, since the reload may have been for its first chat. * Studio: a moved chat takes its slot after the move, and a stale folder says so A chat dropped into a folder or Recents had its slot written into that list's manual order before the move ran, so a failed move parked the chat in a list it never reached. The slot now waits for the move, as the pin already did. On the Projects page a folder whose reload failed kept its rows without a word and never asked again; it now says Could not refresh chats with Retry, and its next open asks again with the rows staying on screen. * Studio: a moved chat takes its slot in the list as it stands when the move lands The slot a dropped chat takes in its new list was written from the order snapshot taken at the drop, so a move slow enough to be overtaken by a reorder of that list wrote the snapshot over the newer order. The landing now carries its target row too, and once the move lands the chat is placed against that row in the list as it stands, keeping the reorder. An untouched list still takes the snapshot. * Studio: a setting that folds a turn's tool calls into its Thinking block (unslothai#11377) * Studio: a setting that folds a turn's tool calls into its Thinking block A turn that calls tools hundreds of times fills the thread with rows nobody reads. Settings, Chat, "Fold tool calls into Thinking" hides them: the round's Thinking header is all that is left, and it says how many calls it is holding. Open the header and they are all there. Off by default, so the thread looks exactly as it does today until the setting is turned on. Each Thinking block owns the run of tool calls that follows it, and a message with several rounds folds each one separately. The parts are grouped by type, so the calls render beside the block rather than inside it; the block publishes its open state in a layout effect and the calls read it before the frame is painted, so nothing flashes on screen. Never folded away: a call awaiting an allow or deny, and the calls that hold their own output (canvases, Python, anything that wrote a file), which is the same carve-out the collapse preference already makes. Tool calls with no Thinking before them, or after the answer has started, have no block to fold under and stay where they are. A folded run is hidden, not unmounted, so its cards keep their state and any output still streaming into them. * Studio: one Thinking block per turn, tool calls and later thinking inside it With "Fold tool calls into Thinking" on, a turn with several rounds still showed a header per round, so a long tool loop was a column of "Worked for" lines. Now the first Thinking block of a turn heads everything before the answer. Collapsed, the turn is one line that says how long it worked and how many calls it holds. Open it and the thoughts, the tool calls and the later thinking are all there, in order. Later reasoning groups in that span render as plain rounds inside the lead and follow its open state, the same way the tool groups do. The lead stays active through them, so its clock and its shimmer cover the whole run-up rather than the first round only. Tool calls after the answer, calls with no thinking before them, calls awaiting an approval and calls that hold their own output stay where they are, as before. The block itself is now a plain header line with no icon or box, a shimmer while it works, and the thoughts in body text under it. Every part in a reply, text, thinking, tool groups and single tool rows, sits on the same 16px rhythm, owned by the message body instead of by each part. The header label no longer clips its descenders. * Studio: fold review fixes, the header, the copy and the rounds it holds Five things the fold got wrong once a turn had more than the plain case in it. The header counted every call in the span, including runs the thread keeps visible: canvases, Python, calls that wrote files, calls awaiting an approval. A closed block could say "2 tool calls" over two cards sitting right under it. The rule for what stays visible now lives in one place, tool-fold-exemptions.ts, and both the tool group and the header ask it, so the count only names calls that are hidden. The count vanished while the block was still working, which is exactly when a closed block hides the most. It sits outside the label now, so "Thinking" and "Worked for" both carry it. A run that gained or lost an exemption switched between the hidden wrapper and the bare group, and React remounted its cards. The wrapper now stays for as long as the run is under a block, and an exemption only changes whether it is visible. Copy on the lead stopped at the lead's own parts, though the later rounds shown under the same header have no Copy of their own. It now reaches to the end of the folded span. A later round rendered its raw children, so a long one lost the paging that protects a long trace. Paging and the body that renders it are one hook and one component now, used by the lead and by every folded round. * Studio: keep generated images out of the fold An image_generation call has no image part of its own: the picture, its preview and its Edit and Download controls live only in the tool card. Folding that card under a closed Thinking block took the turn's result with it. It now counts as holding its own output, like canvases, Python and calls that wrote files, so it stays where it is. * Studio: keep results that carry images out of the fold An MCP tool can answer with text and images, and the fallback card is the only place those images are shown. Folding that card under a closed Thinking block hid the previews. A result in that shape now counts as holding its own output, next to canvases, Python, generated images and calls that wrote files. * Studio: a folded turn keeps the round durations it does know A reply saved before per-round timing has only the last round's duration. The folded total gave up as soon as one round was unknown, so after a reload the single header said "Worked for 0s" where the old last-round header used to show the real number. Unknown rounds are now left out of the sum instead of zeroing it, and the total is undefined only when no round is known at all. * Studio: a steady header, a rule before the answer, lighter thoughts Opening a block pushed its label down by a few pixels: the Copy button's wrapper was an inline span in the flex header, so it took the paragraph line-height and grew the row. It is a flex item now and the row stays 20px either way. When the answer follows the trace directly, a thin rule now closes the trace, so the two do not read as one text. It goes on whatever is last under the header, the block itself, a folded round or a folded tool run, and hides with it. The thoughts sit at three quarters of the text colour, a shade lighter than the answer, so the eye can tell them apart without the rule. * Studio: opening a block by hand grows it downward, the header stays put At the bottom of a thread the viewport follows content growth, so opening a Thinking block counted as new content and the bottom stayed pinned: the trace took the screen and the header slid up out of view. A click that opens a block, a tool group or a tool card now detaches from the bottom first, the way scrolling up does, so the block grows downward under a header that does not move. Scrolling back down re-attaches as before. A stream still follows, since its auto-open is not a click. * Studio: room between tool rows, and the thoughts back in body colour Rows under a tool group header sat 4px apart, tighter than anything else in a reply. They sit 12px apart now, with the same 12px above the first row, and a card's own content sits 8px under its row. The thoughts go back to the answer's colour: the rule at the end of the trace already separates the two. * Studio: a fold is a span, ended only by answer text with something in it Two shapes slipped past the fold. A provider can leave a newline between a closed think block and its tool call, and that whitespace arrives as a text part; the fold read it as the answer starting and left the calls outside. Continue seeds the new message with the previous reply as a leading text part; the fold saw an answer before any thinking and never started. The fold now works in spans: a run of thinking, tool calls and blank text, led by its first reasoning group, ended only by text with something to read. A message can hold several spans, each folded under its own lead, so a continuation's new round folds like a fresh one and a reply with two answers folds twice. The rule that closes a trace skips trailing blank text and never sits on a blank part. --------- Co-authored-by: Unsloth <[email protected]> * Studio: a chat dropped again before its move lands keeps only the latest drop A chat's row stays on screen while its move is written, so it could be dropped into a second folder before the first move landed. Both moves ran at once and each wrote its slot and pin on its own, so the earlier drop could land after the later one, or park its order in a folder the chat never finally joined. Moves of one chat now run one after another, and only the latest drop commits its slot and pin. --------- Co-authored-by: Unsloth <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Stacked on #11373, so the diff here is eleven commits, one of them a merge of the current base. Retarget to main once that one lands.
What this changes
A turn that calls tools hundreds of times fills the thread with rows nobody reads. Settings, Chat, "Fold tool calls into Thinking" hides them under the turn's Thinking block until it is opened.
Collapsed, the whole turn is one line:
Open it and everything the turn did before answering is there, in order: the thoughts, every tool call, and any thinking that followed those calls. Off by default, so the thread looks unchanged until the setting is turned on.
How it is put together
Message parts are grouped by type, so a run of reasoning becomes one group and the run of tool calls after it becomes another. They are siblings, not parent and child, so the block does not contain them; it owns them.
tool-fold-exemptions.tsand both the tool group and the header use it. The count shows while the block is still working too, so a closed block reads "Thinking · 2 tool calls" until it settles.What is never folded
The block itself
The Thinking block is now a plain header line, no icon and no box, with a shimmer on the label while it works and the thoughts in body text under it. Every part in a reply (text, thinking, tool groups, single tool rows) sits on the same 16px gap, owned by the message body rather than by each part, so a header next to a paragraph reads the same as two paragraphs. The label no longer clips the descenders on "Worked" and "Thinking", and the header row keeps its height when Copy appears, so the label does not move when the block opens. Opening a block, a tool group or a tool card by hand also detaches the thread from the bottom first, so the content grows downward under a header that stays where it is instead of the viewport pinning the bottom and sliding the header up. Rows under a tool group header sit 12px apart, with the same 12px above the first row and 8px between a row and its own content. When the answer follows the trace directly a thin rule closes the trace, on whatever is last under the header, so the two do not read as one text.
Tests
npm run testpasses 8100, withthinking-fold.test.tscovering which groups fold under the lead, the count and the summed time in the header, the exemption rule the count and the tool group share, the layout-effect publish, the stable hidden-not-unmounted wrappers, the copy range, the paging on folded rounds and the carve-outs.npm run i18n:checkpasses across all 12 locales. Lint is unchanged from the baseline on every file touched.Driven in a browser with a thread of two thinking rounds around a web search: preference on collapses the turn to one line with its count, opening it shows the first round, the search row and the second round in order, closing hides them all again, and a live turn keeps a single "Thinking" header through the search and the follow-up round before settling on the one line. With "Collapse Thinking by default" on as well, the closed block reads "Thinking · 2 tool calls" while the two searches run and "Worked for 2s · 2 tool calls" after.