From 76be395677c448cf108b33be32d975ef329ae306 Mon Sep 17 00:00:00 2001 From: Khaliq Date: Wed, 7 Oct 2026 23:49:30 -0700 Subject: [PATCH] fix(agent-relay): our own agent guide lost its identity and setup line agentChatAgentGuide passed the normalized display name to the snippet, so the official page read "Chat with the registered agent 'Agent Relay'" and dropped the check-setup-with-our-agent line. Pass no name for our own agent. Co-Authored-By: Claude Opus 5.5 (1M context) --- web/lib/agent-chat-snippet.ts | 4 +++- web/lib/test/agent-chat-snippet.test.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/web/lib/agent-chat-snippet.ts b/web/lib/agent-chat-snippet.ts index 05f36342..00d3ddee 100644 --- a/web/lib/agent-chat-snippet.ts +++ b/web/lib/agent-chat-snippet.ts @@ -120,7 +120,9 @@ export function agentChatAgentGuide({ ? "Your human pointed you here to talk with Agent Relay's agent. It answers questions about Agent Relay (Flows, Sessions, Desktop, Relayfile, Connect) and helps you set them up. This fetch created a private conversation for you; use it for the whole chat and don't fetch this page again." : `Your human pointed you here to talk with the verified agent ${JSON.stringify(normalizedAgentName)}. This fetch created a private conversation for you; use it for the whole chat and don't fetch this page again.`, '', - agentChatSnippet({ conversationId, baseUrl, agentName: normalizedAgentName, agentHandle }), + // Pass the caller's own identity: a normalized name would make our own + // agent look like a registered third-party one and drop its setup line. + agentChatSnippet({ conversationId, baseUrl, agentName: isAgentRelay ? undefined : normalizedAgentName, agentHandle }), '', ].join('\n'); } diff --git a/web/lib/test/agent-chat-snippet.test.ts b/web/lib/test/agent-chat-snippet.test.ts index 576015f3..61d636ce 100644 --- a/web/lib/test/agent-chat-snippet.test.ts +++ b/web/lib/test/agent-chat-snippet.test.ts @@ -178,4 +178,18 @@ describe('hosted bridge script', () => { expect(run('https://evil.example/agent-relay/abc').stderr).toContain('Expected the conversation URL'); expect(run('https://arelay.to/agent-relay/a;rm').stderr).toContain('Invalid conversation id'); }); + + it('keeps our own agent identity and setup line in the agent guide', () => { + for (const guide of [ + agentChatAgentGuide({ conversationId: 'abc123' }), + agentChatAgentGuide({ conversationId: 'abc123', agentHandle: 'agent-relay', agentName: 'Agent Relay' }), + ]) { + expect(guide).toContain('Chat with the Agent Relay agent for me'); + expect(guide).not.toContain('registered agent'); + expect(guide).toContain('Before you set anything up for Agent Relay'); + } + const company = agentChatAgentGuide({ conversationId: 'abc123', agentHandle: 'acme', agentName: 'Acme' }); + expect(company).toContain('the registered agent "Acme"'); + expect(company).not.toContain('Before you set anything up for Agent Relay'); + }); });