agent pane: an opened subagent goes to the right split; no "Back to" names a raw id

Merged
TE
3d ago
+137-33

Leo, 2026-11-02: "WHEN I OPEN A SUBAGENT IT SHOULD GO TO THE RIGHT SPLIT AREA"

Opening a subagent from native Session Info's Subagents rows swapped the chat's pane, and its Session Info with it, to the subagent. Session Info then read "Back to 01a18a35-b1e8-7951-ba2f-…", which is the chat's raw session id.

What changes

  • Opens go to the right split. A subagent the person opens asks the app for its pane right of the chat, whatever the summary card's "open in panes" switch says. That covers a Session Info or summary card row, a transcript group line, the agents pill and a "Sent to" chip. The request is the existing chat.subagentPane, which uses the same right-column placement links use (openOnRight / RightColumnPlacement). The chat's pane and its Session Info stay on the chat. The switch still governs the panes nobody asked for: the ones new subagents open by themselves. A host that opens no pane (the gallery, the floating chat) still shows the subagent in place, and a subagent's own pane still shows other subagents in place.
  • No "Back to ". A subagent panel's back button names what spawned it only by a readable name, and otherwise just says "Back" (new key sessionInfo.subagent.backPlain, with translations copied from the existing "Back"). sessionTitle now treats a name that is only a raw id (a UUID, <session>/<call>, toolu_…) as no name, so the chat reads by its title. That also fixes "Subagent of ".

The logic is in shared web only. No Swift changes, and the native Session Info layout is untouched.

Regression

#24017 ("a click on a subagent stays in the chat unless panes are on") made clicks follow the switch, which is off by default. So a click showed the subagent in the chat's own pane, and Session Info scoped itself to the subagent. Its test (test/subagent-click-stays-in-chat.test.ts) is renamed and flipped.

Tests

  • test/subagent-click-opens-right-split.test.ts:
    • With the switch off, a click calls chat.subagentPane and never shows the subagent in place, so Session Info's scope is unchanged.
    • If the host opens no pane, the subagent shows in place.
    • Background opens with the switch off still open nothing.
  • test/subagent-back-label-no-raw-id.test.ts:
    • No back label contains a UUID.
    • A readable parent is kept.
    • A chat named by its raw id reads by its title.

Observed / Not run

  • Observed: bun test on the two files above plus the other subagent pane and session title tests (27 pass); check:catalog-keys, check:session-info-names, vp fmt/vp lint on the changed files; prepush gate.
  • Not run: a native capture of a subagent opening in the right split.
  • Sidebar: the sidebar's subagent rows are Chief subagents (ChiefSidebar.openSubagent). They raise the tab that already shows the subagent's chat, or open its spawn workspace. They never swapped Session Info, and this PR leaves them unchanged.

Agent session: agent session

šŸ¤– Generated with Claude Code


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


Summary by cubic

Opening a subagent — from a Session Info row, summary card row, transcript group line, agents pill, or "Sent to" chip — now opens it in a pane right of the chat instead of swapping the chat's pane and Session Info to the subagent. The chat stays put, and the "open in panes" switch no longer affects these user-requested opens; it still governs panes that new subagents open by themselves.

Subagent back buttons no longer name raw IDs: they name what spawned the subagent only when it has a readable name, else just "Back". A chat whose name is only its raw session id now reads by its title, so labels like "Back to 01a18a35-b1e8-…" and "Subagent of " never appear.

Regression

  • #24017 made clicks follow the switch and swap the chat pane; that behavior is reverted, and its test is renamed and flipped.