Skip to content

Read the sidebar and reasoning contracts as claims, not as literals - #11404

Merged
danielhanchen merged 68 commits into
mainfrom
ci/sidebar-reasoning-contracts-after-11373
Sep 21, 2026
Merged

danielhanchen merged 68 commits into
mainfrom
ci/sidebar-reasoning-contracts-after-11373

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Three guards fail on main itself, so every open pull request inherits them and they get read as that branch's fault. #11398 and #11399 are both red on these right now, and neither touches the chat sidebar or the reasoning block.

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 across main:

Commit Result
9ba936a5c 44 passed
35a4b3128 (#11373) 3 failed, 41 passed
ca89af7a7 3 failed
f10041ad9 3 failed
915fe8fb3 3 failed

#11373 is right and the guards were wrong

The same mistake three times: each pinned a literal that encoded one commit's layout rather than the property it was defending.

Coarse-pointer padding. Pinned as pr-10. The row gained an action, so it is 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, and the sidebar-touch-reveal and CSS-ordering assertions are unchanged.

The same test's block bound. It cuts the function at the next top-level function. #11373 added a nested one, so the block shrank to a signature and a comment, and every assertion after it was reading an empty room. A guard that can quietly end up inspecting nothing is worse than no guard, so a block too short to be the row now fails as a stale guard with that wording, rather than as a missing affordance.

min-w-0 flex-1. Pinned as one string on the trigger. #11373 moved the filling to a new header wrapper and left the shrinking on the trigger. Shrinking is what stops a long summary widening the row past the thread, so the trigger is matched for min-w-0 specifically and the header for its own.

The streaming height cap. 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 those are now two assertions with their own messages.

Checked by breaking each one

Against a green baseline, one at a time, restoring in between:

Sabotage Fails
remove the coarse padding from both row variants the coarse-pointer assertion
retainStreamingHeight={false} instead of threading it the "flag no longer reaches" assertion
streaming={isStreaming} without the OR the "no longer ORs" assertion
remove min-w-0 from <ReasoningTrigger> the trigger assertion
remove min-w-0 from the header row the header assertion

The trigger check did not fail on its first version, because min-w-0 appears elsewhere in the file and a bare substring test found it there. It is matched against the <ReasoningTrigger element now, and fails as it should.

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 35a4b31 (#11373). Its parent 9ba936a 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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-21T18:02:00.396643Z 579ede4 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

…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.
@danielhanchen
danielhanchen force-pushed the ci/sidebar-reasoning-contracts-after-11373 branch from 291a5af to a6142a8 Compare September 21, 2026 04:36
chatgpt-codex-connector[bot]

This comment was marked as resolved.

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

This comment was marked as resolved.

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

This comment was marked as resolved.

danielhanchen and others added 2 commits September 21, 2026 15:23
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.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

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

This comment was marked as resolved.

…tion

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
suffixed lookalike is refused, the same way the sidebar's row actions already
were.

`_touch_spinner_reach` read the spinner's Tailwind classes and nothing else,
while the action and carrier paths both already refuse inline and unmodelled
positioning. `style={{ right: "8rem" }}` on the wrapper outranks the coarse
`right-16` it reads, and a transform moves the spinner without touching `right`
at all, so the reach reported was not the reach that renders. Both are refused
now.

Doing that turned up an over-reach in the refusal I added last round. It matched
any `translate-*`, and the production spinner is centred with `-translate-y-1/2`,
which moves it vertically and changes no reach at all; the first version of this
change failed the shipped row. The rule is one shared constant now, spelled so
that `translate-y` is not caught, and used by both the action path and the
spinner path so they cannot drift apart again.

Sabotage: `data-className` on the trigger, and an inline `right` and a
`-translate-x-20` on the spinner wrapper, all PASS the previous guards and each
fails only its own test. Re-ran last round's `pr-16` spinner-gutter case, which
still fails, and confirmed the production `-translate-y-1/2` is still accepted.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

… own gate

The carrier refused a spread only where ordering let it beat `className`. That
ordering settles className and nothing else: no attribute here declares `style`,
so `{...rowProps}` with a `style.paddingRight` of 0 overrides every pr-N gutter
from either side of the className. A spread that could supply a style is refused
wherever it sits now. `_className_from_spread` took an attribute and became
`_spread_may_supply`, so the same rule is one function rather than two.

The spinner check keyed its renderings on the literal `showWorkSpinner` while
the gate's condition was read from the markup, and `.get` returned None for any
other spelling, so a builder that names the condition differently is treated as
having no working rows at all and the check silently stops running. The gate now
reports whatever condition it is written with, that is what the renderings are
correlated on, and a gate that correlates with nothing is refused rather than
skipped.

Fixing that broke the paren matching underneath it: widening the gate pattern to
capture the condition moved `gate.end()` off the `(` it had been anchored to,
and the element scan then ran over the wrong region. The gate is found as the
ternary whose true arm opens a `<span`, with the match still ending at the
paren.

Sabotage: `{...rowProps}` on the carrier, and renaming the builder's condition
while leaving the markup gate alone and dropping the coarse gutter to 64px, both
PASS the previous guards and each fails only this test. The second one took
three attempts: the first two left some occurrences of the old name in the
builder, so the renderings still correlated and the previous guard caught them,
which proved nothing about the skip.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

pre-commit-ci Bot and others added 2 commits September 21, 2026 16:15
Both findings are the same shape as the last three rounds: a rule present on one
element and missing from its sibling. The row actions refused an explicit
`style` but not a spread that could supply one, and the spinner scan read the
wrapper `<span>` but not the `<Spinner>` inside it, where a transform moves the
visible glyph while the `right-16` and `size-3.5` this measures stay put.

Fixing the two reported sites and stopping there is what produced this pattern,
so the checks are one function now. `_escapes_the_model` answers why an
element's position cannot be read from its classes and index.css, covering all
three routes together: an inline style, a spread that could supply a style or a
className, and a utility that moves it horizontally by a route the
`right` plus `padding-right` sum does not model. The carrier, the row actions,
the spinner's wrapper and the spinner glyph all ask it, so a rule added to one
reaches the others by construction rather than by my remembering.

The action path keeps its separate refusal over resolved class tokens as well.
That one sees classes reached through an identifier, which a scan of the raw tag
cannot, so the two are not redundant.

Sabotage: a style-bearing spread on the pin and `-translate-x-20` on the
<Spinner> both PASS the previous guards and each fails only this test. The
carrier spread and the wrapper style from earlier rounds were re-run and still
fail, so moving all four onto the shared rule gave nothing back.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Four findings, three of them one theme: a box can be widened, or its padding
replaced, by a route the measurement does not read.

The row actions refused offsets and transforms and accepted padding, while the
reach substitutes the padding read from index.css for every action. `!pr-20` on
the element replaces the number that renders and the calculation carries on with
the stylesheet's, so the glyph clears the gutter. Padding utilities join the
refusal.

The glyph's width was read as `size-*` or a `width` declaration. A `min-width`,
`max-width`, `inline-size` or `@apply w-*` in the same rule widens the box while
the reader reports the original size, so those are refused too. The same hole
was on the spinner, where another width utility beside `size-3.5` renders wider
than the 3.5 the regex reports; that element is refused as unreadable instead.

The fourth is about the reasoning trigger and is a different claim. Its helper
is named for shrinking but only ever checked min-width, and min-width is
necessary rather than sufficient: `shrink-0` or `flex-none` next to `min-w-0`
stops the trigger shrinking inside the flex header and lets a long summary widen
the thread, with every min-width check green. Those are refused now.

Sabotage, four against a green baseline, each failing only its own test:
`shrink-0` on the trigger, `!pr-20` on the pin, `min-width: 5rem` on the glyph
rule, and `min-w-20` on the spinner. All four PASS the previous guards.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

One of these is a correction to last round rather than a new hole. I refused
`grow-0` alongside `shrink-0` and `flex-none`, and it does not belong there:
`grow-0` sets flex-grow and leaves flex-shrink alone, so an element with
`min-w-0` still shrinks normally. That would have failed a correct flex-growth
change for a defect it does not have. Only the two that disable shrinking are
refused now, and `grow-0` is confirmed to pass while `shrink-0` still fails.

The `right-*` refusal matched the bare utility only, so Tailwind's prefix-
important form went through: `!right-40` and `md:!right-40` render further in
than the stylesheet offset this substitutes, and the padding matcher beside it
already allowed for the marker. Both forms are matched now.

The glyph's width was read from the shared `.sidebar-row-action-glyph` rule and
nowhere else, so an instance-level `min-w-20` or an inline width on either
rendered glyph widens that action past a floor still measured from `size-6`.
Every glyph that renders inside the row is now read, through the same
`_escapes_the_model` the other elements use, plus its own width utilities.

Sabotage: `!right-40` on the pin, and `min-w-20` and an inline `minWidth` on a
rendered glyph, all PASS the previous guards and each fails only this test. The
glyph pair took two attempts: the selector used `_tokens`, which expects a
quoted class value rather than a whole tag, so it returned nothing and the loop
skipped every glyph. Both sabotages passed under the new guard and that is what
exposed it.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen and others added 2 commits September 21, 2026 17:09
The gutter comparison reads `pr-N` utilities off the row and nothing else, so an
ordinary project class whose rule in index.css sets `padding-right` replaces the
number that renders while the comparison carries on with the utility's. The
coarse-pointer case is the worst of it: a rule with `!important` leaves the row
still saying `pr-16` while the rendered gutter is zero, and every check here
passes.

Every plain class the builder can contribute is now looked up in index.css, at
any selector that mentions it, since the same claim inside a media query is the
same claim written further away. A class whose rule states a right padding, as a
longhand, a shorthand or an `@apply`, is refused rather than resolved: which
declaration wins depends on specificity and importance, and this guard models
neither.

The three plain classes the row carries today, sidebar-nav-btn, tracking-nav and
leading-ui-19, were checked first: the first two set colour and letter-spacing
and the third has no rule at all, so nothing shipped is affected.

Sabotage: a `no-touch-gutter` class on the row with
`padding-right: 0 !important` in index.css PASSES the previous guard and fails
only this test. My first attempt put the class in the builder's base literal,
which another test pins, so it failed in both directions and proved nothing;
adding it as a separate `cn` argument isolates it.

110 tests across every suite reading app-sidebar.tsx, reasoning.tsx or index.css
pass. No product file is touched.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…rguments

One of these is a false positive in the sweep I added last round. It treated any
rule whose selector mentions the row class as styling the row, so
`.sidebar-nav-btn .decorative-child { padding-right: 0 }` was reported as the row
setting its own gutter. That is harmless descendant styling. The class now has
to appear in the LAST compound of some selector in the list, which is the
element the rule targets, and the descendant case is confirmed to pass.

The same sweep only covered `buttonClass`, and the row actions have the same
hole one level down: only `is-*` is resolved through the stylesheet, and
`_escapes_the_model` reads inline styles and utility tokens, so an ordinary
class with `.pushed-action { right: 5rem !important }` behind it moved the pin
with nothing here the wiser. Action classes are swept too now, against a wider
set of declarations, since an action's edge moves by `right`, `inset`,
`translate` and margins as well as by padding. `sidebar-row-action` and its
glyph are excluded: those two are the rules the reach model already reads in
full.

Last, the new-round predicate was checked for being asked positively but not for
what it was asked about. It reads `isStreaming && !wasStreaming`, so swapping
the two arguments type-checks and inverts it: it then fires when a round ENDS,
leaving a hand-set override alive into the next one, which is the defect the
test exists for. The order is pinned now, with both identifiers derived from the
component rather than named here.

Sabotage: the swapped arguments and the `.pushed-action` class both PASS the
previous guards and each fails only its own test; the descendant rule fails the
previous guard and passes this one.

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

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5afdc570e4

ℹ️ 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 +2075 to +2077
reach = {
name: max(edge + glyph_size for _, edge in found.values())
for name, found in actions.items()

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 Account for the full action hitbox

On coarse-pointer project rows, this computes the required gutter as the action offset plus right padding plus glyph width, but omits the action's pl-2. With the current CSS, the unpin action's hitbox therefore reaches 16 spacing units into the row while the project-row gutter is only pr-14; because sidebar-touch-reveal also enables pointer events, the overlapping 8 px can intercept a title tap and invoke the pin action even though this test passes. Include the left padding/full button box in the reach calculation, or remove that overlap from the production hitbox.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, and this reverses what I said earlier in this PR. I claimed the pin's reach was 15 units and that both row gutters were short; the real numbers are 7.5 (offset) + 0.5 (its own pr) + 6 (size-6 glyph) = 14 units of ink, and 14 + 2 (pl-2) = 16 of hitbox. So the ink was fine and the hitbox was not, which is exactly your point: a project row reserves pr-14, and sidebar-touch-reveal gives the whole box pointer-events, so 8px of the title sat under the pin and a tap opened the pin instead of the chat.

Fixed at the source rather than by widening the gutter. The pin's pl-2 faces the title, not another icon (the gap you see between the two icons is the options button's own pl-2), so on the pin it is dead space. .sidebar-row-action.is-unpin-action now sets padding-left: 0: hitbox drops to 14, exactly flush with pr-14, no title width is given up, and nothing moves visually since the glyph is positioned from the right.

The guard now measures the full box. _row_action_left_paddings reads padding-left per action the same way _row_action_paddings already read padding-right, "pl" joins _SHORTHANDS so a p-/px-/ps- shorthand is not mistaken for silence, and the reach is shift + padding + left. Verified both directions: with the padding-left: 0 reverted the new guard fails, and the old guard passes either way, so the hole was real and the fix is load-bearing.

This puts a product file back in the PR, so the same caveat as the earlier gutter change applies: there is no browser or Studio install on this box, so I cannot attach before/after screenshots. The change is geometrically inert on what is drawn (padding-left on a right-anchored absolutely positioned button with a fixed-size glyph), which is why I was willing to make it without them.

Comment on lines +1488 to +1489
for name in sorted(classes):
for match in re.finditer(r"([^{}]*)\{", live_css):

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 Parse the stylesheet once instead of once per class

This nested loop rescans the entire index.css once for every class and is invoked five times by the new contract. On the current tree, the single test_chat_sidebar_row_actions_visible_on_coarse_pointers takes about 6.4 seconds, with profiling attributing roughly 6.3 seconds to _classes_setting; the other 36 tests in this file collectively take well under a second. Parse/cache the CSS rules once and test the requested class set against that representation so this static guard does not add several seconds to every test run.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed. _classes_setting was walking the whole stylesheet once per class, re-running the brace matcher from scratch each time. There is now a single _css_rules(live_css) pass that returns every rule as (selector list, own declarations), memoised with functools.lru_cache, and the per-class loop filters that tuple instead. Same results, and the file went from 6.4s to 0.29s.

…e title

The coarse-pointer gutter check computed the reach of a row action as offset +
right padding + glyph width. That is what the action SHOWS. It is not what the
action CATCHES: the button also carries pl-2, and sidebar-touch-reveal turns on
pointer-events for the whole box.

With the shipped CSS the pin reaches 7.5 + 0.5 + 6 = 14 units of ink but
7.5 + 0.5 + 6 + 2 = 16 units of hitbox, while a project row only reserves
pr-14. The 8px of overlap sits on top of the title, so a tap meant to open the
chat pinned it instead.

Fixed at the source rather than by widening the gutter. The pin's pl-2 faces
the title, not another icon (the visible gap between the two icons comes from
the options button's own pl-2), so it is dead space: setting padding-left: 0
on .sidebar-row-action.is-unpin-action removes the overlap, costs no title
width, and changes nothing visually because the glyph is positioned from the
right. pr-14 is now exactly flush.

The guard now reads padding-left per action the same way it already reads
padding-right, via _row_action_left_paddings and a "pl" entry in _SHORTHANDS,
and adds it into the reach. Verified both ways: with padding-left: 0 reverted
the new guard fails, and the old guard passes either way.

Also parse the stylesheet once. _classes_setting walked the whole sheet per
class with a fresh brace match each time; _css_rules does one pass behind
functools.lru_cache. The file went from 6.4s to 0.29s.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 579ede41c6

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

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