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

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