Skip to content

Add project pinning, Projects list view, and project chat-session fixes - #7291

Merged
shimmyshimmer merged 21 commits into
mainfrom
projects-sidebar-pins
Jul 22, 2026
Merged

shimmyshimmer merged 21 commits into
mainfrom
projects-sidebar-pins

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

What

Turns Studio projects into first-class, pinnable items, reworks the Projects page into a list, and fixes several chat-session and dialog bugs in projects.

Project pinning

  • New per-project pin, mirroring how chats pin. Pin or unpin from the Projects page row menu or from the sidebar.
  • Pinned projects fold into the existing Pinned section (no separate heading), the same way ChatGPT groups pins. Pinned projects show a folder icon; pinned chats show a chat icon.
  • Each pinned project reveals its recent chats nested below: the 4 most recent, with "Show more" to reveal the rest. Clicking the project row expands or collapses its chats. Show more/less uses a lighter, slightly smaller label in both light and dark mode.
  • Each pinned project has a new-chat button and an options menu (Project home, New chat, Rename project, Unpin project, Delete project), reusing the existing rename and delete dialogs.

Projects page

  • The card grid is now a list with Name and Modified columns. Pinned rows show a pin indicator; the row options menu appears on hover.
  • Default view shows the 4 most recent projects with a Show more toggle. Search still spans all projects.
  • Row menu keeps Pin, Rename, Import chats, Export, and Delete.

Project chats in the sidebar

  • Chats nested under a pinned project use the same row as any other chat, so they get the full options menu (Rename, Pin, Move to project, Export, Archive, Delete) plus a hover pin quick-action.
  • Pinning a chat inside a project promotes it into the pinned chats list and removes it from the project's nested list, so it appears once and is never hidden by the recent-chats cap.
  • The sidebar highlights only the open chat, not its parent project folder, while a chat inside the project is active.
  • Rename project uses the edit icon so it no longer matches the New chat icon.

Chat-session and dialog fixes

  • The project landing composer no longer queues prompts. Queuing a new chat there misbound the thread, so the queue (including the queue button and saved-prompt Run list) now runs only once you are inside a chat session.
  • Starting a new chat inside a project no longer reuses the previous chat. Project new-chat navigation now rotates the thread nonce so each new chat is its own session.
  • Thread nonces fall back off crypto.randomUUID for non-secure (HTTP LAN) contexts where it is undefined.
  • The delete-files toggle resets when a project delete dialog opens, so a later delete never inherits it. The rename dialog seeds its draft from the project name.
  • Deleting a project while viewing one of its chats through a thread-only URL now redirects to a fresh chat instead of leaving the user on a deleted thread.

How

  • New pinned-projects-store (localStorage, same shape as the pinned-chats store), exported from the chat feature index.
  • The sidebar Pinned section renders pinned projects and their nested chats, then pinned chats, styled to match the existing nav pills (height, roundness, icon and font size).
  • Project chat actions reuse the shared archive, delete, move, and export helpers, so behavior matches the sidebar.

Notes

  • No backend or hardware paths change. This is frontend only.
  • Pin state is per user in localStorage; behavior is unchanged when nothing is pinned.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a client-side pinned projects feature, allowing users to pin projects to a new "Projects" section in the sidebar, manage project-level actions, and perform chat-level operations like moving chats between projects and exporting them. Feedback on these changes highlights three key issues: first, the disableQueue prop is not handled at the control level, which allows the queue button to render and bypass submission checks; second, using crypto.randomUUID() directly can crash the application in non-secure HTTP contexts, requiring a safe fallback; and third, limiting the projects page default view to only four items completely hides older projects due to a lack of pagination or a 'Show more' toggle.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +1743 to +1746
if (disableQueue) {
toast.error("Wait for the current response to finish");
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

When disableQueue is true, the canQueueCurrentPrompt helper (defined outside this diff) still evaluates to true. This causes ComposerRightControls to render the 'Queue message' button instead of the 'Cancel' button. When clicked, the 'Queue message' button directly triggers startPromptQueue, completely bypassing this handleSubmit check. Please ensure queuing is disabled at the control level when disableQueue is active.

Comment on lines +1121 to +1123
if (pendingNewThreadId) {
setNewThreadNonce(crypto.randomUUID());
setPendingNewThreadId(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using crypto.randomUUID() directly can crash the application in non-secure contexts (such as self-hosting over HTTP on a local network), where crypto.randomUUID is undefined. Consider using a safe fallback similar to the createNavigationNonce helper used elsewhere in the codebase.

Suggested change
if (pendingNewThreadId) {
setNewThreadNonce(crypto.randomUUID());
setPendingNewThreadId(null);
if (pendingNewThreadId) {
setNewThreadNonce(typeof crypto?.randomUUID === "function" ? crypto.randomUUID() : Date.now() + "-" + Math.random().toString(36).slice(2, 10));
setPendingNewThreadId(null);
}

);
return filtered;
// Default view shows only the 4 most recent; search still spans all matches.
return trimmed ? filtered : filtered.slice(0, 4);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

By slicing the default view to only the 4 most recent projects (filtered.slice(0, 4)), any additional projects are completely hidden from the user on this page unless they perform a search. Since there is currently no 'Show more' button or pagination controls implemented on the grid, this creates an accessibility issue where older projects are orphaned. Consider adding a 'Show more' toggle state or removing the slice until pagination is supported.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0d76635b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1488 to +1494
onSelect={() =>
setRenamingTarget({
kind: "project",
project,
current: project.name,
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Initialize project rename draft

When this pinned-project action opens the rename dialog, it never seeds renameDraft with project.name. The dialog input is controlled by the shared renameDraft state, so after any previous chat/run rename it can open with stale text (or blank) and Save can apply that stale value to the project; set the draft before setting the project rename target.

Useful? React with 👍 / 👎.

Comment on lines +1506 to +1508
onSelect={() =>
setConfirmingDelete({ kind: "project", project })
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset file-delete toggle before project deletes

Opening another project delete from this new menu can inherit deleteProjectFiles from the previous dialog, because commitDelete closes by clearing only confirmingDelete and does not reset the switch state. If a user deletes one project with “Delete files and sandbox folder” enabled, the next pinned project delete dialog opens pre-checked and will pass deleteFiles: true unless they notice; clear the toggle when opening or after confirming.

Useful? React with 👍 / 👎.

Comment on lines 1740 to +1745
if (threadIsRunning || promptQueueActive) {
event.preventDefault();
// Project new-chat composer: never queue, just ask the user to wait.
if (disableQueue) {
toast.error("Wait for the current response to finish");
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disable the queue button for project new chats

This guard only covers form submission, but when the project landing composer is shown while the current thread or prompt queue is running, the visible arrow is the direct Queue button and its onQueueClick path still calls startPromptQueue without checking disableQueue. Clicking that button can still queue a prompt from the project landing and hit the misbound-thread case this change is meant to prevent; include disableQueue in the queue button's disabled/click path as well.

Useful? React with 👍 / 👎.

…log state resets

- Project new-chat composer now shows Stop instead of Queue while running, and the queue click is guarded so a disabled queue cannot enqueue.
- Replace crypto.randomUUID with a helper that falls back on non-secure (HTTP LAN) contexts where it is undefined.
- Projects page keeps all projects reachable: the grid caps at four with a Show more/Show less toggle instead of hiding the rest.
- Reset the rename draft and the delete-files checkbox so a project dialog never opens with stale state.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 523befb552

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<SidebarMenuButton
isActive={activeThreadId === chat.id}
onClick={() =>
navigate({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Close the drawer after nested chat navigation

On mobile, selecting a chat nested under a pinned project navigates to the thread but never calls closeMobileIfOpen(), unlike the other sidebar navigation handlers. In that context the drawer remains open over the newly opened chat until the user dismisses it manually, so this new navigation path should close the mobile sidebar after navigate.

Useful? React with 👍 / 👎.

</DropdownMenu>
</SidebarMenuItem>
{expanded &&
visibleChats.map((chat) => (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Avoid duplicating chats pinned inside pinned projects

When a project is pinned and one of its chats is also pinned, this nested visibleChats render includes that chat under the project, and the later pinnedChatItems.map(...) renders the same pinned chat again in the same Pinned section. In that specific state users see duplicate entries for one chat; filter either the project child list or the top-level pinned-chat list for chats already shown under pinned projects.

Useful? React with 👍 / 👎.

<ComposerAnimated
disabled={disabled}
placeholder={placeholder}
disableQueue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Block saved-prompt queues on project landing

Passing disableQueue here only disables the submit and queue-button paths; the composer still provides startQueue to PromptStorageDialog, whose Run-list action calls it directly. When a user runs a saved prompt list from the project landing composer before a chat thread is bound, the prompts are still queued against that unbound project composer, recreating the misbound-thread behavior this change is meant to prevent; gate startQueue or the saved-prompt Run-list path when disableQueue is true.

Useful? React with 👍 / 👎.

<DropdownMenuItem
variant="destructive"
onSelect={() =>
setConfirmingDelete({ kind: "project", project })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset file-deletion toggle when opening delete

This new project delete entry opens the shared delete dialog without clearing deleteProjectFiles. If a user previously toggled “Delete files and sandbox folder” and canceled, the next pinned-project delete dialog opens with that destructive option still enabled, so confirming can remove the workspace folder unintentionally; reset the switch before or when setting the project delete target, not only after successful confirmation.

Useful? React with 👍 / 👎.

aria-label="New chat"
onClick={(e) => {
e.stopPropagation();
openNewChat(project.id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Rotate project drafts for same-page new chat

When this new-chat control is used while already on the same project landing page with text in the composer, openNewChat(project.id) navigates to the same { project } search and setActiveThreadId(null) is a no-op, so ProjectLanding never rotates newThreadNonce and the in-memory composer keeps the old draft despite clearNewChatDraft(). Include a fresh signal for project new-chat navigation, or explicitly clear/rotate the landing composer, so the action actually opens a blank chat in this scenario.

Useful? React with 👍 / 👎.

shimmyshimmer added 2 commits July 21, 2026 06:10
… saved-prompt queue, reset delete toggle

- Pinned chats that live inside a pinned project now render only nested under the project, not a second time in the flat pinned list.
- Opening a chat nested under a pinned project closes the mobile drawer, matching the other sidebar nav handlers.
- The saved-prompt Run-list path now honours disableQueue, so running a prompt list from the project new-chat composer cannot queue against an unbound thread.
- Reset the delete-files toggle when opening a project delete, since the Cancel button closes the dialog programmatically and skips the onOpenChange reset.
…ick-action

- Chats nested under a pinned project now render through the shared chat row, so they get the same hover kebab (Rename, Pin, Move, Export, Archive, Delete) plus a pin/unpin quick-action, matching top-level chats.
- Show more/less now uses the muted nav token with an override, since the sidebar-nav-btn color rule otherwise won so the label matched the chat rows; it now reads clearly dimmer in both light and dark mode.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e02c80987

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1458 to +1460
const visibleChats =
expanded && !showAll
? projectChats.slice(0, PINNED_PROJECT_CHAT_LIMIT)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep pinned project chats outside the recent-chat cap

When a project is pinned and one of its older chats is also pinned, this recent-only slice can omit that pinned chat from the nested list; since pinnedChatItems now filters out every chat whose projectId is pinned, that pinned chat disappears from the Pinned section until the user expands Show more. In that scenario pinning a chat no longer surfaces it, so include pinned children in visibleChats (or only filter top-level pinned chats that are actually rendered under the project).

Useful? React with 👍 / 👎.

// Cancel closes programmatically and skips the
// dialog onOpenChange reset.
setDeleteProjectFiles(false);
setConfirmingDelete({ kind: "project", project });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle thread-only URLs when deleting projects

When this new pinned-project delete is used while viewing a project chat through a thread-only URL (which ChatPage supports by resolving the project from the thread), commitDelete will not navigate away because activeProjectId is derived only from search.project. The project deletion removes the active thread, but the user remains on /chat?thread=... with the deleted thread because the missing-thread check is not re-run on the history update; compare the deleted project's id against the resolved active project/thread as well before deciding whether to redirect.

Useful? React with 👍 / 👎.

shimmyshimmer added 2 commits July 21, 2026 15:09
- Pinning a chat inside a project now promotes it into the pinned chats list and removes it from the project's nested list, so it shows once in the Pinned section.
- Sidebar highlights only the open chat, not its parent project folder, while a chat inside the project is active.
- Rename project uses the edit icon instead of the compose icon so it no longer matches New chat.
- Projects page is now a list: Name and Modified columns, a pin indicator on pinned rows, and the row options menu on hover, replacing the card grid.
commitDelete only redirected when the ?project= param matched the deleted
project. On a thread-only URL the project is resolved from the thread into the
runtime store, so also compare that resolved id, otherwise the user is left on
a deleted thread.
@shimmyshimmer shimmyshimmer changed the title Add project pinning, full project chat menu, and project new-chat fixes Add project pinning, Projects list view, and project chat-session fixes Jul 21, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 38714da034

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Pinned rows in Recents already reserved room for it, but only the kebab
rendered. Show the unpin button on hover, left of the options button.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70676df24f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// Cancel closes programmatically and skips the
// dialog onOpenChange reset.
setDeleteProjectFiles(false);
setConfirmingDelete({ kind: "project", project });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Refresh pinned child chats after project deletes

When this new pinned-project delete path removes a project that contains chats pinned via the new project chat menus, deleteChatProject only emits the projects update while the backend cascades the chat rows, so useChatSidebarItems keeps stale allChatItems. After the project row disappears, those deleted child chats can still render as top-level pinned chats until another history refresh or reload; invalidate chat history or clear child pins after deleting the project.

Useful? React with 👍 / 👎.

</div>
)}
<AlertDialog
open={confirmingDelete !== null}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Hide project delete dialog off-route

If a user opens this newly added project-landing delete confirmation and then navigates to another app section before answering, ChatPage remains mounted with active=false, but AlertDialog is body-portaled and its open state is not gated by route activity. The confirmation can stay over /projects or /studio and still delete a chat from the hidden project page; gate it on useChatActive()/active or clear confirmingDelete when the chat route deactivates.

Useful? React with 👍 / 👎.

shimmyshimmer added 5 commits July 21, 2026 15:45
- Add side padding to the list and more room after the folder icon.
- Column header now shares the row layout so Name and Modified line up with the values.
- Pin indicator and options button swap by display so they no longer overlap.
- Show more only appears once projects exceed the page height and reveals five more per click.
- Drop the header leading spacer so Name starts at the folder icon edge; the
  right-anchored columns keep Modified aligned.
- Narrow the page to max-w-4xl so the table is less wide.
Bump the page to max-w-5xl and increase the top padding so the header sits
a little lower.
- First page fills the viewport, then a sentinel loads another batch as it
  scrolls into view, re-observing after each load so it keeps filling.
- Search still filters the full project set and shows every match uncapped.
Remove the row and header borders and give each row a rounded hover fill so
the list reads cleaner, closer to a modern file list.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb34835eee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +812 to +815
if (
activeProjectId === target.project.id ||
runtimeProjectId === target.project.id
) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate project-delete redirects to chat routes

When deleting a pinned project from a non-chat route, runtimeProjectId can still equal the last chat project's id because ChatPage stays mounted off-route. In that scenario this new runtime-store check redirects the user to /chat after the delete even though they were on /projects, /hub, etc.; only use the runtime-project fallback when the current route is actually a chat route/thread URL.

Useful? React with 👍 / 👎.

onClick={(e) => e.stopPropagation()}
aria-label="Project options"
className="-mr-1 -mt-1 inline-flex size-7 shrink-0 items-center justify-center rounded-full text-muted-foreground opacity-0 transition-opacity hover:bg-black/5 hover:text-foreground dark:hover:bg-white/10 focus-visible:opacity-100 group-hover/project-card:opacity-100 data-[state=open]:bg-black/5 data-[state=open]:opacity-100 dark:data-[state=open]:bg-white/10"
className="hidden size-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-black/5 hover:text-foreground dark:hover:bg-white/10 group-hover/project-row:flex data-[state=open]:flex data-[state=open]:bg-black/5 dark:data-[state=open]:bg-white/10"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep project row menus focusable without hover

Because this trigger is display: none until the row is hovered, unpinned project rows have no keyboard or touch-accessible way to open the menu for Pin/Rename/Import/Export/Delete; the old opacity-hidden button remained focusable. Use opacity/pointer-event gating (and a touch-visible state) instead of hidden so users without hover can still reach these actions.

Useful? React with 👍 / 👎.

shimmyshimmer added 7 commits July 21, 2026 16:13
Increase row padding so projects sit further apart, and drop the hover
corner radius so it reads as a rounded rectangle rather than a pill.
Increase the list top margin so the header sits further from the rows.
Reduce the landing column to 44rem and remove the New badge from the Sources
tab.
The switcher rows are short, so the shared 12px item radius reads as a pill.
Scope a smaller radius to this menu so the highlight is a rounded rectangle.
Add a kebab menu next to the project title with Rename project, Pin or Unpin
project, Export, and Delete project, reusing the existing project actions.
Revert the earlier item-radius tweak. The container corners were squared on
the scrollbar side because the container itself scrolled; move the scroll to an
inner wrapper so the rounded container never scrolls.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35ee731ea2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

async function commitProjectDelete(): Promise<void> {
setDeletingProject(false);
try {
await deleteChatProject(projectId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Refresh chat history after project deletion

When deleting a project from the landing page, this path only emits the project update from deleteChatProject; useChatSidebarItems refreshes from CHAT_HISTORY_UPDATED_EVENT, so if the deleted project had chats cached in the sidebar or landing lists, those now-deleted threads can linger until another history event or reload. The sidebar delete path explicitly invalidates chat history after the same cascade, so do that here as well.

Useful? React with 👍 / 👎.

</div>
)}
<AlertDialog
open={confirmingDelete !== null}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate chat-delete confirmations off-route

When a chat delete confirmation is opened from the project landing and the user navigates to another section before answering, ChatPage remains mounted off-route and this body-portaled AlertDialog stays open because it is not gated by active. In that scenario the dialog can still delete a hidden project chat from /projects, /studio, etc.; gate or clear it like the project dialogs below.

Useful? React with 👍 / 👎.

<AlertDialogHeader>
<AlertDialogTitle>Delete project</AlertDialogTitle>
<AlertDialogDescription>
Delete "{projectName}"? Its chats will be moved back to Recents.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Correct the project-delete confirmation copy

For project deletes from the landing page, this confirmation says the chats will be moved back to Recents, but the action calls deleteChatProject, whose backend cascades and deletes the project's chat threads. Users who trust the prompt can lose chats they expected to keep, so either update the warning to say the chats are permanently deleted or reparent them before deleting the project.

Useful? React with 👍 / 👎.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 6706a8f5c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer
shimmyshimmer merged commit b9a82d3 into main Jul 22, 2026
40 checks passed
@shimmyshimmer
shimmyshimmer deleted the projects-sidebar-pins branch July 22, 2026 00:27
rhsCZ pushed a commit to rhsCZ/unsloth that referenced this pull request Sep 21, 2026
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 unslothai#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 unslothai#11456's.
pull Bot pushed a commit to Little-Star888/unsloth that referenced this pull request Sep 21, 2026
…nslothai#11404)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Resolve the trigger's min-width per variant

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Stop adjudicating tailwind precedence, and refuse what is ambiguous

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

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

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

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

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

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

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

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

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

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

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

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

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

* Recognise arbitrary properties as the same property

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Say once why the gutter is checked per variant

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Take the comments out before locating anything, not after

Two places were stripping comments too late to matter.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Three more readers that accepted less than they claimed.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Split variants around brackets, refuse style spreads and transforms

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Resolve the trigger's min-width per variant

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Stop adjudicating tailwind precedence, and refuse what is ambiguous

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

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

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

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

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

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

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

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

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

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

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

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

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

* Recognise arbitrary properties as the same property

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Say once why the gutter is checked per variant

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Take the comments out before locating anything, not after

Two places were stripping comments too late to matter.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Three more readers that accepted less than they claimed.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Split variants around brackets, refuse style spreads and transforms

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant