cmux NEXT sidebar: a chat dragged in the Priority view keeps its place

Closed
TE
11d ago
+828-23

Summary

Leo-ask: ask-75bf684b52

Leo (2026-10-21): "i think the click and drag doesn't quite work for moving guys up... some sort of basic baked-in priority view thing sends your chat down since you're dle whereas upper ones are unread... idk how we wanna make this all better".

The sidebar's Priority view ranks every agent chat by tier (needs you, unseen result, failed, Red CI, working, idle) with AgentPriorityRanking, and its rows had no drag at all: a press only opened the chat. So an idle chat always sat below unread ones, and there was no way to move it up.

Now a Priority row drags once the press moves past the sidebar's drag threshold (SidebarPress.movedPastThreshold, the main list's 6 pt; a click with jitter still opens the chat). On drop the view shows the new order at once and sends SidebarPriorityAction.place(id, order:). The feed records the place in the Priority marks (AgentPriorityMarks.State.placed, saved with pins, read and snooze marks; older saved marks still load). The ranking ranks the unplaced chats as before and puts each placed chat back at its place, so the dragged chat holds where it was dropped, whatever its state, until the person drags it again. Chats dragged earlier keep the place they show at when another one is dragged. A placed idle chat stays past the 24-hour idle horizon like a pinned one, and places are pruned with the other marks when acpmux stops listing the chat.

Product choice: Leo's words allow two builds, "a manual order replaces the ranking" or "a dragged chat keeps its dropped place and the rest still rank". This PR takes the second because it changes the least. The Priority view, its tiers, pins and every default stay as they were, and only chats the person actually drags stop auto-ranking. Unplacing a chat (other than dragging it again) is not added here; a follow-up can add that to the row menu if wanted.

Testing

  • AgentPriorityRankingTests.aDraggedChatKeepsItsPlaceWhileTheOthersRank: drag idle-new to the top; a working chat that then asks a question climbs over the others but not over the dragged chat; a second drag keeps the first; a placed idle chat survives the idle horizon; prune drops places.
  • AgentPriorityRankingTests.marksSavedBeforePlacesLoad: marks JSON without placed decodes.
  • SidebarPriorityDragTests (synthesized mouse events on the real SidebarPriorityPanelView in a window): dragging up and down by a slot places the row and sends .place with the shown order; a click, with 3 pt jitter, opens the chat and moves nothing; a drop back in the row's own slot sends nothing.

Observed / Not run

Observed:

  • Red at the test commit RED_SHA: RED_RESULT
  • Green at the fix head HEAD_SHA: GREEN_RESULT
  • cmux-ci compile-check --app --ref HEAD_SHA: passed (job 0800f9718a0be7d9db86c7d2).
  • python3 scripts/cmux-next/prepush-gate.py: no new violations.

Not run: a live drag in a tagged build. The drag was driven only through synthesized events in the test.

Changelog

Changed: A chat you drag in the sidebar's Priority view keeps the place you drop it in, even while idle, and the other chats keep ranking around it.

Proof

No capture: no capture scene shows the Priority view (it needs live acpmux chats), and a drag can't be shown in a still. The behavior is covered by the drag tests above.

Checklist

  • Behavior changes have added or updated tests
  • Localization: no new user-facing strings (the highlight file is English release copy, as the other highlights are)

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

Adds drag-to-reorder to the sidebar's Priority view: a chat you drag keeps the place you drop it in, even while idle, and the other chats keep ranking around it.

  • A row drags once the press passes the sidebar's drag threshold; a click with jitter still opens the chat.
  • The drop order is saved with the other Priority marks and loads on future launches; marks saved by older builds still load.
  • A re-rank, a scroll, or a lost release no longer misplaces an in-flight drag: the drag ends cleanly with no place, and the row springs back.
  • Placed idle chats stay past the idle horizon like pinned ones, and places are pruned when the chat disappears.
  • A release over another window (or a new press elsewhere) ends the drag with no place instead of leaving the row raised.
  • A release note highlight accompanies the change, with its Try it action pointing at the Priority view's toggle.