cmux NEXT tray: a subagent line's time and state sit beside its chevron
Fixes https://github.com/manaflow-ai/cmux/issues/31492
What
In the subagent tray above the composer, a finished line such as "Correctness review PR 30008 · 8m 56s Done ›" showed its time and state floating in the middle of the row instead of next to the chevron.
Each tray line is a grid: title | time (80px) | status (74px) | Stop (28px) | chevron. On a line without a Stop button (a finished, failed or cancelled subagent, or a chat line), the Stop track stayed empty. The state word also sat left-aligned in its fixed track. Together that left about 36px between the state word and the chevron.
Now the time and the state word are one cluster at the line's end:
- A line without Stop gives the cluster Stop's empty track, so "8m 56s Done" ends one tray gap from the chevron.
- A line with Stop (a running subagent or command) ends the cluster one gap before Stop.
- Stop and the chevron keep their fixed columns, so they still line up with the composer's Stop and mic.
- The time keeps its fixed 80px right-aligned box, so a ticking duration never moves the state word. A long state word, such as a retry label, gets the ellipsis before the time does.
- Narrow trays (≤400px) lay the cluster on the controls row and let it use the title's free track.
Tradeoff, on purpose: the time no longer sits on one x across every line, because the cluster follows each line's state word and Stop. The issue asks for the time and state beside the chevron, and with Stop in its own column that can't also hold. The two geometry tests that pinned the old shared columns now pin the new contract.
Tests
The regression test is the first commit, d9ca3f76cd7d5. Commands ran locally in headless Chromium (CMUX_BROWSER_TESTS=1) from webviews/.
bun test test/subagent-tray-columns.test.ts- At the base: the new "state ends beside its next control" check fails,
Expected: <= 8, Received: 36, on both themes. Its other 16 tests pass. - At the head: 18/18 pass.
- At the base: the new "state ends beside its next control" check fails,
bun test test/subagent-tray-composer-geometry.test.ts- At the base: fails at 760, 300 and 200 px. Gaps are unequal:
Received: 32against the 0.5px tolerance. - At the head: passes.
- At the base: fails at 760, 300 and 200 px. Gaps are unequal:
bun test test/subagent-tray-composer-geometry.test.ts test/subagent-tray-trailing.test.ts test/subagent-tray-columns.test.ts: at the head 41b5d12ded0ff, 25/25 pass.bun test test/agent-pane-workflow-progress.test.tsx test/subagent-tray.test.tsx(jsdom): 52/52 pass.scripts/web-lint.sh: passes. The prepush gate reports no new violations.
Observed / Not run
- Observed: the runs above on this Mac, at the commits named. The first two base runs of the columns test failed in setup from local Vite cold-start errors (dependency optimizer, dynamic import), not on an assertion. The third base run produced the red result above.
- Not run: the receipts tool, Freestyle and
cmux-ci run. None of them is reachable from this Mac, so the browser tests ran locally instead. - Not run: a native app capture. This is a webview change, so its visuals come from the PR's gallery advisory run. The
agent-pane.subagent-trayentry'sgeometryandduration-columnsstates show it.
Review
A correctness review subagent found nothing blocking. Its four smaller findings are fixed in 41b5d12ded0ff:
- The trailing test's time-before-Stop check could fail on a line without Stop that shows a short state word. It now applies only to lines with Stop.
- A time-column equality held only because of the fixture's state words. Dropped.
- The cluster gap is tied to
--acpmux-tray-gap, the grid's own gap token. - The
inlinelook keeps its auto-width, left-aligned time.
Changelog
- Fixed: In the subagent tray, a line's duration and state now sit next to its chevron instead of floating mid-row.
🤖 Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the subagent tray so a finished line's duration and state (e.g. "8m 56s Done") sit right beside its chevron instead of floating mid-row.
- Time and state form one right-aligned cluster at the line's end: beside Stop on running lines, beside the chevron on finished ones.
- The time keeps its fixed-width box, so a ticking duration never moves the state word; a long state word gives way first.
- Stop and the chevron keep their fixed columns, so the tray stays aligned with the composer's mic and Stop. On narrow trays the cluster moves to the controls row.
- Tradeoff: the time no longer shares one x across every line, since the cluster follows each line's Stop.
Two geometry tests that pinned the old shared columns now pin the new contract. A review follow-up ties the cluster gap to the tray's own gap token and scopes the trailing test's time-before-Stop check to lines with Stop.