Skip to content

The agent that grows with you

fix(desktop): render a relayed sender re-stamped @handle@connection as an agent notice

teknium1346dd5ca4e78
diff --git a/apps/desktop/src/components/assistant-ui/thread/agent-message.test.tsx b/apps/desktop/src/components/assistant-ui/thread/agent-message.test.tsx
index f6beedaa58e..1a0fc1d9419 100644
--- a/apps/desktop/src/components/assistant-ui/thread/agent-message.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/agent-message.test.tsx
@@ -23,6 +23,16 @@ describe('agent message detection', () => {
expect(m?.[4]).toBe('run them all')
})
+ it('recognizes a relayed sender re-stamped @handle@connection, keeping the bare handle for the avatar', () => {
+ // The receiving gateway re-stamps a relayed "@hermes" as "@hermes@<connection>"
+ // (#103731) β€” still an agent notice, and the avatar resolves by profile handle.
+ const m = AGENT_MESSAGE_RE.exec('Message from πŸ€– hermes (@hermes@Cloud-1): status?')
+
+ expect(m?.[1]?.trim()).toBe('hermes')
+ expect(m?.[2]).toBe('hermes')
+ expect(m?.[4]).toBe('status?')
+ })
+
it('matches without the robot emoji', () => {
const m = AGENT_MESSAGE_RE.exec('Message from Turquoise: ready to work')
diff --git a/apps/desktop/src/components/assistant-ui/thread/user-message.tsx b/apps/desktop/src/components/assistant-ui/thread/user-message.tsx
index c35d5f71f60..678083a8ef1 100644
--- a/apps/desktop/src/components/assistant-ui/thread/user-message.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/user-message.tsx
@@ -76,12 +76,14 @@ export const StopGlyph = <StopFilled aria-hidden className="size-3.5 -translate-
// Agent-to-agent deliveries ("Message from πŸ€– <sender>: …", the Bot Mode /
// multi-profile convention; optional "(@<handle>)" carries the sender's
-// profile name for avatar resolution; legacy "[Message from agent
-// '<sender>'] …" too). They arrive on the user role because the recipient's
-// turn runs on it, but they are NOT the human speaking β€” render them as a
-// compact attributed timeline notice instead of a user bubble.
+// profile name for avatar resolution β€” a relayed sender is re-stamped
+// "(@<handle>@<connection>)" so a reply reaches the right machine (#103731);
+// legacy "[Message from agent '<sender>'] …" too). They arrive on the user
+// role because the recipient's turn runs on it, but they are NOT the human
+// speaking β€” render them as a compact attributed timeline notice instead of
+// a user bubble.
export const AGENT_MESSAGE_RE =
- /^(?:Message from (?:πŸ€–\s*)?([^:\n(]{1,64}?)(?:\s*\(@([a-z0-9][a-z0-9_-]{0,63})\))?:\s*|\[Message from agent '([^']{1,64})'\]\s*)([\s\S]*)$/u
+ /^(?:Message from (?:πŸ€–\s*)?([^:\n(]{1,64}?)(?:\s*\(@([a-z0-9][a-z0-9_-]{0,63})(?:@[a-zA-Z0-9][a-zA-Z0-9_-]{0,63})?\))?:\s*|\[Message from agent '([^']{1,64})'\]\s*)([\s\S]*)$/u
// sender handle -> avatar data URL. Module-level so a chat full of notices
// from one bot resolves once. Hits are cached for the window's lifetime;