Skip to content

The agent that grows with you

fix(desktop): label Settings "Applies to" chips with the bot title / display name

kokhlo2af437b4fe39
diff --git a/apps/desktop/src/app/settings/profile-scope.test.tsx b/apps/desktop/src/app/settings/profile-scope.test.tsx
index 30043f3304b..8078568d379 100644
--- a/apps/desktop/src/app/settings/profile-scope.test.tsx
+++ b/apps/desktop/src/app/settings/profile-scope.test.tsx
@@ -24,8 +24,8 @@ const { $activeGatewayProfile, $profiles } = await import('@/store/profile')
const { $settingsScopeOverride } = await import('@/store/settings-scope')
const { SettingsProfileScope } = await import('./profile-scope')
-const profile = (name: string, isDefault = false): ProfileInfo =>
- ({ has_env: false, is_default: isDefault, model: null, name }) as unknown as ProfileInfo
+const profile = (name: string, isDefault = false, extra: Partial<ProfileInfo> = {}): ProfileInfo =>
+ ({ has_env: false, is_default: isDefault, model: null, name, ...extra }) as ProfileInfo
beforeEach(() => {
$activeGatewayProfile.set('default')
@@ -106,4 +106,32 @@ describe('SettingsProfileScope', () => {
expect(note).toBeTruthy()
expect(note?.hasAttribute('data-scope-loud')).toBe(false)
})
+
+ it('labels chips with the bot title, else the display name, else the slug', () => {
+ $profiles.set([
+ profile('default', true, { bot_title: 'JordyV', display_name: 'JordieF' }),
+ profile('default-2', false, { display_name: 'Copy' }),
+ profile('weather-man')
+ ])
+
+ render(<SettingsProfileScope />)
+
+ // Bot Mode title wins over display_name and the slug — same identity the
+ // Bots roster shows.
+ expect(screen.getByRole('button', { name: 'JordyV' })).toBeTruthy()
+ // display_name (profile.yaml) when no Bot Mode title exists.
+ expect(screen.getByRole('button', { name: 'Copy' })).toBeTruthy()
+ // Canonical slug when neither is set.
+ expect(screen.getByRole('button', { name: 'weather-man' })).toBeTruthy()
+ })
+
+ it('keeps selection keyed on the canonical name while showing the presentation label', () => {
+ $profiles.set([profile('default', true), profile('coder', false, { bot_title: 'JordyV' })])
+
+ render(<SettingsProfileScope />)
+
+ fireEvent.click(screen.getByRole('button', { name: 'JordyV' }))
+ // The label changed, the identity did not: the override stores the slug.
+ expect($settingsScopeOverride.get()).toBe('coder')
+ })
})
diff --git a/apps/desktop/src/app/settings/profile-scope.tsx b/apps/desktop/src/app/settings/profile-scope.tsx
index ebdd0d59a32..2f656fcb496 100644
--- a/apps/desktop/src/app/settings/profile-scope.tsx
+++ b/apps/desktop/src/app/settings/profile-scope.tsx
@@ -3,7 +3,7 @@ import { useEffect } from 'react'
import { useI18n } from '@/i18n'
import { cn } from '@/lib/utils'
-import { $profiles, normalizeProfileKey, refreshProfiles } from '@/store/profile'
+import { $profiles, normalizeProfileKey, profileLabel, refreshProfiles } from '@/store/profile'
import {
$settingsScopeEditsNonDefault,
$settingsScopeOverride,
@@ -66,7 +66,7 @@ export function SettingsProfileScope({ className }: { className?: string }) {
<ScopeChip
active={normalizeProfileKey(profile.name) === selected}
key={profile.name}
- label={profile.name}
+ label={profileLabel(profile)}
onSelect={() => setSettingsScope(profile.name)}
/>
))}
diff --git a/apps/desktop/src/store/profile.ts b/apps/desktop/src/store/profile.ts
index c1805f5e5f5..d8832d4a1b2 100644
--- a/apps/desktop/src/store/profile.ts
+++ b/apps/desktop/src/store/profile.ts
@@ -42,11 +42,18 @@ export function normalizeProfileKey(name: string | null | undefined): string {
return value || 'default'
}
-// Presentation-only label: the display_name from profile.yaml when set (e.g. a
-// renamed default profile), else the canonical name. Never used for
+// 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
// comparison or routing — canonical `name` remains the identity everywhere.
-export function profileLabel(profile: Pick<ProfileInfo, 'display_name' | 'name'>): string {
- return (profile.display_name ?? '').trim() || profile.name
+export function profileLabel(
+ profile: Pick<ProfileInfo, 'bot_title' | 'display_name' | 'name'>
+): string {
+ return (
+ (profile.bot_title ?? '').trim() ||
+ (profile.display_name ?? '').trim() ||
+ profile.name
+ )
}
// The profile the running local backend is actually scoped to (mirrors
diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.ts
index 1d7e7354f51..b6b7f4bb7f8 100644
--- a/apps/desktop/src/types/hermes.ts
+++ b/apps/desktop/src/types/hermes.ts
@@ -985,6 +985,9 @@ export interface ProfileCreatePayload {
export interface ProfileInfo {
/** Presentation-only label override (profile.yaml display_name). */
display_name?: string
+ /** Bot Mode title (profile.yaml ui_meta['hermes-bots'].title) — the name the
+ * Bots roster shows for this profile. Presentation-only. */
+ bot_title?: string
has_env: boolean
is_default: boolean
model: null | string
diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.py
index 5379ff725fa..95434c8b0f8 100644
--- a/hermes_cli/profiles.py
+++ b/hermes_cli/profiles.py
@@ -536,6 +536,9 @@ class ProfileInfo:
description_auto: bool = False
# Presentation-only display name; resolution/comparison/spawn always use ``name``.
display_name: str = ""
+ # Bot Mode title (``profile.yaml`` ``ui_meta['hermes-bots'].title``) — the name
+ # the Bots roster shows. Presentation-only, like ``display_name``.
+ bot_title: str = ""
def _load_yaml_dict(path: Path) -> Optional[dict]:
@@ -675,10 +678,17 @@ def read_profile_meta(profile_dir: Path) -> dict:
defaults when missing/unreadable). Never raises — a corrupt file on one profile must not
break ``hermes profile list``."""
data = _load_yaml_dict(profile_dir / "profile.yaml") or {}
+ ui_meta = data.get("ui_meta")
+ bot_title = ""
+ if isinstance(ui_meta, dict):
+ hermes_bots = ui_meta.get("hermes-bots")
+ if isinstance(hermes_bots, dict):
+ bot_title = str(hermes_bots.get("title") or "").strip()
return {
"description": str(data.get("description") or "").strip(),
"description_auto": bool(data.get("description_auto", False)),
"display_name": str(data.get("display_name") or "").strip(),
+ "bot_title": bot_title,
}
diff --git a/hermes_cli/web_routers/profiles.py b/hermes_cli/web_routers/profiles.py
index 61243e75c8d..bb2141bdcb9 100644
--- a/hermes_cli/web_routers/profiles.py
+++ b/hermes_cli/web_routers/profiles.py
@@ -88,6 +88,7 @@ def _profile_to_dict(info) -> Dict[str, Any]:
"description": attr("description", "") or "",
"description_auto": bool(attr("description_auto", False)),
"display_name": attr("display_name", "") or "",
+ "bot_title": attr("bot_title", "") or "",
"distribution_name": attr("distribution_name", None),
"distribution_version": attr("distribution_version", None),
"distribution_source": attr("distribution_source", None),
diff --git a/hermes_cli/web_server_profiles.py b/hermes_cli/web_server_profiles.py
index 8f8b55ff177..34a0c788a6f 100644
--- a/hermes_cli/web_server_profiles.py
+++ b/hermes_cli/web_server_profiles.py
@@ -109,6 +109,7 @@ def _fallback_profile_entry(profiles_mod, name: str, home: Path, *, is_default:
"skill_count": _safe(lambda: profiles_mod._count_skills(home), 0),
"gateway_running": _safe(gateway_running, False),
"description": meta("description", ""), "description_auto": meta("description_auto", False),
+ "bot_title": meta("bot_title", ""),
"distribution_name": None, "distribution_version": None, "distribution_source": None,
"has_alias": False}
diff --git a/tests/hermes_cli/test_profile_display_name.py b/tests/hermes_cli/test_profile_display_name.py
index 27dbd6e77c2..ec4baaaec5c 100644
--- a/tests/hermes_cli/test_profile_display_name.py
+++ b/tests/hermes_cli/test_profile_display_name.py
@@ -46,6 +46,24 @@ class TestMetaAndValidation:
def test_missing_file_defaults_empty(self, profile_env):
assert read_profile_meta(profile_env)["display_name"] == ""
+ def test_bot_title_read_from_hermes_bots_ui_meta(self, profile_env):
+ (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"
+
+ def test_bot_title_absent_when_no_bots_meta(self, profile_env):
+ (profile_env / "profile.yaml").write_text(
+ "display_name: JordieF\nui_meta:\n user-sections: {}\n", encoding="utf-8")
+ assert read_profile_meta(profile_env)["bot_title"] == ""
+
+ def test_bot_title_never_raises_on_malformed_shapes(self, profile_env):
+ (profile_env / "profile.yaml").write_text(
+ "ui_meta: hermes-bots\n", encoding="utf-8") # ui_meta is a scalar
+ assert read_profile_meta(profile_env)["bot_title"] == ""
+ (profile_env / "profile.yaml").write_text(
+ "ui_meta:\n hermes-bots: 7\n", encoding="utf-8") # not a mapping
+ assert read_profile_meta(profile_env)["bot_title"] == ""
+
def test_empty_clears_key_from_file(self, profile_env):
write_profile_meta(profile_env, display_name="Harumesu")
write_profile_meta(profile_env, display_name="")