cmux-tui: a Close Group that empties its screen reopens as its group (cx-gzh.31)

Merged
TE
23d ago
+96-20

Summary

#20630 made Close Group reopen as a group, but only when the group's tabs were recorded as tab members. If a group holds every tab of a single-pane screen, closing it removes the screen, and the close records one screen member. That member had no tab ids, so the group was dropped and Cmd-Shift-T brought the screen back with loose tabs.

  • Every closed tab record carries its tab_id, including tabs inside a closed screen or workspace. Public items still copy only allowlisted fields, so the id is not exposed.
  • attach_closed_tab_group finds the newest record whose members hold the first tab id at any depth (json_tree), then checks that the record holds all the group's tabs.
  • Reopen records each closed tab's new id as it reopens, for tab members and through screen and workspace fills, then forms the group around them.

Testing

  • Red: 6cc56925080c adds a_closed_tab_group_that_emptied_its_screen_reopens_as_its_group (hosted run 38625071516).
  • Green: the same focused filter on the fix head. Results to follow in a comment.

Changelog

Fixed: Reopening a closed tab group that filled a whole screen brings back the group instead of loose tabs.

🤖 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

Fixes closing a tab group that fills a whole screen so it reopens as its group instead of loose tabs.

  • Closed tab records now carry their tab_id, including tabs inside a closed screen or workspace.
  • Reopen finds the newest close record holding all the group's tabs at any depth, then reforms the group after mapping each closed tab to its reopened id.

Testing

  • Adds a regression test where a two-tab group fills its screen, closes, and reopens as the same group.