cmux NEXT sidebar: an agent's session with --group appears straight in its group, never in the current group first

Merged
TE
4d ago
+114-14

Leo, 2026-11-01:

a lot of these asks or whatever when you guys create them it looks really odd when they pop up into some existing group on the sidebar as a workspace and then go to wherever they're supposed to go to

i feel like the animation should be less jarring/sometimes they dont need animations

What was wrong

agent.openSessionWorkspace (what acpmux new --group, cmux agent open --group and the asks reconciler's sessions go through) registered two placements for one new workspace:

  1. Cmd-N's workspaces.newPlacement slot. Under the default top, that is the top of the window's current group.
  2. Then a join into the named group.

So the row first stood in whatever group the window was showing, then moved across on the sidebar's .move spring to its real group. That is the jump Leo saw.

A second, smaller late-metadata move: the caller's lineage parent (AgentSessionParents) was recorded only after the chat tab opened. That let the row list at top level and then nest under its caller a moment later (sidebar.lineageNesting is on by default).

Fix

  • With a group named, the group join is the row's only placement (byDefault is nil). Without a group, nothing changes: #29889's below-the-parent slot, else the setting.
  • The lineage parent is recorded before the create, so the row nests from its first frame.
  • New-row motion is unchanged. sidebar.insertMotion is already snap by default: rows below land in place and the new row fades in at its slot. That is the quiet appearance the ask wants. The travel came only from the second placement, which is now gone.

Design spec: leo-workspace design/sidebar.md gets the rule "Never show a new workspace row anywhere but its final place" (PR linked below).

Prior art read: #29889 (an agent's spawn without --group joins its parent's group; kept as is) and #28730 (group-name matching; unchanged).

Test

AgentSessionGroupDirectPlacementTests: a window showing a workspace in group "current" while an agent opens a session with group: "lanes". The test hooks the production join and records where the row stands when the join runs. On base, the row is already in "current" at that point.

Observed / Not run

  • Observed: the fleet suite runs above. Review: SHIP at c98a891c57e59e542eea376d270071a95b18e5cd (receipt comment). Follow-up: #30603.
  • Not run: a nightly with an agent-created session (that is the lane's stop condition, after landing). No capture: Mac-only timing change with no new look.

Risk: low/normal. One handler's placement registration; a contained sidebar behavior fix.

Changelog

  • Fixed: a session an agent opens in a sidebar group appears straight in that group, instead of first showing in the current group and then moving.

Agent session: agent session

πŸ€– Generated with Claude Code