Repository navigation
cmux NEXT sidebar: an agent's session with --group appears straight in its group, never in the current group first - #30583
Conversation
…dow's current group first (red) 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". The placement registration moves into AgentSessionWorkspace.expectPlacement, unchanged, so the test can drive it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-40b8bd43a311957f85af
…ement test (red) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-40b8bd43a311957f85af
…oup, nested under its caller from the first frame With a group named (acpmux new --group, cmux agent open --group), the new workspace's only placement is the group join: no Cmd-N slot in the window's current group first, which showed the row there for a moment and then moved it across. The caller's lineage parent is recorded before the create, not once the tab has opened, so the row never nests under its caller a beat after it lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-40b8bd43a311957f85af
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Default changesThis pull request changes 2 defaults at
Signed off on this commit by Merge receipt: merged as Regenerate the snapshot with Shipped in:
|
|
Review (subagent claude-opus-5-5 medium): SHIP at c98a891 Every case traced (existing group, the current group as the target, a remote daemon, the newGroup path, Follow-ups:
|
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Packages/macOS/CmuxNext/Sources/CmuxNextApp/Handlers/AgentSessionWorkspace.swift">
<violation number="1" location="Packages/macOS/CmuxNext/Sources/CmuxNextApp/Handlers/AgentSessionWorkspace.swift:106">
P2: `recordParent` persists the child’s lineage before workspace creation succeeds, but the failure paths never roll it back. A failed or refused creation can therefore leave a stale persistent parent that incorrectly nests a later workspace for the same session; add rollback for the early record on every creation failure.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| expectPlacement(key.rawValue, group: group, top: top, parent: parent, windows: windows) | ||
| // The lineage parent before the row lists, so the row nests under its caller from its first frame, never moves | ||
| // under it once the tab has opened. | ||
| AgentSessionWorkspace.recordParent(parent, of: AgentSessionParents.identity(host: targetHost, session: session), |
There was a problem hiding this comment.
P2: recordParent persists the child’s lineage before workspace creation succeeds, but the failure paths never roll it back. A failed or refused creation can therefore leave a stale persistent parent that incorrectly nests a later workspace for the same session; add rollback for the early record on every creation failure.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At Packages/macOS/CmuxNext/Sources/CmuxNextApp/Handlers/AgentSessionWorkspace.swift, line 106:
<comment>`recordParent` persists the child’s lineage before workspace creation succeeds, but the failure paths never roll it back. A failed or refused creation can therefore leave a stale persistent parent that incorrectly nests a later workspace for the same session; add rollback for the early record on every creation failure.</comment>
<file context>
@@ -100,18 +100,11 @@ enum AgentSessionWorkspace {
+ expectPlacement(key.rawValue, group: group, top: top, parent: parent, windows: windows)
+ // The lineage parent before the row lists, so the row nests under its caller from its first frame, never moves
+ // under it once the tab has opened.
+ AgentSessionWorkspace.recordParent(parent, of: AgentSessionParents.identity(host: targetHost, session: session),
+ in: SidebarSessionTreeFeed.shared.recordedParents)
return Task { @MainActor in
</file context>
|
Tip note: this PR and #30565 together added +15 CmuxNextApp Swift lines, so the arch ratchet's |
Leo, 2026-11-01:
What was wrong
agent.openSessionWorkspace(whatacpmux new --group,cmux agent open --groupand the asks reconciler's sessions go through) registered two placements for one new workspace:workspaces.newPlacementslot. Under the defaulttop, that is the top of the window's current group.joininto the named group.So the row first stood in whatever group the window was showing, then moved across on the sidebar's
.movespring 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.lineageNestingis on by default).Fix
groupnamed, the group join is the row's only placement (byDefaultis nil). Without a group, nothing changes: cmux NEXT: a session an agent opens without --group joins its parent's sidebar group #29889's below-the-parent slot, else the setting.sidebar.insertMotionis alreadysnapby 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.mdgets 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
--groupjoins 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 withgroup: "lanes". The test hooks the productionjoinand records where the row stands when the join runs. On base, the row is already in "current" at that point.cmux-ci run --class light --script scripts/ci/package-test-lane.sh --arg=suite --arg=Packages/macOS/CmuxNext --arg=AgentSessionGroupDirectPlacementTests: failed on the fleet (step df9231c4520cd635f681f80d):Expectation failed: (seen.groupBeforeJoin → "g-current") != (.some(current.rawValue) → "g-current")Observed / Not run
Risk: low/normal. One handler's placement registration; a contained sidebar behavior fix.
Changelog
Agent session: agent session
🤖 Generated with Claude Code