Skip to content

fix(native-chat): keep item chips whole in agent message rows - #51563

Merged
nwparker merged 1 commit into
stablyai:mainfrom
season179:fix/agent-row-item-chip-overflow
Nov 28, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
season179:fix/agent-row-item-chip-overflow

Conversation

@season179

@season179 season179 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

In a chat, the one-line "Started for " rows used to slice item chips in half when the row ran out of room. You'd see half a pill, a lone status icon, or a thin sliver of the next chip. Now each chip is either shown whole, at a readable size with "…" inside its rounded pill, or not shown on that line at all.

What Changed

Before: the names span (sender name, "for", then the item chips) caps its width and clips sideways with overflow-x-clip. Once the chips' minimum widths add up to more than that cap, the clip cuts straight through a chip. In the fixture, the first chip is cut after its icon at 300px, the second chip is cut after its icon at 400px, and a sliver of the second chip shows at 480px.

After:

  • Every item chip keeps the readable 6rem floor (NATIVE_CHAT_READABLE_MIN). A chip that can't fit at that floor drops off the line whole. It is never sliced.
  • In rows narrower than 400px, the chips can move to a line under the worker name, the same way the preview text already wraps in narrow rows. Started rows with items get one line taller there. The icon and chevron stay centered on the first line.
  • Hidden chips stay in the tab order. Tabbing to one scrolls it fully into view, and when focus leaves the row it scrolls back. The row's spoken label still names every item.
  • Rows with room for everything look the same as on main.

Mechanism:

  • NativeChatAgentMessageCard.tsx: the chips now sit in their own data-agent-start-items span. That span wraps (flex-wrap) but is only one line tall and clipped (max-h-5 overflow-clip), so a chip that doesn't fit wraps onto the hidden second line as a whole. focus-within:overflow-hidden turns the span into a scroll box while it has focus, so a focused hidden chip scrolls into view. Chip focus rings are drawn inset so the clip doesn't cut them.
  • NativeChatAgentMessageRow.tsx: under @max-[400px]/agent-row, and only when the row has item chips (:has([data-agent-start-items])), the names span may wrap and the row aligns to the top. The icon span and the end span get min-h-lh items-center, which keeps them centered on the first line. In normal one-line rows this changes nothing.
  • The fixture gets a four-item Started row to cover the worst case.

Why

Cutting a chip in half is the bug in #51205. With one line, a fixed name floor and a varying number of chips, CSS has two clean outcomes for a chip that doesn't fit: shrink it below a readable size, or move it out of view whole. Shrinking later chips to an icon-and-ellipsis stub was tried during review and dropped, because it reads worse than leaving the chip out. Everything here is CSS (no JS measuring, no ResizeObserver), so the row can't jitter and there's no per-update cost.

This is a partial fix. With longer localized "for" words (fr "pour", es/pt "para", ru, ja, ko, zh), a host badge or a +N sender, a chip can still be clipped in rows about 400-450px wide. That needs the floors and width cap redesigned, which is a follow-up. A "+N more" count for hidden chips is also out of scope. It needs JS to measure which chips wrapped.

Linked Issue

Refs #51205

Visual Proof

Fixture NativeChatAgentMessagePreviewRow, dark theme. Main is on the left, this PR on the right. The PR side has one more Started row, the new four-item fixture row.

Narrow (300px). On main, the first chip is cut right after its icon. With this PR the chip moves under the name and shows whole:

Before (main) After
before narrow after narrow

Panel (400px). On main, the second chip is cut after its icon. With this PR it drops out whole:

Before (main) After
before panel after panel

Medium (480px). On main, a sliver of the second chip shows. With this PR it is gone:

Before (main) After
before medium after medium

Testing

  • Reproduced on main with the component fixture (pnpm fixtures:shot native-chat/messages/rows/NativeChatAgentMessagePreviewRow --theme both, headless Chromium): 300px cuts the first chip and 400px cuts the second.

  • Width sweep: a script swept frame widths 260-900px in 1px steps on macOS (local and the m4air test Mac) and measured each chip's visible fraction through its clipping ancestors.

    • English: main had partly cut chips at 499 of 641 widths. This PR has 0 of 641.
    • No visible chip is narrower than the 6rem floor.
    • With a 40px or 64px stand-in for a host badge or +N, the only remaining cuts are in the known 464-570px frame band described under Why.
  • Localized "for" words (pour, para, için, 対象:, für, для, 대상, 处理, 負責): für and için have no cut widths. The rest are cut only in the 464-50x frame band, which is the partial case above.

  • Keyboard: at 300, 466 and 560px, Tab reaches all four chips in the four-item row. Each focused chip is 100% visible, and scroll resets to 0 when focus leaves the row by Tab or by clicking outside.

  • Alignment: across 3372 row samples, the offsets between icon or chevron and the kind text match main (+0.38px).

  • Static checks: oxlint, oxfmt --check, the anti-slop and native-plugin oxlint configs, ast-grep scan and check-changed-code-quality all pass on the 3 changed files. vitest NativeChatBotItemNoteRow.test.tsx (ItemChip) passes.

  • Platforms: tested on macOS only. The change is plain CSS with no platform-specific code.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

No unit tests: the change is layout-only CSS, so the fixture row covers it instead.

Performance

Code paths: only class strings change, in the renderer. There is no JS, store, selector, memo, observer, IPC or main-process change.

  • At N=200 rows, selector and heuristic calls per single update are unchanged (0 extra), so there is no fanout across rows.
  • One cn() call per item-chip card render becomes a template literal.

Layout cost, measured with 212 agent rows mounted, 164 of them with items:

  • Full relayout on resize, median: main 9.9-10.2ms, this PR 11.6-12.4ms. That is about +10µs per mounted item row. The transcript is virtualized, so realistically this is under 0.3ms per resize.
  • Single-row mutation: 0.1ms on both main and this PR.
  • Focusing a hidden chip: 0.3ms.

Risk

Level: Low

  • In chat panels under 400px wide, Started rows with items get one line taller.
  • Chips that don't fit are hidden with no "+N" count. They are still reachable by keyboard and screen reader.
  • The CSS relies on container queries, :has() and calc-size(), which this row and the renderer already use.
  • A plain revert backs it out.

Original fix by @season179. Maintainer review follow-ups are squashed into this single commit, with Season Saw as author.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@season179
season179 marked this pull request as ready for review November 28, 2026 07:53
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Agent-start message rows now use updated alignment, wrapping, and overflow rules. Item chips use responsive sizing and layout rules. The preview fixture adds a message with four associated items.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 3339e

This is a layout-only change that keeps item chips whole in narrow agent-start rows. No concrete functional, accessibility, or performance risk was found, and the remaining narrow-width clipping cases were disclosed by the author.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(native-chat): keep item chips whole in agent message rows" names the primary change. The changeset stops item chips in agent-start rows from being cut mid-chip. It adds wrapping, a narr…
Description check Passed The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes #51205), Visual Proof with before/after images, Testing with a checked list, Performance, Risk…
Linked Issues check Passed Issue #51205 requires that an item chip which does not fit either truncates with an ellipsis and keeps its rounded end, or drops out whole. It must not be cut flat. The reviewed head of NativeChatAgen…
Out of Scope Changes check Passed The changes stay in the chat agent-message row path. They cover the item-chip span in NativeChatAgentMessageCard.tsx (read at head, and it matches the issue's scope), the names span layout in NativeCh…
Full details: Title check

Explanation

The title "fix(native-chat): keep item chips whole in agent message rows" names the primary change. The changeset stops item chips in agent-start rows from being cut mid-chip. It adds wrapping, a narrow-width layout, and a fixture row. The title is specific and matches the summary and objectives, so it passes.

Full details: Description check

Explanation

The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes #51205), Visual Proof with before/after images, Testing with a checked list, Performance, Risk with level, AI Disclosure, Review, the upstream boundary checkbox, Notes, and Checklist. It explains the mechanism, the alternatives considered, and the risk. Visual proof is supplied as images. The description is detailed and complete, so it passes.

Full details: Linked Issues check

Explanation

Issue #51205 requires that an item chip which does not fit either truncates with an ellipsis and keeps its rounded end, or drops out whole. It must not be cut flat. The reviewed head of NativeChatAgentMessageCard.tsx puts the agent-start ItemChips in a span with flex max-h-5 max-w-fit grow-[calc(infinity)] basis-0 flex-wrap gap-1 overflow-clip focus-within:overflow-hidden. Each chip is max-w-fit flex-1 basis-0 focus-visible:ring-inset. A chip that cannot fit on the visible line wraps onto the clipped second line as a whole, so no flat cut passes through a chip. The span uses NATIVE_CHAT_READABLE_MIN, which keeps the first chip's readable minimum, and focus-within:overflow-hidden brings focused hidden chips into view. This matches the previous assessment. Changes since the previous reviewed head (e54c521) could not be read. The diff tools returned that changed blobs are missing from the checkout, so the head file read is the only direct code evidence. The fixture screenshots, pixel comparisons and width sweep are author-reported and not verified here. The code evidence still supports the requirement. The PR description says the chips omit a '+N' count, and the issue permits omission without a count.

Full details: Out of Scope Changes check

Explanation

The changes stay in the chat agent-message row path. They cover the item-chip span in NativeChatAgentMessageCard.tsx (read at head, and it matches the issue's scope), the names span layout in NativeChatAgentMessageRow.tsx (from the raw summary only), and a four-item fixture row in NativeChatAgentMessagePreviewRow.fixture.tsx (raw summary only). The fixture row supports test coverage for the issue's narrow-row cases. The raw summary says the icon and pinned end area gain line-height minimum heights in the Row file. The PR description says wide rows stay unchanged. That claim is author-reported and was not verified, because the diff was unavailable. This is a layout detail within the same row, not an unrelated change, so no out-of-scope change is demonstrated. The diff tools were unavailable for the Row and fixture files, so the assessment for them relies on the summary.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3f416f1a-bd85-46a3-8ed9-e127ac682979
Commits

Reviewing files that changed from the base of the PR and between e54c521 and 3339e4f.

Files selected for processing: 2

  • src/renderer/src/components/native-chat/messages/rows/NativeChatAgentMessageCard.tsx
  • src/renderer/src/components/native-chat/messages/rows/NativeChatAgentMessageRow.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

"Started <worker> for <items>" rows clipped item chips flat when the
names span ran out of room, leaving half a pill, a lone status icon or a
sliver of the next chip.

The item chips now sit in their own one-line, clipped, wrapping span, so
a chip that cannot fit at its readable 6rem floor wraps out of view whole
instead of being cut. The span becomes a scroll box while focused, so Tab
still reaches every hidden chip. Rows narrower than 400px let the chips
wrap under the name, with the icon and chevron kept centered on the first
line. A four-item fixture row covers the worst case.

Long localized "for" words, a host badge or a +N sender can still clip a
chip at row widths of about 400-450px, so this is a partial fix.

Refs stablyai#51205

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the fix/agent-row-item-chip-overflow branch from e54c521 to 3339e4f Compare November 28, 2026 09:08
@nwparker
nwparker merged commit 73cec78 into stablyai:main Nov 28, 2026
55 checks passed
@season179
season179 deleted the fix/agent-row-item-chip-overflow branch November 28, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants