Skip to content

The agent that grows with you

fix(desktop): Bot-workspace new chats use the bot profile's model, not the ambient composer pick

bheji0793f38972ef39
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.tsx
index 20fc0aa01d1..deab6cc9c1b 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
@@ -4538,6 +4538,51 @@ describe('openNewSessionTile workspace target', () => {
expect(createParams).not.toHaveProperty('cwd')
})
+ it('omits the manual ambient composer model from a Bot-workspace tile so the bot profile default applies', async () => {
+ setCurrentModel('ambient-model')
+ setCurrentProvider('ambient-provider')
+ setCurrentModelSource('manual')
+
+ let createParams: Record<string, unknown> | undefined
+
+ vi.mocked(requestGatewayForAgent).mockImplementation(async (_connectionId, _profile, method, params) => {
+ if (method === 'session.create') {
+ createParams = params as Record<string, unknown>
+
+ return {
+ info: { cwd: '', model: 'profile-default-model', tools: {}, skills: {} },
+ session_id: RUNTIME_SESSION_ID,
+ stored_session_id: 'stored-bot-tile'
+ } as never
+ }
+
+ return {} as never
+ })
+
+ const requestGateway = vi.fn(async () => ({}) as never)
+ let handle: HarnessHandle | null = null
+ render(<Harness onReady={value => (handle = value)} requestGateway={requestGateway} />)
+ await waitFor(() => expect(handle).not.toBeNull())
+
+ const route = { connectionId: 'local', mode: 'local' as const, profile: 'writer', targetProfile: 'writer' }
+
+ try {
+ await act(async () => {
+ await handle!.openNewSessionTile('center', {
+ listed: false,
+ route,
+ workspaceScope: { ownerRoute: route, workspaceMode: 'bots', workspaceOwnerKey: 'bot:local::writer' }
+ })
+ })
+ } finally {
+ setCurrentModelSource('')
+ }
+
+ expect(createParams).toMatchObject({ hidden: true, profile: 'writer' })
+ expect(createParams).not.toHaveProperty('model')
+ expect(createParams).not.toHaveProperty('provider')
+ })
+
it('keeps an unlisted named local legacy-profile tile owned by its bare profile', async () => {
const storedSessionId = 'stored-unlisted-omar'
setConnection({ mode: 'local' } as never)
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.ts
index d4f7378edbb..8ac03353895 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
@@ -296,7 +296,8 @@ async function desktopSessionCreateParams(
cwd: string,
capturedRoute = resolveNewChatOwnerRoute(),
requestedProfile?: string,
- legacyProfileIntent = false
+ legacyProfileIntent = false,
+ includeComposerModel = true
): Promise<Record<string, unknown>> {
// Treat Send as the linearization point for the visible selector state. The
// profile handshake below can yield long enough for background config/model
@@ -331,7 +332,7 @@ async function desktopSessionCreateParams(
source: 'desktop',
...(cwd && { cwd }),
...(profile ? { profile: capturedRoute?.targetProfile || profile } : {}),
- ...(selection.model
+ ...(includeComposerModel && selection.model
? { model: selection.model, ...(selection.provider ? { provider: selection.provider } : {}) }
: {}),
...(selection.effort ? { reasoning_effort: selection.effort } : {}),
@@ -841,12 +842,18 @@ export function useSessionActions({
const cwd =
options?.cwd === null ? '' : typeof options?.cwd === 'string' ? options.cwd.trim() : resolveNewSessionCwd()
+ // Bot-workspace tabs target an agent profile without switching the
+ // window's ambient composer. Do not leak that unrelated session's
+ // manual model/provider into the bot's chat; omitting both lets the
+ // selected profile supply its configured default. Ordinary Sessions
+ // tiles keep the sticky composer override.
const params = {
...(await desktopSessionCreateParams(
cwd,
capturedRoute,
requestedProfile,
- options?.route === null || defaultTarget?.route === null
+ options?.route === null || defaultTarget?.route === null,
+ workspaceScope.workspaceMode !== 'bots'
)),
...(workspaceScope.workspaceMode === 'bots' ? { hidden: true } : {})
}