Honor iMessage workspace ordering and previews

Merged
LA
6mo ago
+261-47

Task: iMessage mode workspace ordering and sidebar previews.

Changes:

  • Insert new workspaces at the top of the unpinned segment when iMessage mode is enabled, while pinned workspaces remain first.
  • Show the latest conversation message in the sidebar, including human prompt submits and agent final responses.
  • Handle stop and subagent stop feed events as assistant final messages.

Testing:

  • xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-unit -configuration Debug -destination 'platform=macOS' -derivedDataPath /tmp/cmux-imtop-test -only-testing:cmuxTests/WorkspaceCreationPlacementTests -only-testing:cmuxTests/WorkspacePromptSubmitTests test
  • ./scripts/reload.sh --tag imtop

[!NOTE]
Medium Risk
Changes workspace insertion/reordering behavior and feed-event side effects in iMessage mode, which can impact tab ordering, selection, and sidebar rendering. Risk is limited to UI/state updates (no auth/data persistence changes) but touches central TabManager and event-handling paths.

Overview
Improves iMessage mode workspace behavior and sidebar previews. New workspaces now insert at the top of the unpinned segment when iMessage mode is enabled (via WorkspacePlacementSettings.effectivePlacement), keeping pinned workspaces grouped first.

Sidebar preview text is renamed and expanded from latestSubmittedMessage to latestConversationMessage, and is now updated from both user prompt submits and assistant final responses; .stop/.subagentStop feed events trigger these assistant-final side effects.

Global search browse hits now treat .rightSidebarTool panels like title-only panels (previously excluded from the switch).

Reviewed by Cursor Bugbot for commit 705d7ec2202cd3370371d646f186d394f051fa2d. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Makes iMessage mode feel like Messages: new workspaces go to the top of unpinned tabs, and the sidebar shows the latest conversation message (user prompt or assistant final). Stop events now count as assistant finals for previews and ordering, and repeated finals still bump the thread.

  • New Features

    • Insert new workspaces at the top of the unpinned segment when iMessage mode is on; pinned stay first and selection is preserved.
    • Sidebar preview now uses latestConversationMessage, showing user submits and assistant finals from .stop/.subagentStop; extracts text from event JSON/context and trims whitespace.
    • On prompt submit or a non-blank assistant final, record the preview and move the workspace to the top in iMessage mode.
  • Bug Fixes

    • Include the right sidebar tool panel in global search.
    • Reorder on repeated assistant finals even if the preview text doesn’t change; ignore blank finals.

Summary by CodeRabbit

  • New Features

    • New workspace insertion: when iMessage mode is enabled, new workspaces are placed at the top of the unpinned segment.
  • Improvements

    • Sidebar now shows conversation-based message previews with better de-duplication and trimming.
    • Assistant event handling expanded to record final messages (including stop events) and update workspace ordering.
    • Search mapping improved for right-sidebar results.
  • Tests

    • Updated/added tests for iMessage placement, conversation-message behavior, and assistant final-message scenarios.

Review Change Stack