The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): Group Chat speaker labels qualify twins per room and never show a raw key
teknium1ab4bd4ba176c
diff --git a/apps/desktop/src/plugins/hermes-bots/group-activity.ts b/apps/desktop/src/plugins/hermes-bots/group-activity.tsindex fb5be2f09cf..ef93fa4218a 100644--- a/apps/desktop/src/plugins/hermes-bots/group-activity.ts+++ b/apps/desktop/src/plugins/hermes-bots/group-activity.ts@@ -70,8 +70,9 @@ export function currentGroupActivity(group: string) {}/** Human label for one activity event, used by the collapsed summary and- * the expanded rows. */-export function groupActivityLabel(event: GroupActivityEntry) {+ * the expanded rows. `group` scopes the same-name disambiguation to the+ * room's seats. */+export function groupActivityLabel(event: GroupActivityEntry, group?: null | string) {const kind = event?.kindconst base = GROUP_ACTIVITY_LABELS[kind] || kind || 'did something'@@ -79,7 +80,7 @@ export function groupActivityLabel(event: GroupActivityEntry) {return base}- const who = event?.member === 'You' ? 'You' : groupSpeakerLabel(event?.member || 'A bot')+ const who = event?.member === 'You' ? 'You' : groupSpeakerLabel(event?.member || 'A bot', group)return `${who} ${base}`}diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat-view.tsx b/apps/desktop/src/plugins/hermes-bots/group-chat-view.tsxindex ef7607a2124..100940ef804 100644--- a/apps/desktop/src/plugins/hermes-bots/group-chat-view.tsx+++ b/apps/desktop/src/plugins/hermes-bots/group-chat-view.tsx@@ -798,7 +798,7 @@ export function GroupChatWorkspace({ group, members, onBack, visible = true }: G<Codicon className="shrink-0 text-[0.65rem]" name={activityOpen ? 'chevron-down' : 'chevron-right'} /><span className="shrink-0 font-medium">{b.group.activity}</span>{summaryActivity ? (- <span className={cn('min-w-0 flex-1 truncate', groupActivityTone(summaryActivity.kind))}>{`${groupActivityLabel(summaryActivity)} · ${relativeTime(summaryActivity.at)}`}</span>+ <span className={cn('min-w-0 flex-1 truncate', groupActivityTone(summaryActivity.kind))}>{`${groupActivityLabel(summaryActivity, group)} · ${relativeTime(summaryActivity.at)}`}</span>) : null}</RowButton>{room.running ? (@@ -825,7 +825,7 @@ export function GroupChatWorkspace({ group, members, onBack, visible = true }: Gname={GROUP_ACTIVITY_GLYPHS[event.kind] || 'circle-outline'}/><span className={cn('min-w-0 flex-1 truncate', groupActivityTone(event.kind))}>- {groupActivityLabel(event)}+ {groupActivityLabel(event, group)}</span><span className="shrink-0 text-[0.625rem] text-(--ui-text-quaternary)">{relativeTime(event.at)}</span>{event.kind === 'working' ? (diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat.test.ts b/apps/desktop/src/plugins/hermes-bots/group-chat.test.tsindex b0bf06152a5..71feaa6a58b 100644--- a/apps/desktop/src/plugins/hermes-bots/group-chat.test.ts+++ b/apps/desktop/src/plugins/hermes-bots/group-chat.test.ts@@ -211,6 +211,34 @@ describe('speaker labels', () => {expect(chat.groupSpeakerLabel('research')).toBe('Radar')})+ it('qualifies twins per room and never renders a raw key when the roster row is missing', async () => {+ const { chat } = await loadRoom()+ const data = await import('./data')++ const local = { connectionId: 'local', connectionLabel: 'This device', name: 'reviewer', sourceScoped: true }+ const spark = { connectionId: 'spark', connectionLabel: 'Spark', name: 'reviewer', remoteSource: true, sourceScoped: true }+ data.$lastRoster.set([local, spark])+ data.$botMeta.set({})++ // #94869 acceptance 3: the room seats only the local reviewer, so it+ // reads plain "Reviewer" however many other connections expose one.+ chat.updateGroupChat('Core', room => ({ ...room, members: [{ connectionId: 'local', name: 'reviewer', remoteSource: true, sourceScoped: true }] }), { sync: false })++ expect(chat.groupSpeakerLabel('local::reviewer', 'Core')).toBe('Reviewer')+ expect(chat.groupSpeakerLabel('local::reviewer')).toBe('Reviewer · This device')++ // Cold start (Bots pane not mounted yet) / owning connection removed:+ // no roster row for the key — degrade to the profile name, not the key.+ data.$lastRoster.set([])++ expect(chat.groupSpeakerLabel('local::reviewer')).toBe('reviewer')+ expect(chat.groupSpeakerLabel('spark::default')).toBe('Hermes')++ data.$botMeta.set({ 'spark::reviewer': { title: 'Beta' } })++ expect(chat.groupSpeakerLabel('spark::reviewer')).toBe('Beta')+ })+it("never borrow a remote row's display_name for a local speaker", async () => {const { chat } = await loadRoom()const data = await import('./data')diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat.ts b/apps/desktop/src/plugins/hermes-bots/group-chat.tsindex 7dec5f70f3e..8acb8508b87 100644--- a/apps/desktop/src/plugins/hermes-bots/group-chat.ts+++ b/apps/desktop/src/plugins/hermes-bots/group-chat.ts@@ -1238,10 +1238,16 @@ export const GROUP_CHAT_MAX_MEMBERS = 6* Bot meta is persisted under the route-qualified key (botMetaKey), so a* keyed caller resolves through the exact roster row + botRosterMeta — the* same pipeline the Bots tab renders — and a raw name resolves the same- * way when exactly one roster row carries it. Same-named members on two- * connections that resolve to the same label get their connection label- * appended, so two failing `default`s are never one anonymous "Hermes". */-export function groupSpeakerLabel(name?: null | string) {+ * way when exactly one roster row carries it. Same-named members that+ * resolve to the same label get their connection label appended, so two+ * failing `default`s are never one anonymous "Hermes" — judged against the+ * ROOM's seats when the caller names the room (#94869: a room whose only+ * `reviewer` is local reads plain "Reviewer" however many other connections+ * expose one), against the whole roster otherwise. A key with no roster row+ * ($lastRoster is empty until the Bots pane mounts; the owning connection+ * may be gone) still resolves through the route-keyed meta and the profile+ * segment — a keyed caller never renders the raw key. */+export function groupSpeakerLabel(name?: null | string, group?: null | string) {const trimmed = (name || '').trim()if (!trimmed) {@@ -1257,11 +1263,25 @@ export function groupSpeakerLabel(name?: null | string) {if (exact) {const label = friendly(exact)- const twin = rows.some(bot => bot !== exact && bot.name === exact.name && friendly(bot) === label)+ const seats = group ? new Set(($groupChats.get()[group]?.members || []).map(botRosterKey)) : null+ const peers = seats?.size ? rows.filter(bot => seats.has(botRosterKey(bot))) : rows+ const twin = peers.some(bot => bot !== exact && bot.name === exact.name && friendly(bot) === label)return twin ? `${label} · ${exact.connectionLabel || exact.connectionId}` : label}+ const boundary = trimmed.indexOf('::')++ if (boundary !== -1) {+ const connection = trimmed.slice(0, boundary)+ const profile = trimmed.slice(boundary + 2)+ const title = String(meta?.[trimmed]?.title || meta?.[profile]?.title || '').trim()+ const label = title || (profile.toLowerCase() === 'default' ? 'Hermes' : profile)++ // Another connection still exposes this name: keep them tellable apart.+ return rows.some(bot => bot.name === profile) ? `${label} · ${connection}` : label+ }+// A raw `default` names the ACTIVE gateway's primary profile — it must// never borrow a remote default's identity, so only a local row counts.const isDefault = trimmed.toLowerCase() === 'default'diff --git a/apps/desktop/src/plugins/hermes-bots/group-round-members.ts b/apps/desktop/src/plugins/hermes-bots/group-round-members.tsindex a9f548aba7a..9b9d348690d 100644--- a/apps/desktop/src/plugins/hermes-bots/group-round-members.ts+++ b/apps/desktop/src/plugins/hermes-bots/group-round-members.ts@@ -94,7 +94,7 @@ function prepareGroupRoundMember(context: GroupRoundMemberContext, member: GroupgroupName: context.group,members,viewer: member,- deltaLines: delta.slice(-GROUP_CHAT_HISTORY_LIMIT).map((e: GroupMessage) => formatGroupChatLine(e, member))+ deltaLines: delta.slice(-GROUP_CHAT_HISTORY_LIMIT).map((e: GroupMessage) => formatGroupChatLine(e, member, context.group))})// Images riding this delta (user attachments — member entries don'tdiff --git a/apps/desktop/src/plugins/hermes-bots/group-round-prompt.ts b/apps/desktop/src/plugins/hermes-bots/group-round-prompt.tsindex ace4c415c7e..e372287da16 100644--- a/apps/desktop/src/plugins/hermes-bots/group-round-prompt.ts+++ b/apps/desktop/src/plugins/hermes-bots/group-round-prompt.ts@@ -24,7 +24,7 @@ export type GroupChatLineViewer =/** Room-log line as a member sees it: `Name (user): …` / `Name: …` /* `Name (you): …`. */-export function formatGroupChatLine(entry: GroupMessage, viewer: GroupChatLineViewer) {+export function formatGroupChatLine(entry: GroupMessage, viewer: GroupChatLineViewer, group?: null | string) {// Attachments are staged into each member's session as real payloads; the// transcript line names them so the delta text and the bytes line up.const attached =@@ -47,7 +47,7 @@ export function formatGroupChatLine(entry: GroupMessage, viewer: GroupChatLineVi// two machines stay tellable apart in every member's transcript.const source = entry.from.source ? ` [${entry.from.source}]` : ''- return `${groupSpeakerLabel(entry.from.name)}${suffix}${source}: ${relabelMemberControlFrames(entry.text)}${attached}`+ return `${groupSpeakerLabel(entry.from.name, group)}${suffix}${source}: ${relabelMemberControlFrames(entry.text)}${attached}`}function viewerNameOf(viewer: GroupChatLineViewer): string {