next: the running tray starts folded to its header, per-chat memory; subagent icon spacing

Closed
AU
5d ago
+0-0

Closes https://github.com/manaflow-ai/cmux/issues/28875

What

The agent chat's running tray ("Running in background · N commands / subagents") above the composer now starts folded to its one-line header. Clicking the header opens it. Before, a tray of 3 lines or fewer started open and took the transcript's room.

  • Per-chat memory. Opening or folding a chat's tray holds when you switch to another chat and back, for the pane's life. It's a bounded Map (200 chats, least recently used dropped first) in subagents/trayFoldMemory.ts; App.tsx passes chat={shownSessionId}. Other chats still start folded.
  • Focus. When a lone line gains a header (a second item starts), the list folds and goes inert. If focus was on that line or its Stop, it now moves to the header instead of falling to the page. This works with motion off too, where the fold leaves in the same commit.
  • Icon spacing. A subagent line's icons were cramped: the branch icon (agent.fork) touched the title. The state icon, kind icon and title now keep the row's 8px icon gap (--acpmux-line-icon-gap) in both the wide and narrow tray.
  • Cards above the composer that I left alone on purpose:
    • The question card, which needs an answer.
    • The pull request dock, which already starts compact.
    • The queued prompts, which already fold past 3 and remember per chat.

Tests

The regression tests are in webviews/test/subagent-tray.test.tsx:

  • A headed tray starts folded.
  • A chat's open or fold holds across a switch, and another chat starts folded.
  • Focus moves to the header with motion on and with motion off.
  • Focus the person moved elsewhere stays put.

A new browser test in test/subagent-tray-columns.test.ts measures both icon gaps at 760px and 360px.

The tests and plays that read the tray's lines now open it first, through test/support/openRunningTray.ts. The glyph check uses the one-line variant, and the BackgroundTasksPanel closed play opens the tray.

Observed / Not run

All runs are on Freestyle VMs (node snapshot and webviews/playwright snapshot), using the receipts tool's own jobs:

  • Red (2624cd3a2a15, test only): bun test ./test/subagent-tray.test.tsx fails 1 of 39. "focus on the line moves to the header (motion off)" expected .acpmux-running-tray__head but got body.
  • Green (284a554aef38): results in the comment below.
  • The base already has reds in files this branch doesn't touch: vp fmt --check, vp lint, check:type-scale and check:browser-lanes (pages/settings, pages/apps/styles.css, test/composer-draft-overflow.test.ts at 5aee3770f46e). The push used CMUX_WEB_LINT_SKIP_REASON for those, and the prepush gate found no new violations.
  • running-strip.test.ts "hover … with the hand" and background-tasks-drill-perf.test.ts also fail at base 0779a9459c5a: the cursor test expects pointer against https://github.com/manaflow-ai/cmux/pull/28925's arrow rule, and the frame-budget test is timing-dependent.
  • Not run: a tagged macOS dev build. This change is webview-only, and the gallery shows the folded tray (agent-pane.subagent-tray, agent-pane.subagent-tray-motion).

Performance

No perf numbers: this changes when the tray's list is drawn (folded by default) and its icon spacing, not a measured path. A folded tray draws fewer lines than before.

Changelog

  • Changed: The running tray above the chat's composer starts folded to its header and remembers each chat's choice; its subagent icons no longer touch the title.

🤖 Generated with Claude Code