diff --git a/frontend/src/lib/components/sessions/HomeSessionStarter.svelte b/frontend/src/lib/components/sessions/HomeSessionStarter.svelte
index b43af354b3..92dcc4dc72 100644
--- a/frontend/src/lib/components/sessions/HomeSessionStarter.svelte
+++ b/frontend/src/lib/components/sessions/HomeSessionStarter.svelte
@@ -83,7 +83,7 @@
{#snippet actingOn()}
{#if session}
-
+
{/if}
{/snippet}
diff --git a/frontend/src/lib/components/sessions/SessionWorkspaceBar.svelte b/frontend/src/lib/components/sessions/SessionWorkspaceBar.svelte
index 9aef699490..41cbb73a81 100644
--- a/frontend/src/lib/components/sessions/SessionWorkspaceBar.svelte
+++ b/frontend/src/lib/components/sessions/SessionWorkspaceBar.svelte
@@ -8,8 +8,22 @@
} from './sessionState.svelte'
import WorkspaceFamilyPicker from './WorkspaceFamilyPicker.svelte'
import WorkspaceScopeTrigger from '$lib/components/WorkspaceScopeTrigger.svelte'
+ import { switchWorkspace } from '$lib/storeUtils'
+ import { workspaceAIClients } from '$lib/components/copilot/lib'
+ import { fixupUrlAfterWorkspaceSwitch } from '$lib/components/sidebar/workspaceSwitchUrl'
- let { session }: { session: Session } = $props()
+ // `switchesWorkspace`: a pick also moves the navigation workspace. For a host whose page
+ // shows the navigation workspace around the composer (Home), where a pick that left it
+ // behind would read as ignored; the session page follows the session's own workspace instead.
+ let { session, switchesWorkspace = false }: { session: Session; switchesWorkspace?: boolean } =
+ $props()
+
+ function followPick(id: string) {
+ if (!switchesWorkspace || $workspaceStore === id) return
+ workspaceAIClients.init(id)
+ switchWorkspace(id)
+ void fixupUrlAfterWorkspaceSwitch(id)
+ }
// Effective workspace for display: committed → pending pick → active store.
const effectiveId = $derived(getEffectiveWorkspaceId(session) ?? $workspaceStore ?? undefined)
@@ -17,14 +31,15 @@
function pick(id: string) {
// Pre-send only: writes the pending pick. workspace_id stays undefined until
- // the user sends their first message. The global workspaceStore is left
- // untouched — the chat targets this pending workspace via the manager's
- // workspace resolver, so picking here must not switch the active workspace.
+ // the user sends their first message. The chat targets this pending workspace
+ // via the manager's workspace resolver, not the global workspaceStore.
setSessionPendingWorkspace(session.id, id)
+ followPick(id)
}
function stageFork(req: { parent_workspace_id: string; id: string; name: string }) {
setSessionPendingFork(session.id, req)
+ followPick(req.parent_workspace_id)
}