The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): own tab-strip drafts from the draft profile
KoNit-K88a7e6f96a74
diff --git a/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx b/apps/desktop/src/app/session/hooks/use-session-actions.test.tsxindex 668029481ab..353c43d3dce 100644--- a/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-session-actions.test.tsx@@ -4106,6 +4106,8 @@ describe('openNewSessionTile workspace target', () => {afterEach(() => {cleanup()$profiles.set([])+ $newChatProfile.set(null)+ $activeGatewayProfile.set('default')$projectScope.set(ALL_PROJECTS)$projectTree.set([])$sessionTiles.set([])@@ -4198,6 +4200,51 @@ describe('openNewSessionTile workspace target', () => {undefined)})++ it('records the draft profile owner when tab-strip create omits profile', async () => {+ const storedSessionId = 'stored-unlisted-draft-omar'+ $profiles.set([{ name: 'default' }, { name: 'omar' }] as never)+ $newChatProfile.set('omar')+ $activeGatewayProfile.set('default')+ setConnection({ mode: 'local' } as never)++ const requestGateway = vi.fn(async (method: string) => {+ if (method === 'session.create') {+ return {+ info: { cwd: '', model: 'test-model', tools: {}, skills: {} },+ session_id: RUNTIME_SESSION_ID,+ stored_session_id: storedSessionId+ } as never+ }++ throw new Error(`Unexpected ambient RPC: ${method}`)+ })+ vi.mocked(requestGatewayForProfile).mockResolvedValue({ control: {} } as never)++ let handle: HarnessHandle | null = null+ render(<Harness onReady={value => (handle = value)} requestGateway={requestGateway} />)+ await waitFor(() => expect(handle).not.toBeNull())++ await act(async () => {+ await handle!.openNewSessionTile('center', { listed: false })+ })++ expect($sessionTiles.get()).toContainEqual(expect.objectContaining({ ownerProfile: 'omar', storedSessionId }))+ expect(knownOwnerForSession(storedSessionId)).toBe('omar')++ await expect(+ requestForOwnedSession(storedSessionId, requestGateway, 'session.control.read', {+ session_id: RUNTIME_SESSION_ID+ })+ ).resolves.toEqual({ control: {} })+ expect(requestGatewayForProfile).toHaveBeenCalledWith(+ 'omar',+ 'session.control.read',+ { session_id: RUNTIME_SESSION_ID },+ undefined,+ undefined+ )+ })})describe('openNewSessionTile unlisted owner (#102792)', () => {diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts b/apps/desktop/src/app/session/hooks/use-session-actions/index.tsindex 1d83e5c4b07..877f368e9cd 100644--- a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts+++ b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts@@ -769,13 +769,15 @@ export function useSessionActions({// occupied (openTab path for "New session in Home").const capturedRoute = options?.route !== undefined ? options.route : resolveNewChatOwnerRoute(options?.profile)- // A named local profile deliberately uses the legacy profile-only- // transport, so it has no connectionId to capture. For an explicit,- // unique non-default profile from the active local roster, the bare- // profile is still an authoritative pool owner. Keep every other null- // route unresolved: explicit null, default, remote, missing or- // duplicate profile intent retains its prior behavior.- const requestedProfile = typeof options?.profile === 'string' ? normalizeProfileKey(options.profile) : null+ // A named local profile uses the legacy profile-only transport (no+ // connectionId). Tab-strip "+" omits `options.profile`; the draft or+ // active profile is still the owner. Unique non-default local roster+ // names stay authoritative; default/remote/duplicate stay unresolved.+ const requestedProfile = normalizeProfileKey(+ typeof options?.profile === 'string' && options.profile+ ? options.profile+ : ($newChatProfile.get() || $activeGatewayProfile.get())+ )const legacyOwnerProfile =options?.route === undefined &&!capturedRoute &&