Files
pipelines/app/notes/chat-list-pane-menu.md
T
alan 3ce7f7a5dd Expose pane actions in chat list menu
Share the open chat pane menu choices with session rows so list actions use the same handlers and target the selected chat. Add command routing, pane movement support, and focused coverage for wide and narrow layouts.
2026-11-12 01:17:46 +00:00

8.6 KiB

Chat list row menu offers the open pane's More choices

Run 385, stage 01-implement. Source only; nothing committed, no UI captured.

What changed

The chat list row's More menu now also offers the choices of the open chat pane's More menu, under the same labels and visibility, after its split and Float items and before the list's own Star, Colour, Rename, Close and Hide.

Offered choices and what each runs for the row's chat:

Choice Shown when (as the pane shows it) Runs
Add chat pane always opens the row's chat, then _addPane
Open chats (n) more than one pane opens the row's chat, then _pickPane
Center stage (shortcut) / Leave center stage more than one pane, wide layout opens the row's chat, then toggles center stage
Move up / Move down / Move left / Move right (shortcut as text) the row's chat is in a tiled pane (the pane's own rule); a direction with no neighbour is listed disabled _movePane with the pane's move target for that direction; the chat is already open, so nothing is opened
Close pane the row's chat is in a pane and more than one pane _closePane for that pane
Chat details inside a window only opens the chat, then the conversation's info
Files always opens the chat, then the conversation's Files toggle
Run command… always opens the chat, then the conversation's run dialog
Dismiss all finished commands the chat's conversation holds finished runs opens the chat, then the conversation's dismiss
Open in terminal a terminal surface and a folder opens the chat, then the conversation's terminal open

Float keeps its existing list behaviour. Open to the right and Open below are offered only where the pane offers them (wide layout), as before.

Choices are read when the menu opens, so they follow the panes as they are then.

How it is wired

  • ui/sessions/session_pane_menu.dart: SessionPaneMenu (choices and run) and SessionPaneAction. ChatSessionsScreen takes it as paneMenu and passes it down the row chain as one stable object, so no memo key changes.
  • ui/layout/app_overflow_menu.dart: optional actionsBuilder, called when the menu opens, and AppMenuAction.enabled (default true) for disabled items. Existing callers are unchanged.
  • Move targets: ChatWorkspace reports each pane's move targets (the same map its pane scope uses) through the new onMoveTargetsChanged callback after a layout that changed them. chat_screen_workspace.dart stores them; the list reads them when its menu opens, and _movePane runs the chosen swap.
  • chat_screen_pane_menu.dart (mixin on ChatScreen): builds the choices with the pane's own conditions and runs them. Pane-level handlers are the same methods the pane's menu calls.
  • workspace/chat_pane_commands.dart: ChatPaneCommands, a small bus. The list opens the chat and requests a command; the chat's ChatThreadView takes it once built (initState post-frame, or on notify) and runs the same handler its own menu uses. It also records which chats hold finished runs.
  • conversation/chat_thread_view.dart: takes requests, reports finished runs, and shares the terminal refusal notice with its header.
  • workspace/chat_center_stage_action.dart: label extracted to chatCenterStageLabel, used by both menus.

Focused results

Command: tool/memwatch/full.sh 'test/features/chat/ui/sessions test/features/chat/chat_floating_pane_test.dart'

  • PASS: 127 passed, 0 failed, 0 skipped; peak 1674 MB; 31s; exit 0.
  • Verdict named only the two intended paths.
  • An earlier run had one failure in the new narrow-layout test (the phone's open chat covers the list). The test now taps chat-back first. No expectation was changed.

New tests:

  • ui/sessions/chat_session_actions_test.dart
    • The row menu shows pane choices in order before Star, and choosing one runs run for that row only (no gateway calls beyond the list's read).
    • A disabled pane choice is listed disabled and running it does nothing; an enabled move runs.
    • The choices are read at each open (an emptied list drops the item).
    • Command requests reach a chat once, in order; finished-run flags set and clear.
  • chat_floating_pane_test.dart
    • Wide: the list menu for chat b offers the pane choices and omits Chat details and Open in terminal.
    • Wide, side by side: Move up/down/right are listed disabled, Move left is enabled, and choosing it swaps b with a (panes now b, a).
    • Close pane from the list closes that pane only.
    • Files from the list opens a chat that was not open (it becomes a pane).
    • Run command… from the list shows the run dialog and leaves panes unchanged.
    • Narrow: Add chat pane and Open chats (2) show; Center stage, Float, Open to the right and every Move do not.

Analyzer: tool/analyze.sh lib/features/chat lib/ui/layout/app_overflow_menu.dart test/features/chat/ui/sessions test/features/chat/chat_floating_pane_test.dart reports clean (0 errors, 0 warnings, 0 infos).

Affected UI states (not captured, not verified in a browser or on a device)

  • Wide list row menu, with one pane and with two or more panes.
  • Narrow list row menu (Add chat pane, Open chats, no Float or Open to the right).
  • Row menu for a chat not open (Files, Run command… open it into a pane).
  • Row menu with a window (Chat details appears only for a window's own pane, so it is not shown from the main list).
  • Dismiss all finished commands, Open in terminal, Center stage, Close pane with terminal and finished-run states: code paths only, no test asserts them.

Limitations

  • Move shortcut hints are text. The pane shows the move chord beside the label through Material's menu shortcut; a list item has only a label, so the list writes it into the label, e.g. Move up (Ctrl+Alt+Shift+Up) (Command+ Option+Shift on macOS). Same chord, different presentation.
  • Move targets are one layout behind at most. They are reported after a frame, so a menu opened during the very first layout after a change may read the previous targets.
  • Dismiss all finished commands appears only after the chat's conversation has reported finished runs in this visit. A chat never opened this visit will not show it, even if the server has finished runs for it.
  • Open in terminal and Run command… from the list open the chat first, as the rule for this change requires; the pane itself does not need the chat opened for them.
  • Add chat pane, Open chats and Center stage from the list are not asserted by tests beyond the menu labels and the run/close paths above.
  • Changed shared code that other suites use: chatCenterStageLabel extraction, the header's terminal refusal (now _terminalRefused), and AppOverflowMenu (new optional actionsBuilder). Suites beyond the two named files were not run here; the land gate covers them.
  • No Cupertino code, tests or captures were added.

Re-entry after ui-review: list Files did not open the panel

Defect: choosing Files from an unopened chat's list menu opened and selected the chat, but the Files panel stayed hidden. Cause: the list's request was taken in the thread view's first post-frame callback, which toggled Files on. The saved Files state then loaded asynchronously and wrote the stored value (hidden) over it.

Fix (conversation/chat_thread_view.dart):

  • _takeCommands waits until the saved Files state has loaded (_filesPrefsLoaded), so the Files toggle always acts on the loaded state.
  • _loadFilesPreferences runs pending commands once the state is set.
  • A session switch resets _filesPrefsLoaded and retries pending commands after the frame, so a request made before the pane showed the chat is not stranded.

Test (chat_floating_pane_test.dart, "a list choice opens a chat that is not open first"): now also asserts that the FilesPanel is shown. It failed before the fix (0 FilesPanel widgets) and passes after.

Focused results after the fix: tool/memwatch/full.sh 'test/features/chat/chat_floating_pane_test.dart test/features/chat/ui/sessions test/features/chat/conversation/chat_floating_chrome_test.dart test/features/chat/conversation/chat_thread_view_test.dart test/features/chat/files/files_directory_metadata_test.dart'

  • PASS: 142 passed, 0 failed, 0 skipped; peak 1890 MB; 30s; exit 0.
  • Verdict named only those paths.

Analyzer (tool/analyze.sh lib/features/chat lib/ui/layout/app_overflow_menu.dart test/features/chat/ui/sessions test/features/chat/chat_floating_pane_test.dart): clean.

Limitations: the wider conversation suites (about 40 files that use ChatThreadView) were not run here; the land gate covers them. Narrow-width Files (bottom sheet) from the list is not asserted by a test.