Repository navigation
fix(core): ChatToolCalls truncates its target inside a ChatMessage - #12424
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ChatToolCalls | 33.8 kB (+15 B) · 8.5 kB CSS (0) | — | ✓ · ✓ · — |
| ChatComposer | 85.8 kB (0) · 12.9 kB CSS (0) | — | ✓ · ✓ · — |
| ChatComposerDrawer | 18.2 kB (0) · 4.7 kB CSS (0) | — | ✓ · ✓ · — |
14 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ChatComposerInput | 83.5 kB (0) · 12.1 kB CSS (0) | — | ✓ · ✓ · — |
| ChatComposerTokenElement | 83.5 kB (0) · 12.1 kB CSS (0) | — | ✓ · ✓ · — |
| ChatDictationButton | 66.8 kB (0) · 10.9 kB CSS (0) | — | ✓ · ✓ · — |
| ChatLayout | 89.8 kB (0) · 11.4 kB CSS (0) | — | ✓ · ✓ · — |
| ChatLayoutScrollButton | 66.8 kB (0) · 11.0 kB CSS (0) | — | ✓ · ✓ · — |
| ChatMessage | 17.2 kB (0) · 3.7 kB CSS (0) | — | ✓ · ✓ · ✓ |
| ChatMessageBubble | 7.6 kB (0) · 3.7 kB CSS (0) | — | ✓ · ✓ · ✓ |
| ChatMessageList | 29.5 kB (0) · 7.1 kB CSS (0) | — | ✓ · ✓ · — |
| ChatMessageMetadata | 20.5 kB (0) · 4.1 kB CSS (0) | — | ✓ · ✓ · — |
| ChatSendButton | 66.6 kB (0) · 10.8 kB CSS (0) | — | ✓ · ✓ · — |
| ChatSystemMessage | 7.1 kB (0) · 3.8 kB CSS (0) | — | ✓ · ✓ · — |
| ChatTokenizedText | 7.6 kB (0) · 4.0 kB CSS (0) | — | ✓ · ✓ · — |
| chat | — | — | — · ✓ · — |
| Chat | — | — | ✓ · ✓ · — |
Package size: @astryxdesign/core 7.65 MB packed (+125 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is a draft; it runs once the pull request is marked ready for review.
The root max-width: 100% cap restores the ChatToolCalls contract that rows truncate without horizontal overflow: the extended Narrow story fails without the fix (a 520 px scroll width in a 320 px container) and passes with it, and in the ai-chat template the running edit call's target now ends at the message column with an ellipsis at 375 and 390 px. One optional suggestion: shorten the new comment on the root and drop "to the start", since user and system messages align their children to the end and the centre (see the inline comment).
Claims and files checked
Review mode: full; reason: no-earlier-review
- Changeset: inside a ChatMessage, a long target now truncates with an ellipsis on a narrow screen instead of running past the message column. Verified: the
Narrowstory fails on the base packages and passes on this head; the template target is flush and ellipsized at 375 and 390 px. - Description: a single row inside a message overflows the column on a phone, and the
ai-chattemplate's running edit call shows it. Verified:page.tsx:771-788; on the base the target ends 70 px past the column at 375 px and 55 px past it at 390 px. - Description: at 375 px the target is cut by the screen edge; at 390 px it runs into the padding. Verified at 375 px (it ends 22 px past the viewport); at 390 px it ended 7 px past the viewport with this environment's fallback font, so the exact placement depends on the font.
- Description: the message's children column aligns children to the start, so the root takes the row's min-content width, which is the whole target. Verified:
ChatMessage.tsx:160-168,ChatToolCalls.tsx:257-267; on the base the in-message root is 504 px wide in a 288 px column. - Description: the target label already truncates (
min-width: 0,text-overflow: ellipsis). Verified:ChatToolCalls.tsx:257-267. - Description: readers lose the end of the path and the page can shift sideways. Verified in part: on the base the target is not ellipsized and the overflow widens the message list's scrollable content; touch scrolling was not exercised.
- Description: one declaration on the root and no other style changes. Verified:
ChatToolCalls.tsx:110-113is the only source change. - Description: the governing claim is the ChatToolCalls record's narrow-context state, rows truncate without horizontal overflow. Verified in the current component record.
- Description: the
Narrowstory also renders the call inside a ChatMessage and keeps its no-overflow assertion at 320 CSS px. Verified:ChatToolCalls.stories.tsx:137-171. - Description: the play function fails without the fix (520 vs 320) and passes with it (320 vs 320), light and dark. Verified in Chromium against the base packages with this head's story, and against this head.
- Description: at 1280 px the target fits and renders in full, as before. Verified: the before and after template frames are pixel-identical.
- Description: the Chat unit tests and the theming-targets test pass. Verified: 27 files, 959 tests passed.
- Description: one defect, no new public API, default or interaction model. Verified: the API report lists no added, changed or removed rows.
- File
.changeset/chat-tool-calls-message-truncate.md: clear. - File
apps/storybook/stories/ChatToolCalls.stories.tsx: clear. - File
packages/core/src/Chat/ChatToolCalls.tsx: one optional comment-style suggestion.
| // A message column aligns its children to the start, so the root sizes | ||
| // to its content and a long target never shrinks. The cap lets each row | ||
| // shrink to the column, so its target truncates. |
There was a problem hiding this comment.
Optional: this comment packs three topics into its first sentence, and "aligns its children to the start" is true only for assistant messages; user messages align their children to the end and system messages to the centre, and the cap matters for all three. A shorter version that keeps only the reason:
// A parent that does not stretch this root sizes it to its content.
// The cap keeps the root in the parent, so a long target truncates.There was a problem hiding this comment.
Approved pending CI: CI is still running on this head.
The root max-width: 100% cap restores the ChatToolCalls contract that rows truncate without horizontal overflow: the extended Narrow story fails without the fix (a 520 px scroll width in a 320 px container) and passes with it, and in the ai-chat template the running edit call's target now ends at the message column with an ellipsis at 375 and 390 px. The new changeset credit line follows the documented changeset format. The earlier optional suggestion to shorten the comment on the root still stands (see the open inline comment).
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Changeset: inside a ChatMessage, a long target now truncates with an ellipsis on a narrow screen instead of running past the message column. Verified: the
Narrowstory fails on the base packages and passes on this head; the template target is flush with the column and ellipsized at 375 and 390 px. - Description: a single row inside a message overflows the column on a phone, and the
ai-chattemplate's running edit call shows it. Verified:page.tsx:771-788; on the base the target ends 70 px past the column at 375 px and 55 px past it at 390 px. - Description: at 375 px the target is cut by the screen edge with no ellipsis and no way to scroll; at 390 px it runs into the padding. Verified at 375 px (it ends 22 px past the screen, and the message list hides horizontal overflow,
ChatLayout.tsx:139-140); at 390 px it ended 7 px past the screen with this environment's fallback font, so the exact placement depends on the font. - Description: the message's children column aligns its children to the start, so the root takes the row's min-content width, the whole target. Verified:
ChatMessage.tsx:160-168,ChatToolCalls.tsx:257-267; on the base the in-message root is 504 px wide in a 288 px column. - Description: the target label already truncates (
min-width: 0,text-overflow: ellipsis). Verified:ChatToolCalls.tsx:257-267. - Description: readers lose the end of the path and the page can shift sideways. Verified in part: on the base the list's content is 38 px wider than the list at 375 px, and scrolling the target into view shifts the list sideways by that much; touch scrolling was not exercised.
- Description: one declaration on the root and no other style changes. Verified:
ChatToolCalls.tsx:110-113is the only package source change. - Description: the governing claim is the ChatToolCalls record's narrow-context state, rows truncate without horizontal overflow. Verified in the current component record.
- Description: the
Narrowstory also renders the call inside a ChatMessage and keeps its no-overflow assertion at 320 CSS px. Verified:ChatToolCalls.stories.tsx:137-171. - Description: the play function fails without the fix (520 vs 320) and passes with it (320 vs 320), light and dark. Verified in Chromium against the base packages with this head's story, and against this head.
- Description: at 1280 px the target fits and renders in full, as before. Verified: the before and after template frames are pixel-identical.
- Description: the Chat unit tests and the theming-targets test pass. Verified: 27 files, 959 tests passed.
- Description: one defect, with no new public API, default or interaction model. Verified: the API comparison lists no added, changed or removed rows.
- Description: the public text carries no internal context. Verified for the added lines, title, description and commit messages.
- File
.changeset/chat-tool-calls-message-truncate.md: clear. - File
apps/storybook/stories/ChatToolCalls.stories.tsx: clear. - File
packages/core/src/Chat/ChatToolCalls.tsx: one optional comment-style suggestion, carried.
User impact
A single
ChatToolCallsrow inside aChatMessageruns past the message column on a phone when its target is long (for example a file path). At 375 px the path is cut by the screen edge with no ellipsis and no way to scroll; at 390 px it runs into the column's padding. Theai-chattemplate shows it on its running "edit" call.Problem and solution fit
ChatToolCallsroot is sized to fit its content. Its row's min-content width is the full, unwrapped target, so the root grows past the column.min-width: 0,text-overflow: ellipsis), but it only shrinks when its row is narrower than its content. A root that grows to the content never gives it that chance, so the text is clipped by the viewport, not ellipsized.Capping the root at
max-width: 100%lets the row shrink to the column, so the existing truncation takes over. No other style changes.Expected behavior and authority
component:ChatToolCalls, Representative states, "Narrow / RTL context": rows truncate without horizontal overflow.Smallest restoration
One declaration on the root:
maxWidth: '100%'. TheNarrowstory now also renders the same call inside aChatMessageand keeps its existing play assertion (no horizontal overflow at 320 CSS px).Evidence
ai-chattemplate at 375 px and 390 px, light and dark, in a Vite app and in a single-file export: the target is not ellipsized and ends past the message column (at 375 px it is cut by the screen edge).Narrowstory's play function, with the newChatMessagecase, fails without the fix (container scrollWidth 520 vs clientWidth 320) and passes with it (320 vs 320), light and dark.Scope
Components: ChatToolCalls
Testing
CI=1 vitest run --project ui packages/core/src/Chat(ChatToolCalls, ChatMessage and the rest of Chat pass),packages/core/src/theme/themingTargets.test.ts.ai-chatat 375, 390 and 1280 px, light and dark, Vite app and exported file, before and after; theNarrowstory composition before and after.