From cfc5e098f278ebc40f3d302885b08129945636f2 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 13 Aug 2026 01:50:04 -0700 Subject: [PATCH] fix(sdk): keep all-profiles sidebar scope on cross-profile openSession (#85155) ensureGatewayProfile narrows the Sessions sidebar to the activated profile as a side effect, so every cross-profile open from a plugin surface silently locked the user into that profile's session list. A plugin-driven open is a navigation, not a scope choice: openSession now restores the unified all-profiles view after a cross-profile activation (keepAllProfilesScope, default true; pass false for the old narrowing). Same-profile opens write no scope at all. --- apps/desktop/src/sdk/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/sdk/index.ts b/apps/desktop/src/sdk/index.ts index ba6e636dbb026..d3d9ae923ef8b 100644 --- a/apps/desktop/src/sdk/index.ts +++ b/apps/desktop/src/sdk/index.ts @@ -26,7 +26,7 @@ import { onGatewayEvent } from '@/contrib/events' import { getLogs, getStatus } from '@/hermes' import { $gateway } from '@/store/gateway' import { notify, notifyError } from '@/store/notifications' -import { $activeGatewayProfile, ensureGatewayProfile, newSessionInProfile } from '@/store/profile' +import { $activeGatewayProfile, ensureGatewayProfile, newSessionInProfile, setShowAllProfiles } from '@/store/profile' import { $activeSessionId, $currentCwd, $currentModel, $gatewayState } from '@/store/session' import { runGatewayRestart } from '@/store/system-actions' @@ -91,15 +91,23 @@ export const host = { /** Open a stored session the way core surfaces do (focus an existing * tile/main, else load into main). When `profile` names a non-active * profile, its backend is activated first so the resume routes to the - * right state.db — the same soft profile swap the unified sidebar does. */ + * right state.db — the same soft profile swap the unified sidebar does. + * `keepAllProfilesScope` (default true) keeps the Sessions sidebar in the + * unified all-profiles view instead of narrowing it to the target + * profile's sessions — a cross-profile open from a plugin surface is a + * navigation, not a scope choice; pass false to also scope the sidebar. */ openSession: async ( storedSessionId: string, - options: { intent?: OpenSessionIntent; profile?: null | string } = {} + options: { intent?: OpenSessionIntent; keepAllProfilesScope?: boolean; profile?: null | string } = {} ): Promise => { const profile = (options.profile ?? '').trim() if (profile && profile !== $activeGatewayProfile.get()) { await ensureGatewayProfile(profile) + + if (options.keepAllProfilesScope !== false) { + setShowAllProfiles(true) + } } openSession(