Skip to content

The agent that grows with you

fix(desktop): scope the bot-title label to the Settings chips; unbreak providers-settings test

teknium1f10b93802f4b
diff --git a/apps/desktop/src/app/settings/profile-scope.tsx b/apps/desktop/src/app/settings/profile-scope.tsx
index 9427302fb53..4641db23fe3 100644
--- a/apps/desktop/src/app/settings/profile-scope.tsx
+++ b/apps/desktop/src/app/settings/profile-scope.tsx
@@ -10,6 +10,17 @@ import {
$settingsScopeProfile,
setSettingsScope
} from '@/store/settings-scope'
+import type { ProfileInfo } from '@/types/hermes'
+
+// Settings-chip label: the Bot Mode title the Bots roster shows when set
+// (ui_meta['hermes-bots'].title), else the app-wide profileLabel
+// (display_name → slug). Scoped to this selector on purpose — the profile
+// rail and Profiles page keep naming profiles by display_name.
+export function settingsScopeLabel(
+ profile: Pick<ProfileInfo, 'bot_title' | 'display_name' | 'name'>
+): string {
+ return (profile.bot_title ?? '').trim() || profileLabel(profile)
+}
// The same chip affordance the Gateway page uses for its per-profile
// connection overrides (gateway-settings ScopeChip). That one stays local to
@@ -49,7 +60,7 @@ export function SettingsProfileScope({ className }: { className?: string }) {
// chip (Bot title → display_name → slug); the slug alone can name a bot the
// user has never seen called that.
const selectedLabel = profiles.find(profile => normalizeProfileKey(profile.name) === selected)
- const selectedName = selectedLabel ? profileLabel(selectedLabel) : selected
+ const selectedName = selectedLabel ? settingsScopeLabel(selectedLabel) : selected
// Refresh lazily so a profile created elsewhere shows up; the cached list
// paints immediately. Best-effort — a failure keeps the cached roster.
@@ -71,7 +82,7 @@ export function SettingsProfileScope({ className }: { className?: string }) {
<ScopeChip
active={normalizeProfileKey(profile.name) === selected}
key={profile.name}
- label={profileLabel(profile)}
+ label={settingsScopeLabel(profile)}
onSelect={() => setSettingsScope(profile.name)}
/>
))}
diff --git a/apps/desktop/src/app/settings/providers-settings.test.tsx b/apps/desktop/src/app/settings/providers-settings.test.tsx
index e3c8f5947e7..f90e35d1097 100644
--- a/apps/desktop/src/app/settings/providers-settings.test.tsx
+++ b/apps/desktop/src/app/settings/providers-settings.test.tsx
@@ -18,7 +18,8 @@ vi.mock('@/store/profile', () => ({
$activeGatewayProfile: atom('alpha'),
$profiles: atom([]),
refreshProfiles: async () => {},
- normalizeProfileKey: (p: string | null) => p || 'default'
+ normalizeProfileKey: (p: string | null) => p || 'default',
+ profileLabel: (p: { display_name?: string; name: string }) => p.display_name || p.name
}))
vi.mock('@/hermes', () => ({
diff --git a/apps/desktop/src/store/profile.ts b/apps/desktop/src/store/profile.ts
index d8832d4a1b2..c1805f5e5f5 100644
--- a/apps/desktop/src/store/profile.ts
+++ b/apps/desktop/src/store/profile.ts
@@ -42,18 +42,11 @@ export function normalizeProfileKey(name: string | null | undefined): string {
return value || 'default'
}
-// Presentation-only label: the Bot Mode title the Bots roster shows when set
-// (ui_meta['hermes-bots'].title), else the display_name from profile.yaml
-// (e.g. a renamed default profile), else the canonical name. Never used for
+// Presentation-only label: the display_name from profile.yaml when set (e.g. a
+// renamed default profile), else the canonical name. Never used for
// comparison or routing — canonical `name` remains the identity everywhere.
-export function profileLabel(
- profile: Pick<ProfileInfo, 'bot_title' | 'display_name' | 'name'>
-): string {
- return (
- (profile.bot_title ?? '').trim() ||
- (profile.display_name ?? '').trim() ||
- profile.name
- )
+export function profileLabel(profile: Pick<ProfileInfo, 'display_name' | 'name'>): string {
+ return (profile.display_name ?? '').trim() || profile.name
}
// The profile the running local backend is actually scoped to (mirrors
diff --git a/tests/hermes_cli/test_profile_display_name.py b/tests/hermes_cli/test_profile_display_name.py
index ec4baaaec5c..37a8052fbbd 100644
--- a/tests/hermes_cli/test_profile_display_name.py
+++ b/tests/hermes_cli/test_profile_display_name.py
@@ -50,6 +50,9 @@ class TestMetaAndValidation:
(profile_env / "profile.yaml").write_text(
"ui_meta:\n hermes-bots:\n title: JordyV\n", encoding="utf-8")
assert read_profile_meta(profile_env)["bot_title"] == "JordyV"
+ # The web/Desktop roster carries it through the same dict the chips read.
+ from hermes_cli.web_routers.profiles import _profile_to_dict
+ assert _profile_to_dict(list_profiles()[0])["bot_title"] == "JordyV"
def test_bot_title_absent_when_no_bots_meta(self, profile_env):
(profile_env / "profile.yaml").write_text(