The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): a split-dragged Bot tab keeps its Bot workspace scope
liguoyu1592e48ac9e6
diff --git a/apps/desktop/src/store/session-states.test.ts b/apps/desktop/src/store/session-states.test.tsindex 3d1bcf26309..9c026b223d9 100644--- a/apps/desktop/src/store/session-states.test.ts+++ b/apps/desktop/src/store/session-states.test.ts@@ -382,6 +382,45 @@ describe('SessionTile workspace scope', () => {})})+ it('preserves an existing Bot tile scope when moving it without an explicit scope', () => {+ const scope = {+ ownerRoute: {+ connectionId: 'connection-a',+ mode: 'remote' as const,+ profile: 'default',+ targetProfile: 'default'+ },+ workspaceMode: 'bots' as const,+ workspaceOwnerKey: 'bot:connection-a::default',+ workspaceTabTitle: 'Bot chat'+ }++ openSessionTile('bot-chat', 'right', undefined, undefined, scope)+ $layoutTree.set(group(['workspace', 'session-tile:bot-chat'], { id: 'workspace-group' }))+ // A split drag re-docks the tab with no scope (session-drag onCommit).+ openSessionTile('bot-chat', 'left', 'workspace')++ expect($sessionTiles.get()).toEqual([+ expect.objectContaining({+ anchor: 'workspace',+ dir: 'left',+ ownerRoute: scope.ownerRoute,+ storedSessionId: 'bot-chat',+ workspaceMode: 'bots',+ workspaceOwnerKey: scope.workspaceOwnerKey,+ workspaceTabTitle: 'Bot chat'+ })+ ])++ // An explicit scope from the caller still wins over the tile's current one.+ openSessionTile('bot-chat', 'right', 'workspace', undefined, { workspaceMode: 'sessions' })++ expect($sessionTiles.get()).toEqual([+ expect.objectContaining({ dir: 'right', storedSessionId: 'bot-chat', workspaceMode: 'sessions' })+ ])+ expect($sessionTiles.get()[0]).not.toHaveProperty('workspaceOwnerKey', scope.workspaceOwnerKey)+ })+it('preserves workspace scope while dropping a stale runtime binding', () => {$sessionTiles.set([{diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.tsindex 605dfc0d608..fd9cb8cf60e 100644--- a/apps/desktop/src/store/session-states.ts+++ b/apps/desktop/src/store/session-states.ts@@ -1409,9 +1409,17 @@ export function openSessionTile(dir: TileDock = 'right',anchor?: string,before?: null | string,- workspaceScope: SessionTileWorkspaceScope = { workspaceMode: 'sessions' }+ explicitScope?: SessionTileWorkspaceScope) {const tiles = $sessionTiles.get()+ const existing = tiles.find(t => t.storedSessionId === storedSessionId)++ // No scope on an already-open tile is a MOVE (a split drag re-docking a tab),+ // not a re-scope: keep the workspace it lives in instead of re-bucketing it+ // into Sessions — a Bot tab used to vanish from the Bot workspace on drop.+ const workspaceScope: SessionTileWorkspaceScope = explicitScope ?? {+ workspaceMode: existing?.workspaceMode ?? 'sessions'+ }// Opening a session in a tab/tile is "reading" it — clear its unread dot// exactly like main-thread resume does. Previously only@@ -1459,7 +1467,9 @@ export function openSessionTile(return}- setSessionTileWorkspaceScope(storedSessionId, workspaceScope)+ if (explicitScope) {+ setSessionTileWorkspaceScope(storedSessionId, explicitScope)+ }// Already open: relocate the existing pane to the drop target (pane-mirror// only docks on first adoption, so a re-drag must move the tree pane itself).