cmux-tui: a closed tab group reopens as its group (cx-gzh.10)

Merged
TE
23d ago
+196-29

Summary

Close Group (tab_group.close) recorded the group's tabs in closed history but not the group itself. Cmd-Shift-T brought the tabs back loose.

  • The close now attaches the group's archive (id, name, color, icon, tabs) to the closed-history record of its tabs. The attach runs in the same transaction, after the capture. It only matches a record that holds every one of the group's tabs.
  • Captured tab members keep their closed tab id internally. The public list does not show it.
  • Reopen maps each closed tab id to the id it reopened as and forms the group again around those tabs.
  • A partial reopen forms the group around the tabs it chose. Reopening the rest adds them to that group. The reply lists only the tabs that reopen restored.
  • group_archive is now shared by Ungroup and Close Group, and lives in tab_strip.rs to keep tab_groups.rs under the 1000-line cap.

Known gaps (follow-ups, unchanged behavior):

  • A Close Group that empties a whole screen records the tabs inside the screen member, so the group is not attached and the screen reopens with loose tabs.
  • A group linked to a saved tab group reopens unlinked.
  • After a partial reopen, the later tabs join at the end of the group's run, so the order can differ from the original.

Testing

All runs are hosted, at the socket boundary (verify-cmux-tui-hosted.sh):

  • Red, at 3243c714dee3e (test only), filter a_closed_tab_group_reopens_as_its_group, on Linux: reopen_closed_kinds.rs:561 fails with "the reopen formed no group: []".
  • Green, at 6f7aa765376f, filter reopen, on Linux: 80 passed, 0 failed. This includes a_closed_tab_group_reopens_as_its_group, a_partial_reopen_restores_the_chosen_members_and_keeps_the_rest (which now also checks that the group gets all 3 tabs back), a_bulk_close_is_one_group_and_one_reopen_restores_every_tab_in_place and an_ungrouped_tab_group_reopens_whole.
  • crash_ratchet and check-no-godfiles pass for the touched files.
  • A review subagent ran. Its partial-reopen finding is fixed and covered by the test above. Its lookup-hardening finding is done.

Changelog

  • Fixed: Reopening a closed tab group (Cmd-Shift-T) brings its tabs back as the same group, with its name and color.

🤖 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 the tab group close history so reopening a closed tab group (Cmd-Shift-T) brings its tabs back as the same group, with its name, color, and icon, instead of loose tabs.

  • The close now attaches the group's archive (id, name, color, icon, tabs) to the closed-history record of its tabs, in the same transaction.
  • Reopen maps each closed tab id to the id it reopened as and forms the group again; after a partial reopen, later reopened tabs join that same group.

Known gaps (unchanged behavior)

  • Closing a group that empties a whole screen still reopens loose tabs.
  • A group linked to a saved tab group reopens unlinked.
  • After a partial reopen, the later tabs join at the end, so order can differ.