Agent pane: a fresh chat for a past chat shows its turns read-only (cx-5esm)

Merged
TE
1mo ago
+397-10

Summary

Opening a chat from the chats list sometimes starts a fresh agent chat: when the old chat can't resume here because its folder is gone, or acpmux plans a terminal or read-only open for it. That fresh chat now shows the original chat's past turns read-only, where the new chat's hero would be, until it has a session.

  • ChatsOpenCoordinator puts the chat's index key on the seed (pastChat) for the terminal, readOnly and needsFolder routes. Adopted chats replay their history as before.
  • When the page is ready, the model fills handshake.pastTurns from acpmux's _acpmux/chat_transcript (#19507), with a 2 s deadline. The key stays on the seed, so a reload before the first send shows the turns again. A daemon without the verb, or a chat it can't read, shows the normal empty chat.
  • PastChat.tsx draws each prompt as a bubble and each answer as Markdown, under "From the original chat (read-only)" in all 21 locales. It goes away once the chat has a session.

Most of this was built by op-next-toolbar (the cx-khns1 commits). I dropped the pure parser unit test and fixed up the work after a base merge and review.

Testing

Swift (AgentPanePastChatTests, at the model and route boundary):

  • Red on 80a72bf, their test commit: the suite does not compile, because pastChat, AgentPanePastTurn and the reader don't exist yet.
  • Green on 403828a: fleet run-swift-testing-suites.sh Packages/macOS/CmuxNext passed all 107 suites, including AgentPanePastChatTests.

Other checks:

  • Fleet check-release-compile.sh BUILD SUCCEEDED on 46c16f3 (Xcode 26.6). The merged head is compiled again before merge.
  • webviews: bun run check (type-scale, layers, system-blue, vp check) and bun test test/ui-rules.test.ts pass.
  • The god-file check (--base) passes. The crash ratchet adds nothing. The two check-concurrency hits are on base, in files this PR doesn't touch.
  • A review subagent found nothing blocking. Its fixes are in 403828a: the label wording, the 2 s deadline and aria-labelledby.

Changelog

Added: Opening a past chat that can't resume here shows its earlier turns, read-only, above the new chat.

🤖 Generated with Claude Code


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


Summary by cubic

Opening a chat that can't resume here now starts a fresh chat that shows the original chat's past turns read-only, where the new chat's hero would be, instead of an empty chat.

  • The chat's index key rides on the seed (pastChat), so a reload before the first send shows the turns again; adopted chats replay their history as before.
  • Turns come from the daemon's _acpmux/chat_transcript with a 2 s deadline; a daemon without the verb or an unreadable chat shows the normal empty chat.
  • The turns render under "From the original chat (read-only)" in all 21 locales and disappear once the chat has a session.