cmux-next agent tabs: close tabs of panes closed out of sight; Duplicate Tab keeps the session

Merged
TE
1mo ago
+135-12

Summary

Two agent tab lifecycle fixes from the Swift lifecycle batch.

  • Agent tabs of a pane closed out of sight. PaneController.teardown closed a pane's agent tabs only when the daemon was connected and no longer listed the pane. A pane closed while its window showed another workspace has no controller to tear down. A pane closed while its daemon was away tears down while disconnected. Either way its tabs and web views stayed in AgentTabStore for the rest of the session. The store now records each pane's daemon store and watches it. Once that store is connected with a live tree that no longer lists the pane, the pane's agent tabs close.
  • Duplicate Tab on an agent tab. It opened an empty chat. It now opens a tab right after the original that shows the same acpmux session.

Testing

Red first (commit d58629f5167), then the fix. Both run in the cmux-next swift test lane:

  • AgentTabLifecycleTests.aPaneTheDaemonNoLongerListsClosesItsAgentTabs
  • AgentTabLifecycleTests.duplicatingAnAgentTabShowsTheSameSession

Red and green results are in the comments below. The lane's known failures (RemoteMachineCompat, DaemonStartupState, ColumnCloseScroll) are unrelated.

Changelog

none

šŸ¤– Generated with Claude Code

https://claude.ai/code/session_01RYQHfug1ZVQDp4eWgwVUtD


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

Fixes two agent tab lifecycle bugs: tabs of panes closed out of sight now close, and Duplicate Tab on an agent tab keeps its session instead of opening an empty chat.

Bug Fixes

  • AgentTabStore now records each pane's daemon store and watches it, closing the pane's agent tabs once the daemon is connected with a live tree that no longer lists the pane. This covers panes closed while another workspace was showing or while the daemon was away.
  • Duplicate Tab now opens a tab right after the original showing the same session.