cmux-next sidebar: manual order only; attention order lives in the Priority view

Merged
TE
16d ago
+73-210

In progress: waiting on CI's compile and the regression test's red on base and green on head.

Leo (2026-10-20): the normal sidebar keeps manual order. A drag always sticks, and no row moves on its own. Unread and attention show only as badges. Sorting by attention belongs only in the optional Priority view (#22778).

What was moving rows

  • SidebarRows.show ran SidebarPriority().reordered on every rebuild while model.priorityOrdering was on.
  • priorityOrdering reused notifications.attention.moveToTop, which is on by default. With the default, any rebuild after a state change (unread, waiting, failed, working, done) re-sorted the rows and undid the user's drag.
  • This PR deletes that projection: SidebarRows.show now sets the rows it was given. It also removes SidebarModel.priorityOrdering and SidebarPriority.reordered, along with that function's helpers and its test. SidebarPriority.items stays, because the Priority view uses it.

Sort settings checked

  • Sort by Name, Last Used and Directory (WorkspaceSortKey) run only as one-shot actions (WorkspaceVerbHandlers.sort). Nothing applies them again when something changes.
  • sidebar.groupBy defaults to none.

Not in this PR

  • When a notification arrives, NotificationCenterService.moveToTop still moves its workspace to the top once (notifications.attention.moveToTop, default on, matching classic's app.reorderOnNotification). This is also an automatic move. Turning the default off is a defaults change, which needs a call-owner review, so it goes in a separate PR to keep this one from being held.
  • #22626 builds on the projection this PR deletes, so this PR makes it moot.

Test

Tests/CmuxNextAppTests/SidebarManualOrderTests.swift:

  1. Five rows, with moveToTop on. Drag row 5 to row 1.
  2. Every other row turns unread, waiting, failed or working, both in place and through a full rebuild, before and after the daemon holds the drag.
  3. Then they all finish.

The order stays w5 w1 w2 w3 w4 throughout. Commit a0b00158cd6 adds the test alone; it should fail on base.

Observed / Not run

  • Observed: prepush-gate.py reports no new violations.
  • Not run yet: the Swift compile and the test (fleet and CI), both pending.

Changelog

  • Changed: The sidebar keeps the order you set. A row's unread or agent state no longer moves it, and attention order lives in the Priority view.

Agent session: cosmic-gray

๐Ÿค– 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

Makes the cmux-next sidebar keep manual order only: a drag always sticks and no row moves on its own. Unread and attention states now show only as badges; attention order lives just in the Priority view.

Previously SidebarRows.show re-sorted rows by attention while notifications.attention.moveToTop was on (the default), undoing a drag on any rebuild after a state change. This PR removes that projection entirely (SidebarPriority, SidebarPriorityModel.priorityOrdering, and their tests) โ€” the Priority view ranks chats with AgentPriorityRanking instead โ€” and adds a regression test covering drags across unread, waiting, failed, working, and done state changes.

One behavior is unchanged for now: when a notification arrives, its workspace still jumps to the top once. Changing that default is deferred to a separate PR.