Repository navigation
Studio: drag sidebar rows into place, and make a project row do more - #11373
Conversation
Reordering the sidebar was two menu items, Move up and Move down, one slot per click. They are gone. Every chat and project row drags now, in Recents, in Pinned, and inside a project, with an insertion line showing where the row will land. A chat can be dragged onto a project to file it there, or into Pinned to pin it exactly where it is dropped. The drag source is held outside React state. A dragover can fire in the same frame as its dragstart, before the state commits, so the first gesture after picking a row up was read as a drag of nothing and refused. That is what made rows feel undraggable. Also here: - Manual order and the other sorts say what they do in the sort menu, and dropping a row in a sorted list switches that list to Manual rather than dropping the row back where it was. - A folder in Pinned is reachable from anywhere in its block of chats, instead of from its own row alone. - The project Edit dialog groups the source folders into one card with per-folder rows and an Add folder row. - The Projects page reveals a project's chats inline and pins or unpins in one click. - A chat row renames on double click, marks unread from its own menu, and shows its pin on hover. - Pin project and Pin chat are both just Pin, and a section's chevron appears on hovering anywhere in the section. - Chat rows use a plain message bubble without the dots inside it. - The reasoning header reads "Worked for 2m 5s" instead of "Thought for 125 seconds".
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…aders Mark as unread only ever added the dot: on a row that already carried one the item was disabled, so there was no way to take it off again. It is now one item that goes the way the row is not, Mark as read or Mark as unread, in the row menu and in the selection menu. Both carry an eye, open once the row is read and crossed out while it is not. Projects and Recents also carried the same pair of header actions in opposite orders. Both now put their own action first, new project or new chat, with the menu after it.
Every sidebar drop now goes through planSidebarDrop in lib/sidebar-drag.ts: the row being carried plus the spot under the pointer gives what the drop does, what to paint, and the effects to run. The four interleaved branches in the sidebar's row handlers are gone, and use-sidebar-drag.ts owns the native events, the lifted row and the cue. New drops: a folder dragged into Pinned is pinned in the slot it lands on, and back into Projects is unpinned there. A pinned chat dragged out is unpinned. Section headers take drops while collapsed, and a closed folder or section opens under a resting pointer. Pinned shows itself to a drag that could pin even while empty, so a first pin has somewhere to land. A hint beside the cursor says what the drop will do: Pin, Unpin, Reorder, Move to a folder, or Move to Recents. Three preferences in the Organize menu: show the hint, whether reordering a sorted list switches it to Manual order, and whether folders open while hovering. The document-level listener that moves the hint and clears a stale cue needs every dragover, so zones mark the event they answered instead of stopping propagation. Tests: sidebar-row-drag.test.ts now covers the planner directly.
|
Pushed 87429f2, which reworks the drag-and-drop on this branch. What changed since the last commit:
Verified in a fresh install with three projects and nine chats: chat to folder, folder chat to Recents, pin at a slot, pin via the section and via the collapsed header, folder pin and unpin at a slot, pinned folder reorder across a chat block, unpin a chat, reorder with the Manual switch toast, refusal with the switch off, spring open, and alt + arrow reorder. Tests 8073 pass, i18n parity passes, lint unchanged from baseline. The PR description is updated to match. |
|
@codex review |
…eader Pinned no longer appears while a chat or folder is dragged. It is on screen only when it has rows, as before. The ring drawn around a folder or section is now inset. A ring sits outside its box otherwise, and the first row's box ends exactly where the section's collapsible clips, so the top edge was cut off. The gap between a section header and its first row read as dead space: the pointer left the row, the cue went, and dropping above the first row felt impossible. The header now stands for the top of its first row for a drag of the same kind, so a folder dragged over the Projects header lands above the first folder, and a chat over the Recents header lands above the first chat. A chat over the Projects header still does nothing.
|
Follow-up in the latest commit, from trying it in the browser:
Tests still 8073 passing, i18n parity and lint unchanged. |
|
@codex review |
|
Two of the reds here are stale rather than anything in this branch.
The rest are this branch's own: |
…lothai#11386) A pull_request run does not test the branch head. It tests refs/pull/N/merge, a merge of the branch into the base as the base stood when the run was created. GitHub does not rebuild that ref because the base later moved, and a re-run replays the same merge commit, so a fix that lands on main after a run starts stays invisible to that run until someone pushes to the branch. That cost real time today. unslothai#11372 gave three test files encoding = "utf-8" and merged at 14:35 UTC. Runs created at 13:39, 14:26 and 14:29 on unslothai#11375, unslothai#11357 and unslothai#11373 all went on failing tests/test_source_read_encoding.py on exactly those three lines, and all three were first read as defects in branches that had never touched the files. Adds .github/actions/merge-ref-age, which asks the compare endpoint how far the base branch has moved since this run's merge ref was built and prints a notice if the answer is not zero. It is wired into the two studio-backend-ci.yml jobs that run pytest, gated on failure(), so a green job never pays for it and it stays quiet when the base has not moved. It is advisory and cannot fail a job. A stale merge ref does not make a failure untrue: the merge really does fail. Deciding otherwise for the reader would be worse than the confusion it is fixing, so the script never exits non-zero and never emits ::error::. tests/studio/test_merge_ref_age_is_reported.py keeps both properties: every job in that workflow running pytest carries the step under failure(), and the action's script cannot fail the job it sits in. Each assertion was checked by reverting it individually against a green baseline. The repo's own test_workflow_guards_run_unfiltered caught the new guard missing from the unfiltered job, so it is registered in workflow-trigger-lint.yml too.
|
The drag planner in features/chat/lib/sidebar-drag.ts is the right shape and the tests around it read well, but this branch also carries the Project Edit dialog rewrite, the Projects page rows, linked-folders-manager and the reasoning header wording. Could you split those out so the sidebar drag change can land on its own, and note whether the coarse-pointer row-actions contract still holds once rows are draggable? |
- A pinned chat dropped into a folder or Recents is unpinned only after the move has gone through. A failed move used to leave it unpinned in place. - Touch browsers start no native drag, so their row menus keep Move up and Move down. Both paths share one reorder and the same sort rule. - Projects page: a comparison's two threads are one row that opens on the compare route; a project's chat list reloads when chat history changes; Enter or Space on the chevron or pin button no longer opens the project. - Edit project: Ctrl or Cmd + Enter in the name field saved twice.
|
Addressed the review comments in cdb4abd, each checked against the code and the running app:
Tests 8074 passing, i18n parity and lint unchanged. @codex review |
…load overtook The Projects page reloaded every open project's chats on every chat history event, and a streaming chat fires one per chunk. It now reloads once per quiet window, in place, with the rows kept on screen. Each project's load carries a sequence number, so a slow response that a later load overtook is discarded instead of putting a moved or deleted chat back.
|
Both points from the last round were right and are fixed in the latest commit:
Tests 8074 passing, lint and i18n unchanged. @codex review |
|
Both points were right and are fixed in the latest commit, each checked in the running app:
|
|
@codex review |
… move lands The slot a dropped chat takes in its new list was written from the order snapshot taken at the drop, so a move slow enough to be overtaken by a reorder of that list wrote the snapshot over the newer order. The landing now carries its target row too, and once the move lands the chat is placed against that row in the list as it stands, keeping the reorder. An untouched list still takes the snapshot.
|
Right, and fixed in the latest commit. The slot a dropped chat took in its new list was written from the order snapshot taken at the drop, so a move slow enough to be overtaken by a reorder of that list wrote the snapshot over the newer order. The landing now carries its target row as well, and once the move lands the chat is placed against that row in the list as it stands, so the reorder survives. An untouched list still takes the snapshot. Checked with the move request delayed by 1.5 seconds: a chat dropped above the first chat of a folder, the folder's other chat lifted above that first chat while the move ran, and the folder ended as lifted chat, dropped chat, first chat. The same drop with nothing touched meanwhile wrote the snapshot as before. |
|
@codex review |
…ock (#11377) * Studio: a setting that folds a turn's tool calls into its Thinking block A turn that calls tools hundreds of times fills the thread with rows nobody reads. Settings, Chat, "Fold tool calls into Thinking" hides them: the round's Thinking header is all that is left, and it says how many calls it is holding. Open the header and they are all there. Off by default, so the thread looks exactly as it does today until the setting is turned on. Each Thinking block owns the run of tool calls that follows it, and a message with several rounds folds each one separately. The parts are grouped by type, so the calls render beside the block rather than inside it; the block publishes its open state in a layout effect and the calls read it before the frame is painted, so nothing flashes on screen. Never folded away: a call awaiting an allow or deny, and the calls that hold their own output (canvases, Python, anything that wrote a file), which is the same carve-out the collapse preference already makes. Tool calls with no Thinking before them, or after the answer has started, have no block to fold under and stay where they are. A folded run is hidden, not unmounted, so its cards keep their state and any output still streaming into them. * Studio: one Thinking block per turn, tool calls and later thinking inside it With "Fold tool calls into Thinking" on, a turn with several rounds still showed a header per round, so a long tool loop was a column of "Worked for" lines. Now the first Thinking block of a turn heads everything before the answer. Collapsed, the turn is one line that says how long it worked and how many calls it holds. Open it and the thoughts, the tool calls and the later thinking are all there, in order. Later reasoning groups in that span render as plain rounds inside the lead and follow its open state, the same way the tool groups do. The lead stays active through them, so its clock and its shimmer cover the whole run-up rather than the first round only. Tool calls after the answer, calls with no thinking before them, calls awaiting an approval and calls that hold their own output stay where they are, as before. The block itself is now a plain header line with no icon or box, a shimmer while it works, and the thoughts in body text under it. Every part in a reply, text, thinking, tool groups and single tool rows, sits on the same 16px rhythm, owned by the message body instead of by each part. The header label no longer clips its descenders. * Studio: fold review fixes, the header, the copy and the rounds it holds Five things the fold got wrong once a turn had more than the plain case in it. The header counted every call in the span, including runs the thread keeps visible: canvases, Python, calls that wrote files, calls awaiting an approval. A closed block could say "2 tool calls" over two cards sitting right under it. The rule for what stays visible now lives in one place, tool-fold-exemptions.ts, and both the tool group and the header ask it, so the count only names calls that are hidden. The count vanished while the block was still working, which is exactly when a closed block hides the most. It sits outside the label now, so "Thinking" and "Worked for" both carry it. A run that gained or lost an exemption switched between the hidden wrapper and the bare group, and React remounted its cards. The wrapper now stays for as long as the run is under a block, and an exemption only changes whether it is visible. Copy on the lead stopped at the lead's own parts, though the later rounds shown under the same header have no Copy of their own. It now reaches to the end of the folded span. A later round rendered its raw children, so a long one lost the paging that protects a long trace. Paging and the body that renders it are one hook and one component now, used by the lead and by every folded round. * Studio: keep generated images out of the fold An image_generation call has no image part of its own: the picture, its preview and its Edit and Download controls live only in the tool card. Folding that card under a closed Thinking block took the turn's result with it. It now counts as holding its own output, like canvases, Python and calls that wrote files, so it stays where it is. * Studio: keep results that carry images out of the fold An MCP tool can answer with text and images, and the fallback card is the only place those images are shown. Folding that card under a closed Thinking block hid the previews. A result in that shape now counts as holding its own output, next to canvases, Python, generated images and calls that wrote files. * Studio: a folded turn keeps the round durations it does know A reply saved before per-round timing has only the last round's duration. The folded total gave up as soon as one round was unknown, so after a reload the single header said "Worked for 0s" where the old last-round header used to show the real number. Unknown rounds are now left out of the sum instead of zeroing it, and the total is undefined only when no round is known at all. * Studio: a steady header, a rule before the answer, lighter thoughts Opening a block pushed its label down by a few pixels: the Copy button's wrapper was an inline span in the flex header, so it took the paragraph line-height and grew the row. It is a flex item now and the row stays 20px either way. When the answer follows the trace directly, a thin rule now closes the trace, so the two do not read as one text. It goes on whatever is last under the header, the block itself, a folded round or a folded tool run, and hides with it. The thoughts sit at three quarters of the text colour, a shade lighter than the answer, so the eye can tell them apart without the rule. * Studio: opening a block by hand grows it downward, the header stays put At the bottom of a thread the viewport follows content growth, so opening a Thinking block counted as new content and the bottom stayed pinned: the trace took the screen and the header slid up out of view. A click that opens a block, a tool group or a tool card now detaches from the bottom first, the way scrolling up does, so the block grows downward under a header that does not move. Scrolling back down re-attaches as before. A stream still follows, since its auto-open is not a click. * Studio: room between tool rows, and the thoughts back in body colour Rows under a tool group header sat 4px apart, tighter than anything else in a reply. They sit 12px apart now, with the same 12px above the first row, and a card's own content sits 8px under its row. The thoughts go back to the answer's colour: the rule at the end of the trace already separates the two. * Studio: a fold is a span, ended only by answer text with something in it Two shapes slipped past the fold. A provider can leave a newline between a closed think block and its tool call, and that whitespace arrives as a text part; the fold read it as the answer starting and left the calls outside. Continue seeds the new message with the previous reply as a leading text part; the fold saw an answer before any thinking and never started. The fold now works in spans: a run of thinking, tool calls and blank text, led by its first reasoning group, ended only by text with something to read. A message can hold several spans, each folded under its own lead, so a continuation's new round folds like a fresh one and a reply with two answers folds twice. The rule that closes a trace skips trailing blank text and never sits on a blank part. --------- Co-authored-by: Unsloth <[email protected]>
…est drop A chat's row stays on screen while its move is written, so it could be dropped into a second folder before the first move landed. Both moves ran at once and each wrote its slot and pin on its own, so the earlier drop could land after the later one, or park its order in a folder the chat never finally joined. Moves of one chat now run one after another, and only the latest drop commits its slot and pin.
|
Right, and fixed in the latest commit. A chat's row stays on screen while its move is written, so it could be dropped into a second folder before the first move landed. Both moves ran at once and each wrote its slot and pin on its own, so the earlier drop could land after the later one, or leave its order in a folder the chat never finally joined. Moves of one chat now run one after another, and only the latest drop commits its slot and pin. Checked with the move request delayed by 1.5 seconds: a chat dropped into one folder and, before that landed, into a second. The second request started only after the first finished, the chat ended in the second folder at its slot, and the first folder's manual order was untouched. |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Heads up: this one left three things red on main, and I have fixed two of them. The third needs your hand because it is a harness that has to grow a message context, and I cannot run that leg here. Fixed already
Still red, and yours to judge With the label fix in, that job gets one driver further and hits a second break:
so the page throws on mount and never publishes I did not want to rewrite that harness blind, since the four disclosure scenes it measures are the point of it and I have no browser here to check I kept them. It was invisible until now because the job died at the label timeout first. |
) Chat UI Tests (extra) fails on main. The driver waits 30s and then times out on waiting for get_by_role("button", name="Thought for 0 seconds", exact=True) because 35a4b31 (unslothai#11373) reworded the trigger from 'Thought for N seconds' to 'Worked for ...'. The button is present the whole time; only the copy moved. Four unrelated pull requests are red on this right now, including one that only touches backend test helpers, so it reads as their fault rather than main's. The component guarantees data-slot="reasoning-trigger" on the clickable element; the label is product copy and will move again. The driver now locates the slot. This one cannot be run here: the leg needs a Studio install and a browser, so CI on this pull request is the check.
…unslothai#11416) * Narrow the drag planner's outcome before reading a plan off it Frontend CI has been failing typecheck on main since planSidebarDrop started answering STAY. Its return type is SidebarDropPlan | STAY | null, and the test read .action, .cue and .effects straight off that, which is 61 errors in one file and a red Frontend CI on every open pull request. assert.ok only rules out null, so a plannedDrop helper rules out both and returns the plan. Asserting rather than casting is the point: where a test expects a plan and the planner answers STAY, it now fails saying so, instead of reading a property off a string somewhere further on. Two inline dereferences that used ?. are wrapped the same way, and the asserts that only checked for null are gone where the helper already covers them. Test-only. tsc -b and tsc -p tsconfig.test.json are both clean, and the frontend suite is 8165 passed, 0 failed. * Give the tool-activity harness the provider its components now need ToolGroupRoot started reading message.status through useAuiState in unslothai#11373. useAuiState throws outside an AuiProvider, and the harness page renders those primitives on their own, so it died before publishing __probeReady and the Tool activity collapse regression job has failed on main ever since. The page has no runtime and no message, and "no message is running" is the scene it wants, so it provides the two things useAuiState actually uses: a subscribe for useSyncExternalStore and the symbol-keyed state its selector reads. Anything else a component reaches for still throws, which is the right outcome for a harness: faking a whole client would hide the next dependency like this one. Verified in chromium against the dev server, with the page loaded both ways: without this change __probeReady undefined, page error "You are using a component or hook that requires an AuiProvider" with it no page errors, 14 probe elements, __probeReady published The sibling collapse-layout harness does not render a tool group and was already clean; it was checked the same way.
…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…
…lothai#11386) A pull_request run does not test the branch head. It tests refs/pull/N/merge, a merge of the branch into the base as the base stood when the run was created. GitHub does not rebuild that ref because the base later moved, and a re-run replays the same merge commit, so a fix that lands on main after a run starts stays invisible to that run until someone pushes to the branch. That cost real time today. unslothai#11372 gave three test files encoding = "utf-8" and merged at 14:35 UTC. Runs created at 13:39, 14:26 and 14:29 on unslothai#11375, unslothai#11357 and unslothai#11373 all went on failing tests/test_source_read_encoding.py on exactly those three lines, and all three were first read as defects in branches that had never touched the files. Adds .github/actions/merge-ref-age, which asks the compare endpoint how far the base branch has moved since this run's merge ref was built and prints a notice if the answer is not zero. It is wired into the two studio-backend-ci.yml jobs that run pytest, gated on failure(), so a green job never pays for it and it stays quiet when the base has not moved. It is advisory and cannot fail a job. A stale merge ref does not make a failure untrue: the merge really does fail. Deciding otherwise for the reader would be worse than the confusion it is fixing, so the script never exits non-zero and never emits ::error::. tests/studio/test_merge_ref_age_is_reported.py keeps both properties: every job in that workflow running pytest carries the step under failure(), and the action's script cannot fail the job it sits in. Each assertion was checked by reverting it individually against a green baseline. The repo's own test_workflow_guards_run_unfiltered caught the new guard missing from the unfiltered job, so it is registered in workflow-trigger-lint.yml too.
…nslothai#11373) * Studio: drag sidebar rows into place, and make a project row do more Reordering the sidebar was two menu items, Move up and Move down, one slot per click. They are gone. Every chat and project row drags now, in Recents, in Pinned, and inside a project, with an insertion line showing where the row will land. A chat can be dragged onto a project to file it there, or into Pinned to pin it exactly where it is dropped. The drag source is held outside React state. A dragover can fire in the same frame as its dragstart, before the state commits, so the first gesture after picking a row up was read as a drag of nothing and refused. That is what made rows feel undraggable. Also here: - Manual order and the other sorts say what they do in the sort menu, and dropping a row in a sorted list switches that list to Manual rather than dropping the row back where it was. - A folder in Pinned is reachable from anywhere in its block of chats, instead of from its own row alone. - The project Edit dialog groups the source folders into one card with per-folder rows and an Add folder row. - The Projects page reveals a project's chats inline and pins or unpins in one click. - A chat row renames on double click, marks unread from its own menu, and shows its pin on hover. - Pin project and Pin chat are both just Pin, and a section's chevron appears on hovering anywhere in the section. - Chat rows use a plain message bubble without the dots inside it. - The reasoning header reads "Worked for 2m 5s" instead of "Thought for 125 seconds". * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: one read-or-unread item, and the same action order in both headers Mark as unread only ever added the dot: on a row that already carried one the item was disabled, so there was no way to take it off again. It is now one item that goes the way the row is not, Mark as read or Mark as unread, in the row menu and in the selection menu. Both carry an eye, open once the row is read and crossed out while it is not. Projects and Recents also carried the same pair of header actions in opposite orders. Both now put their own action first, new project or new chat, with the menu after it. * Studio: one planner for every sidebar drop, and Pinned takes folders too Every sidebar drop now goes through planSidebarDrop in lib/sidebar-drag.ts: the row being carried plus the spot under the pointer gives what the drop does, what to paint, and the effects to run. The four interleaved branches in the sidebar's row handlers are gone, and use-sidebar-drag.ts owns the native events, the lifted row and the cue. New drops: a folder dragged into Pinned is pinned in the slot it lands on, and back into Projects is unpinned there. A pinned chat dragged out is unpinned. Section headers take drops while collapsed, and a closed folder or section opens under a resting pointer. Pinned shows itself to a drag that could pin even while empty, so a first pin has somewhere to land. A hint beside the cursor says what the drop will do: Pin, Unpin, Reorder, Move to a folder, or Move to Recents. Three preferences in the Organize menu: show the hint, whether reordering a sorted list switches it to Manual order, and whether folders open while hovering. The document-level listener that moves the hint and clears a stale cue needs every dragover, so zones mark the event they answered instead of stopping propagation. Tests: sidebar-row-drag.test.ts now covers the planner directly. * Studio: keep Pinned out of a drag, and reach the first row from its header Pinned no longer appears while a chat or folder is dragged. It is on screen only when it has rows, as before. The ring drawn around a folder or section is now inset. A ring sits outside its box otherwise, and the first row's box ends exactly where the section's collapsible clips, so the top edge was cut off. The gap between a section header and its first row read as dead space: the pointer left the row, the cue went, and dropping above the first row felt impossible. The header now stands for the top of its first row for a drag of the same kind, so a folder dragged over the Projects header lands above the first folder, and a chat over the Recents header lands above the first chat. A chat over the Projects header still does nothing. * Studio: review fixes for the sidebar drag and the project rows - A pinned chat dropped into a folder or Recents is unpinned only after the move has gone through. A failed move used to leave it unpinned in place. - Touch browsers start no native drag, so their row menus keep Move up and Move down. Both paths share one reorder and the same sort rule. - Projects page: a comparison's two threads are one row that opens on the compare route; a project's chat list reloads when chat history changes; Enter or Space on the chevron or pin button no longer opens the project. - Edit project: Ctrl or Cmd + Enter in the name field saved twice. * Studio: debounce the project chat reload, and drop responses a newer load overtook The Projects page reloaded every open project's chats on every chat history event, and a streaming chat fires one per chunk. It now reloads once per quiet window, in place, with the rows kept on screen. Each project's load carries a sequence number, so a slow response that a later load overtook is discarded instead of putting a moved or deleted chat back. * Studio: a closed project's pending chat load cannot refill its cache The history refresh dropped a closed project's cached chats but left its in-flight load alone, so that load could land afterwards and the reopened row would keep the stale list. The refresh now advances every closed project's sequence, and the late answer is dropped. * Studio: a failed project chat load says so and retries A load that failed was cached as an empty list, so the row read "No chats" and reopening it never asked again. A failed first load now shows "Could not load chats. Retry", reopening the row loads again, and a failed reload keeps the rows already on screen. * Studio: project chat loads retry from the right state, and touch means any touch Closing a project row after a failed load started a request the reopen then waited on; only opening a row loads now. A silent reload that overtook a pending first load and failed left the row on its skeleton with nothing to retry; it now becomes the retryable error unless rows are already showing. The Move up and Move down fallback keyed off the primary pointer, so a laptop with a touchscreen and a trackpad lost it. It keys off any-pointer. * Studio: Pinned is one list, and a drop draws a line where the row lands Pinned kept folders first and chats after, in two orders, and a drop at the very top of it lit the whole section instead of showing where the row would go. Pinned is one interleaved list now. Every drop in it draws a single line, at the top included, and folders and chats land in the order they were dropped. Filing a chat into a pinned folder still works from the folder's chats or the lower half of its row. * Studio: a row over its own slot paints nothing instead of aiming at the last slot Lifting a row a little kept the pointer over the row itself, which had no answer, so the section body answered with its last slot and the line jumped to the bottom of the list at once. A row over its own slot, or an edge it already sits on, now claims the drag and paints nothing, and a drop there does nothing. * Studio: the gap between sidebar rows belongs to the row above it The menu keeps a 1px gap between rows. A pointer resting on it hit the section instead, whose only answer is its last slot, so the line jumped to the bottom of the list mid drag. Each draggable row's box now reaches over the gap below it, and a folder block's own rows (Show more, an empty folder) aim below that folder rather than at the last slot. * Studio: keep the Projects nav row put when a page borrows its section The row steps aside into More while the Projects section lists the folders, and comes back when that section is gone. It read that off whether the section was on screen, and Train, Recipes and Export list their runs where the folders go. Walking to Train pinned the row back to the top, which reads as a row the user had put away turning itself on, and walking back turned it off again. It now reads the setting behind the section, whether the sidebar is set up to list folders at all, so a route that borrows the section leaves the row where it was. The icon rail still keeps the row, since it hides the section without unmounting it and the row is the only way to reach projects there. * Studio: Pinned chords, folder moves and empty folder reloads follow the rows The chords walked Pinned as folder chats then top-level chats, which no longer matches a list where a chat can sit between folders; they now walk the rows as drawn. A pinned folder moved with alt + arrow or the touch menu carried no sort, so a Pinned list on Priority or Last updated wrote an order it never showed; it now switches to Manual or refuses, as a drop does. On the Projects page an empty folder whose reload failed kept saying No chats; it now offers Retry, since the reload may have been for its first chat. * Studio: a moved chat takes its slot after the move, and a stale folder says so A chat dropped into a folder or Recents had its slot written into that list's manual order before the move ran, so a failed move parked the chat in a list it never reached. The slot now waits for the move, as the pin already did. On the Projects page a folder whose reload failed kept its rows without a word and never asked again; it now says Could not refresh chats with Retry, and its next open asks again with the rows staying on screen. * Studio: a moved chat takes its slot in the list as it stands when the move lands The slot a dropped chat takes in its new list was written from the order snapshot taken at the drop, so a move slow enough to be overtaken by a reorder of that list wrote the snapshot over the newer order. The landing now carries its target row too, and once the move lands the chat is placed against that row in the list as it stands, keeping the reorder. An untouched list still takes the snapshot. * Studio: a setting that folds a turn's tool calls into its Thinking block (unslothai#11377) * Studio: a setting that folds a turn's tool calls into its Thinking block A turn that calls tools hundreds of times fills the thread with rows nobody reads. Settings, Chat, "Fold tool calls into Thinking" hides them: the round's Thinking header is all that is left, and it says how many calls it is holding. Open the header and they are all there. Off by default, so the thread looks exactly as it does today until the setting is turned on. Each Thinking block owns the run of tool calls that follows it, and a message with several rounds folds each one separately. The parts are grouped by type, so the calls render beside the block rather than inside it; the block publishes its open state in a layout effect and the calls read it before the frame is painted, so nothing flashes on screen. Never folded away: a call awaiting an allow or deny, and the calls that hold their own output (canvases, Python, anything that wrote a file), which is the same carve-out the collapse preference already makes. Tool calls with no Thinking before them, or after the answer has started, have no block to fold under and stay where they are. A folded run is hidden, not unmounted, so its cards keep their state and any output still streaming into them. * Studio: one Thinking block per turn, tool calls and later thinking inside it With "Fold tool calls into Thinking" on, a turn with several rounds still showed a header per round, so a long tool loop was a column of "Worked for" lines. Now the first Thinking block of a turn heads everything before the answer. Collapsed, the turn is one line that says how long it worked and how many calls it holds. Open it and the thoughts, the tool calls and the later thinking are all there, in order. Later reasoning groups in that span render as plain rounds inside the lead and follow its open state, the same way the tool groups do. The lead stays active through them, so its clock and its shimmer cover the whole run-up rather than the first round only. Tool calls after the answer, calls with no thinking before them, calls awaiting an approval and calls that hold their own output stay where they are, as before. The block itself is now a plain header line with no icon or box, a shimmer while it works, and the thoughts in body text under it. Every part in a reply, text, thinking, tool groups and single tool rows, sits on the same 16px rhythm, owned by the message body instead of by each part. The header label no longer clips its descenders. * Studio: fold review fixes, the header, the copy and the rounds it holds Five things the fold got wrong once a turn had more than the plain case in it. The header counted every call in the span, including runs the thread keeps visible: canvases, Python, calls that wrote files, calls awaiting an approval. A closed block could say "2 tool calls" over two cards sitting right under it. The rule for what stays visible now lives in one place, tool-fold-exemptions.ts, and both the tool group and the header ask it, so the count only names calls that are hidden. The count vanished while the block was still working, which is exactly when a closed block hides the most. It sits outside the label now, so "Thinking" and "Worked for" both carry it. A run that gained or lost an exemption switched between the hidden wrapper and the bare group, and React remounted its cards. The wrapper now stays for as long as the run is under a block, and an exemption only changes whether it is visible. Copy on the lead stopped at the lead's own parts, though the later rounds shown under the same header have no Copy of their own. It now reaches to the end of the folded span. A later round rendered its raw children, so a long one lost the paging that protects a long trace. Paging and the body that renders it are one hook and one component now, used by the lead and by every folded round. * Studio: keep generated images out of the fold An image_generation call has no image part of its own: the picture, its preview and its Edit and Download controls live only in the tool card. Folding that card under a closed Thinking block took the turn's result with it. It now counts as holding its own output, like canvases, Python and calls that wrote files, so it stays where it is. * Studio: keep results that carry images out of the fold An MCP tool can answer with text and images, and the fallback card is the only place those images are shown. Folding that card under a closed Thinking block hid the previews. A result in that shape now counts as holding its own output, next to canvases, Python, generated images and calls that wrote files. * Studio: a folded turn keeps the round durations it does know A reply saved before per-round timing has only the last round's duration. The folded total gave up as soon as one round was unknown, so after a reload the single header said "Worked for 0s" where the old last-round header used to show the real number. Unknown rounds are now left out of the sum instead of zeroing it, and the total is undefined only when no round is known at all. * Studio: a steady header, a rule before the answer, lighter thoughts Opening a block pushed its label down by a few pixels: the Copy button's wrapper was an inline span in the flex header, so it took the paragraph line-height and grew the row. It is a flex item now and the row stays 20px either way. When the answer follows the trace directly, a thin rule now closes the trace, so the two do not read as one text. It goes on whatever is last under the header, the block itself, a folded round or a folded tool run, and hides with it. The thoughts sit at three quarters of the text colour, a shade lighter than the answer, so the eye can tell them apart without the rule. * Studio: opening a block by hand grows it downward, the header stays put At the bottom of a thread the viewport follows content growth, so opening a Thinking block counted as new content and the bottom stayed pinned: the trace took the screen and the header slid up out of view. A click that opens a block, a tool group or a tool card now detaches from the bottom first, the way scrolling up does, so the block grows downward under a header that does not move. Scrolling back down re-attaches as before. A stream still follows, since its auto-open is not a click. * Studio: room between tool rows, and the thoughts back in body colour Rows under a tool group header sat 4px apart, tighter than anything else in a reply. They sit 12px apart now, with the same 12px above the first row, and a card's own content sits 8px under its row. The thoughts go back to the answer's colour: the rule at the end of the trace already separates the two. * Studio: a fold is a span, ended only by answer text with something in it Two shapes slipped past the fold. A provider can leave a newline between a closed think block and its tool call, and that whitespace arrives as a text part; the fold read it as the answer starting and left the calls outside. Continue seeds the new message with the previous reply as a leading text part; the fold saw an answer before any thinking and never started. The fold now works in spans: a run of thinking, tool calls and blank text, led by its first reasoning group, ended only by text with something to read. A message can hold several spans, each folded under its own lead, so a continuation's new round folds like a fresh one and a reply with two answers folds twice. The rule that closes a trace skips trailing blank text and never sits on a blank part. --------- Co-authored-by: Unsloth <[email protected]> * Studio: a chat dropped again before its move lands keeps only the latest drop A chat's row stays on screen while its move is written, so it could be dropped into a second folder before the first move landed. Both moves ran at once and each wrote its slot and pin on its own, so the earlier drop could land after the later one, or park its order in a folder the chat never finally joined. Moves of one chat now run one after another, and only the latest drop commits its slot and pin. --------- Co-authored-by: Unsloth <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
) Chat UI Tests (extra) fails on main. The driver waits 30s and then times out on waiting for get_by_role("button", name="Thought for 0 seconds", exact=True) because 35a4b31 (unslothai#11373) reworded the trigger from 'Thought for N seconds' to 'Worked for ...'. The button is present the whole time; only the copy moved. Four unrelated pull requests are red on this right now, including one that only touches backend test helpers, so it reads as their fault rather than main's. The component guarantees data-slot="reasoning-trigger" on the clickable element; the label is product copy and will move again. The driver now locates the slot. This one cannot be run here: the leg needs a Studio install and a browser, so CI on this pull request is the check.
…unslothai#11416) * Narrow the drag planner's outcome before reading a plan off it Frontend CI has been failing typecheck on main since planSidebarDrop started answering STAY. Its return type is SidebarDropPlan | STAY | null, and the test read .action, .cue and .effects straight off that, which is 61 errors in one file and a red Frontend CI on every open pull request. assert.ok only rules out null, so a plannedDrop helper rules out both and returns the plan. Asserting rather than casting is the point: where a test expects a plan and the planner answers STAY, it now fails saying so, instead of reading a property off a string somewhere further on. Two inline dereferences that used ?. are wrapped the same way, and the asserts that only checked for null are gone where the helper already covers them. Test-only. tsc -b and tsc -p tsconfig.test.json are both clean, and the frontend suite is 8165 passed, 0 failed. * Give the tool-activity harness the provider its components now need ToolGroupRoot started reading message.status through useAuiState in unslothai#11373. useAuiState throws outside an AuiProvider, and the harness page renders those primitives on their own, so it died before publishing __probeReady and the Tool activity collapse regression job has failed on main ever since. The page has no runtime and no message, and "no message is running" is the scene it wants, so it provides the two things useAuiState actually uses: a subscribe for useSyncExternalStore and the symbol-keyed state its selector reads. Anything else a component reaches for still throws, which is the right outcome for a harness: faking a whole client would hide the next dependency like this one. Verified in chromium against the dev server, with the page loaded both ways: without this change __probeReady undefined, page error "You are using a component or hook that requires an AuiProvider" with it no page errors, 14 probe elements, __probeReady published The sibling collapse-layout harness does not render a tool group and was already clean; it was checked the same way.
…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…
What this changes
Reordering the sidebar was two menu items, Move up and Move down, one slot per click. Every chat and project row drags now, in Recents, in Pinned and inside a project, with an insertion line showing where the row will land. The menu items stay only on touch screens, where the browser never starts a native drag; alt + arrow reorders from the keyboard.
Dragging also moves a row between lists:
A small hint follows the cursor and says what the drop will do: Pin, Unpin, Reorder, Move to a folder, or Move to Recents. Folder and section targets get a ring and tint; rows get a line on the landing edge.
How a drop is decided
Every drop goes through one planner,
planSidebarDropinlib/sidebar-drag.ts. It takes the row being carried and the spot under the pointer and returns what the drop does, what to paint, and a flat list of effects (orders to write, pins to toggle, a chat to move, a sort to switch). The hover cue, the hint and the drop itself all read the same answer, and the planner is pure, so it is unit tested directly.hooks/use-sidebar-drag.tsowns the native drag events, the lifted row and the cue. Every row, folder block, section body and section header describes itself as a drop zone and asks the planner.The bug behind "I can't drag anything"
The row being dragged was kept in React state. A
dragovercan fire in the same frame as thedragstartthat started it, before that state commits, so the first gesture after picking a row up read the dragged row asnulland refused the drop. Rows felt dead until the pointer left and came back.It now lives in
sidebar-drag-source.ts, a small module outside React, written ondragstartand read synchronously by every handler. The state is kept alongside it only to repaint the row.Two more found on the way: a document-level listener moves the hint and clears a stale cue, and it needs every
dragover, so zones mark the event they answered instead of stopping propagation. And the hint's position was written back by React on each re-render while it sat in an inline style, so it is set through a ref only.The ring around a folder or section is drawn inset. A ring sits outside its box otherwise, and the first row's box ends where the section's collapsible clips, so its top edge was cut off.
Sorting and preferences
Pinned is one list
Pinned used to keep folders first and chats after, in two separate orders. It is one list now: folders and chats sit in the order they were dropped, so a chat can go above a pinned folder and a folder can go last. Every drop in Pinned draws a single line where the row will land, at the very top included; nothing in Pinned lights the whole section any more.
A pinned project's chats sit between it and the next row, so a folder's whole block is one target: how far down it the pointer is decides which end of the folder the drop lands on, and the line flips once, in the middle. A chat over the lower half of a pinned folder, or over its chats, is filed into it, which is the only ring left in Pinned.
The insertion line is drawn inside the row rather than around it, because the collapsible content clips its overflow and the line on the first row was being cut in half.
Read and unread
Mark as unread only ever added the dot: on a row that already carried one the item was disabled, so there was no way to take it off again. It is now one item that goes the way the row is not, Mark as read or Mark as unread, in the row menu and in the selection menu. Both carry an eye, open once the row is read and crossed out while it is not.
Section headers
Projects and Recents carried the same pair of header actions in opposite orders. Both now put their own action first, new project or new chat, with the menu after it.
Project Edit dialog
The source folders were a settings panel, with its own heading, blurb and button, dropped into the dialog. They are now one card of folder rows with an Add folder row at the bottom, the name and instructions sit above it, and Cmd or Ctrl + Enter saves.
Projects page
A project row now reveals its chats inline through a chevron, and pins or unpins in one click instead of through the menu. Clicking a revealed chat opens it; a comparison is one row and opens as one. The list reloads when chat history changes.
Smaller things
Tests
npm run testpasses 8073.sidebar-row-drag.test.tsnow covers the planner directly: reorders, sorted-list switching and refusal, filing into folders with and without a slot, pinning chats and folders at a slot or last, unpinning both, the folder block rule, and the wiring of every row and section. Plussidebar-row-actions.test.ts,edit-project-dialog.test.tsandprojects-page-rows.test.ts, and unit tests forinsertIdAt,placeIdAt,dropEdgeAtandfolderDropTarget.npm run i18n:checkpasses across all 12 locales. Lint is unchanged from the baseline on every file touched.