Repository navigation
fix(native-chat): one set of rules for chat text size, colour, hover and focus - #26685
Conversation
Sizes were picked per component, so the same kind of row came out 12, 13 or 14px and the Text size setting reached only a few of them.
Icons and gaps stayed fixed while text grew, so at larger sizes they looked undersized and sat off-centre.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to Some composer task labels may not follow the documented surface palette, and transcript row estimates can drift at non-default text sizes. These are bounded presentation issues; the styling rule also has a narrow enforcement gap. The change is mergeable with follow-up. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
06c1ce9a-aaa9-4c86-bbba-95095cf6c6cb
⛔ Files ignored due to path filters (1)
src/renderer/src/components/sidebar/__snapshots__/subagent-child-row-fallback-pixels.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (49)
.oxlintrc.jsonAGENTS.mdconfig/oxlint-plugins/native-chat-design-tokens.mjsconfig/scripts/native-chat-design-tokens-plugin.test.mjsdocs/STYLEGUIDE.mdsrc/renderer/src/assets/main.csssrc/renderer/src/components/native-chat/NativeChatAgentMessageSenders.tsxsrc/renderer/src/components/native-chat/NativeChatApprovalCard.tsxsrc/renderer/src/components/native-chat/NativeChatAssistantMessageRow.tsxsrc/renderer/src/components/native-chat/NativeChatAutocompleteMenus.tsxsrc/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsxsrc/renderer/src/components/native-chat/NativeChatBackgroundTaskRun.tsxsrc/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.tsxsrc/renderer/src/components/native-chat/NativeChatCodeBlock.tsxsrc/renderer/src/components/native-chat/NativeChatComposerField.tsxsrc/renderer/src/components/native-chat/NativeChatComposerNotices.tsxsrc/renderer/src/components/native-chat/NativeChatContextUsageRing.tsxsrc/renderer/src/components/native-chat/NativeChatDiffCard.tsxsrc/renderer/src/components/native-chat/NativeChatDiffView.tsxsrc/renderer/src/components/native-chat/NativeChatEmptyState.tsxsrc/renderer/src/components/native-chat/NativeChatInlineVisual.tsxsrc/renderer/src/components/native-chat/NativeChatLoadingCue.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.task-list-frames.test.tsxsrc/renderer/src/components/native-chat/NativeChatNoticeRow.test.tsxsrc/renderer/src/components/native-chat/NativeChatNoticeRow.tsxsrc/renderer/src/components/native-chat/NativeChatOlderHistoryRow.tsxsrc/renderer/src/components/native-chat/NativeChatReasoningDisclosure.tsxsrc/renderer/src/components/native-chat/NativeChatReasoningRow.tsxsrc/renderer/src/components/native-chat/NativeChatResolutionReceipt.tsxsrc/renderer/src/components/native-chat/NativeChatSubagentRun.tsxsrc/renderer/src/components/native-chat/NativeChatSubagentSectionHead.tsxsrc/renderer/src/components/native-chat/NativeChatTaskList.test.tsxsrc/renderer/src/components/native-chat/NativeChatTaskList.tsxsrc/renderer/src/components/native-chat/NativeChatToolLine.test.tsxsrc/renderer/src/components/native-chat/NativeChatToolLine.tsxsrc/renderer/src/components/native-chat/NativeChatToolRun.appearance.test.tsxsrc/renderer/src/components/native-chat/NativeChatToolRun.test.tsxsrc/renderer/src/components/native-chat/NativeChatToolRun.tsxsrc/renderer/src/components/native-chat/NativeChatToolRunMembers.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptRow.tsxsrc/renderer/src/components/native-chat/NativeChatTurnActivityLine.tsxsrc/renderer/src/components/native-chat/NativeChatUserMessageRow.tsxsrc/renderer/src/components/native-chat/NativeChatVisualPanel.tsxsrc/renderer/src/components/native-chat/NativeChatWorkingStatus.tsxsrc/renderer/src/components/native-chat/native-chat-appearance.csssrc/renderer/src/components/native-chat/native-chat-row-height-estimate.tssrc/renderer/src/components/native-chat/native-chat-type-scale.test.tssrc/renderer/src/lib/utils.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
|
||
| const CHECKS = { | ||
| 'no-arbitrary-font-size': { | ||
| pattern: /^text-\[(?:length:)?[\d.]+(?:px|rem|em)\]$/, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject typed arbitrary font sizes.
text-[length:var(--fixed-size)] is an arbitrary font-size class, but this pattern does not match it. The class can therefore bypass the native-chat type-scale rule and leave text outside the documented steps. Match typed length values as well as numeric lengths, while continuing to exclude arbitrary text colours.
- Scale row gap with text size so controls don't overlap - Clamp 'Match terminal interface' to 12-20 for labels/controls - Use existing --status-warning token for warning color - Rewrite stale test for scaled typography tokens - Use app colors for in-progress tasks in composer dock
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
373314cf-0206-4a8f-98bf-90bc12e4eeb7
⛔ Files ignored due to path filters (1)
src/renderer/src/components/sidebar/__snapshots__/subagent-child-row-fallback-pixels.test.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (20)
src/renderer/src/assets/main.csssrc/renderer/src/components/native-chat/NativeChatAgentMessageSenders.tsxsrc/renderer/src/components/native-chat/NativeChatApprovalCard.tsxsrc/renderer/src/components/native-chat/NativeChatAssistantMessageRow.tsxsrc/renderer/src/components/native-chat/NativeChatAutocompleteMenus.tsxsrc/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsxsrc/renderer/src/components/native-chat/NativeChatCodeBlock.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatNoticeRow.test.tsxsrc/renderer/src/components/native-chat/NativeChatNoticeRow.tsxsrc/renderer/src/components/native-chat/NativeChatReasoningDisclosure.tsxsrc/renderer/src/components/native-chat/NativeChatTaskList.tsxsrc/renderer/src/components/native-chat/NativeChatToolLine.test.tsxsrc/renderer/src/components/native-chat/NativeChatToolLine.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsxsrc/renderer/src/components/native-chat/NativeChatUserMessageRow.tsxsrc/renderer/src/components/native-chat/native-chat-appearance-style.test.tssrc/renderer/src/components/native-chat/native-chat-appearance-style.tssrc/renderer/src/components/native-chat/native-chat-row-height-estimate.tssrc/renderer/src/components/native-chat/use-native-chat-transcript-window.ts
🚧 Files skipped from review as they are similar to previous changes (10)
- src/renderer/src/components/native-chat/NativeChatCodeBlock.tsx
- src/renderer/src/components/native-chat/NativeChatApprovalCard.tsx
- src/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsx
- src/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsx
- src/renderer/src/components/native-chat/NativeChatUserMessageRow.tsx
- src/renderer/src/components/native-chat/NativeChatToolLine.tsx
- src/renderer/src/components/native-chat/NativeChatNoticeRow.tsx
- src/renderer/src/components/native-chat/NativeChatAgentMessageSenders.tsx
- src/renderer/src/components/native-chat/NativeChatAssistantMessageRow.tsx
- src/renderer/src/components/native-chat/NativeChatAutocompleteMenus.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
| > | ||
| {list.tasks.map((task, index) => ( | ||
| <TaskRow key={`${task.content}:${index}`} task={task} /> | ||
| <TaskRow key={`${task.content}:${index}`} task={task} isInDock={isInDock} /> |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Resolve the failing key check.
The GitHub static-analysis check reports react-doctor(no-array-index-as-key) for this changed TaskRow call. The key includes index, so the check fails. Use a stable task identifier if the task contract provides one. Otherwise, document and narrowly suppress the rule for this stateless row.
🧰 Tools
🪛 GitHub Check: static analysis and typecheck
[failure] 92-92: react-doctor(no-array-index-as-key)
Your users can see & submit the wrong data when this list reorders or filters, so use a stable id like key={item.id}, not the array index "index".
Source: Linters/SAST tools
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f216caf4-5621-463d-85d9-4a418e91d0dc
📒 Files selected for processing (1)
src/renderer/src/components/native-chat/NativeChatTaskList.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| 'flex items-start gap-1.5 text-xs text-muted-foreground', | ||
| task.status === 'in_progress' && 'font-medium text-foreground' | ||
| 'flex items-start gap-1.5', | ||
| task.status === 'in_progress' && 'font-medium text-chat-foreground-strong' |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
# Check composer-mode callers and the documented palette rule.
rg -n -C 3 '(<NativeChatTaskList\b|NativeChatTaskList\s*\()' src/renderer/src --glob '*.tsx'
rg -n -i -C 3 'native-chat|composer|foreground|colour|color' docs/STYLEGUIDE.mdRepository: stablyai/orca
Length of output: 18309
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- NativeChatTaskList.tsx ---'
nl -ba src/renderer/src/components/native-chat/NativeChatTaskList.tsx | sed -n '1,180p'
printf '%s\n' '--- NativeChatMessageList.tsx caller ---'
nl -ba src/renderer/src/components/native-chat/NativeChatMessageList.tsx | sed -n '380,455p'
printf '%s\n' '--- composer references and containers ---'
rg -n -C 6 --glob '*.tsx' 'presentation="composer"|composer.*NativeChat|NativeChatComposer|<NativeChatTaskList' src/renderer/src/components/native-chat src/renderer/src
printf '%s\n' '--- relevant changed diff ---'
git diff 59631b8b2633692f93c82da05103184cd4d40440 440fd856d30f96780bef827e782ccdd8b9a751cd -- src/renderer/src/components/native-chat/NativeChatTaskList.tsx src/renderer/src/components/native-chat/NativeChatMessageList.tsxRepository: stablyai/orca
Length of output: 45668
Use the app palette for in-progress composer tasks.
In composer mode, the checklist inherits text-muted-foreground from its app-colored container. The in-progress row overrides that color with text-chat-foreground-strong, which is reserved for chat-canvas text. Keep the chat token for inline mode, and use text-foreground for composer mode.
🐛 Suggested fix
-function TaskRow({ task, label }: { task: NativeChatTask; label?: string }): React.JSX.Element {
+function TaskRow({
+ task,
+ label,
+ appPalette = false
+}: {
+ task: NativeChatTask
+ label?: string
+ appPalette?: boolean
+}): React.JSX.Element {
...
- task.status === 'in_progress' && 'font-medium text-chat-foreground-strong'
+ task.status === 'in_progress' &&
+ cn('font-medium', appPalette ? 'text-foreground' : 'text-chat-foreground-strong')
...
-function Checklist({ list }: { list: TaskList }): React.JSX.Element {
+function Checklist({
+ list,
+ appPalette = false
+}: {
+ list: TaskList
+ appPalette?: boolean
+}): React.JSX.Element {
...
- <TaskRow key={`${task.content}:${index}`} task={task} />
+ <TaskRow key={`${task.content}:${index}`} task={task} appPalette={appPalette} />
...
- <Checklist list={list} />
+ <Checklist list={list} appPalette />Source: Learnings
…d spacing stay in 12-20
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
9920e94f-627a-49ac-8760-6f0428ba61bb
📒 Files selected for processing (7)
src/renderer/src/components/native-chat/native-chat-appearance-style.test.tssrc/renderer/src/components/native-chat/native-chat-appearance-style.tssrc/renderer/src/components/native-chat/native-chat-appearance.csssrc/renderer/src/components/native-chat/native-chat-row-height-estimate.test.tssrc/renderer/src/components/native-chat/native-chat-row-height-estimate.tssrc/renderer/src/components/native-chat/use-native-chat-row-typography.tssrc/renderer/src/components/native-chat/use-native-chat-transcript-window.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/components/native-chat/native-chat-appearance.css
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| typography = DEFAULT_ROW_TYPOGRAPHY | ||
| ): number { | ||
| // Chat spacing and icons scale with the text size, so a row's fixed parts do too. | ||
| const scale = typography.spacingScale |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep the collapsed-reasoning estimate at least one line high.
When matched terminal message text is 24px, lineHeightPx is about 37.7px, but COLLAPSED_REASONING_PX * spacingScale is about 34.3px. The previous estimate used the greater of line height and 24px. Restore that minimum so a collapsed reasoning trigger does not start with an estimate shorter than its text line.
…ain's new notice test uses the chat colour
ELI5
The native chat had no shared rules for how text and controls look, so each part picked its own. Text came out at slightly different sizes and shades, rows highlighted at different strengths on hover, keyboard focus was hard to see, and some warning and diff text was close to unreadable in one theme. This gives the chat one set of rules for size, text colour, hover, focus and contrast, and a lint check that keeps them.
What Changed
Five things, all inside the native chat.
1. Font size
Before, each component picked its own size. There were six sizes between 10 and 14px, 18 of them one-off values like
text-[13px]. Rows doing the same job disagreed: a tool run header was 14px, the tool rows inside it 13px, the task list 12px. The Text size setting reached 11 elements, so at size 20 a tool run had a 20px header over 13px rows.Now there are four named sizes, and Text size scales all of them in proportion. Icons, gaps, padding and row heights scale with the text too, so a larger Text size reads like a zoom of the chat instead of big text beside small icons. Code keeps its own size and follows Code text size.
text-smtext-xstext-2xstext-3xsAt the default size, tool rows, subagent entries, background tasks and diff card headers go from 13px to 14px. Task rows in the transcript and the approval card's description go from 12px to 14px.
2. Text colour
Before, secondary text used two greys interchangeably (
text-muted-foreground79 times,text-chat-foreground-faint47 times), and main text used three colours. Rows that used the app colour ignored the Contrast setting, and seven of them softened it by hand with an opacity liketext-foreground/85.Now text on the chat canvas uses the chat colours, so it follows Contrast. Text on a card, menu, popover or the docks above the composer keeps the app colours. 26 secondary and 10 primary uses moved. Light mode looks the same. In dark mode those rows get slightly dimmer and match the tool rows beside them.
3. Hover and focus
Transcript rows now share one hover strength (
hover:bg-accent/20); the diff card header was the outlier. Tool rows and diff card headers had no focus style of their own and now use the same inset ring as their sibling rows. Two one-off ring strengths are gone.4. Contrast
Four pairs failed the accessibility minimum in at least one theme. Each now uses a chat-only token mixed toward the foreground, so it darkens in light mode and lightens in dark.
5. Enforcement
A lint plugin,
native-chat-design-tokens, failspnpm linton arbitrary font sizes,text-foreground/NNandring-ring/NNinsidecomponents/native-chat/.docs/STYLEGUIDE.mddocuments the size scale and the colour, hover and focus rules.Mechanism
main.cssaddstext-2xs,text-3xsandtext-chat-codeas theme steps. The chat root (.native-chat-appearance) redefines--text-smand the smaller steps as ratios of--chat-font-size, so every size class inside the chat scales without opting in.size-*,gap-*,p-*andmin-h-*inside the chat follows it. The row-height estimates the transcript uses before it measures a row scale by the same factor.native-chat-message-textclass is gone. It setfont-sizeoutside a CSS layer, so it silently beat any Tailwind size class on the same element. The subagent header carriedtext-[13px]and never rendered at 13px.cn()registers the new steps with tailwind-merge. Without that it readstext-2xsas a colour and drops it next totext-muted-foreground.--ringat a new--chat-focus-ringtoken, so every focus ring in the chat picks up the passing colour.--chat-warning,--chat-diff-addedand--chat-diff-removedare defined next to the other chat colour tokens.Why
The chat had colour tokens but no type scale, and no stated rule for when to use the chat colours over the app's. Nothing told a new component which size or colour to pick, so each one guessed. Fixing rows one at a time would have left that gap open.
I compared against T3 Code, which has the same kind of transcript. It uses named steps only, gives each step one job, and scales them all from a single setting. This follows that model.
Alternatives I considered:
This reverses the "keep metadata independent of chat text size" decision from #25657. Labels and timestamps now scale. Worth a look from whoever made that call.
Linked Issue
None.
Visual Proof
In the running app
Rendered in the real app (a hidden dev build with an isolated profile) from a seeded chat transcript, not a live agent. Before is
mainwithout this PR (59631b8b263). After is this PR (440fd856d30). Each shot hovers the first reply so its copy, scroll-to-top and time row is showing, with the next message right below it.Text size 12, 16 and 20
mainthose stay at 20px, 24px and 12px, and only the message text grows."Match terminal interface" on, terminal font size 10 and 24 (whole window, so the message box shows too)
A warning-coloured element was not captured. In a chat it only appears when an SSH host goes offline or when a live agent session reports a warning, and this rig had neither.
Earlier renders
Before and after at Text size 12, 14, in dark and light. Before is built from
main.Before/after dark
Before / after Light (14px)
Dark (Before / After)

Testing
Not yet opened in the running app. What I did check:
mainand on this branch, at Text size 12, 14 and 20 in both themes. That is where the screenshots come from. It does not cover the composer, cards, menus or focus rings.main.css.pnpm lint,pnpm tc, the three audit scripts and the renderer test suite pass on a fresh rebase onto main.Review
Three things I left alone and would like an opinion on:
text-yellow-500, which is 1.9:1 in light mode. It matches the sidebar's monitor indicator and a test pins the two together, so fixing it means changing the sidebar too.text-foreground/80to fulltext-foregroundso the lint rule could be on without exceptions. They are slightly stronger than before.Agent skill upstream boundary
Notes
Renderer-only CSS and class changes. No IPC, wire, SSH or platform-specific code. Dialogs and menus that render outside the chat root keep the app's sizes. Mobile is a separate app and is untouched. With "Match terminal interface" and a low-contrast terminal theme, derived colours can only be as readable as the theme itself.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)