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.
This commit is contained in:
Teknium 2026-08-13 01:50:04 -07:00 committed by GitHub
parent 04d8222115
commit cfc5e098f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 3 deletions

View File

@ -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<void> => {
const profile = (options.profile ?? '').trim()
if (profile && profile !== $activeGatewayProfile.get()) {
await ensureGatewayProfile(profile)
if (options.keepAllProfilesScope !== false) {
setShowAllProfiles(true)
}
}
openSession(