Responsive composer controls
Each row responds to its own measured width, with no fixed breakpoint: chat and DAG pages have different controls at the same width. Menus, values, keyboard, tooltips and accessible names never change.
Environment row
| Level | Shows |
|---|---|
| 0 | Everything |
| 1 | Names capped near 12 characters with an ellipsis; environment chip icon-only |
| 2 | Branch names hidden: branch icon and diff badge |
3 (data-compact) | Every label hidden (status, surface, project, directory, DAG Fit, zoom percentage, Legend); diff badge becomes a half-green, half-red dot |
use-compact-environment-row.ts lays the row out per level with transitions off (data-measuring), then animates to the first data-squeeze level that fits clientWidth. It measures the last chip's right edge with auto margins zeroed: that margin makes scrollWidth always fill the row. Roomier levels need 12px of slack. Split panes use the same logic.
Control row
| Aspect | Rule |
|---|---|
| Measure | use-compact-controls-row.ts sums clusters and gap in a hidden max-content copy beside .composer-bottom-row, removed before paint |
| Compact | Sets data-compact when the sum exceeds the width: permission, model and effort labels collapse to Shield, Message, Terminal and Biceps icons |
| Expand | Needs 12px of slack |
| Re-measures on | Resize, content or class changes, web-font load |
| Why a copy | The live row is never toggled: its Buttons transition every property, so it would still report compact widths |
Rules
- One row, never wrapping; no control hidden. Composer height and
splitRatiodo not change. - Labels do not flex-shrink. A capped name ends in an ellipsis. One transition rule, no
display:none. - Icon triggers keep size, order and operation; chat and execution use distinct icons; effort-icon colour shows the level.
- Native
ResizeObserverandMutationObserver; model, permission and effort state untouched.
Bottom control surface
| State | Surface | Unchanged |
|---|---|---|
| Resting | background:var(--chip-bg); border 0, no shadow | 20px height, 5px radius, icon and label colours |
| Hover, open | 8% of --chip-bg mixed into --text-bright | Menus, tooltips, animations, effort colours |
| Narrow | As resting | Triggers stay 20px icon buttons |
focus-visible indicators stay.
Context popover
ContextBreakdownPanel unmounts when closed, so a cache prevents a Loading-only card on reopen.
| Case | Shows at once | Background |
|---|---|---|
| Same session and branch | Last complete statistics | Request, update in place |
| First open, no cache | Loading state | Request, cache on success |
| Other session or branch | Cache for that sessionId + headId | Old request cancelled, cannot overwrite |
| Refresh fails | Cached content | No error page |
Frontend process only, 32 branches, least recently used out (apps/web/lib/chat/context-breakdown-cache.ts). For concurrent refreshes of one key the newest wins.
Component boundaries
Under composer/ | Does | Does not |
|---|---|---|
environment-row/environment-row.tsx | Composes chips, renders caller-supplied trailing content | DAG names, portal ids, submission, project state |
environment-row/use-compact-environment-row.ts | Measures and sets level | Render or style |
environment-row/environment-row.module.css | Layout, pills, squeeze animation, DAG slot | Input or bottom controls |
environment-row/chips/ | channel-chip, environment-chip, web-surface-chip, worktree-chip | The row's responsive state |
input/ | Textarea, keyboard, history callbacks | Send or switch mode |
attach/, paste/, modes/question/ | Component and its CSS Module together | Selectors in the root module |
submit/ | Build and submit messages, side effects | Render the input |
modes/composer-body.tsx | Selects input, function form or question form | Own input, attachment or session state |
state/use-composer-settings.ts | Settings for the current SessionScope | Global focused-session fallback |
controls/use-*.ts | Model availability, tool profiles, unattended state | Sync in the Composer root |
index.tsx | Passes arguments, renders one EnvironmentRow | Hold refs, observers or row JSX |
The DAG module owns its HUD and supplies it through EnvironmentRow's trailing slot. ProjectBadge, WorkingDirChips and GoalChip stay in shared modules. Check: apps/web/scripts/chat/check-composer-environment-row.mjs.
Options compared
| Option | Outcome |
|---|---|
| Container queries | Only for the context ring label and effort card width: the row's need is not a function of width alone |
| Accessible names | Reuse tooltips, triggers and labels; visual hiding keeps DOM semantics |
| Horizontal scrolling | Fallback for extremely narrow widths only |
| Wrap to two rows | Rejected: changes composer height and transcript spacing |
Acceptance
- Overflow squeezes through
data-squeezetodata-compact, with no fixed-width cases or labelflex-shrink:1. - All labels share one animation rule.
- Past the split-pane threshold, all right-hand settings and left permission and more controls stay visible without overlap.
- Permission, chat model, execution model and effort icons each open their menu.
- Widening returns all labels; reselecting split, switching chat and DAG, and refreshing preserve this.
- Bottom controls have a non-transparent surface at rest, border 0, no shadow, and a stronger background on hover or open.
- Reopened Context statistics come from the cache; background completion updates cache and ring.
- Cache isolated by session and branch; stale requests cancelled; failed refreshes keep the cache; 32-entry eviction.