cmux-next: a subagent pane draws its chat from the kept tail

TE
6d ago
+21-0

Leo: "i also like the way it just loads in the subagent stuff instantly :(" / "as in i want ours to load fast too :("

What

Clicking a subagent opens it in a pane of its own (chat.subagentPane). That pane is a new tab on the chat's own session (subagentPanes.ts). openOwnTab and onMoveToTab hand the chat on screen to the host before chat.openTab, so the new tab draws it from the kept tail (tailCache.ts) before its attach answers. showSubagent never did this. The subagent pane found nothing kept, opened blank and waited for its own attach round trip.

This PR adds the same one-line hand-over before openSubagentPane. It also adds a source-reading wiring test, next to the existing chat.openTab one, so the call can't be dropped silently.

Tests

  • bun test test/agent-pane-new-tab-cached-chat.test.ts: 13 pass. With the App.tsx change reverted, the new test fails (12 pass, 1 fail).
  • tsc --noEmit: the only error is test/latency/probe.ts interactionId, which is unchanged from base.

Performance

metricbeforeafterdeltaharness
subagent pane: host kept tail present at openno (cold attach)yes (drawn from cache)the attach round trip is no longer on the first paintred/green test above
subagent click to first content (fleet)pendingpendingpendingchat-open bench (cmux#27625, lands first), subagent case

The fleet numbers will be added when the bench lands on feat-cmux-next, since the controller runs measure scripts only from there.

Risk

Low. The change is one call that the two tab-open actions already make. It sends the chat's current tail to the host's in-memory cache and changes nothing else.

🤖 Generated with Claude Code

Agent session: agent session


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.