fix(messages): restore explicit responsePrefix default

This commit is contained in:
Peter Steinberger
2026-01-09 19:18:30 +00:00
parent 237480ed9b
commit 72b0777341
7 changed files with 14 additions and 15 deletions

View File

@@ -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).

View File

@@ -59,8 +59,8 @@ When the wizard asks for your personal WhatsApp number, enter the phone you will
}
```
Tip: if you set the routed agents `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)

View File

@@ -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(

View File

@@ -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),
);
});

View File

@@ -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). */

View File

@@ -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 () => {

View File

@@ -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();
});
});