fix(desktop): bot navigation no longer forces the all-profiles sidebar on

Every host.openSession call in the Bot Mode plugin omitted
keepAllProfilesScope, so the SDK applied its default and flipped
$showAllProfiles back on whenever the target session belonged to a
different profile than the live gateway (sdk/index.ts:
options.keepAllProfilesScope !== false => setShowAllProfiles(true)).

For anyone running more than one profile this silently undid the sidebar
profile filter: narrow Sessions to one profile, click any other bot, and
the unified all-profiles list came back.

Bot navigation is an explicit context switch into that bot's profile, so
pass keepAllProfilesScope: false at every openSession call site (4 on
current main after the plugin.js refactor consolidated the original 7).

Salvaged from PR #89031 onto current main; includes contributor mapping.
This commit is contained in:
marketing2981
2026-08-18 21:15:35 -07:00
committed by Teknium
parent af3373f7c8
commit ed47d41dc9
3 changed files with 8 additions and 6 deletions

View File

@@ -3190,7 +3190,8 @@ async function openStoredBotChat(name, storedId, summary) {
profile: name,
intent: 'main',
awaitHydration: true,
expectHistory
expectHistory,
keepAllProfilesScope: false
})
return storedId
@@ -3230,7 +3231,7 @@ function createCanonicalChat(name) {
if (sid && typeof host.openSession === 'function') {
try {
await host.openSession(sid, { profile: name, intent: 'main' })
await host.openSession(sid, { profile: name, intent: 'main', keepAllProfilesScope: false })
opened = true
} catch {
// The stored row may not exist until the kickoff persists it. Retry
@@ -3245,7 +3246,7 @@ function createCanonicalChat(name) {
await host.request('prompt.submit', { session_id: runtime, text: 'Hey, tell me about yourself!' })
if (!opened && sid && typeof host.openSession === 'function') {
await host.openSession(sid, { profile: name, intent: 'main' })
await host.openSession(sid, { profile: name, intent: 'main', keepAllProfilesScope: false })
}
} catch {
// The chat already exists. Keep the pin so the next click
@@ -7686,7 +7687,7 @@ async function openProfileSession(botName, session, gatewayGeneration) {
typeof session?.message_count === 'number' && Number.isFinite(session.message_count)
const expectHistory = hasAuthoritativeCount ? session.message_count > 0 : Boolean(session?.preview)
await host.openSession(id, { profile, awaitHydration: true, expectHistory })
await host.openSession(id, { profile, awaitHydration: true, expectHistory, keepAllProfilesScope: false })
if (gatewayGeneration !== $sessionsGatewayGeneration.get()) return
$botSelectedSessions.set({ ...$botSelectedSessions.get(), [profile]: id })
}

View File

@@ -90,7 +90,7 @@ test('sessions workspace: opening a stored row uses profile-aware navigation and
const runtime = load({ profile: 'default' })
await runtime.__sessions.openProfileSession('ops', { id: 'stored-123', message_count: 4 }, 0)
assert.deepEqual(plain(runtime.calls), [
['openSession', 'stored-123', { profile: 'ops', awaitHydration: true, expectHistory: true }]
['openSession', 'stored-123', { profile: 'ops', awaitHydration: true, expectHistory: true, keepAllProfilesScope: false }]
])
assert.equal(runtime.__sessions.$botSelectedSessions.get().ops, 'stored-123')
})
@@ -117,7 +117,7 @@ test('sessions workspace: an empty session with no preview does not demand histo
const runtime = load()
await runtime.__sessions.openProfileSession('ops', { id: 'stored-empty', message_count: 0 }, 0)
assert.deepEqual(plain(runtime.calls), [
['openSession', 'stored-empty', { profile: 'ops', awaitHydration: true, expectHistory: false }]
['openSession', 'stored-empty', { profile: 'ops', awaitHydration: true, expectHistory: false, keepAllProfilesScope: false }]
])
})

View File

@@ -0,0 +1 @@
marketing2981