From 72b0777341f6da5565e217f30dd388244aedcebf Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 9 Jan 2026 19:18:30 +0000 Subject: [PATCH] fix(messages): restore explicit responsePrefix default --- docs/gateway/configuration.md | 3 +-- docs/providers/whatsapp.md | 4 ++-- src/agents/identity.ts | 4 ++-- src/auto-reply/reply/route-reply.test.ts | 4 ++-- src/config/types.ts | 2 +- src/slack/monitor.tool-result.test.ts | 6 +++--- src/web/auto-reply.test.ts | 6 +++--- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/gateway/configuration.md b/docs/gateway/configuration.md index fbd7bbc8f..67044d2d4 100644 --- a/docs/gateway/configuration.md +++ b/docs/gateway/configuration.md @@ -937,8 +937,7 @@ See [Messages](/concepts/messages) for queueing, sessions, and streaming context `responsePrefix` is applied to **all outbound replies** (tool summaries, block streaming, final replies) across providers unless already present. -If `messages.responsePrefix` is unset and the routed agent has `identity.name` -set, Clawdbot defaults the prefix to `[{identity.name}]`. +If `messages.responsePrefix` is unset, no prefix is applied by default. If `messages.messagePrefix` is unset, the default stays **unchanged**: `"[clawdbot]"` when `whatsapp.allowFrom` is empty, otherwise `""` (no prefix). diff --git a/docs/providers/whatsapp.md b/docs/providers/whatsapp.md index 9321bdeab..f11c98ab6 100644 --- a/docs/providers/whatsapp.md +++ b/docs/providers/whatsapp.md @@ -59,8 +59,8 @@ When the wizard asks for your personal WhatsApp number, enter the phone you will } ``` -Tip: if you set the routed agent’s `identity.name`, you can omit -`messages.responsePrefix` and it will default to `[{identity.name}]`. +Tip: set `messages.responsePrefix` explicitly if you want a consistent bot prefix +on outbound replies. ### Number sourcing tips - **Local eSIM** from your country's mobile carrier (most reliable) diff --git a/src/agents/identity.ts b/src/agents/identity.ts index 20f68bd4f..764f736e8 100644 --- a/src/agents/identity.ts +++ b/src/agents/identity.ts @@ -47,11 +47,11 @@ export function resolveMessagePrefix( export function resolveResponsePrefix( cfg: ClawdbotConfig, - agentId: string, + _agentId: string, ): string | undefined { const configured = cfg.messages?.responsePrefix; if (configured !== undefined) return configured; - return resolveIdentityNamePrefix(cfg, agentId); + return undefined; } export function resolveEffectiveMessagesConfig( diff --git a/src/auto-reply/reply/route-reply.test.ts b/src/auto-reply/reply/route-reply.test.ts index 3d94ebd16..07a620d1d 100644 --- a/src/auto-reply/reply/route-reply.test.ts +++ b/src/auto-reply/reply/route-reply.test.ts @@ -99,7 +99,7 @@ describe("routeReply", () => { ); }); - it("derives responsePrefix from agent identity when routing", async () => { + it("does not derive responsePrefix from agent identity when routing", async () => { mocks.sendMessageSlack.mockClear(); const cfg = { agents: { @@ -121,7 +121,7 @@ describe("routeReply", () => { }); expect(mocks.sendMessageSlack).toHaveBeenCalledWith( "channel:C123", - "[Richbot] hi", + "hi", expect.any(Object), ); }); diff --git a/src/config/types.ts b/src/config/types.ts index fcca0c011..c80a231b1 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -932,7 +932,7 @@ export type AudioConfig = { export type MessagesConfig = { messagePrefix?: string; // Prefix added to all inbound messages (default: "[{agents.list[].identity.name}]" or "[clawdbot]" if no allowFrom, else "") - responsePrefix?: string; // Prefix auto-added to all outbound replies (default: "[{agents.list[].identity.name}]" when set, else none) + responsePrefix?: string; // Prefix auto-added to all outbound replies (default: none) groupChat?: GroupChatConfig; queue?: QueueConfig; /** Emoji reaction used to acknowledge inbound messages (empty disables). */ diff --git a/src/slack/monitor.tool-result.test.ts b/src/slack/monitor.tool-result.test.ts index 77a5e15f5..d67fe25ab 100644 --- a/src/slack/monitor.tool-result.test.ts +++ b/src/slack/monitor.tool-result.test.ts @@ -154,7 +154,7 @@ describe("monitorSlackProvider tool results", () => { expect(sendMock.mock.calls[1][1]).toBe("PFX final reply"); }); - it("derives responsePrefix from routed agent identity when unset", async () => { + it("does not derive responsePrefix from routed agent identity when unset", async () => { config = { agents: { list: [ @@ -214,8 +214,8 @@ describe("monitorSlackProvider tool results", () => { await run; expect(sendMock).toHaveBeenCalledTimes(2); - expect(sendMock.mock.calls[0][1]).toBe("[Richbot] tool update"); - expect(sendMock.mock.calls[1][1]).toBe("[Richbot] final reply"); + expect(sendMock.mock.calls[0][1]).toBe("tool update"); + expect(sendMock.mock.calls[1][1]).toBe("final reply"); }); it("updates assistant thread status when replies start", async () => { diff --git a/src/web/auto-reply.test.ts b/src/web/auto-reply.test.ts index 458b09d55..f172ba0af 100644 --- a/src/web/auto-reply.test.ts +++ b/src/web/auto-reply.test.ts @@ -2022,7 +2022,7 @@ describe("web auto-reply", () => { resetLoadConfigMock(); }); - it("uses identity.name for responsePrefix when set", async () => { + it("does not derive responsePrefix from identity.name when unset", async () => { setLoadConfigMock(() => ({ agents: { list: [ @@ -2076,8 +2076,8 @@ describe("web auto-reply", () => { sendMedia: vi.fn(), }); - // Reply should have identity-based responsePrefix prepended - expect(reply).toHaveBeenCalledWith("[Richbot] hello there"); + // No implicit responsePrefix. + expect(reply).toHaveBeenCalledWith("hello there"); resetLoadConfigMock(); }); });