Agent pane: a sub-session or agent-run result keeps its "Show more" after the card closes, scrolls away or the chat switches

Merged
TE
4d ago
+159-8

Carries draft #28693 (opened by ChatGPT for Leo, tests not run there) together with the draft it was stacked on, #28634 (an earlier agent-lane draft). Both are carried here as one PR.

Leo: "oh btw i talked with chatgpt and they raised a bunch more drafts and issues across cmuxterm-hq, cmux, and cmux-platform. some stuff worth looking at"

What was wrong

On base, the result text in a sub-session card (wait_for_sessions reply) and in a standalone agent-run card is shown through Cut in SubsessionCallCard.tsx, and Cut kept its "Show more" state in a plain useState. When a reader expanded a long report, closing the card, scrolling it out of the virtualized transcript or switching chats and back collapsed it again.

What changed

  • Cut reads and writes its open state through the existing transcript disclosure storage (useTranscriptDisclosure in conversation/transcriptDisclosure.tsx), the same storage the card's own disclosure uses. disclosureKey is now a required prop.
  • Every Cut call site on current base supplies a stable key. There are two, and no prompt cuts remain on base:
    • sub-session reply: subsession-reply:<tool id>:<sub-session id>
    • agent-run result: agent-result:<agent id>
  • Standalone agent-run rows (SubagentGroupRow in App.tsx) render AgentRunTranscriptCard, which wraps the card in TranscriptDisclosureProvider with the row's chat id. That way a tool-call id that repeats in another chat does not share the choice. It follows the existing per-row provider pattern (WorkingRow); no outer provider surrounds these rows, so nothing is wrapped twice. The row memo now compares sessionId so a chat switch re-renders the row.
  • Gallery: the result-reopened variant on SubsessionCallCard expands a result, closes the card, reopens it and checks that "Show more" is still expanded.
  • Tests (webviews/test/subsession-disclosure.test.tsx):
    • the choice survives closing the card and a virtualized remount, and does not carry into a different parent chat
    • an agent run's choice is scoped to its parent chat across switches and remounts

Carry notes: the cherry-pick conflicted in the test file, because base has since replaced the "started labels" test with "a started sub-session's row is its name". The conflict was resolved by keeping base's test and adding the new tests in front of it. No other changes vs the drafts.

Risk

Small and contained to the agent pane's result cards. Choices are stored per view (Normal / Thinking / Verbose), like every other transcript disclosure. A chat-find reveal that opens a cut is now remembered as well.

Leo-ask: ask-e06a62154f
Agent session: agent session
šŸ¤– Generated with Claude Code


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


Summary by cubic

Persists the "Show more" state on sub-session and agent-run result cards so expanding a long report stays expanded after closing the card, scrolling it out of the virtualized transcript, or switching chats and back.

  • Cut now stores its open state through the existing transcript disclosure storage instead of local state, with a required stable disclosureKey per result.
  • Agent-run disclosures are scoped to their parent chat, so a repeating tool-call id in another chat doesn't share the choice.
  • Adds gallery and unit coverage for reopening cards and switching chats.