Skip to content

The agent that grows with you

fix(desktop): Bot Mode tabs caption a Bot Chat with the bot's name, not "Bot Chat"

Teknium209de12d5f44
diff --git a/apps/desktop/e2e/bot-mode-tab-shows-bot-name.spec.ts b/apps/desktop/e2e/bot-mode-tab-shows-bot-name.spec.ts
new file mode 100644
index 00000000000..c26cd180432
--- /dev/null
+++ b/apps/desktop/e2e/bot-mode-tab-shows-bot-name.spec.ts
@@ -0,0 +1,137 @@
+import fs from 'node:fs'
+import path from 'node:path'
+
+import {
+ buildAppEnv,
+ createSandbox,
+ launchDesktop,
+ type MockBackendFixture,
+ waitForAppReady,
+ writeEnvFile,
+ writeMockProviderConfig
+} from './fixtures'
+import { MOCK_REPLY, startMockServer } from './mock-server'
+import { RealSessionBuilder } from './real-session-builder'
+import { expect, test } from './test'
+
+// Every bot's canonical chat is STORED under the same title ("Bot Chat" — the
+// name the gateway resolves it by), so the main tab strip captioned every open
+// bot chat identically and two bots' tabs were indistinguishable (#99152). The
+// tab must read the bot's display name while the stored title stays canonical.
+
+type Page = MockBackendFixture['page']
+
+let fixture: MockBackendFixture | null = null
+
+async function openBots(page: Page): Promise<void> {
+ const tab = page
+ .getByRole('button', { name: 'Bots', exact: true })
+ .or(page.getByRole('tab', { name: 'Bots', exact: true }))
+ .first()
+
+ await tab.click()
+ await expect(page.getByRole('button', { name: 'New bot or group chat' })).toBeVisible()
+}
+
+async function openUntil(action: () => Promise<void>, expected: () => Promise<void>, attempts = 3): Promise<void> {
+ for (let attempt = 1; ; attempt += 1) {
+ await action()
+
+ try {
+ await expected()
+
+ return
+ } catch (error) {
+ if (attempt >= attempts) {
+ throw error
+ }
+ }
+ }
+}
+
+async function seedBot(hermesHome: string, mockUrl: string, name: string): Promise<void> {
+ const dir = path.join(hermesHome, 'profiles', name)
+ fs.mkdirSync(dir, { recursive: true })
+ writeMockProviderConfig(dir, mockUrl)
+ writeEnvFile(dir)
+
+ const builder = await RealSessionBuilder.start(dir)
+
+ try {
+ await builder.createSession({ title: 'Bot Chat', turns: [`Hello ${name}`] })
+ } finally {
+ await builder.close()
+ }
+}
+
+/** Every tab caption in the main strip (the main `workspace` tab + tiles). */
+function mainStripTabTitles(page: Page): Promise<string[]> {
+ return page.evaluate(() =>
+ [...document.querySelectorAll<HTMLElement>('[data-zone-tabstrip="grp-main"] [data-tree-tab]')].map(element =>
+ (element.textContent ?? '').trim()
+ )
+ )
+}
+
+test.beforeAll(async () => {
+ const mock = await startMockServer()
+ const sandbox = createSandbox('bots-tabname')
+ writeMockProviderConfig(sandbox.hermesHome, mock.url)
+ writeEnvFile(sandbox.hermesHome)
+ await seedBot(sandbox.hermesHome, mock.url, 'alpha')
+ await seedBot(sandbox.hermesHome, mock.url, 'beta')
+
+ const { app, page } = await launchDesktop(buildAppEnv(sandbox))
+
+ fixture = {
+ app,
+ page,
+ mock,
+ mockUrl: mock.url,
+ sandbox,
+ cleanup: async () => {
+ await app.close().catch(() => undefined)
+ await mock.close()
+ sandbox.cleanup()
+ }
+ }
+ await waitForAppReady(fixture, 120_000)
+})
+
+test.afterAll(async () => {
+ await fixture?.cleanup()
+ fixture = null
+})
+
+test("an open Bot Chat's tab reads the bot's name, not the canonical 'Bot Chat' title", async () => {
+ test.setTimeout(300_000)
+ const page = fixture!.page
+
+ await openBots(page)
+
+ const alphaRow = page.getByRole('button', { name: /^alpha\b/i }).filter({ visible: true }).first()
+ await expect(alphaRow).toBeVisible({ timeout: 30_000 })
+
+ await openUntil(
+ () => alphaRow.click(),
+ () =>
+ expect(page.getByText('Hello alpha', { exact: true }).filter({ visible: true }).first()).toBeVisible({
+ timeout: 45_000
+ })
+ )
+
+ // A `+` side thread beside the Bot Chat gives the main zone a tab strip —
+ // the surface where every bot chat used to read "Bot Chat".
+ await page.keyboard.press('Control+t')
+ const composer = page.locator('[data-slot="composer-root"] [contenteditable="true"]').filter({ visible: true }).first()
+ await expect(composer).toBeVisible({ timeout: 15_000 })
+ await composer.click()
+ await composer.fill('hello alpha thread')
+ await page.keyboard.press('Enter')
+ await expect(page.getByText(MOCK_REPLY).filter({ visible: true }).first()).toBeVisible({ timeout: 60_000 })
+
+ await expect.poll(() => mainStripTabTitles(page), { timeout: 15_000 }).toHaveLength(2)
+ const captions = await mainStripTabTitles(page)
+ expect(captions.some(caption => /alpha/i.test(caption))).toBe(true)
+ expect(captions.some(caption => /bot chat/i.test(caption))).toBe(false)
+})
diff --git a/apps/desktop/src/app/chat/session-tile.tsx b/apps/desktop/src/app/chat/session-tile.tsx
index 35f4bdad9a1..46e5a180c78 100644
--- a/apps/desktop/src/app/chat/session-tile.tsx
+++ b/apps/desktop/src/app/chat/session-tile.tsx
@@ -28,6 +28,7 @@ import { formatRefValue } from '@/components/assistant-ui/directive-text'
import { CenteredThreadSpinner } from '@/components/assistant-ui/thread/status'
import { findGroupOfPane } from '@/components/pane-shell/tree/model'
import { $layoutTree, closeTreePane, moveTreePane, setTreeGroupTabStrip } from '@/components/pane-shell/tree/store'
+import { $workspaceOwnerLabels, workspaceOwnerTitle } from '@/components/pane-shell/workspace-scope'
import { Button } from '@/components/ui/button'
import { ConfirmDialog } from '@/components/ui/confirm-dialog'
import { transcribeAudio } from '@/hermes'
@@ -489,14 +490,23 @@ function tileTitle(storedSessionId: string): string {
return stored ? sessionTitle(stored) : explicit || NEW_SESSION_TITLE
}
+/** The tab's CAPTION: a bot chat's owner name over the canonical stored title
+ * (#99152). The menu keeps `tileTitle` — rename/delete show the real row. */
+function tileCaption(storedSessionId: string): string {
+ return workspaceOwnerTitle(
+ tileTitle(storedSessionId),
+ $sessionTiles.get().find(tile => tile.storedSessionId === storedSessionId)
+ )
+}
+
/** The `@session` link payload for a tile tab drag — id + owning profile + title.
* Resolved at drag time, so an unsent tab drags under its draft name. */
function tileDragPayload(storedSessionId: string): SessionDragPayload {
const stored = tileStoredRow(storedSessionId)
- const explicit = $sessionTiles.get().find(tile => tile.storedSessionId === storedSessionId)?.workspaceTabTitle
- const title = stored ? sessionTitle(stored) : explicit || draftTitleFor(storedSessionId) || NEW_SESSION_TITLE
+ const tile = $sessionTiles.get().find(candidate => candidate.storedSessionId === storedSessionId)
+ const title = stored ? sessionTitle(stored) : tile?.workspaceTabTitle || draftTitleFor(storedSessionId) || NEW_SESSION_TITLE
- return { id: storedSessionId, profile: stored?.profile ?? '', title }
+ return { id: storedSessionId, profile: stored?.profile ?? '', title: workspaceOwnerTitle(title, tile) }
}
// ---------------------------------------------------------------------------
@@ -683,14 +693,14 @@ export const watchSessionTiles = paneMirror<SessionTile>({
// $projectTree: a tile whose session is older than the recents page resolves
// its title through the tree, which loads after the tiles register. (The tab's
// status dot subscribes to color/state itself, so it needs no `also` entry.)
- also: [$sessions, $projectTree],
+ also: [$sessions, $projectTree, $workspaceOwnerLabels],
key: t => t.storedSessionId,
prefix: 'session-tile',
dir: t => t.dir,
anchor: t => t.anchor,
before: t => t.before,
minWidth: '20rem',
- title: tileTitle,
+ title: tileCaption,
// The tab's status dot — the SAME primitive the sidebar row renders, keyed by
// the stored id, so a session's status/color can never disagree between the
// two surfaces. Self-subscribing (live state + resolved color), so the strip
diff --git a/apps/desktop/src/app/contrib/controller.tsx b/apps/desktop/src/app/contrib/controller.tsx
index 5c626d91b4e..ad30d21f666 100644
--- a/apps/desktop/src/app/contrib/controller.tsx
+++ b/apps/desktop/src/app/contrib/controller.tsx
@@ -34,6 +34,7 @@ import {
toggleTargetZoneTabStrip,
watchContributedPanes
} from '@/components/pane-shell/tree/store'
+import { $workspaceOwnerLabels, workspaceOwnerTitle } from '@/components/pane-shell/workspace-scope'
import { SidebarProvider } from '@/components/ui/sidebar'
import { discoverBundledPlugins } from '@/contrib/plugins'
import { Slot } from '@/contrib/react/slot'
@@ -70,6 +71,7 @@ import {
} from '@/store/review'
import { $currentCwd, $selectedStoredSessionId, $sessions, $yoloActive, sessionMatchesStoredId } from '@/store/session'
import { watchSessionPins } from '@/store/session-pin-sync'
+import { $botChatScopes } from '@/store/session-states'
import { watchUnreadWriteGuard } from '@/store/session-unread-remote'
import { $statusbarVisible } from '@/store/statusbar-prefs'
import { isBrowserWindow, isHudWindow } from '@/store/windows'
@@ -490,7 +492,12 @@ const syncWorkspaceTitle = () => {
area: 'panes',
// The placeholder, not the draft's live name — `tabTitle` below renders
// that. Keeping it here would re-register the pane on every keystroke.
- title: stored ? storedSessionTitle(stored) : NEW_SESSION_TITLE,
+ // A bot chat reads as its BOT: every canonical Bot Chat is stored under
+ // the same name, which told two open bots apart by nothing (#99152).
+ title: workspaceOwnerTitle(
+ stored ? storedSessionTitle(stored) : NEW_SESSION_TITLE,
+ selected ? $botChatScopes.get()[selected] : undefined
+ ),
data: {
// The tab's status dot — the SAME primitive the sidebar row and session
// tiles render, so the main tab never disagrees with its sidebar row. A
@@ -515,6 +522,8 @@ const syncWorkspaceTitle = () => {
$selectedStoredSessionId.listen(syncWorkspaceTitle)
$sessions.listen(syncWorkspaceTitle)
+$botChatScopes.listen(syncWorkspaceTitle)
+$workspaceOwnerLabels.listen(syncWorkspaceTitle)
$workspaceIsPage.listen(syncWorkspaceTitle)
// Layout reset collapses every session tile into main as a tab (after the
diff --git a/apps/desktop/src/components/pane-shell/workspace-scope.test.ts b/apps/desktop/src/components/pane-shell/workspace-scope.test.ts
index e90d5cb02a8..3e5b3ef6d0c 100644
--- a/apps/desktop/src/components/pane-shell/workspace-scope.test.ts
+++ b/apps/desktop/src/components/pane-shell/workspace-scope.test.ts
@@ -9,7 +9,9 @@ import {
rememberActivePane,
resetRememberedActivePanes,
resolveRememberedActivePane,
- setWorkspaceScope
+ setWorkspaceOwnerLabel,
+ setWorkspaceScope,
+ workspaceOwnerTitle
} from './workspace-scope'
afterEach(() => {
@@ -67,6 +69,21 @@ describe('workspace scope', () => {
})
})
+describe('workspace owner title', () => {
+ it("captions a bot chat by its bot instead of the canonical stored title, and leaves everything else alone (#99152)", () => {
+ setWorkspaceOwnerLabel('bot:alpha', 'Alpha')
+ const botChat = { workspaceMode: 'bots' as const, workspaceOwnerKey: 'bot:alpha', workspaceTabTitle: 'Bot Chat' }
+
+ expect(workspaceOwnerTitle('Bot Chat', botChat)).toBe('Alpha')
+ // A `+` side thread under the same bot keeps its own title.
+ expect(workspaceOwnerTitle('Plan the launch', botChat)).toBe('Plan the launch')
+ // A Sessions tab titled the same way is not a bot chat.
+ expect(workspaceOwnerTitle('Bot Chat', { workspaceMode: 'sessions' })).toBe('Bot Chat')
+ // No label yet (roster not loaded): the stored title stands.
+ expect(workspaceOwnerTitle('Bot Chat', { ...botChat, workspaceOwnerKey: 'bot:beta' })).toBe('Bot Chat')
+ })
+})
+
describe('remembered active panes', () => {
beforeEach(() => resetRememberedActivePanes())
diff --git a/apps/desktop/src/components/pane-shell/workspace-scope.ts b/apps/desktop/src/components/pane-shell/workspace-scope.ts
index 7b62390908a..4b0972265cf 100644
--- a/apps/desktop/src/components/pane-shell/workspace-scope.ts
+++ b/apps/desktop/src/components/pane-shell/workspace-scope.ts
@@ -46,6 +46,33 @@ export type WorkspaceNewSessionTarget =
/** Sessions uses its established ambient behavior (`null`). */
export const $workspaceNewSessionTarget = atom<WorkspaceNewSessionTarget | null>(null)
+/** Display name per exact owner key, published by the workspace that owns the
+ * key (Bot Mode: the roster's display name). Presentation only — never a
+ * session title, which for a canonical Bot Chat is an identity the backend
+ * resolves by name and must stay exactly as stored. */
+export const $workspaceOwnerLabels = atom<Readonly<Record<string, string>>>({})
+
+export function setWorkspaceOwnerLabel(ownerKey: string, label: string): void {
+ if ($workspaceOwnerLabels.get()[ownerKey] !== label) {
+ $workspaceOwnerLabels.set({ ...$workspaceOwnerLabels.get(), [ownerKey]: label })
+ }
+}
+
+/** The caption a workspace-owned tab shows: its owner's label while the stored
+ * row still carries only the placeholder its opener registered — every bot's
+ * canonical chat is stored under the same name, so the tab reads the bot's
+ * (#99152). Any other title (a `+` side thread, a Sessions tab) is untouched. */
+export function workspaceOwnerTitle(
+ title: string,
+ scope: { workspaceMode?: WorkspaceMode; workspaceOwnerKey?: string; workspaceTabTitle?: string } | undefined
+): string {
+ if (scope?.workspaceMode !== 'bots' || !scope.workspaceOwnerKey || title !== scope.workspaceTabTitle) {
+ return title
+ }
+
+ return $workspaceOwnerLabels.get()[scope.workspaceOwnerKey] ?? title
+}
+
/** One key for window-local active-pane memory. Owner keys stay opaque. */
export function workspaceScopeKey(mode: WorkspaceMode, ownerKey: string | null): string {
return mode === 'sessions' ? 'sessions' : `bots:${ownerKey ?? ''}`
diff --git a/apps/desktop/src/plugins/hermes-bots/roster-pane.tsx b/apps/desktop/src/plugins/hermes-bots/roster-pane.tsx
index 60b561961d2..51d22c2c1c4 100644
--- a/apps/desktop/src/plugins/hermes-bots/roster-pane.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/roster-pane.tsx
@@ -62,6 +62,7 @@ import { groupChatMemberBots, groupChatNames, groupLastActivity } from './group-
import { $groupMainTabsRev, shouldRenderGroupChatInPane } from './group-panes'
import { $showHiddenBots, isBotHidden, isBotPinned } from './hidden-bots'
import { useBots } from './i18n'
+import { displayName } from './labels'
import { deleteBot, mergeServerMeta, pullServerAvatars } from './profile-ops'
import { $activityToasts, setActivityToasts, trackInboundActivity } from './roster-actions'
import {
@@ -478,6 +479,11 @@ export function BotsPane() {
// writes must settle after render: other subscribers of the same atoms
// would otherwise be updated while BotsPane was still rendering.
$lastRoster.set(roster.filter(row => !row?.ghost))
+ // Tabs caption a bot chat by its bot (#99152); republished with the
+ // roster so a rename follows and tiles restored at boot resolve.
+ roster.forEach(bot => {
+ host.setWorkspaceOwnerLabel?.(botWorkspaceOwnerKey(bot), displayName(bot, botRosterMeta(bot, allMeta)))
+ })
if (Array.isArray(data?.sources)) {
$lastSources.set(data.sources)
diff --git a/apps/desktop/src/sdk/index.ts b/apps/desktop/src/sdk/index.ts
index e25fc4784c4..832c4d45517 100644
--- a/apps/desktop/src/sdk/index.ts
+++ b/apps/desktop/src/sdk/index.ts
@@ -36,6 +36,7 @@ import {
$workspaceMode,
$workspaceOwnerKey,
setWorkspaceScope as publishWorkspaceScope,
+ setWorkspaceOwnerLabel,
type WorkspaceNewSessionTarget
} from '@/components/pane-shell/workspace-scope'
import { onGatewayEvent } from '@/contrib/events'
@@ -1160,6 +1161,11 @@ export const host = {
return close
},
+ /** Name a workspace owner on its tabs (a bot's display name). A canonical
+ * chat's STORED title is an identity the backend resolves by name; this is
+ * the caption shown for it. Feature-detect on older desktops. */
+ setWorkspaceOwnerLabel,
+
/** Switch the visible main-pane workspace without unregistering retained panes. */
setWorkspaceScope: (
mode: WorkspaceMode,
diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.ts
index ec04175a617..605dfc0d608 100644
--- a/apps/desktop/src/store/session-states.ts
+++ b/apps/desktop/src/store/session-states.ts
@@ -1110,8 +1110,23 @@ export const $botChatSessionIds = atom<ReadonlySet<string>>(
new Set((readJson<unknown>(BOT_CHAT_SCOPE_KEY) as unknown[] | null)?.filter(id => typeof id === 'string') ?? [])
)
-function rememberBotChatScope(storedSessionId: string, isBotChat: boolean): void {
+/** The bot-mode scope each stored id was last opened under, for the main tab
+ * (which has no tile to carry one). Window-local: the caption falls back to
+ * the stored title until the chat is opened again. */
+export const $botChatScopes = atom<Readonly<Record<string, SessionTileWorkspaceScope>>>({})
+
+function rememberBotChatScope(storedSessionId: string, scope: SessionTileWorkspaceScope): void {
+ const isBotChat = scope.workspaceMode === 'bots'
const current = $botChatSessionIds.get()
+ const { [storedSessionId]: previous, ...rest } = $botChatScopes.get()
+
+ const changed = isBotChat
+ ? previous?.workspaceOwnerKey !== scope.workspaceOwnerKey || previous?.workspaceTabTitle !== scope.workspaceTabTitle
+ : Boolean(previous)
+
+ if (changed) {
+ $botChatScopes.set(isBotChat ? { ...rest, [storedSessionId]: scope } : rest)
+ }
if (current.has(storedSessionId) === isBotChat) {
return
@@ -1141,7 +1156,7 @@ export function isBotChatSession(sessionId: null | string | undefined): boolean
export function setSessionTileWorkspaceScope(storedSessionId: string, scope: SessionTileWorkspaceScope): boolean {
// Before the tile lookup: openSession routes every open through here, and a
// bot chat usually has no tile to record the scope on.
- rememberBotChatScope(storedSessionId, scope.workspaceMode === 'bots')
+ rememberBotChatScope(storedSessionId, scope)
const tile = $sessionTiles.get().find(candidate => candidate.storedSessionId === storedSessionId)
const workspaceOwnerKey = scope.workspaceMode === 'bots' ? scope.workspaceOwnerKey : undefined
diff --git a/website/docs/user-guide/bot-mode.md b/website/docs/user-guide/bot-mode.md
index 32a3492974f..7170fa3aabf 100644
--- a/website/docs/user-guide/bot-mode.md
+++ b/website/docs/user-guide/bot-mode.md
@@ -17,7 +17,7 @@ There is no new primitive to learn: a Bot **is** a Hermes profile — isolated c
The roster shows one row per agent profile: avatar, latest-message preview, and timestamp.
-- **Click a Bot** to land in its chat — every Bot has a canonical, persistent **Bot Chat** conversation that is created (and pinned) the moment the Bot is born. A row click always opens that Bot Chat (the same conversation the row previews), even when you have other tabs open for the Bot; those tabs stay open beside it.
+- **Click a Bot** to land in its chat — every Bot has a canonical, persistent **Bot Chat** conversation that is created (and pinned) the moment the Bot is born. A row click always opens that Bot Chat (the same conversation the row previews), even when you have other tabs open for the Bot; those tabs stay open beside it. In the tab strip the Bot Chat is captioned with the Bot's name, so two open Bots are told apart at a glance.
- **Active now** — a presence strip above the roster shows every Bot currently working: the gateway-busy profile plus any Bot that wrote within the last 90 seconds. Each chip opens that Bot's chat. The strip never reorders the roster and disappears when the fleet is idle.
- **Search** filters the roster as you type.
- **Hide a Bot** — right-click a row → **Hide Bot** to take a Bot you don't use out of the roster and the Active-now strip. Hiding is display-only: @mentions still resolve, group-chat memberships are untouched, and routines keep running. Once at least one Bot is hidden, an **eye toggle** appears in the pane header — click it to reveal hidden Bots dimmed in place, then right-click → **Unhide Bot** to bring one back. Hidden Bots never toast, but they accumulate unread activity silently and the eye badges a dot so you know something happened. Hidden state is saved in the Bot's profile metadata, so it follows the Bot to every desktop connected to that backend.