fix(messages): restore explicit responsePrefix default
This commit is contained in:
@@ -937,8 +937,7 @@ See [Messages](/concepts/messages) for queueing, sessions, and streaming context
|
|||||||
`responsePrefix` is applied to **all outbound replies** (tool summaries, block
|
`responsePrefix` is applied to **all outbound replies** (tool summaries, block
|
||||||
streaming, final replies) across providers unless already present.
|
streaming, final replies) across providers unless already present.
|
||||||
|
|
||||||
If `messages.responsePrefix` is unset and the routed agent has `identity.name`
|
If `messages.responsePrefix` is unset, no prefix is applied by default.
|
||||||
set, Clawdbot defaults the prefix to `[{identity.name}]`.
|
|
||||||
|
|
||||||
If `messages.messagePrefix` is unset, the default stays **unchanged**:
|
If `messages.messagePrefix` is unset, the default stays **unchanged**:
|
||||||
`"[clawdbot]"` when `whatsapp.allowFrom` is empty, otherwise `""` (no prefix).
|
`"[clawdbot]"` when `whatsapp.allowFrom` is empty, otherwise `""` (no prefix).
|
||||||
|
|||||||
@@ -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
|
Tip: set `messages.responsePrefix` explicitly if you want a consistent bot prefix
|
||||||
`messages.responsePrefix` and it will default to `[{identity.name}]`.
|
on outbound replies.
|
||||||
|
|
||||||
### Number sourcing tips
|
### Number sourcing tips
|
||||||
- **Local eSIM** from your country's mobile carrier (most reliable)
|
- **Local eSIM** from your country's mobile carrier (most reliable)
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ export function resolveMessagePrefix(
|
|||||||
|
|
||||||
export function resolveResponsePrefix(
|
export function resolveResponsePrefix(
|
||||||
cfg: ClawdbotConfig,
|
cfg: ClawdbotConfig,
|
||||||
agentId: string,
|
_agentId: string,
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
const configured = cfg.messages?.responsePrefix;
|
const configured = cfg.messages?.responsePrefix;
|
||||||
if (configured !== undefined) return configured;
|
if (configured !== undefined) return configured;
|
||||||
return resolveIdentityNamePrefix(cfg, agentId);
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveEffectiveMessagesConfig(
|
export function resolveEffectiveMessagesConfig(
|
||||||
|
|||||||
@@ -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();
|
mocks.sendMessageSlack.mockClear();
|
||||||
const cfg = {
|
const cfg = {
|
||||||
agents: {
|
agents: {
|
||||||
@@ -121,7 +121,7 @@ describe("routeReply", () => {
|
|||||||
});
|
});
|
||||||
expect(mocks.sendMessageSlack).toHaveBeenCalledWith(
|
expect(mocks.sendMessageSlack).toHaveBeenCalledWith(
|
||||||
"channel:C123",
|
"channel:C123",
|
||||||
"[Richbot] hi",
|
"hi",
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -932,7 +932,7 @@ export type AudioConfig = {
|
|||||||
|
|
||||||
export type MessagesConfig = {
|
export type MessagesConfig = {
|
||||||
messagePrefix?: string; // Prefix added to all inbound messages (default: "[{agents.list[].identity.name}]" or "[clawdbot]" if no allowFrom, else "")
|
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;
|
groupChat?: GroupChatConfig;
|
||||||
queue?: QueueConfig;
|
queue?: QueueConfig;
|
||||||
/** Emoji reaction used to acknowledge inbound messages (empty disables). */
|
/** Emoji reaction used to acknowledge inbound messages (empty disables). */
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ describe("monitorSlackProvider tool results", () => {
|
|||||||
expect(sendMock.mock.calls[1][1]).toBe("PFX final reply");
|
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 = {
|
config = {
|
||||||
agents: {
|
agents: {
|
||||||
list: [
|
list: [
|
||||||
@@ -214,8 +214,8 @@ describe("monitorSlackProvider tool results", () => {
|
|||||||
await run;
|
await run;
|
||||||
|
|
||||||
expect(sendMock).toHaveBeenCalledTimes(2);
|
expect(sendMock).toHaveBeenCalledTimes(2);
|
||||||
expect(sendMock.mock.calls[0][1]).toBe("[Richbot] tool update");
|
expect(sendMock.mock.calls[0][1]).toBe("tool update");
|
||||||
expect(sendMock.mock.calls[1][1]).toBe("[Richbot] final reply");
|
expect(sendMock.mock.calls[1][1]).toBe("final reply");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("updates assistant thread status when replies start", async () => {
|
it("updates assistant thread status when replies start", async () => {
|
||||||
|
|||||||
@@ -2022,7 +2022,7 @@ describe("web auto-reply", () => {
|
|||||||
resetLoadConfigMock();
|
resetLoadConfigMock();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses identity.name for responsePrefix when set", async () => {
|
it("does not derive responsePrefix from identity.name when unset", async () => {
|
||||||
setLoadConfigMock(() => ({
|
setLoadConfigMock(() => ({
|
||||||
agents: {
|
agents: {
|
||||||
list: [
|
list: [
|
||||||
@@ -2076,8 +2076,8 @@ describe("web auto-reply", () => {
|
|||||||
sendMedia: vi.fn(),
|
sendMedia: vi.fn(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reply should have identity-based responsePrefix prepended
|
// No implicit responsePrefix.
|
||||||
expect(reply).toHaveBeenCalledWith("[Richbot] hello there");
|
expect(reply).toHaveBeenCalledWith("hello there");
|
||||||
resetLoadConfigMock();
|
resetLoadConfigMock();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user