Skip to content

Studio: three-state Thinking and Tool calls visibility in Display - #11433

Merged
shimmyshimmer merged 9 commits into
mainfrom
studio-display-visibility-settings
Sep 21, 2026
Merged

shimmyshimmer merged 9 commits into
mainfrom
studio-display-visibility-settings

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Problem

Display had three switches that overlapped and talked past each other:

  • Collapse Thinking by default
  • Collapse tool activity by default
  • Fold tool calls into Thinking

Each of the first two only chose between "collapsed" and the automatic behaviour. There was no way to say keep it open. Reasoning always snapped shut the moment its stream ended, and tool cards closed as soon as the answer started, no matter what you wanted. The third switch could quietly contradict the second: with folding on, tool calls disappeared behind a Thinking block even if you had just asked for tool activity to be visible.

What this does

Both switches become one dropdown each:

Row Options
Thinking Collapsed / Expand while running / Always expanded
Tool calls Collapsed / Expand while running / Always expanded

Always expanded keeps blocks open in every phase, streaming and running included, and stays open once the turn finishes. A block you collapse by hand stays collapsed.

Three switches become two dropdowns plus one switch that now admits when it cannot apply. Both dropdowns share one set of option labels, so the same state never gets two names.

Manual toggles

Each block keeps a single override, null until its trigger is clicked. Your click wins for the rest of the round. Changing the setting clears overrides so it reaches messages already on screen, not just the next turn.

The fold conflict

Folding hides a turn's tool calls behind its Thinking block. Always expanded asks for those calls to be open. Honouring both pins them open inside something closed, which means invisible.

Always expanded wins. The fold row disables itself and says why:

Unavailable while tool calls are set to Always expanded, which keeps them on their own rows.

The stored preference is untouched, so switching tool calls back to Collapsed or Expand while running restores the grouping without re-checking the box. Also renamed to Group tool calls under Thinking, which describes what it actually does.

Migration

collapseThinkingByDefault and collapseToolActivityByDefault map true to collapsed and false to auto. Reading the old false as expanded would have left every upgrading install with permanently open tool cards, so it deliberately does not. An unknown value falls back to the default instead of blanking the select.

Search

The rows are now labelled with what they are (Thinking, Tool calls) rather than what one state of them does, so searching Settings for "collapse" or "expand" would have stopped finding them. Added keywords to keep that working. All twelve locales updated.

Testing

npm test, npm run typecheck and npm run i18n:check all pass. 64 tests across the three affected files, with new coverage for:

  • always expanded across running, finished and answered
  • a card closed by hand staying closed under always expanded
  • each setting change re-applying to blocks already on screen
  • legacy migration in both directions, plus a stored value winning over a legacy boolean beside it
  • the fold conflict, and the fold preference surviving being suspended
  • the Settings row rendering disabled exactly when the fold cannot apply

One unrelated pre-existing failure remains on this branch: no module-scope read of a chat barrel value, which fails identically on a clean main checkout.

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.
@chatgpt-codex-connector

This comment has been minimized.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

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.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Unsloth added 2 commits September 21, 2026 02:11
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.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review


P2 Badge Preserve manual opens when answer text arrives

For controlled cards using useToolActivityOpen (web search, knowledge base, skill reads, and code execution), currentOpen does not distinguish an automatic open from a user override. Under auto, if the user opens a completed card before the assistant emits prose, the first hasText=true update forces it closed here, so the user's click does not win for the rest of the round as it does for uncontrolled cards. Track an explicit override for this hook and only apply the automatic close when no override exists.

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

@wasimysaid

Copy link
Copy Markdown
Collaborator

Verified on a live Studio build of this head (f3d3e82) — Qwen3.8-27B-GGUF (UD-Q4_K_XL) on llama.cpp, Playwright/Chromium 1440×900, web search on.

2× walkthrough of the three states

🎬 2× mp4, 16.5 s (raw recording 32.8 s)

  • Display rows: both dropdowns show Collapsed / Expand while running / Always expanded. With tool calls on Always expanded the fold switch disables itself with the explanation, and switching back restores its stored value without re-checking the box.
  • Real tool call under Expand while running: reasoning + tool card open while the turn streams, closed once it ends. Under Always expanded the blocks of the already-rendered turn re-open (open, closed, open, open, closed, open), and one manual collapse still wins.
  • Both choices survive a full page reload with the fold row still disabled; the answer came back with source chips at ~127 tok/s.

Rendered evidence + raw state arrays: wasimysaid#199 (comment)

chatgpt-codex-connector[bot]

This comment was marked as resolved.

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.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

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.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 21, 2026
@unslothai unslothai deleted a comment from shimmyshimmer Sep 21, 2026
@unslothai unslothai deleted a comment from shimmyshimmer Sep 21, 2026
@unslothai unslothai deleted a comment from shimmyshimmer Sep 21, 2026
@unslothai unslothai deleted a comment from shimmyshimmer Sep 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 21, 2026
@wasimysaid

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fc9d60b24

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

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.
@wasimysaid

Copy link
Copy Markdown
Collaborator

@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.
@wasimysaid

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

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.
@shimmyshimmer
shimmyshimmer merged commit 49b4843 into main Sep 21, 2026
40 of 43 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-display-visibility-settings branch September 21, 2026 12:29
rhsCZ pushed a commit to rhsCZ/unsloth that referenced this pull request Sep 21, 2026
Merging main in turned this branch red on two contracts, both because a guard
refused a spelling rather than reading it. Neither product change is wrong.

unslothai#11408 states the working row's touch gutter as `pr-[78px]`. The sidebar guard
compares `pr-N` in Tailwind spacing units and refused arbitrary values outright,
so a row reserving 19.5 units failed a check about reserving too few. Arbitrary
px and rem gutters are now converted to units and compared like any other, and
only values that resolve against something static analysis cannot see (`%`,
`calc()`, `var()`) are still refused. Verified both ways: `pr-[8px]` is caught
by the floor as too small, and `pr-[50%]` is still refused as unreadable.

unslothai#11433 replaced the `manualOpen` / `dismissedWhileStreaming` pair with a single
nullable override, and `test_reasoning_clears_manual_open_on_a_new_stream`
pinned the literal `setManualOpen(false)`, so a deliberate rename read as the
reset having been deleted. The invariant is intact in the new model: a new round
calls `setOverride(null)`. The test now finds the override the way the component
does, through the value `resolveReasoningOpen` is given, derives its setter from
the `useState` that declares it, checks the hand toggle is what writes it, and
then requires the new-round branch to clear it.

Sabotage on that last one found a real bug in the guard rather than confirming
it. `_without_block_comments` strips the braces around a comment together with
the comment, so a branch whose body is only a comment loses its `{}`, and
scanning for the next `{` walked into the visibility-change branch, which also
clears the override. The guard passed while the reset it exists for was gone.
It now requires the brace to be the condition's own and fails if anything
separates them. Both the emptied branch and `setOverride(false)` in place of
`setOverride(null)` now fail, and only this test.

96 tests across the eight suites that read app-sidebar.tsx or reasoning.tsx pass
on the merged tree.
pull Bot pushed a commit to Little-Star888/unsloth that referenced this pull request Sep 21, 2026
…nslothai#11404)

* Read the sidebar and reasoning contracts as claims, not as literals

Three guards fail on main itself, so every open pull request inherits them:

  tests/studio/test_desktop_reliability_frontend_contract.py
    ::test_chat_sidebar_row_actions_visible_on_coarse_pointers
  tests/studio/test_chat_response_details_ui_contract.py
    ::test_response_model_badge_is_user_configurable_and_rendered_once_per_message
    ::test_reasoning_keeps_streaming_height_cap_through_automatic_collapse

Bisected to 35a4b3128 (#11373). Its parent 9ba936a5c passes all three.

#11373 is right and the guards were wrong, in the same way three times: each
pinned a literal that encoded one commit's layout rather than the property it
was defending.

- The coarse-pointer padding was pinned as pr-10. The row gained an action, so
  it is now pr-14 on project rows and pr-16 on recents. Reserving room on a
  touch device is the contract (#7276); the number is not. It now matches any
  [@media(pointer:coarse)]:pr-N.

- That same test bounds its block at the next top-level function. #11373 added
  a nested one, so the block shrank to a signature and a comment and every
  assertion was reading an empty room. It now fails as a stale guard if the
  block comes back too short to be the row.

- min-w-0 flex-1 was pinned as one string on the trigger. The filling moved to
  a new header wrapper and the shrinking stayed on the trigger. Shrinking is
  what stops a long summary widening the row, so the trigger is now matched for
  min-w-0 specifically, and the header for its own.

- The streaming height cap was pinned as
  streaming={isReasoningStreaming || retainStreamingHeight}. The render moved
  down a level: the state lives in the parent and is handed over as a prop,
  and the child ORs it with its own streaming flag. Which component evaluates
  it is layout. That the flag reaches the evaluation, and that it is still
  ORed, is the claim, and both are now asserted separately.

Every assertion was checked by breaking the thing it guards, one at a time,
against a green baseline: removing the coarse padding, unthreading the retained
flag, dropping the OR, removing min-w-0 from the trigger, and removing it from
the header each fail their own assertion and only theirs. The first pass of the
trigger check did not, because min-w-0 appears elsewhere in the file; it is
matched against the ReasoningTrigger element now.

* Check the coarse padding on each row variant, not once for the block

A single search over renderChatSidebarItem is satisfied by the project row on
its own, so recents could lose their coarse-pointer padding and the guard would
stay green. That is the half of #7276 that was actually reported.

Each variant is now read separately: find the class strings that widen that
row's padding on hover, and require one of them to widen it on a coarse pointer
too. Removing only pr-16 fails naming recent-item, removing only pr-14 fails
naming project-chat-item, and my earlier single search passed both.

The absent-row case is its own failure with its own wording, since a variant
that no longer widens on hover means this guard can no longer tell whether the
touch case is covered, which is not the same as the padding being gone.

* Require the coarse gutter to be at least the hover gutter

Matching [@media(pointer:coarse)]:pr-N on any N accepts pr-0. The hover padding
stays pr-14 and pr-16, so the row still looks like it reserves room while the
always-visible touch action sits back over the title, which is the overlap
#7276 was filed for.

There is a number already in the row saying how much room the action needs: the
padding it applies on hover. So the claim is that a coarse pointer gets at
least that, whatever it is, which stays true the next time the row gains an
action and both values move together.

Shrinking recents to pr-1 fails naming (16, 1), shrinking project rows to pr-0
fails naming (14, 0), and removing either one entirely still fails on the
earlier assertion with its own wording.

* Read whole class tokens, and read the element that owns the cap

Two ways the loosened assertions could still be satisfied by something that
does not hold:

min-w-0 was matched with \b, and a colon is a word boundary, so md:min-w-0
satisfied it while the trigger stayed unable to shrink at every width it was
not qualified for. Both the trigger and the header row are now read as class
LISTS and the token has to be there unqualified.

The streaming cap was matched anywhere in the file. ReasoningText is the
element that writes data-streaming and therefore owns the cap, so the same OR
on a sibling read identically and capped nothing. The match is now scoped to
the ReasoningText element.

Each is checked with the mutation it describes: qualifying either utility as
md: fails its own assertion, and moving the OR from ReasoningText onto the
sibling MarkdownTextSource fails the cap assertion and prints the element it
read.

* Read the trigger's effective classes, not the caller's copy

min-w-0 is written twice, in ReasoningTrigger's base classes and again on the
call site. Requiring the call-site copy would have failed a deduplication that
leaves the trigger shrinking exactly as before, which is the literal-layout
check this whole change is meant to stop writing.

Both are read now and either satisfies it. Removing just the call-site copy
passes, removing just the base copy passes, removing both fails and prints what
it read from each, and qualifying both as md: fails as well, since a variant
that only applies above a breakpoint is not the trigger shrinking at every
width.

* Hold every padded element, and read classes without assuming prop order

Two ways the guards could still pass while the thing they defend was gone.

The coarse-padding loop asked for one match among the class lists that widen a
variant's padding on hover. A second padded element therefore vouched for the
row that had lost its gutter: the unprotected list produced (N, None) and was
skipped rather than failing. Every such list is now required to carry a coarse
padding at least as large as its own hover gutter, since each one is an element
making room for the action and each owes the same room on touch.

The class-list reads required className to sit immediately after data-slot, so
inserting a ref, an aria-* or a test id between them would have failed a guard
whose whole purpose is to stop unrelated refactors reddening main. The opening
tag is found first and the attribute read out of it, which is what _class_list
does for both the header and the ReasoningTrigger call site.

Checked with the mutations described: padding a decoy recent-item element while
stripping the real row's coarse gutter now fails and prints the unprotected
class list, inserting aria-busy between data-slot and className keeps the suite
green, and doing both at once fails on the missing min-w-0 rather than on the
attribute order.

* Read the whole opening tag, and let a call-site override lose the guard

_class_list scanned forward from the marker, so a className written BEFORE
data-slot was invisible and the contract failed on an element that was fine.
That is the attribute-order assumption again, one level down. It backs up to
the element's own < now.

The trigger width was a union of base and call-site tokens, which is not what
renders. cn runs tailwind-merge, so a call site passing min-w-full or
min-w-max drops the base min-w-0 and the trigger stops shrinking, while a union
still holds the base token and calls it fine. The tokens are read in cn order
and the LAST min-w-* has to be min-w-0.

Checked four ways: className before data-slot stays green, min-w-full at the
call site fails and prints the utilities in order, min-w-max appended after a
kept min-w-0 fails, and dropping the call-site copy entirely stays green
because the base still carries it.

* Resolve the trigger's min-width per variant

startswith("min-w-") only sees unqualified utilities, so min-w-0 md:min-w-max
read as min-w-0 and passed. tailwind-merge keeps both, because it resolves each
variant separately, and above the md breakpoint the trigger stops shrinking:
the long-summary overflow is back at exactly the widths the override applies
to.

Tokens are grouped by variant now, the last min-w in each group is the
effective one, and every one of them has to be min-w-0. An unqualified group
must also exist, or the base case is unstated and the smallest widths are left
to whatever the element defaults to.

min-w-0 md:min-w-max fails naming {'md': 'min-w-max'}, min-w-0 lg:min-w-full
fails naming {'lg': 'min-w-full'}, and min-w-0 md:min-w-0 stays green.

* Find the real end of a JSX tag, and resolve every class list last-wins

Three more ways these guards could read something other than what renders.

The opening tag ended at the first > character, and an expression prop can
contain one. onClick={() => undefined} before className cut the tag short and
the class list vanished, so a callback added to the header would have failed a
guard that exists to survive exactly that. Only a > outside the JSX expression
braces closes the tag now.

The header was checked for the presence of min-w-0 while the trigger was
resolved per variant. md:min-w-max on the header therefore passed, and above
that breakpoint the overflow is back one level up. Both go through the same
resolution now, and being a flex row is its own assertion with its own message.

The coarse-pointer padding read the FIRST match in a class list. A later
[@media(pointer:coarse)]:pr-0 is what tailwind-merge keeps, so the guard was
reporting a gutter that had already been overridden. Both the hover gutter and
the coarse padding take the last occurrence.

Checked: an arrow-function prop before className keeps the suite green,
md:min-w-max on the header fails naming {'md': 'min-w-max'}, and a trailing
[@media(pointer:coarse)]:pr-0 on recents fails naming (16, 0).

* Read expression classNames, and resolve padding across the whole cn call

Two more places where the guards read something other than what renders.

className={cn(...)} and className={"min-w-max"} are both valid and neither is
a double-quoted attribute, so the reader returned None, the caller fell back on
the base classes, and a call site that overrode min-w-0 passed. The quoted
pieces of an expression are what tailwind-merge sees, so those are read in
order. An expression with no readable piece is now its own failure: absent and
unreadable want opposite treatment, and quietly falling back is what made this
a hole rather than a gap.

The coarse padding was resolved within each quoted string. These rows are one
cn() over many arguments and tailwind-merge keeps the last conflicting value
wherever it was written, so an argument further down carrying only
[@media(pointer:coarse)]:pr-0 overrides the gutter above it and was ignored
because it held no hover utility. Which later arguments apply is decided by the
ternary the two variants sit on: a string naming the other variant is the
branch that did not render, and a string naming neither is unconditional.

Checked: className={"min-w-max"} fails naming {'': 'min-w-max'},
className={cn("min-w-0")} stays green, className={someVar} fails as unreadable
rather than passing on the base, and a standalone
"[@media(pointer:coarse)]:pr-0" argument fails naming (14, 0).

* Refuse conditional class expressions, and scope padding to the row's own cn

Both holes were opened by the widening in the previous commit.

Flattening an expression's quoted pieces reads a conditional wrong. A className
of `wide ? "min-w-max" : "min-w-0"` concatenates to a list ending in min-w-0
and looks fine, while the `wide` branch renders min-w-max and restores the
overflow. Reading each branch separately is a real expression evaluator. Saying
the expression is unreadable is not, and it fails loudly instead of approving a
branch nobody checked.

The padding scan ranged over every quoted literal in renderChatSidebarItem, so
an unrelated element further down could supply the effective gutter for a row
that had lost its own. That is the borrowed-vouching hole again, one level out.
It is bounded to the arguments of the cn() that builds the row now, found by
matching parentheses from the row's own class string.

Checked: a conditional className fails as unreadable, and stripping both real
coarse paddings while adding a later element carrying
[@media(pointer:coarse)]:pr-16 fails naming the project row's unprotected class
list, where before it passed.

* Refuse what the reader cannot evaluate, and pin the streaming operand

Three more places where a value that could be anything was read as a value
that was fine.

The className parse ran to the end of the tag, so quoted strings belonging to
later attributes were collected as classes, and a mixed expression such as
cn("min-w-0", widthClass) resolved to min-w-0 while widthClass could be
min-w-max. It is bounded to the className expression's own brace now, a single
cn() wrapper is stripped, and every argument has to be a plain string literal.
Anything else means the class list is unknown, which is not the same as it
being whatever literals happen to be lying around.

The height cap matched streaming={\w+ || retainStreamingHeight}, and any
identifier satisfied it. An actively streaming block would go uncapped whenever
the retained flag was false, which is most of the time. The left operand has to
be isStreaming, the component's own input.

The padding scan treated every literal inside the row's cn() as unconditional.
A conditional argument applies only when its condition holds, and
showWorkSpinner && "[@media(pointer:coarse)]:pr-16" is absent in exactly the
branch that carries the hover gutter. Only bare string literal arguments may
vouch for a row other than the one they are written in.

Checked: cn("min-w-0", widthClass) fails as unreadable, falseFlag on the left
of the OR fails and prints the element, and the conditional padding argument
fails naming the recents row's unprotected class list.

* Recognise important modifiers, and scan the ReasoningText tag the same way

An important utility is exactly how an override that these guards must catch
would be written, and neither reader saw one. Stripping the marker for
recognition makes !min-w-max and min-w-max! count as the min-width they are,
and the same for a coarse padding written !pr-0. The marker is kept in the
reported value so a failure says which form it found.

The ReasoningText tag was matched with [^>]*, which ends at the first > and an
arrow function in an earlier prop supplies one. That is the same truncation the
class reader already grew a balanced scan for, so this uses one too.

Checked: !min-w-max at the call site fails naming {'': '!min-w-max'}, an
important coarse padding of 0 on recents fails naming (16, 0), and an
arrow-function prop before streaming on ReasoningText keeps the suite green.

* Stop adjudicating tailwind precedence, and refuse what is ambiguous

These two guards had been growing an evaluator: last in cn order, then per
responsive variant, then across cn arguments, then conditional arguments only
in their own branch, then importance beating a later ordinary utility. Every
rule was right and the next one was still missing, because the question is
tailwind-merge plus the cascade and a test file should not hold a second copy
of either. Twenty-three review findings on this branch were that treadmill.

So they no longer decide. The trigger and the header each have to state one
min-width utility, unqualified and unmarked, and it has to be min-w-0. Each
sidebar row has to state one hover gutter and one coarse-pointer padding, both
plain, with the touch padding at least the hover one, and nothing else in the
row's own cn() may add a coarse padding. Duplicates of the same class are still
fine: writing min-w-0 on both the base and the call site is not a conflict.

This is stricter than the framework. min-w-0 md:min-w-0 really does shrink
everywhere and is refused anyway. It is refused LOUDLY, naming what it found
and saying this guard does not adjudicate precedence, which is a message
someone can act on. The failure mode that matters is the other one: quietly
approving a layout nobody checked. Between a guard that is occasionally
inconvenient and one that is occasionally wrong, this picks the first.

Checked: !min-w-max before min-w-0 is refused, md:min-w-0 is refused, an
important coarse padding is refused, a second coarse padding elsewhere in the
row's cn is refused, and the real source passes.

* Read the component's whole composition, and exempt only the sibling's own row

The base classes were the first quoted literal in ReasoningTrigger's cn(). A
second literal appended after className would be effective and invisible, so
the whole call is parsed now: every argument has to be a string literal or the
className prop itself, and anything else means the composition is unknown
rather than fine.

The padding scan exempted any literal containing a variant name, which let
"group/recent-item [@media(pointer:coarse)]:pr-0" through while that zero is
what renders. Only the other variant's own row strings are exempt now,
identified exactly the way this variant's were.

Checked: appending "min-w-max" after className fails naming both utilities,
composing from an unresolved value fails as unreadable, and the named-group
literal carrying pr-0 fails naming itself.

* Check the handoff on the element that receives it, and keep the cn call honest

The retained-height handoff was a file-wide substring test, so the same text on
another element, or in a comment, kept it green while the real ReasoningBody
lost the prop. ReasoningBody is rendered more than once, and the one that
matters is the one holding this state: it receives
isStreaming={isReasoningStreaming}, the flag whose end the retained height
bridges. Every such call now has to hand the flag over.

Commented-out lines are stripped from a tag before it is read. A prop commented
out is a prop that is not passed, and every check here is a substring test, so
leaving the text in place let a disabled prop satisfy the guard whose whole job
is noticing it went away. Only a // that begins a line counts.

The sidebar scan found the nearest PRECEDING cn(, which may already have
closed, and then read another element's arguments as the row's. It now requires
the call it found to still be open at the gutter.

Checked: commenting out the prop fails, moving it to the other ReasoningBody
fails, and both name the tag they read.

* Recognise arbitrary properties as the same property

Tailwind can set min-width as [min-width:max-content] and right padding as
[padding-right:0], and both readers knew only the min-w-N and pr-N spellings,
so a class list containing one read as stating nothing about that property.

Splitting on the last colon breaks on the arbitrary form too, since the value
contains one, so the min-width case is matched before any variant is stripped.

The padding case is refused outright rather than compared: this guard compares
pr-N numbers and cannot say how an arbitrary property interacts with them,
which is the same reason it no longer adjudicates importance or variants.

Checked: [min-width:max-content]! on the trigger and md:[min-width:max-content]
on the header are both refused and named, and
[@media(pointer:coarse)]:[padding-right:0] on the row is refused and named.

* Read whole padding values, and refuse shorthands that move the same edge

pr-16.5 matched as pr-16, so a hover gutter larger than the touch one read as
equal to it and passed. Tailwind 4 takes fractional spacing, so the utilities
are matched whole, with a boundary that stops a prefix counting, and compared
as numbers rather than integers.

px-0, p-0 and pe-0 all move the right edge and all override pr-N through
tailwind-merge, and none of them looked like a pr-N to this guard. A row
carrying one is a row whose touch gutter cannot be read off its pr-N utilities,
so it is refused with that said plainly.

Checked: a coarse px-0 and a coarse p-0 are each refused and named, and a
fractional hover gutter of 16.5 against a touch gutter of 16 now fails as
(16.5, 16.0) where it used to read as equal.

* Bind the row classes to buttonClass, and refuse spreads and arbitrary values

The row's classes were found by searching the whole function for a hover
gutter, so moving both verified pairs into any other cn() call satisfied the
guard while the buttons that render carried no gutter at all. They are read
from `const buttonClass = cn(...)` now, by name, and the guard also checks that
buttonClass is still applied to something.

A spread can carry className and nothing here can say what is in it, so an
element that spreads props is unreadable rather than silent. Silent would send
the caller back to the base classes and let an override through, which is the
same fallback hole as before in a different spelling.

pr-[0px] is an arbitrary VALUE rather than an arbitrary property, so the check
added for [padding-right:0] did not see it while tailwind-merge drops the
numeric gutter for it. Both forms are refused now.

Checked: a spread on the trigger fails as unreadable, moving both row pairs
into a decoy cn() fails on the first variant, and pr-[0px] after the numeric
coarse gutter fails naming itself.

* Refuse identifier values, spreads on the holder, and important arbitrary widths

Three more values that could be anything and were read as fine.

The arbitrary min-width pattern wanted the bracket immediately after the
variant colon, so an important one written md:![min-width:max-content] fell
through to the fallback, which then split at the colon inside the value. The
marker is allowed there now.

buttonClass was scanned for quoted literals, so a class string held in an
identifier was invisible while cn made it effective. Every VALUE position in
its arguments now has to be a literal or undefined; conditions may still be
anything, since a condition cannot become the class string. Comments are
stripped first, because they hold commas and splitting around them turns a
sentence into an unreadable value.

A spread on the ReasoningBody holding this state can supply the same prop and,
written after it, wins. That holder is refused rather than read.

Checked: md:![min-width:max-content] is refused and named, an identifier
argument in buttonClass is refused and named, and a spread after the verified
prop is refused and prints the tag.

* Read the sidebar gutter per branch, and refuse a spread on ReasoningText

Three holes, all reachable without touching the strings these guards read.

The sidebar contract found the verified hover/coarse pair anywhere in
buttonClass, so moving it into "showWorkSpinner ? pair : undefined" left
every ordinary row with no gutter while the scan over literals still found
it. The builder's arguments are now enumerated into the class lists it can
actually produce, tracking each condition's text so that two arguments
branching on the same expression cannot be combined into a state neither
can be in, which is exactly how the real row is written: the touch gutters
sit under "showWorkSpinner ? undefined : pair" and the room for the spinner
case is stated in a separate argument on the same flag. Each rendering that
states a gutter for a variant, through hover, an open menu or keyboard
focus, has to reserve at least that much on a coarse pointer.

That reading takes the last pr-N to win, so the refusals that made it safe
moved from the selected literal to the whole builder: no importance marker,
no p-/px-/pe- shorthand, no arbitrary padding. A bare "!pr-0" argument beat
every coarse gutter below it and carried no coarse marker, so nothing was
looking at it.

ReasoningText took a spread after its streaming prop, which wins in JSX
while the explicit text goes on satisfying the regex. Same treatment as the
ReasoningBody holder above it: refused rather than read.

* Say once why the gutter is checked per variant

The paragraph explaining that a single search over the whole function
would stay green while the recents row lost its padding was pasted
twice.

* Close three ways a gutter check reads a value that does not render

A block comment switches a prop off as well as a line comment does, and it
sits between two attributes rather than on its own line, so the tag reader
now drops it wherever it appears. Commenting out the retained-height handoff
left the contract green with the cap released the moment streaming stopped.

pr-px is a real utility worth one pixel. tailwind-merge drops an earlier pr-
for a later one whatever the later one's value is, so appending it after the
checked gutter replaced that gutter while every check here, all of them
numeric, went on reporting the old number. Any right padding the builder can
contribute now has to be a number this guard can compare.

Zero against zero satisfied the comparison and reserved nothing. The action
has a width whatever the row says about it, so a row claiming no room for it
has stopped claiming rather than been fixed. The gutter's size is still not
pinned, only that there is one.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Read className on an attribute boundary, and || before &&

`className="..."` was matched unanchored, so `data-className="flex min-w-0"`
matched on its suffix and handed back tokens the browser never applies as
the element's rendered classes. Both the literal and the expression form now
require the name to start an attribute.

The branch reader took the last logical operator as the outermost, which is
right within one operator and wrong across two: `a || b && "x"` is
`a || (b && "x")`, not `(a || b) && "x"`. Read the wrong way round, a row
whose cn() receives a bare truthy value and adds no classes at all was
credited with the gutters in that string. Splitting on `||` first gets the
grouping right, and it also puts the identifier in a value position, where
the readability rule refuses it rather than guessing what it holds.

* Anchor the three remaining prop and class reads to attribute boundaries

Same defect as the className reader, at the three sites that were not going
through it. Each was a substring or unanchored search, and each has a
`data-` spelling that satisfies it while the real prop goes unset:

  - `className={buttonClass}` on the sidebar row. Also read past comments
    now, since an assignment surviving only as a comment reads identically
    to a substring search while the button receives no gutter classes.
  - `retainStreamingHeight={retainStreamingHeight}` on the ReasoningBody
    holding the state.
  - `streaming={isStreaming || retainStreamingHeight}` on ReasoningText.

Both reasoning props are optional, so a `data-` prefixed spelling left the
component on its default of false and the streaming height cap gone, with
the tests green.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Check the row button, every branch, and a floor under both gutters

Three ways the sidebar gutter contract could still be satisfied by a row
that reserves nothing.

buttonClass was only required to reach SOMETHING in renderChatSidebarItem.
The row also renders an inline rename input and a pin, so handing the
builder to one of those and leaving the button without it kept the contract
green while every padding class checked below reached nothing the gutters
are measured against. It has to be on a <SidebarMenuButton>, and that tag is
refused if it also spreads props, on the same ground as the other holders.

A rendering that claimed no gutter for a variant was skipped as "not this
variant's row", so making both variants' gutters conditional on one flag
left ordinary rows with no touch padding and nothing checking them. A row is
identified by the gutter it claims, so a row that claims none cannot be
identified, and that is the thing to refuse rather than to skip.

The comparison is relative, so reducing both sides together satisfied it
while reserving nothing usable: pr-0.5 against pr-0.5 passed. One action is
one .sidebar-row-action-glyph, sized in index.css, and the gutter now has to
hold at least one of them. That is a floor and not the whole requirement:
the row's own stated gutter is still what the coarse padding is measured
against, and the floor is read from the stylesheet rather than written here.

* Count the row's actions, and require the trigger to be rendered

The floor under both gutters was one glyph, but a row carries a pin and an
options button. Reducing every gutter to pr-6 reserved 24px for the two of
them and passed, putting the pin back over the title, which is the
regression this contract exists to stop. The floor now counts the row's
labelled actions and multiplies, so it is 12 rather than 6 and tracks the
row if an action is added or removed. Counted by label, so that the two
branches of a per-variant class do not read as two actions while the one
button they dress reads as none.

`_class_list` answers None both for a call site that passes no className and
for one that is not there, and the component's own function can stay behind
unused, so the header could stop rendering ReasoningTrigger entirely while
the checks went on describing base classes that reach nothing. That it is
rendered is now asserted before what it is given is read.

* Strip JSX comments, count actions per variant, and order the spreads

`{/* ... */}` is how a prop is commented out in JSX, and it is the spelling
that would be used, but the stripper only knew `//`. A disabled
`className={buttonClass}` therefore read as a live prop and every padding
check went on describing classes no rendered button receives.

The action count was taken across the whole function and applied to both
rows, but the pin sits inside a per-variant gate while the options button
does not. An action added to one row would have required room on the other
and failed a correct change. Actions are counted per variant now, by reading
which `{variant === "x" && (` gate encloses each button, so adding one to
recents leaves the project floor at 12 and raises only the recent one.

Refusing every spread was too strict, and this direction matters more than
it sounds: JSX applies attributes in order, so `{...props} className="..."`
ends with the explicit one whatever the spread holds. Refusing it would have
failed a safe refactor that forwards unrelated props, which stops correct
work rather than catching anything. Only a spread written AFTER the explicit
attribute is unresolved, and a tag that states the attribute nowhere is
still unknown if it spreads at all. The same ordering now applies to the
ReasoningBody and ReasoningText checks, which had the same overreach.

* Measure how far the actions reach, and order the row button's spreads

Counting the actions assumed they sit side by side. They do not: they are
absolutely positioned and the pin is pushed clear of the options button by
`right: 1.875rem`, so what the row must reserve is how far the furthest one
reaches, not how many there are. At two glyphs the floor was 12 while the
offset action's glyph already ends at 13.5, which let every recent-row
gutter drop from pr-16 to pr-12 and still pass. The floor is now read from
that offset plus the glyph size, per variant, so it follows the stylesheet
rather than a count.

Measured to the far edge of the glyph, not of its container. The container
adds pr-1.5 of its own, and including that puts the project row's reach at
15 against the pr-14 it states. That is a 4px question about the product,
not about this guard, so it is raised on the PR rather than settled here by
reddening main.

The row button rejected every spread, including
`<SidebarMenuButton {...rowProps} className={buttonClass}>`, which is safe:
JSX applies attributes in order, so the explicit class wins whatever the
spread holds. Only a spread after it is unresolved. Same correction as the
reasoning checks got, at the site that had been left behind.

* Refuse a right padding under a qualifier this guard does not read

Being numeric was not enough. The comparison reads three shapes, a bare
pr-N, a coarse-pointer one, and a variant-qualified gutter, and a padding
under any other variant matched none of them, so it was left out of the
answer entirely while still rendering.
`focus:[@media(pointer:coarse)]:pr-0` is the case: effective on a focused
touch row, invisible here, and the row credited with the gutter it no longer
has.

Refused rather than modelled, which is the rule already applied to
importance markers and to arbitrary values. This guard does not adjudicate
what it cannot read, and it says so loudly rather than quietly reporting a
number that does not render.

* Take the comments out before locating anything, not after

Two places were stripping comments too late to matter.

The row builder was located in the raw function text, so an old
`const buttonClass = cn(...)` left inside `/* ... */` sits earlier than the
live one and was the one selected. The gutter analysis then described
classes nothing renders while the carrier check, which did read the stripped
text, saw the live `buttonClass` and agreed with it. Both now run on the
stripped text, and the class slice is taken from it too.

`_class_list` stripped comments from the opening tag AFTER slicing to it,
but a commented-out element still contains its own `<`, so the slice landed
inside `{/* ... */}` and returned the class list of something the page does
not render. The whole source is stripped before the search now, which is
also what makes the rendered-trigger assertion mean anything: it was a
substring test over text that still held the commented call.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Read every claimed state, resolve every action's classes, strip the rest

Four ways the contracts still described something other than what renders.

`max(claimed)` reported the largest gutter a row states, so dropping one
state's gutter to pr-0 left a sibling's 16 answering for it. Each qualified
class names a state in which the action is visible, and in that state the
row reserves exactly that gutter, so every one of them has to meet the
floor. An open menu on a coarse pointer is such a state.

Counting the row's actions skipped any button whose classes it could not
read, which silently lowered the floor while the action still rendered.
Moving the project pin's literal into a differently named constant did
exactly that. The three forms that appear here, a literal, a `cn(...)` over
literals and a local constant holding either, are resolved; anything else is
refused rather than dropped.

`_cn_literals` and the ReasoningBody holder scan were still reading raw
source, so a dead `cn(...)` or a commented-out body sitting before the live
one was what they read. Both go through the same stripper the trigger
lookup already used.

* Read the live text everywhere, and identify an action by where it is

Three more readers were still taking raw text, and I said last round there
were none left, which was wrong.

The ReasoningText lookup, and the two CSS reads behind the floor. A rule
left in a comment above a live one is what a search finds, so the glyph
size and the pin's offset could both be measured from something the page
does not render. The reasoning test now strips once at the top and every
assertion in it reads the live text, rather than each lookup stripping for
itself: they are all claims about what the file DOES, and commented-out
code does nothing, so it is a precondition for all of them rather than a
precaution for some.

Actions were keyed by aria-label, which dropped any that names itself
another way. `aria-labelledby` is the ordinary one, and dropping the offset
pin took the row's reach down to a single glyph while the pin went on
rendering. They are keyed by position now, with the label kept only so the
failure message can name them.

* Measure the glyph through its padding, and fix the row it shows is short

The floor left out the action container's own pr. The container is
justify-end, so the glyph's right edge sits that far inside it and the left
edge is offset + pr + size: 15 spacing units for the offset pin, not 13.5.
I raised this as a 4px question last round rather than decide it, and the
answer is that the padding counts.

With it counted, the project chat row reserves 14 against a pin that reaches
15, so its title really does run under the glyph by 4px. The recent row
already reserves 16 and carries the same two actions with the same geometry,
so the project row now reserves 16 as well. That is a product change, small
and deliberate, and it is what makes the corrected floor true rather than
something the guard is taught to ignore.

`actionClass` is a per-variant ternary, and flattening both branches let one
of them lose `sidebar-row-action` while the other's token kept the button
counted for both rows. Each variant resolves its own branch now, split at
the `:` that pairs with the `?` rather than the first one, since every class
string here is full of colons.

Spread detection matched object spreads inside other props, so
`onClick={() => call({...payload})}` made a readable tag unreadable. Only
spreads at the tag's own attribute level can override an attribute.

* Read the offsets from CSS, and require the caller's classes to arrive

Positioning was reduced to whether the class text said `is-unpin-action`,
so any other action was recorded as flush right and its reach understated.
The modifiers and their right edges are read from index.css now, and an
action positioned by a `right-*` utility or by a modifier the stylesheet
does not define is refused rather than assumed to sit at zero.

A counted action also has to carry `sidebar-touch-reveal`. Dropping it from
the options button left the gutter looking correct while the button was
transparent and inert on a coarse pointer, and the file-wide reveal check
stayed satisfied by either pin.

`_cn_literals` returned the base literals whether or not the composition
included `className`, and the caller's classes are added to the order
afterwards, so a trigger that stopped forwarding kept passing while the call
site's min-w-0 reached nothing. A composition without it is unreadable.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Resolve every class argument, and refuse an offset stated another way

Collecting the quoted literals and ignoring everything else was already
wrong on the current source: the project pin builds its classes with
`cn(literal, REVEAL_WITH_OPEN_MENU_PROJECT_CHAT)`, and that constant was
invisible. A constant supplying `sidebar-row-action`, an `is-*` modifier or
a positioning utility would have skipped the button or understated its
reach with the contract still green.

Every argument resolves now, or the whole class list is unreadable and the
guard says so. Four forms are read, a literal, `cn(...)`, a ternary on the
variant, and an identifier defined as a const in the file, resolved
recursively; anything else is refused.

`_row_action_offsets` recorded zero both for a rule that leaves `right`
alone and for one that states it in a spelling it cannot read, so `30px`, a
`calc(...)` or an `@apply right-*` would have lowered the floor silently.
The two are distinguished now and the second is refused by name.

Both are the shape that keeps recurring here: a reader that quietly drops
what it cannot understand rather than refusing it. These were the last two
places in these files that did that.

* Require the shared row action, and say why the floor stops at the glyph

Two findings on the sidebar coarse-pointer contract, resolved differently.

The first is structural and is fixed. Every assertion about the reserved
gutter is written about a row that renders the shared "Chat options" action,
but nothing checked that it is still there. The per-variant pins alone keep
both action maps non-empty, so removing that button, or letting it lose
`sidebar-row-action`, left the floor and the reserve agreeing with each other
while the action the gutter exists for was gone. `_labelled_actions` now
requires at least one action that sits outside every `variant === "..."` gate.
It is keyed on the gate structure rather than on the English label, because
label-keying was itself a finding here earlier and would break on translation.

Verified by sabotage: swapping the options button's `className={actionClass}`
for a plain class passes the previous guard (37 passed) and fails exactly
`test_chat_sidebar_row_actions_visible_on_coarse_pointers` under this one.

The second is a real observation that I am not turning into an assertion. The
floor measures `offset + pr + glyph` = 15 units, and the action's container
also carries `pl-2`, so its box reaches 17 while both rows reserve `pr-16`.
The two paddings are not alike: the container is justify-end, so `pr` decides
where the glyph sits and belongs in the sum, while `pl` decides nothing about
the glyph and only extends a transparent box further left. #7276 is about the
action sitting over the title, and what sits over the title is the glyph.

The box does overhang by one unit, and `.sidebar-row-action.sidebar-touch-reveal`
is `pointer-events-auto`, so a tap in the last 4px of the title area hits the
pin instead of opening the chat. That is worth fixing, but it is a product
decision affecting the recents row too, which #7276 never touched and which
has shipped this way. Raising a contract test's floor would make that decision
by failing CI rather than by deciding it, so the reasoning and the number are
recorded in the code instead, for whoever changes the rows.

* Read the gutter and the reasoning reset as main now spells them

Merging main in turned this branch red on two contracts, both because a guard
refused a spelling rather than reading it. Neither product change is wrong.

#11408 states the working row's touch gutter as `pr-[78px]`. The sidebar guard
compares `pr-N` in Tailwind spacing units and refused arbitrary values outright,
so a row reserving 19.5 units failed a check about reserving too few. Arbitrary
px and rem gutters are now converted to units and compared like any other, and
only values that resolve against something static analysis cannot see (`%`,
`calc()`, `var()`) are still refused. Verified both ways: `pr-[8px]` is caught
by the floor as too small, and `pr-[50%]` is still refused as unreadable.

#11433 replaced the `manualOpen` / `dismissedWhileStreaming` pair with a single
nullable override, and `test_reasoning_clears_manual_open_on_a_new_stream`
pinned the literal `setManualOpen(false)`, so a deliberate rename read as the
reset having been deleted. The invariant is intact in the new model: a new round
calls `setOverride(null)`. The test now finds the override the way the component
does, through the value `resolveReasoningOpen` is given, derives its setter from
the `useState` that declares it, checks the hand toggle is what writes it, and
then requires the new-round branch to clear it.

Sabotage on that last one found a real bug in the guard rather than confirming
it. `_without_block_comments` strips the braces around a comment together with
the comment, so a branch whose body is only a comment loses its `{}`, and
scanning for the next `{` walked into the visibility-change branch, which also
clears the override. The guard passed while the reset it exists for was gone.
It now requires the brace to be the condition's own and fails if anything
separates them. Both the emptied branch and `setOverride(false)` in place of
`setOverride(null)` now fail, and only this test.

96 tests across the eight suites that read app-sidebar.tsx or reasoning.tsx pass
on the merged tree.

* Resolve each action's own right padding, and drop the product change

The floor was wrong and it drove a product change that was not needed.

`.sidebar-row-action` applies `pr-1.5`, and the reach calculation gave that to
every action. It is not what every action gets: `.sidebar-row-action.is-unpin-action`
overrides it to `padding-right: 0.125rem`, deliberately, to close the gap to the
options button, and index.css says so directly above the rule. The container is
justify-end, so that padding is what decides where the glyph sits. The pin
therefore reaches 7.5 + 0.5 + 6 = 14 units, not 15.

I read that rule earlier for the `right: 1.875rem` offset and quoted the comment
above it without noticing the line below. The consequence was a floor of 15 that
rejected the project row's `pr-14`, which was in fact exactly sufficient, and I
widened the row to `pr-16` to satisfy it. That cost 8px of title space on every
project chat row to fix nothing.

So: `_row_action_paddings` now reads each modifier's own right padding out of
the stylesheet, as a bare rem value or an `@apply pr-N`, and `_labelled_actions`
uses it in place of the base for any action that carries such a modifier. A
modifier that states a padding this cannot read is refused rather than treated
as stating none, and two modifiers both stating one are refused too, since which
applies is a source-order question this does not adjudicate.

The `pr-16` change to app-sidebar.tsx is reverted. This branch no longer touches
any product file: `git diff origin/main` on app-sidebar.tsx is empty, and the
project row is back to the `pr-14` that #7291 shipped.

Sabotage, all three against a green baseline and each failing only this test:
raising the pin's override to 0.5rem takes its reach to 15.5 and the row's
pr-14 fails; stating it as `var(--gap)` is refused as unreadable; deleting the
override drops the pin back to the base 1.5, reach 15, and pr-14 fails again.

109 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. The one remaining failure there is test_sidebar_exposes_queue_activity_for_each_thread,
which is #11456's.

* Compare classes as tokens, and refuse a spread over either streaming prop

Two checks that asked a different question than the thing they guard.

`"sidebar-touch-reveal" in classes` is a substring test, but CSS matches a class
name exactly. A rename or typo to a longer token, `sidebar-touch-reveal-disabled`
being the obvious one, satisfies it while matching no rule: the CSS that reveals
the action still exists, so every other check here stays green, and the button
goes on being transparent and inert on a coarse pointer, which is the whole of
#7276. The same flaw sat on `"sidebar-row-action" not in classes` in the other
direction, where `sidebar-row-action-glyph` would enrol a button no rule
positions. Both are whole-token comparisons now, and the two readers below that
already split reuse the same list.

The streaming-height check refused a holder whose spread could override
`retainStreamingHeight` but said nothing about `isStreaming`. What is kept is
the OR of the two, so a spread replacing the live flag loses just as much:
`{...{ isStreaming: false }}` written between the two attributes leaves the
retained flag untouched and the check green while ReasoningText stops seeing the
stream and renders uncapped until the retained state catches up. `isStreaming`
is also what selects the holders, so a spread over it makes the selection wrong
as well. Both props are checked now.

Sabotage, each against a green baseline: the renamed reveal class and the
interposed spread both PASS the previous guards, and each now fails only its own
test. 110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or
index.css pass.

* Ask the new-round question positively, and refuse a qualified right-*

Two more places where a check passed on something that was not true.

The new-round guard located `startsNewReasoningRound(` and read the block after
it, which says nothing about the sense the question was asked in. Both
inversions read as green: `if (!startsNewReasoningRound(...))` clears the
override on every transition EXCEPT a new round, and
`if (startsNewReasoningRound(...) === false)` does the same, each the exact
inverse of the contract. `if (` now has to sit immediately before the call, and
the only thing allowed between the call and the brace is the paren that closes
the `if`.

The `right-*` refusal matched the bare utility only, so a variant-qualified one
went through. `[@media(pointer:coarse)]:right-40` positions the action on
precisely the path this test is about, and the reach would then have been taken
from the CSS modifier or from zero while the action rendered far into the title
on every touch device. Any token whose utility half is `right-*` is refused now,
under whatever variant.

Sabotage, all three against a green baseline: the negated predicate, the
`=== false` predicate and the qualified `right-40` each PASS the previous
guards, and each now fails only its own test.

A third item in the same review, the base `sidebar-row-action` class being
matched as a substring, was already fixed in 6960f86d2; that review ran against
the head before it. Re-checked here rather than assumed: renaming the shared
button's class to `sidebar-row-action-disabled` fails the contract at this head.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Read the base edge, refuse className spreads, bound the isStreaming match

Three more readers that accepted less than they claimed.

The offset reader scanned only `.sidebar-row-action.is-*` rules and treated an
action with no modifier edge as flush right, without ever reading the base
`.sidebar-row-action` rule. It is `right-0` today, so the answer was right by
luck. Change the base to `right-8` and every action slides eight units into the
title while the floors, all measured from an assumed zero, do not move and the
contract stays green. The base edge is read now, a spelling this cannot read is
refused rather than assumed, and it is the fallback for any modifier that states
no edge of its own.

`_button_classes` looked for `className=` and returned "" when it found none, so
an action whose className arrives through a JSX spread was read as carrying no
classes and skipped as not being a row action at all. The reach calculation then
lost it entirely while the shared options button kept every later assertion
satisfied, which is why the empty result was invisible. A top-level spread is
now unreadable by attribute order: with no explicit className any spread may be
supplying it, and with one, only a spread written after it can override, since
JSX applies attributes left to right. The className search is on an attribute
boundary too.

The streaming holders were selected by substring, so
`data-isStreaming={isReasoningStreaming}` still matched. The tag stayed a holder
while ReasoningBody received no isStreaming at all, and every assertion below it
went on passing with the live stream uncapped. Matched on an attribute boundary
now, the same way the retained flag already was.

Sabotage, each against a green baseline: the base rule moved to `right-8`, the
`data-` prefixed prop, and the pin supplied as
`{...{ className: "sidebar-row-action sidebar-touch-reveal right-40" }}` all
PASS the previous guards, and each now fails only its own test. The first
sabotage I wrote for the spread case put it on the options button instead, which
the previous guard already caught through the shared-action assertion, so it
proved nothing; the pin is the case the reader was blind to.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Take the last CSS value, not the first, and refuse a className lookalike

Three readers that reported the first answer they found where CSS renders the
last, or read a miss as an absence.

`.sidebar-row-action-glyph` and the base `.sidebar-row-action` rule were each
read with a lazy `[^}]*?` search for the first `size-N` and `pr-N`. CSS resolves
a repeated declaration to the last, so appending `@apply size-20` or
`@apply pr-20` to either rule changes what renders while every floor here goes
on being measured from the value above it. Both now collect every value the rule
states and refuse anything but a single readable one, rather than picking a
winner: which one applies also depends on specificity and on where Tailwind
emits the utility, and this guard models neither.

Reading the rule at all was a second bug in the same place. `[^}]*` stops at the
first `}`, and `.sidebar-row-action` has a nested `.sidebar-touch-reveal` rule,
so the old form took in part of that nested rule while cutting the outer one
short. `_own_declarations` brace-matches the rule and drops anything nested
inside it.

The className boundary added in e9e20834c was right to decline
`data-className={cn(...)}`, but returning "" for it said the button carried no
classes, and `_labelled_actions` then skipped it as not a row action. Renaming
the pin's attribute that way made it disappear from the reach calculation while
it went on rendering with none of the classes that position or reveal it, and
the shared options button kept every later assertion satisfied. A suffixed
lookalike is refused now instead of read as an absence.

Sabotage, each against a green baseline: `data-className` on the pin, a later
`size-20` on the glyph, and a later `pr-20` on the base rule all PASS the
previous guards, and each now fails only this test.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Finish the CSS sweep, and read what outranks the utilities

Seven findings, three of them the sweep I should have done last round.

Last round I put the base glyph and base padding readers on a whole-rule read
that collects every declaration, and left the three others on first-match:
the base right edge, the modifier paddings and the modifier offsets. All three
were the same bug, and a later `right: 5rem`, `padding-right: 5rem` or
`@apply pr-20` in any of those rules renders while the reader reports the value
above it. They now share one path: `_modifier_rules` brace-matches each rule,
`_sole_measure` collects every value it states and refuses two readable ones
rather than picking a winner, and a modifier that states nothing falls back to
the base rule, which is what CSS does.

That path also fixed a bug of its own: the property search was `\bright:`, and
the boundary matches inside `padding-right:`, so the two measures could read
each other. It is `(?<![\w-])` now.

Three more where something outranks the utilities being compared and nothing
looked at it. An inline style beats every Tailwind class:
`style={{ paddingRight: 0 }}` on the row carrier puts the touch actions back
over the title, and `style={{ minWidth: "max-content" }}` on ReasoningTrigger
lets a long summary widen the row, both with every assertion green because only
the class strings were read. Both are refused now. And the open toggle was only
required to CALL the override setter, so `setOverride(null)` in the handler
passed while no hand toggle was ever remembered, which makes the new-round reset
below it guard nothing; it now has to store the answer resolveReasoningToggle
returned.

Last, `_without_block_comments` left line comments searchable, so a stale
`// <ReasoningBody isStreaming={...} retainStreamingHeight={...}>` above the
render is what `_opening_tags` finds while the live body has lost both props.
It strips both kinds now, keeping `https://` out of it.

Sabotage on all seven against a green baseline, each failing only its own test.
The line-comment one took two attempts: the first edit replaced the text inside
the comment it had just inserted, so it proved the opposite of what I wanted.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Refuse shorthands that contain the edge, and inline styles on the actions

Two more ways to set the edge this guard measures without it noticing.

A shorthand overrides the longhand it contains, and only the longhand was read.
`padding: 0 5rem` in the base action rule beats the parsed `pr-1.5`, and
`inset: 0 5rem auto auto` on a modifier beats its `right`, both with the reach
computed from values that no longer render. `_sole_measure` now refuses a rule
that states either, along with the Tailwind spellings of the same thing,
`@apply p-20` and `@apply px-20`, since `@apply` is the same declaration written
another way. Refused rather than parsed: a shorthand's right component depends
on how many values it carries, and this guard does not model that.

The base padding read was going straight to `_stated_units` and so bypassed
that refusal entirely. It goes through `_sole_measure` now, which is what let
the first version of this fix still pass `padding: 0 5rem`.

Inline styles on the row actions themselves were not checked. The carrier was
already refused one, for exactly this reason, and the actions were not:
`style={{ right: "5rem" }}` or `style={{ paddingRight: "5rem" }}` on an action
outranks every class and CSS rule the reach is derived from, so the permanently
visible touch action can sit over the title with the contract green.

Sabotage, six cases against a green baseline, each failing only this test:
`padding: 0 5rem`, `@apply p-20` and `@apply px-20` in the base rule, `inset`
on the pin modifier, and inline `right` and `paddingRight` on an action. All six
PASS the previous guard.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Merge repeated modifier rules, and require the reset to be a statement

A `.sidebar-row-action.is-*` selector may appear more than once, and the reader
replaced the earlier body with the later one. CSS does not: it keeps an earlier
declaration for any property the later rule does not restate, so a rule setting
`right: 5rem` followed by one setting only `color` still renders at 5rem, while
this recorded the colour rule alone, found no offset, fell back to the base and
passed with the action over the title. The bodies are joined in source order
now. That also means a property genuinely restated across two rules appears
twice, which `_sole_measure` refuses rather than resolves, the same answer it
already gave for a repeat inside one rule.

The new-round reset was checked with a substring, so `if (false)
setOverride(null)` inside the branch satisfied it, as would any nested block,
while a hand-opened block stayed pinned across a regenerate. It has to be a
statement of the branch itself now.

Sabotage, both against a green baseline: the duplicated modifier selector and
the nested reset each PASS the previous guards and each fails only its own test.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Read --spacing from the theme, find the real header, name the override

The reach arithmetic hard-coded 0.25rem per spacing unit while index.css states
it as `--spacing`. The pin's offset and padding are fixed rem and the row's
gutters are pr-N, so the two are only comparable through that number: set
`--spacing: 0.20rem` and `pr-14` buys 2.8rem where the pin still needs 3.5, and
the action overlaps the title while arithmetic done in assumed units says it
does not. It is read now, and more than one value in the file is refused rather
than picked between.

The inline-style check added last round named `<ReasoningHeader>`, and the
header is a plain `<div data-slot="reasoning-header">`, so that half of it
matched nothing and was vacuous from the start. It locates the div by its
data-slot now, and requires one to exist.

The toggle check required the stored value to start with `next.`, which
`setOverride(next.releaseStreamingHeight)` satisfies. Both fields are booleans
so it type-checks, but reopening a hand-closed block whose setting defaults open
wants override true while releaseStreamingHeight is false, and the block stays
shut. It has to be the result's `override`, by name.

Also removed a shadowed `_row_action_paddings` left behind when the readers were
rewritten: 30 dead lines carrying the last hard-coded 0.25 in the file.

Sabotage, three against a green baseline, each failing only its own test:
`--spacing: 0.20rem`, an inline minWidth on the header div, and
`setOverride(next.releaseStreamingHeight)`. All three PASS the previous guards.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Split variants around brackets, refuse style spreads and transforms

Three more ways to render something the arithmetic does not describe.

`_is_min_width` split a class on its last `:` to strip variants, and an
arbitrary value can hold one: `min-w-[length:max-content]` compiles to
`min-width: max-content` and drops an earlier `min-w-0` through tailwind-merge,
while the split left `max-content]` and the reader saw no min-width at all.
Bracketed spans are masked before the split now.

The inline-style check on the trigger and header looked for an explicit `style=`
only. A spread carries one as easily, and written before `className` it leaves
the class list readable, so `{...{ style: { minWidth: "max-content" } }}`
applied the override with every width check green. Both elements now refuse a
top-level spread that could supply a style, by the same attribute-order rule
used elsewhere in these files.

The action reach refused `right-*` positioning and nothing else, but `right` is
not the only thing that moves an action. `-translate-x-20` slides the pin five
rem toward the title without touching its `right`, so the computed reach did not
change. The refusal now covers transforms and the other horizontal routes that
sit outside this model: translate, transform, inset, inset-x, left, and the
end-side margins, negative forms included. The reach is derived from `right` and
`padding-right` alone, and a utility outside that pair renders something this
arithmetic does not describe.

Sabotage, four against a green baseline, each failing only its own test:
the typed arbitrary min-width, the style-bearing spread, `-translate-x-20` and
`mr-20`. All four PASS the previous guards. The min-width one took two attempts:
the first added a second `className` attribute rather than appending to the
existing value, which is not valid JSX and proved nothing.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Measure the working row's spinner, and the element that holds min-w-0

The first of these is about the contract itself rather than a reader, and it is
the more useful of the two.

The row's actions are not the only thing the title has to clear. A working row
also renders a spinner, anchored right and pushed clear of the actions on touch,
which is why it reserves 78px there and not the 64 the pin alone needs; the
product comment beside it says exactly that. The floor was built from the
actions only, so replacing `[@media(pointer:coarse)]:pr-[78px]` with `pr-16`
passed while the spinner sat over the title.

The gutter is now checked against the spinner too, on the renderings that show
it. `_rendered_class_lists` was already tracking which conditions each rendering
needed and discarding them on the way out; it keeps them now, so this asks what
the rendering with `showWorkSpinner` true reserves rather than what some
rendering reserves. The spinner's reach is read the way everything else here is:
its coarse offset off the element carrying it, its width off the glyph inside
it, and a refusal for anything unresolvable.

The inline-style guard covered the ReasoningTrigger call site and the header
div, but the base min-w-0 lives on the `<Trigger>` those render, so a style
there overrode the very class this test reads. That element is in the loop now.

Spreads stay refused on the call site and the header only. The base Trigger
forwards `{...props}` by design, which is how a caller reaches it at all, and
what arrives through it is what the call-site check already adjudicates;
refusing it there failed the shipped component for doing the right thing, which
the first version of this change did.

Sabotage: `pr-16` in place of `pr-[78px]`, and an inline minWidth on the base
Trigger, both PASS the previous guards and each fails only its own test. The
call-site spread case from the last round was re-run and still fails, so
narrowing that check did not give anything back.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Bind the trigger's classes to className, and guard the spinner's position

Both of these are checks already applied elsewhere in these files and not here.

The base composition was located by its first literal, and a literal says
nothing about where it is applied. `data-className={cn(...)}` is valid JSX that
renders none of those classes, so neither the base nor the call site's min-w-0
reached the DOM while every check below went on describing them. The
composition now has to be the value of the trigger's own `className`, and the
suffix…
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…slothai#11433)

* Studio: three-state Thinking and Tool calls visibility in Display

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.

* Studio: one wording for the middle option on both Display dropdowns

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.

* Studio: migrate the tool-activity browser harness to the visibility API

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.

* Studio: let "Expand while running" reach every tool disclosure

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.

* Studio: keep a controlled tool card open once its call is clicked

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.

* Studio: open a running tool card when the setting changes to auto

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.

* Studio: drop a tool card's manual state when its call starts a new round

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.

* Studio: give uncontrolled tool cards the same round boundary

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.

---------

Co-authored-by: Unsloth <[email protected]>
Co-authored-by: wasimysaid <[email protected]>
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…nslothai#11404)

* Read the sidebar and reasoning contracts as claims, not as literals

Three guards fail on main itself, so every open pull request inherits them:

  tests/studio/test_desktop_reliability_frontend_contract.py
    ::test_chat_sidebar_row_actions_visible_on_coarse_pointers
  tests/studio/test_chat_response_details_ui_contract.py
    ::test_response_model_badge_is_user_configurable_and_rendered_once_per_message
    ::test_reasoning_keeps_streaming_height_cap_through_automatic_collapse

Bisected to 35a4b3128 (#11373). Its parent 9ba936a5c passes all three.

#11373 is right and the guards were wrong, in the same way three times: each
pinned a literal that encoded one commit's layout rather than the property it
was defending.

- The coarse-pointer padding was pinned as pr-10. The row gained an action, so
  it is now pr-14 on project rows and pr-16 on recents. Reserving room on a
  touch device is the contract (#7276); the number is not. It now matches any
  [@media(pointer:coarse)]:pr-N.

- That same test bounds its block at the next top-level function. #11373 added
  a nested one, so the block shrank to a signature and a comment and every
  assertion was reading an empty room. It now fails as a stale guard if the
  block comes back too short to be the row.

- min-w-0 flex-1 was pinned as one string on the trigger. The filling moved to
  a new header wrapper and the shrinking stayed on the trigger. Shrinking is
  what stops a long summary widening the row, so the trigger is now matched for
  min-w-0 specifically, and the header for its own.

- The streaming height cap was pinned as
  streaming={isReasoningStreaming || retainStreamingHeight}. The render moved
  down a level: the state lives in the parent and is handed over as a prop,
  and the child ORs it with its own streaming flag. Which component evaluates
  it is layout. That the flag reaches the evaluation, and that it is still
  ORed, is the claim, and both are now asserted separately.

Every assertion was checked by breaking the thing it guards, one at a time,
against a green baseline: removing the coarse padding, unthreading the retained
flag, dropping the OR, removing min-w-0 from the trigger, and removing it from
the header each fail their own assertion and only theirs. The first pass of the
trigger check did not, because min-w-0 appears elsewhere in the file; it is
matched against the ReasoningTrigger element now.

* Check the coarse padding on each row variant, not once for the block

A single search over renderChatSidebarItem is satisfied by the project row on
its own, so recents could lose their coarse-pointer padding and the guard would
stay green. That is the half of #7276 that was actually reported.

Each variant is now read separately: find the class strings that widen that
row's padding on hover, and require one of them to widen it on a coarse pointer
too. Removing only pr-16 fails naming recent-item, removing only pr-14 fails
naming project-chat-item, and my earlier single search passed both.

The absent-row case is its own failure with its own wording, since a variant
that no longer widens on hover means this guard can no longer tell whether the
touch case is covered, which is not the same as the padding being gone.

* Require the coarse gutter to be at least the hover gutter

Matching [@media(pointer:coarse)]:pr-N on any N accepts pr-0. The hover padding
stays pr-14 and pr-16, so the row still looks like it reserves room while the
always-visible touch action sits back over the title, which is the overlap
#7276 was filed for.

There is a number already in the row saying how much room the action needs: the
padding it applies on hover. So the claim is that a coarse pointer gets at
least that, whatever it is, which stays true the next time the row gains an
action and both values move together.

Shrinking recents to pr-1 fails naming (16, 1), shrinking project rows to pr-0
fails naming (14, 0), and removing either one entirely still fails on the
earlier assertion with its own wording.

* Read whole class tokens, and read the element that owns the cap

Two ways the loosened assertions could still be satisfied by something that
does not hold:

min-w-0 was matched with \b, and a colon is a word boundary, so md:min-w-0
satisfied it while the trigger stayed unable to shrink at every width it was
not qualified for. Both the trigger and the header row are now read as class
LISTS and the token has to be there unqualified.

The streaming cap was matched anywhere in the file. ReasoningText is the
element that writes data-streaming and therefore owns the cap, so the same OR
on a sibling read identically and capped nothing. The match is now scoped to
the ReasoningText element.

Each is checked with the mutation it describes: qualifying either utility as
md: fails its own assertion, and moving the OR from ReasoningText onto the
sibling MarkdownTextSource fails the cap assertion and prints the element it
read.

* Read the trigger's effective classes, not the caller's copy

min-w-0 is written twice, in ReasoningTrigger's base classes and again on the
call site. Requiring the call-site copy would have failed a deduplication that
leaves the trigger shrinking exactly as before, which is the literal-layout
check this whole change is meant to stop writing.

Both are read now and either satisfies it. Removing just the call-site copy
passes, removing just the base copy passes, removing both fails and prints what
it read from each, and qualifying both as md: fails as well, since a variant
that only applies above a breakpoint is not the trigger shrinking at every
width.

* Hold every padded element, and read classes without assuming prop order

Two ways the guards could still pass while the thing they defend was gone.

The coarse-padding loop asked for one match among the class lists that widen a
variant's padding on hover. A second padded element therefore vouched for the
row that had lost its gutter: the unprotected list produced (N, None) and was
skipped rather than failing. Every such list is now required to carry a coarse
padding at least as large as its own hover gutter, since each one is an element
making room for the action and each owes the same room on touch.

The class-list reads required className to sit immediately after data-slot, so
inserting a ref, an aria-* or a test id between them would have failed a guard
whose whole purpose is to stop unrelated refactors reddening main. The opening
tag is found first and the attribute read out of it, which is what _class_list
does for both the header and the ReasoningTrigger call site.

Checked with the mutations described: padding a decoy recent-item element while
stripping the real row's coarse gutter now fails and prints the unprotected
class list, inserting aria-busy between data-slot and className keeps the suite
green, and doing both at once fails on the missing min-w-0 rather than on the
attribute order.

* Read the whole opening tag, and let a call-site override lose the guard

_class_list scanned forward from the marker, so a className written BEFORE
data-slot was invisible and the contract failed on an element that was fine.
That is the attribute-order assumption again, one level down. It backs up to
the element's own < now.

The trigger width was a union of base and call-site tokens, which is not what
renders. cn runs tailwind-merge, so a call site passing min-w-full or
min-w-max drops the base min-w-0 and the trigger stops shrinking, while a union
still holds the base token and calls it fine. The tokens are read in cn order
and the LAST min-w-* has to be min-w-0.

Checked four ways: className before data-slot stays green, min-w-full at the
call site fails and prints the utilities in order, min-w-max appended after a
kept min-w-0 fails, and dropping the call-site copy entirely stays green
because the base still carries it.

* Resolve the trigger's min-width per variant

startswith("min-w-") only sees unqualified utilities, so min-w-0 md:min-w-max
read as min-w-0 and passed. tailwind-merge keeps both, because it resolves each
variant separately, and above the md breakpoint the trigger stops shrinking:
the long-summary overflow is back at exactly the widths the override applies
to.

Tokens are grouped by variant now, the last min-w in each group is the
effective one, and every one of them has to be min-w-0. An unqualified group
must also exist, or the base case is unstated and the smallest widths are left
to whatever the element defaults to.

min-w-0 md:min-w-max fails naming {'md': 'min-w-max'}, min-w-0 lg:min-w-full
fails naming {'lg': 'min-w-full'}, and min-w-0 md:min-w-0 stays green.

* Find the real end of a JSX tag, and resolve every class list last-wins

Three more ways these guards could read something other than what renders.

The opening tag ended at the first > character, and an expression prop can
contain one. onClick={() => undefined} before className cut the tag short and
the class list vanished, so a callback added to the header would have failed a
guard that exists to survive exactly that. Only a > outside the JSX expression
braces closes the tag now.

The header was checked for the presence of min-w-0 while the trigger was
resolved per variant. md:min-w-max on the header therefore passed, and above
that breakpoint the overflow is back one level up. Both go through the same
resolution now, and being a flex row is its own assertion with its own message.

The coarse-pointer padding read the FIRST match in a class list. A later
[@media(pointer:coarse)]:pr-0 is what tailwind-merge keeps, so the guard was
reporting a gutter that had already been overridden. Both the hover gutter and
the coarse padding take the last occurrence.

Checked: an arrow-function prop before className keeps the suite green,
md:min-w-max on the header fails naming {'md': 'min-w-max'}, and a trailing
[@media(pointer:coarse)]:pr-0 on recents fails naming (16, 0).

* Read expression classNames, and resolve padding across the whole cn call

Two more places where the guards read something other than what renders.

className={cn(...)} and className={"min-w-max"} are both valid and neither is
a double-quoted attribute, so the reader returned None, the caller fell back on
the base classes, and a call site that overrode min-w-0 passed. The quoted
pieces of an expression are what tailwind-merge sees, so those are read in
order. An expression with no readable piece is now its own failure: absent and
unreadable want opposite treatment, and quietly falling back is what made this
a hole rather than a gap.

The coarse padding was resolved within each quoted string. These rows are one
cn() over many arguments and tailwind-merge keeps the last conflicting value
wherever it was written, so an argument further down carrying only
[@media(pointer:coarse)]:pr-0 overrides the gutter above it and was ignored
because it held no hover utility. Which later arguments apply is decided by the
ternary the two variants sit on: a string naming the other variant is the
branch that did not render, and a string naming neither is unconditional.

Checked: className={"min-w-max"} fails naming {'': 'min-w-max'},
className={cn("min-w-0")} stays green, className={someVar} fails as unreadable
rather than passing on the base, and a standalone
"[@media(pointer:coarse)]:pr-0" argument fails naming (14, 0).

* Refuse conditional class expressions, and scope padding to the row's own cn

Both holes were opened by the widening in the previous commit.

Flattening an expression's quoted pieces reads a conditional wrong. A className
of `wide ? "min-w-max" : "min-w-0"` concatenates to a list ending in min-w-0
and looks fine, while the `wide` branch renders min-w-max and restores the
overflow. Reading each branch separately is a real expression evaluator. Saying
the expression is unreadable is not, and it fails loudly instead of approving a
branch nobody checked.

The padding scan ranged over every quoted literal in renderChatSidebarItem, so
an unrelated element further down could supply the effective gutter for a row
that had lost its own. That is the borrowed-vouching hole again, one level out.
It is bounded to the arguments of the cn() that builds the row now, found by
matching parentheses from the row's own class string.

Checked: a conditional className fails as unreadable, and stripping both real
coarse paddings while adding a later element carrying
[@media(pointer:coarse)]:pr-16 fails naming the project row's unprotected class
list, where before it passed.

* Refuse what the reader cannot evaluate, and pin the streaming operand

Three more places where a value that could be anything was read as a value
that was fine.

The className parse ran to the end of the tag, so quoted strings belonging to
later attributes were collected as classes, and a mixed expression such as
cn("min-w-0", widthClass) resolved to min-w-0 while widthClass could be
min-w-max. It is bounded to the className expression's own brace now, a single
cn() wrapper is stripped, and every argument has to be a plain string literal.
Anything else means the class list is unknown, which is not the same as it
being whatever literals happen to be lying around.

The height cap matched streaming={\w+ || retainStreamingHeight}, and any
identifier satisfied it. An actively streaming block would go uncapped whenever
the retained flag was false, which is most of the time. The left operand has to
be isStreaming, the component's own input.

The padding scan treated every literal inside the row's cn() as unconditional.
A conditional argument applies only when its condition holds, and
showWorkSpinner && "[@media(pointer:coarse)]:pr-16" is absent in exactly the
branch that carries the hover gutter. Only bare string literal arguments may
vouch for a row other than the one they are written in.

Checked: cn("min-w-0", widthClass) fails as unreadable, falseFlag on the left
of the OR fails and prints the element, and the conditional padding argument
fails naming the recents row's unprotected class list.

* Recognise important modifiers, and scan the ReasoningText tag the same way

An important utility is exactly how an override that these guards must catch
would be written, and neither reader saw one. Stripping the marker for
recognition makes !min-w-max and min-w-max! count as the min-width they are,
and the same for a coarse padding written !pr-0. The marker is kept in the
reported value so a failure says which form it found.

The ReasoningText tag was matched with [^>]*, which ends at the first > and an
arrow function in an earlier prop supplies one. That is the same truncation the
class reader already grew a balanced scan for, so this uses one too.

Checked: !min-w-max at the call site fails naming {'': '!min-w-max'}, an
important coarse padding of 0 on recents fails naming (16, 0), and an
arrow-function prop before streaming on ReasoningText keeps the suite green.

* Stop adjudicating tailwind precedence, and refuse what is ambiguous

These two guards had been growing an evaluator: last in cn order, then per
responsive variant, then across cn arguments, then conditional arguments only
in their own branch, then importance beating a later ordinary utility. Every
rule was right and the next one was still missing, because the question is
tailwind-merge plus the cascade and a test file should not hold a second copy
of either. Twenty-three review findings on this branch were that treadmill.

So they no longer decide. The trigger and the header each have to state one
min-width utility, unqualified and unmarked, and it has to be min-w-0. Each
sidebar row has to state one hover gutter and one coarse-pointer padding, both
plain, with the touch padding at least the hover one, and nothing else in the
row's own cn() may add a coarse padding. Duplicates of the same class are still
fine: writing min-w-0 on both the base and the call site is not a conflict.

This is stricter than the framework. min-w-0 md:min-w-0 really does shrink
everywhere and is refused anyway. It is refused LOUDLY, naming what it found
and saying this guard does not adjudicate precedence, which is a message
someone can act on. The failure mode that matters is the other one: quietly
approving a layout nobody checked. Between a guard that is occasionally
inconvenient and one that is occasionally wrong, this picks the first.

Checked: !min-w-max before min-w-0 is refused, md:min-w-0 is refused, an
important coarse padding is refused, a second coarse padding elsewhere in the
row's cn is refused, and the real source passes.

* Read the component's whole composition, and exempt only the sibling's own row

The base classes were the first quoted literal in ReasoningTrigger's cn(). A
second literal appended after className would be effective and invisible, so
the whole call is parsed now: every argument has to be a string literal or the
className prop itself, and anything else means the composition is unknown
rather than fine.

The padding scan exempted any literal containing a variant name, which let
"group/recent-item [@media(pointer:coarse)]:pr-0" through while that zero is
what renders. Only the other variant's own row strings are exempt now,
identified exactly the way this variant's were.

Checked: appending "min-w-max" after className fails naming both utilities,
composing from an unresolved value fails as unreadable, and the named-group
literal carrying pr-0 fails naming itself.

* Check the handoff on the element that receives it, and keep the cn call honest

The retained-height handoff was a file-wide substring test, so the same text on
another element, or in a comment, kept it green while the real ReasoningBody
lost the prop. ReasoningBody is rendered more than once, and the one that
matters is the one holding this state: it receives
isStreaming={isReasoningStreaming}, the flag whose end the retained height
bridges. Every such call now has to hand the flag over.

Commented-out lines are stripped from a tag before it is read. A prop commented
out is a prop that is not passed, and every check here is a substring test, so
leaving the text in place let a disabled prop satisfy the guard whose whole job
is noticing it went away. Only a // that begins a line counts.

The sidebar scan found the nearest PRECEDING cn(, which may already have
closed, and then read another element's arguments as the row's. It now requires
the call it found to still be open at the gutter.

Checked: commenting out the prop fails, moving it to the other ReasoningBody
fails, and both name the tag they read.

* Recognise arbitrary properties as the same property

Tailwind can set min-width as [min-width:max-content] and right padding as
[padding-right:0], and both readers knew only the min-w-N and pr-N spellings,
so a class list containing one read as stating nothing about that property.

Splitting on the last colon breaks on the arbitrary form too, since the value
contains one, so the min-width case is matched before any variant is stripped.

The padding case is refused outright rather than compared: this guard compares
pr-N numbers and cannot say how an arbitrary property interacts with them,
which is the same reason it no longer adjudicates importance or variants.

Checked: [min-width:max-content]! on the trigger and md:[min-width:max-content]
on the header are both refused and named, and
[@media(pointer:coarse)]:[padding-right:0] on the row is refused and named.

* Read whole padding values, and refuse shorthands that move the same edge

pr-16.5 matched as pr-16, so a hover gutter larger than the touch one read as
equal to it and passed. Tailwind 4 takes fractional spacing, so the utilities
are matched whole, with a boundary that stops a prefix counting, and compared
as numbers rather than integers.

px-0, p-0 and pe-0 all move the right edge and all override pr-N through
tailwind-merge, and none of them looked like a pr-N to this guard. A row
carrying one is a row whose touch gutter cannot be read off its pr-N utilities,
so it is refused with that said plainly.

Checked: a coarse px-0 and a coarse p-0 are each refused and named, and a
fractional hover gutter of 16.5 against a touch gutter of 16 now fails as
(16.5, 16.0) where it used to read as equal.

* Bind the row classes to buttonClass, and refuse spreads and arbitrary values

The row's classes were found by searching the whole function for a hover
gutter, so moving both verified pairs into any other cn() call satisfied the
guard while the buttons that render carried no gutter at all. They are read
from `const buttonClass = cn(...)` now, by name, and the guard also checks that
buttonClass is still applied to something.

A spread can carry className and nothing here can say what is in it, so an
element that spreads props is unreadable rather than silent. Silent would send
the caller back to the base classes and let an override through, which is the
same fallback hole as before in a different spelling.

pr-[0px] is an arbitrary VALUE rather than an arbitrary property, so the check
added for [padding-right:0] did not see it while tailwind-merge drops the
numeric gutter for it. Both forms are refused now.

Checked: a spread on the trigger fails as unreadable, moving both row pairs
into a decoy cn() fails on the first variant, and pr-[0px] after the numeric
coarse gutter fails naming itself.

* Refuse identifier values, spreads on the holder, and important arbitrary widths

Three more values that could be anything and were read as fine.

The arbitrary min-width pattern wanted the bracket immediately after the
variant colon, so an important one written md:![min-width:max-content] fell
through to the fallback, which then split at the colon inside the value. The
marker is allowed there now.

buttonClass was scanned for quoted literals, so a class string held in an
identifier was invisible while cn made it effective. Every VALUE position in
its arguments now has to be a literal or undefined; conditions may still be
anything, since a condition cannot become the class string. Comments are
stripped first, because they hold commas and splitting around them turns a
sentence into an unreadable value.

A spread on the ReasoningBody holding this state can supply the same prop and,
written after it, wins. That holder is refused rather than read.

Checked: md:![min-width:max-content] is refused and named, an identifier
argument in buttonClass is refused and named, and a spread after the verified
prop is refused and prints the tag.

* Read the sidebar gutter per branch, and refuse a spread on ReasoningText

Three holes, all reachable without touching the strings these guards read.

The sidebar contract found the verified hover/coarse pair anywhere in
buttonClass, so moving it into "showWorkSpinner ? pair : undefined" left
every ordinary row with no gutter while the scan over literals still found
it. The builder's arguments are now enumerated into the class lists it can
actually produce, tracking each condition's text so that two arguments
branching on the same expression cannot be combined into a state neither
can be in, which is exactly how the real row is written: the touch gutters
sit under "showWorkSpinner ? undefined : pair" and the room for the spinner
case is stated in a separate argument on the same flag. Each rendering that
states a gutter for a variant, through hover, an open menu or keyboard
focus, has to reserve at least that much on a coarse pointer.

That reading takes the last pr-N to win, so the refusals that made it safe
moved from the selected literal to the whole builder: no importance marker,
no p-/px-/pe- shorthand, no arbitrary padding. A bare "!pr-0" argument beat
every coarse gutter below it and carried no coarse marker, so nothing was
looking at it.

ReasoningText took a spread after its streaming prop, which wins in JSX
while the explicit text goes on satisfying the regex. Same treatment as the
ReasoningBody holder above it: refused rather than read.

* Say once why the gutter is checked per variant

The paragraph explaining that a single search over the whole function
would stay green while the recents row lost its padding was pasted
twice.

* Close three ways a gutter check reads a value that does not render

A block comment switches a prop off as well as a line comment does, and it
sits between two attributes rather than on its own line, so the tag reader
now drops it wherever it appears. Commenting out the retained-height handoff
left the contract green with the cap released the moment streaming stopped.

pr-px is a real utility worth one pixel. tailwind-merge drops an earlier pr-
for a later one whatever the later one's value is, so appending it after the
checked gutter replaced that gutter while every check here, all of them
numeric, went on reporting the old number. Any right padding the builder can
contribute now has to be a number this guard can compare.

Zero against zero satisfied the comparison and reserved nothing. The action
has a width whatever the row says about it, so a row claiming no room for it
has stopped claiming rather than been fixed. The gutter's size is still not
pinned, only that there is one.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Read className on an attribute boundary, and || before &&

`className="..."` was matched unanchored, so `data-className="flex min-w-0"`
matched on its suffix and handed back tokens the browser never applies as
the element's rendered classes. Both the literal and the expression form now
require the name to start an attribute.

The branch reader took the last logical operator as the outermost, which is
right within one operator and wrong across two: `a || b && "x"` is
`a || (b && "x")`, not `(a || b) && "x"`. Read the wrong way round, a row
whose cn() receives a bare truthy value and adds no classes at all was
credited with the gutters in that string. Splitting on `||` first gets the
grouping right, and it also puts the identifier in a value position, where
the readability rule refuses it rather than guessing what it holds.

* Anchor the three remaining prop and class reads to attribute boundaries

Same defect as the className reader, at the three sites that were not going
through it. Each was a substring or unanchored search, and each has a
`data-` spelling that satisfies it while the real prop goes unset:

  - `className={buttonClass}` on the sidebar row. Also read past comments
    now, since an assignment surviving only as a comment reads identically
    to a substring search while the button receives no gutter classes.
  - `retainStreamingHeight={retainStreamingHeight}` on the ReasoningBody
    holding the state.
  - `streaming={isStreaming || retainStreamingHeight}` on ReasoningText.

Both reasoning props are optional, so a `data-` prefixed spelling left the
component on its default of false and the streaming height cap gone, with
the tests green.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Check the row button, every branch, and a floor under both gutters

Three ways the sidebar gutter contract could still be satisfied by a row
that reserves nothing.

buttonClass was only required to reach SOMETHING in renderChatSidebarItem.
The row also renders an inline rename input and a pin, so handing the
builder to one of those and leaving the button without it kept the contract
green while every padding class checked below reached nothing the gutters
are measured against. It has to be on a <SidebarMenuButton>, and that tag is
refused if it also spreads props, on the same ground as the other holders.

A rendering that claimed no gutter for a variant was skipped as "not this
variant's row", so making both variants' gutters conditional on one flag
left ordinary rows with no touch padding and nothing checking them. A row is
identified by the gutter it claims, so a row that claims none cannot be
identified, and that is the thing to refuse rather than to skip.

The comparison is relative, so reducing both sides together satisfied it
while reserving nothing usable: pr-0.5 against pr-0.5 passed. One action is
one .sidebar-row-action-glyph, sized in index.css, and the gutter now has to
hold at least one of them. That is a floor and not the whole requirement:
the row's own stated gutter is still what the coarse padding is measured
against, and the floor is read from the stylesheet rather than written here.

* Count the row's actions, and require the trigger to be rendered

The floor under both gutters was one glyph, but a row carries a pin and an
options button. Reducing every gutter to pr-6 reserved 24px for the two of
them and passed, putting the pin back over the title, which is the
regression this contract exists to stop. The floor now counts the row's
labelled actions and multiplies, so it is 12 rather than 6 and tracks the
row if an action is added or removed. Counted by label, so that the two
branches of a per-variant class do not read as two actions while the one
button they dress reads as none.

`_class_list` answers None both for a call site that passes no className and
for one that is not there, and the component's own function can stay behind
unused, so the header could stop rendering ReasoningTrigger entirely while
the checks went on describing base classes that reach nothing. That it is
rendered is now asserted before what it is given is read.

* Strip JSX comments, count actions per variant, and order the spreads

`{/* ... */}` is how a prop is commented out in JSX, and it is the spelling
that would be used, but the stripper only knew `//`. A disabled
`className={buttonClass}` therefore read as a live prop and every padding
check went on describing classes no rendered button receives.

The action count was taken across the whole function and applied to both
rows, but the pin sits inside a per-variant gate while the options button
does not. An action added to one row would have required room on the other
and failed a correct change. Actions are counted per variant now, by reading
which `{variant === "x" && (` gate encloses each button, so adding one to
recents leaves the project floor at 12 and raises only the recent one.

Refusing every spread was too strict, and this direction matters more than
it sounds: JSX applies attributes in order, so `{...props} className="..."`
ends with the explicit one whatever the spread holds. Refusing it would have
failed a safe refactor that forwards unrelated props, which stops correct
work rather than catching anything. Only a spread written AFTER the explicit
attribute is unresolved, and a tag that states the attribute nowhere is
still unknown if it spreads at all. The same ordering now applies to the
ReasoningBody and ReasoningText checks, which had the same overreach.

* Measure how far the actions reach, and order the row button's spreads

Counting the actions assumed they sit side by side. They do not: they are
absolutely positioned and the pin is pushed clear of the options button by
`right: 1.875rem`, so what the row must reserve is how far the furthest one
reaches, not how many there are. At two glyphs the floor was 12 while the
offset action's glyph already ends at 13.5, which let every recent-row
gutter drop from pr-16 to pr-12 and still pass. The floor is now read from
that offset plus the glyph size, per variant, so it follows the stylesheet
rather than a count.

Measured to the far edge of the glyph, not of its container. The container
adds pr-1.5 of its own, and including that puts the project row's reach at
15 against the pr-14 it states. That is a 4px question about the product,
not about this guard, so it is raised on the PR rather than settled here by
reddening main.

The row button rejected every spread, including
`<SidebarMenuButton {...rowProps} className={buttonClass}>`, which is safe:
JSX applies attributes in order, so the explicit class wins whatever the
spread holds. Only a spread after it is unresolved. Same correction as the
reasoning checks got, at the site that had been left behind.

* Refuse a right padding under a qualifier this guard does not read

Being numeric was not enough. The comparison reads three shapes, a bare
pr-N, a coarse-pointer one, and a variant-qualified gutter, and a padding
under any other variant matched none of them, so it was left out of the
answer entirely while still rendering.
`focus:[@media(pointer:coarse)]:pr-0` is the case: effective on a focused
touch row, invisible here, and the row credited with the gutter it no longer
has.

Refused rather than modelled, which is the rule already applied to
importance markers and to arbitrary values. This guard does not adjudicate
what it cannot read, and it says so loudly rather than quietly reporting a
number that does not render.

* Take the comments out before locating anything, not after

Two places were stripping comments too late to matter.

The row builder was located in the raw function text, so an old
`const buttonClass = cn(...)` left inside `/* ... */` sits earlier than the
live one and was the one selected. The gutter analysis then described
classes nothing renders while the carrier check, which did read the stripped
text, saw the live `buttonClass` and agreed with it. Both now run on the
stripped text, and the class slice is taken from it too.

`_class_list` stripped comments from the opening tag AFTER slicing to it,
but a commented-out element still contains its own `<`, so the slice landed
inside `{/* ... */}` and returned the class list of something the page does
not render. The whole source is stripped before the search now, which is
also what makes the rendered-trigger assertion mean anything: it was a
substring test over text that still held the commented call.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Read every claimed state, resolve every action's classes, strip the rest

Four ways the contracts still described something other than what renders.

`max(claimed)` reported the largest gutter a row states, so dropping one
state's gutter to pr-0 left a sibling's 16 answering for it. Each qualified
class names a state in which the action is visible, and in that state the
row reserves exactly that gutter, so every one of them has to meet the
floor. An open menu on a coarse pointer is such a state.

Counting the row's actions skipped any button whose classes it could not
read, which silently lowered the floor while the action still rendered.
Moving the project pin's literal into a differently named constant did
exactly that. The three forms that appear here, a literal, a `cn(...)` over
literals and a local constant holding either, are resolved; anything else is
refused rather than dropped.

`_cn_literals` and the ReasoningBody holder scan were still reading raw
source, so a dead `cn(...)` or a commented-out body sitting before the live
one was what they read. Both go through the same stripper the trigger
lookup already used.

* Read the live text everywhere, and identify an action by where it is

Three more readers were still taking raw text, and I said last round there
were none left, which was wrong.

The ReasoningText lookup, and the two CSS reads behind the floor. A rule
left in a comment above a live one is what a search finds, so the glyph
size and the pin's offset could both be measured from something the page
does not render. The reasoning test now strips once at the top and every
assertion in it reads the live text, rather than each lookup stripping for
itself: they are all claims about what the file DOES, and commented-out
code does nothing, so it is a precondition for all of them rather than a
precaution for some.

Actions were keyed by aria-label, which dropped any that names itself
another way. `aria-labelledby` is the ordinary one, and dropping the offset
pin took the row's reach down to a single glyph while the pin went on
rendering. They are keyed by position now, with the label kept only so the
failure message can name them.

* Measure the glyph through its padding, and fix the row it shows is short

The floor left out the action container's own pr. The container is
justify-end, so the glyph's right edge sits that far inside it and the left
edge is offset + pr + size: 15 spacing units for the offset pin, not 13.5.
I raised this as a 4px question last round rather than decide it, and the
answer is that the padding counts.

With it counted, the project chat row reserves 14 against a pin that reaches
15, so its title really does run under the glyph by 4px. The recent row
already reserves 16 and carries the same two actions with the same geometry,
so the project row now reserves 16 as well. That is a product change, small
and deliberate, and it is what makes the corrected floor true rather than
something the guard is taught to ignore.

`actionClass` is a per-variant ternary, and flattening both branches let one
of them lose `sidebar-row-action` while the other's token kept the button
counted for both rows. Each variant resolves its own branch now, split at
the `:` that pairs with the `?` rather than the first one, since every class
string here is full of colons.

Spread detection matched object spreads inside other props, so
`onClick={() => call({...payload})}` made a readable tag unreadable. Only
spreads at the tag's own attribute level can override an attribute.

* Read the offsets from CSS, and require the caller's classes to arrive

Positioning was reduced to whether the class text said `is-unpin-action`,
so any other action was recorded as flush right and its reach understated.
The modifiers and their right edges are read from index.css now, and an
action positioned by a `right-*` utility or by a modifier the stylesheet
does not define is refused rather than assumed to sit at zero.

A counted action also has to carry `sidebar-touch-reveal`. Dropping it from
the options button left the gutter looking correct while the button was
transparent and inert on a coarse pointer, and the file-wide reveal check
stayed satisfied by either pin.

`_cn_literals` returned the base literals whether or not the composition
included `className`, and the caller's classes are added to the order
afterwards, so a trigger that stopped forwarding kept passing while the call
site's min-w-0 reached nothing. A composition without it is unreadable.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Resolve every class argument, and refuse an offset stated another way

Collecting the quoted literals and ignoring everything else was already
wrong on the current source: the project pin builds its classes with
`cn(literal, REVEAL_WITH_OPEN_MENU_PROJECT_CHAT)`, and that constant was
invisible. A constant supplying `sidebar-row-action`, an `is-*` modifier or
a positioning utility would have skipped the button or understated its
reach with the contract still green.

Every argument resolves now, or the whole class list is unreadable and the
guard says so. Four forms are read, a literal, `cn(...)`, a ternary on the
variant, and an identifier defined as a const in the file, resolved
recursively; anything else is refused.

`_row_action_offsets` recorded zero both for a rule that leaves `right`
alone and for one that states it in a spelling it cannot read, so `30px`, a
`calc(...)` or an `@apply right-*` would have lowered the floor silently.
The two are distinguished now and the second is refused by name.

Both are the shape that keeps recurring here: a reader that quietly drops
what it cannot understand rather than refusing it. These were the last two
places in these files that did that.

* Require the shared row action, and say why the floor stops at the glyph

Two findings on the sidebar coarse-pointer contract, resolved differently.

The first is structural and is fixed. Every assertion about the reserved
gutter is written about a row that renders the shared "Chat options" action,
but nothing checked that it is still there. The per-variant pins alone keep
both action maps non-empty, so removing that button, or letting it lose
`sidebar-row-action`, left the floor and the reserve agreeing with each other
while the action the gutter exists for was gone. `_labelled_actions` now
requires at least one action that sits outside every `variant === "..."` gate.
It is keyed on the gate structure rather than on the English label, because
label-keying was itself a finding here earlier and would break on translation.

Verified by sabotage: swapping the options button's `className={actionClass}`
for a plain class passes the previous guard (37 passed) and fails exactly
`test_chat_sidebar_row_actions_visible_on_coarse_pointers` under this one.

The second is a real observation that I am not turning into an assertion. The
floor measures `offset + pr + glyph` = 15 units, and the action's container
also carries `pl-2`, so its box reaches 17 while both rows reserve `pr-16`.
The two paddings are not alike: the container is justify-end, so `pr` decides
where the glyph sits and belongs in the sum, while `pl` decides nothing about
the glyph and only extends a transparent box further left. #7276 is about the
action sitting over the title, and what sits over the title is the glyph.

The box does overhang by one unit, and `.sidebar-row-action.sidebar-touch-reveal`
is `pointer-events-auto`, so a tap in the last 4px of the title area hits the
pin instead of opening the chat. That is worth fixing, but it is a product
decision affecting the recents row too, which #7276 never touched and which
has shipped this way. Raising a contract test's floor would make that decision
by failing CI rather than by deciding it, so the reasoning and the number are
recorded in the code instead, for whoever changes the rows.

* Read the gutter and the reasoning reset as main now spells them

Merging main in turned this branch red on two contracts, both because a guard
refused a spelling rather than reading it. Neither product change is wrong.

#11408 states the working row's touch gutter as `pr-[78px]`. The sidebar guard
compares `pr-N` in Tailwind spacing units and refused arbitrary values outright,
so a row reserving 19.5 units failed a check about reserving too few. Arbitrary
px and rem gutters are now converted to units and compared like any other, and
only values that resolve against something static analysis cannot see (`%`,
`calc()`, `var()`) are still refused. Verified both ways: `pr-[8px]` is caught
by the floor as too small, and `pr-[50%]` is still refused as unreadable.

#11433 replaced the `manualOpen` / `dismissedWhileStreaming` pair with a single
nullable override, and `test_reasoning_clears_manual_open_on_a_new_stream`
pinned the literal `setManualOpen(false)`, so a deliberate rename read as the
reset having been deleted. The invariant is intact in the new model: a new round
calls `setOverride(null)`. The test now finds the override the way the component
does, through the value `resolveReasoningOpen` is given, derives its setter from
the `useState` that declares it, checks the hand toggle is what writes it, and
then requires the new-round branch to clear it.

Sabotage on that last one found a real bug in the guard rather than confirming
it. `_without_block_comments` strips the braces around a comment together with
the comment, so a branch whose body is only a comment loses its `{}`, and
scanning for the next `{` walked into the visibility-change branch, which also
clears the override. The guard passed while the reset it exists for was gone.
It now requires the brace to be the condition's own and fails if anything
separates them. Both the emptied branch and `setOverride(false)` in place of
`setOverride(null)` now fail, and only this test.

96 tests across the eight suites that read app-sidebar.tsx or reasoning.tsx pass
on the merged tree.

* Resolve each action's own right padding, and drop the product change

The floor was wrong and it drove a product change that was not needed.

`.sidebar-row-action` applies `pr-1.5`, and the reach calculation gave that to
every action. It is not what every action gets: `.sidebar-row-action.is-unpin-action`
overrides it to `padding-right: 0.125rem`, deliberately, to close the gap to the
options button, and index.css says so directly above the rule. The container is
justify-end, so that padding is what decides where the glyph sits. The pin
therefore reaches 7.5 + 0.5 + 6 = 14 units, not 15.

I read that rule earlier for the `right: 1.875rem` offset and quoted the comment
above it without noticing the line below. The consequence was a floor of 15 that
rejected the project row's `pr-14`, which was in fact exactly sufficient, and I
widened the row to `pr-16` to satisfy it. That cost 8px of title space on every
project chat row to fix nothing.

So: `_row_action_paddings` now reads each modifier's own right padding out of
the stylesheet, as a bare rem value or an `@apply pr-N`, and `_labelled_actions`
uses it in place of the base for any action that carries such a modifier. A
modifier that states a padding this cannot read is refused rather than treated
as stating none, and two modifiers both stating one are refused too, since which
applies is a source-order question this does not adjudicate.

The `pr-16` change to app-sidebar.tsx is reverted. This branch no longer touches
any product file: `git diff origin/main` on app-sidebar.tsx is empty, and the
project row is back to the `pr-14` that #7291 shipped.

Sabotage, all three against a green baseline and each failing only this test:
raising the pin's override to 0.5rem takes its reach to 15.5 and the row's
pr-14 fails; stating it as `var(--gap)` is refused as unreadable; deleting the
override drops the pin back to the base 1.5, reach 15, and pr-14 fails again.

109 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. The one remaining failure there is test_sidebar_exposes_queue_activity_for_each_thread,
which is #11456's.

* Compare classes as tokens, and refuse a spread over either streaming prop

Two checks that asked a different question than the thing they guard.

`"sidebar-touch-reveal" in classes` is a substring test, but CSS matches a class
name exactly. A rename or typo to a longer token, `sidebar-touch-reveal-disabled`
being the obvious one, satisfies it while matching no rule: the CSS that reveals
the action still exists, so every other check here stays green, and the button
goes on being transparent and inert on a coarse pointer, which is the whole of
#7276. The same flaw sat on `"sidebar-row-action" not in classes` in the other
direction, where `sidebar-row-action-glyph` would enrol a button no rule
positions. Both are whole-token comparisons now, and the two readers below that
already split reuse the same list.

The streaming-height check refused a holder whose spread could override
`retainStreamingHeight` but said nothing about `isStreaming`. What is kept is
the OR of the two, so a spread replacing the live flag loses just as much:
`{...{ isStreaming: false }}` written between the two attributes leaves the
retained flag untouched and the check green while ReasoningText stops seeing the
stream and renders uncapped until the retained state catches up. `isStreaming`
is also what selects the holders, so a spread over it makes the selection wrong
as well. Both props are checked now.

Sabotage, each against a green baseline: the renamed reveal class and the
interposed spread both PASS the previous guards, and each now fails only its own
test. 110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or
index.css pass.

* Ask the new-round question positively, and refuse a qualified right-*

Two more places where a check passed on something that was not true.

The new-round guard located `startsNewReasoningRound(` and read the block after
it, which says nothing about the sense the question was asked in. Both
inversions read as green: `if (!startsNewReasoningRound(...))` clears the
override on every transition EXCEPT a new round, and
`if (startsNewReasoningRound(...) === false)` does the same, each the exact
inverse of the contract. `if (` now has to sit immediately before the call, and
the only thing allowed between the call and the brace is the paren that closes
the `if`.

The `right-*` refusal matched the bare utility only, so a variant-qualified one
went through. `[@media(pointer:coarse)]:right-40` positions the action on
precisely the path this test is about, and the reach would then have been taken
from the CSS modifier or from zero while the action rendered far into the title
on every touch device. Any token whose utility half is `right-*` is refused now,
under whatever variant.

Sabotage, all three against a green baseline: the negated predicate, the
`=== false` predicate and the qualified `right-40` each PASS the previous
guards, and each now fails only its own test.

A third item in the same review, the base `sidebar-row-action` class being
matched as a substring, was already fixed in 6960f86d2; that review ran against
the head before it. Re-checked here rather than assumed: renaming the shared
button's class to `sidebar-row-action-disabled` fails the contract at this head.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Read the base edge, refuse className spreads, bound the isStreaming match

Three more readers that accepted less than they claimed.

The offset reader scanned only `.sidebar-row-action.is-*` rules and treated an
action with no modifier edge as flush right, without ever reading the base
`.sidebar-row-action` rule. It is `right-0` today, so the answer was right by
luck. Change the base to `right-8` and every action slides eight units into the
title while the floors, all measured from an assumed zero, do not move and the
contract stays green. The base edge is read now, a spelling this cannot read is
refused rather than assumed, and it is the fallback for any modifier that states
no edge of its own.

`_button_classes` looked for `className=` and returned "" when it found none, so
an action whose className arrives through a JSX spread was read as carrying no
classes and skipped as not being a row action at all. The reach calculation then
lost it entirely while the shared options button kept every later assertion
satisfied, which is why the empty result was invisible. A top-level spread is
now unreadable by attribute order: with no explicit className any spread may be
supplying it, and with one, only a spread written after it can override, since
JSX applies attributes left to right. The className search is on an attribute
boundary too.

The streaming holders were selected by substring, so
`data-isStreaming={isReasoningStreaming}` still matched. The tag stayed a holder
while ReasoningBody received no isStreaming at all, and every assertion below it
went on passing with the live stream uncapped. Matched on an attribute boundary
now, the same way the retained flag already was.

Sabotage, each against a green baseline: the base rule moved to `right-8`, the
`data-` prefixed prop, and the pin supplied as
`{...{ className: "sidebar-row-action sidebar-touch-reveal right-40" }}` all
PASS the previous guards, and each now fails only its own test. The first
sabotage I wrote for the spread case put it on the options button instead, which
the previous guard already caught through the shared-action assertion, so it
proved nothing; the pin is the case the reader was blind to.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Take the last CSS value, not the first, and refuse a className lookalike

Three readers that reported the first answer they found where CSS renders the
last, or read a miss as an absence.

`.sidebar-row-action-glyph` and the base `.sidebar-row-action` rule were each
read with a lazy `[^}]*?` search for the first `size-N` and `pr-N`. CSS resolves
a repeated declaration to the last, so appending `@apply size-20` or
`@apply pr-20` to either rule changes what renders while every floor here goes
on being measured from the value above it. Both now collect every value the rule
states and refuse anything but a single readable one, rather than picking a
winner: which one applies also depends on specificity and on where Tailwind
emits the utility, and this guard models neither.

Reading the rule at all was a second bug in the same place. `[^}]*` stops at the
first `}`, and `.sidebar-row-action` has a nested `.sidebar-touch-reveal` rule,
so the old form took in part of that nested rule while cutting the outer one
short. `_own_declarations` brace-matches the rule and drops anything nested
inside it.

The className boundary added in e9e20834c was right to decline
`data-className={cn(...)}`, but returning "" for it said the button carried no
classes, and `_labelled_actions` then skipped it as not a row action. Renaming
the pin's attribute that way made it disappear from the reach calculation while
it went on rendering with none of the classes that position or reveal it, and
the shared options button kept every later assertion satisfied. A suffixed
lookalike is refused now instead of read as an absence.

Sabotage, each against a green baseline: `data-className` on the pin, a later
`size-20` on the glyph, and a later `pr-20` on the base rule all PASS the
previous guards, and each now fails only this test.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Finish the CSS sweep, and read what outranks the utilities

Seven findings, three of them the sweep I should have done last round.

Last round I put the base glyph and base padding readers on a whole-rule read
that collects every declaration, and left the three others on first-match:
the base right edge, the modifier paddings and the modifier offsets. All three
were the same bug, and a later `right: 5rem`, `padding-right: 5rem` or
`@apply pr-20` in any of those rules renders while the reader reports the value
above it. They now share one path: `_modifier_rules` brace-matches each rule,
`_sole_measure` collects every value it states and refuses two readable ones
rather than picking a winner, and a modifier that states nothing falls back to
the base rule, which is what CSS does.

That path also fixed a bug of its own: the property search was `\bright:`, and
the boundary matches inside `padding-right:`, so the two measures could read
each other. It is `(?<![\w-])` now.

Three more where something outranks the utilities being compared and nothing
looked at it. An inline style beats every Tailwind class:
`style={{ paddingRight: 0 }}` on the row carrier puts the touch actions back
over the title, and `style={{ minWidth: "max-content" }}` on ReasoningTrigger
lets a long summary widen the row, both with every assertion green because only
the class strings were read. Both are refused now. And the open toggle was only
required to CALL the override setter, so `setOverride(null)` in the handler
passed while no hand toggle was ever remembered, which makes the new-round reset
below it guard nothing; it now has to store the answer resolveReasoningToggle
returned.

Last, `_without_block_comments` left line comments searchable, so a stale
`// <ReasoningBody isStreaming={...} retainStreamingHeight={...}>` above the
render is what `_opening_tags` finds while the live body has lost both props.
It strips both kinds now, keeping `https://` out of it.

Sabotage on all seven against a green baseline, each failing only its own test.
The line-comment one took two attempts: the first edit replaced the text inside
the comment it had just inserted, so it proved the opposite of what I wanted.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Refuse shorthands that contain the edge, and inline styles on the actions

Two more ways to set the edge this guard measures without it noticing.

A shorthand overrides the longhand it contains, and only the longhand was read.
`padding: 0 5rem` in the base action rule beats the parsed `pr-1.5`, and
`inset: 0 5rem auto auto` on a modifier beats its `right`, both with the reach
computed from values that no longer render. `_sole_measure` now refuses a rule
that states either, along with the Tailwind spellings of the same thing,
`@apply p-20` and `@apply px-20`, since `@apply` is the same declaration written
another way. Refused rather than parsed: a shorthand's right component depends
on how many values it carries, and this guard does not model that.

The base padding read was going straight to `_stated_units` and so bypassed
that refusal entirely. It goes through `_sole_measure` now, which is what let
the first version of this fix still pass `padding: 0 5rem`.

Inline styles on the row actions themselves were not checked. The carrier was
already refused one, for exactly this reason, and the actions were not:
`style={{ right: "5rem" }}` or `style={{ paddingRight: "5rem" }}` on an action
outranks every class and CSS rule the reach is derived from, so the permanently
visible touch action can sit over the title with the contract green.

Sabotage, six cases against a green baseline, each failing only this test:
`padding: 0 5rem`, `@apply p-20` and `@apply px-20` in the base rule, `inset`
on the pin modifier, and inline `right` and `paddingRight` on an action. All six
PASS the previous guard.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Merge repeated modifier rules, and require the reset to be a statement

A `.sidebar-row-action.is-*` selector may appear more than once, and the reader
replaced the earlier body with the later one. CSS does not: it keeps an earlier
declaration for any property the later rule does not restate, so a rule setting
`right: 5rem` followed by one setting only `color` still renders at 5rem, while
this recorded the colour rule alone, found no offset, fell back to the base and
passed with the action over the title. The bodies are joined in source order
now. That also means a property genuinely restated across two rules appears
twice, which `_sole_measure` refuses rather than resolves, the same answer it
already gave for a repeat inside one rule.

The new-round reset was checked with a substring, so `if (false)
setOverride(null)` inside the branch satisfied it, as would any nested block,
while a hand-opened block stayed pinned across a regenerate. It has to be a
statement of the branch itself now.

Sabotage, both against a green baseline: the duplicated modifier selector and
the nested reset each PASS the previous guards and each fails only its own test.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Read --spacing from the theme, find the real header, name the override

The reach arithmetic hard-coded 0.25rem per spacing unit while index.css states
it as `--spacing`. The pin's offset and padding are fixed rem and the row's
gutters are pr-N, so the two are only comparable through that number: set
`--spacing: 0.20rem` and `pr-14` buys 2.8rem where the pin still needs 3.5, and
the action overlaps the title while arithmetic done in assumed units says it
does not. It is read now, and more than one value in the file is refused rather
than picked between.

The inline-style check added last round named `<ReasoningHeader>`, and the
header is a plain `<div data-slot="reasoning-header">`, so that half of it
matched nothing and was vacuous from the start. It locates the div by its
data-slot now, and requires one to exist.

The toggle check required the stored value to start with `next.`, which
`setOverride(next.releaseStreamingHeight)` satisfies. Both fields are booleans
so it type-checks, but reopening a hand-closed block whose setting defaults open
wants override true while releaseStreamingHeight is false, and the block stays
shut. It has to be the result's `override`, by name.

Also removed a shadowed `_row_action_paddings` left behind when the readers were
rewritten: 30 dead lines carrying the last hard-coded 0.25 in the file.

Sabotage, three against a green baseline, each failing only its own test:
`--spacing: 0.20rem`, an inline minWidth on the header div, and
`setOverride(next.releaseStreamingHeight)`. All three PASS the previous guards.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Split variants around brackets, refuse style spreads and transforms

Three more ways to render something the arithmetic does not describe.

`_is_min_width` split a class on its last `:` to strip variants, and an
arbitrary value can hold one: `min-w-[length:max-content]` compiles to
`min-width: max-content` and drops an earlier `min-w-0` through tailwind-merge,
while the split left `max-content]` and the reader saw no min-width at all.
Bracketed spans are masked before the split now.

The inline-style check on the trigger and header looked for an explicit `style=`
only. A spread carries one as easily, and written before `className` it leaves
the class list readable, so `{...{ style: { minWidth: "max-content" } }}`
applied the override with every width check green. Both elements now refuse a
top-level spread that could supply a style, by the same attribute-order rule
used elsewhere in these files.

The action reach refused `right-*` positioning and nothing else, but `right` is
not the only thing that moves an action. `-translate-x-20` slides the pin five
rem toward the title without touching its `right`, so the computed reach did not
change. The refusal now covers transforms and the other horizontal routes that
sit outside this model: translate, transform, inset, inset-x, left, and the
end-side margins, negative forms included. The reach is derived from `right` and
`padding-right` alone, and a utility outside that pair renders something this
arithmetic does not describe.

Sabotage, four against a green baseline, each failing only its own test:
the typed arbitrary min-width, the style-bearing spread, `-translate-x-20` and
`mr-20`. All four PASS the previous guards. The min-width one took two attempts:
the first added a second `className` attribute rather than appending to the
existing value, which is not valid JSX and proved nothing.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Measure the working row's spinner, and the element that holds min-w-0

The first of these is about the contract itself rather than a reader, and it is
the more useful of the two.

The row's actions are not the only thing the title has to clear. A working row
also renders a spinner, anchored right and pushed clear of the actions on touch,
which is why it reserves 78px there and not the 64 the pin alone needs; the
product comment beside it says exactly that. The floor was built from the
actions only, so replacing `[@media(pointer:coarse)]:pr-[78px]` with `pr-16`
passed while the spinner sat over the title.

The gutter is now checked against the spinner too, on the renderings that show
it. `_rendered_class_lists` was already tracking which conditions each rendering
needed and discarding them on the way out; it keeps them now, so this asks what
the rendering with `showWorkSpinner` true reserves rather than what some
rendering reserves. The spinner's reach is read the way everything else here is:
its coarse offset off the element carrying it, its width off the glyph inside
it, and a refusal for anything unresolvable.

The inline-style guard covered the ReasoningTrigger call site and the header
div, but the base min-w-0 lives on the `<Trigger>` those render, so a style
there overrode the very class this test reads. That element is in the loop now.

Spreads stay refused on the call site and the header only. The base Trigger
forwards `{...props}` by design, which is how a caller reaches it at all, and
what arrives through it is what the call-site check already adjudicates;
refusing it there failed the shipped component for doing the right thing, which
the first version of this change did.

Sabotage: `pr-16` in place of `pr-[78px]`, and an inline minWidth on the base
Trigger, both PASS the previous guards and each fails only its own test. The
call-site spread case from the last round was re-run and still fails, so
narrowing that check did not give anything back.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.

* Bind the trigger's classes to className, and guard the spinner's position

Both of these are checks already applied elsewhere in these files and not here.

The base composition was located by its first literal, and a literal says
nothing about where it is applied. `data-className={cn(...)}` is valid JSX that
renders none of those classes, so neither the base nor the call site's min-w-0
reached the DOM while every check below went on describing them. The
composition now has to be the value of the trigger's own `className`, and the
suffix…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants