Skip to content

Commit b32e0a2

Browse files
committed
fix(agents): generalize group message-tool etiquette
1 parent 9e7b057 commit b32e0a2

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/agents/system-prompt.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ describe("buildAgentSystemPrompt", () => {
11041104
);
11051105
expect(prompt).not.toContain("Attach media: `MEDIA:<path-or-url>`");
11061106
expect(prompt).toContain(
1107-
"Discord group/thread etiquette: a mention plus message-tool-only delivery does not require visible output",
1107+
"Group/channel etiquette: message-tool-only delivery does not require visible output",
11081108
);
11091109
expect(prompt).toContain("The target defaults to the current source channel");
11101110
expect(prompt).toContain("do not repeat that visible content in your final answer");
@@ -1130,6 +1130,9 @@ describe("buildAgentSystemPrompt", () => {
11301130
});
11311131

11321132
expect(prompt).toContain("include `target` and `message`; `target` is required for this turn");
1133+
expect(prompt).toContain(
1134+
"Group/channel etiquette: message-tool-only delivery does not require visible output",
1135+
);
11331136
expect(prompt).not.toContain("The target defaults to the current source channel");
11341137
});
11351138

@@ -1150,7 +1153,7 @@ describe("buildAgentSystemPrompt", () => {
11501153
);
11511154
});
11521155

1153-
it("keeps Discord group etiquette scoped to group message-tool-only delivery", () => {
1156+
it("keeps group/channel etiquette scoped to message-tool-only delivery", () => {
11541157
const prompt = buildAgentSystemPrompt({
11551158
workspaceDir: "/tmp/openclaw",
11561159
toolNames: ["message"],
@@ -1160,10 +1163,10 @@ describe("buildAgentSystemPrompt", () => {
11601163
},
11611164
});
11621165

1163-
expect(prompt).not.toContain("Discord group/thread etiquette");
1166+
expect(prompt).not.toContain("Group/channel etiquette");
11641167
});
11651168

1166-
it("omits Discord group etiquette for direct message-tool-only delivery", () => {
1169+
it("omits group/channel etiquette for direct message-tool-only delivery", () => {
11671170
const prompt = buildAgentSystemPrompt({
11681171
workspaceDir: "/tmp/openclaw",
11691172
toolNames: ["message"],
@@ -1175,7 +1178,7 @@ describe("buildAgentSystemPrompt", () => {
11751178
});
11761179

11771180
expect(prompt).toContain("use `message(action=send)` for visible source-channel output");
1178-
expect(prompt).not.toContain("Discord group/thread etiquette");
1181+
expect(prompt).not.toContain("Group/channel etiquette");
11791182
});
11801183

11811184
it("suppresses plain chat approval commands when inline approval UI is available", () => {

src/agents/system-prompt.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,8 @@ function buildMessagingSection(params: {
500500
}
501501
const messageToolOnly = params.sourceReplyDeliveryMode === "message_tool_only";
502502
const showGenericInlineButtonHint = params.runtimeChannel !== "slack";
503-
const discordGroupMessageToolOnly =
504-
messageToolOnly &&
505-
params.runtimeChannel === "discord" &&
506-
(params.runtimeChatType === "group" || params.runtimeChatType === "channel");
503+
const groupMessageToolOnly =
504+
messageToolOnly && (params.runtimeChatType === "group" || params.runtimeChatType === "channel");
507505
const telegramRuntime = params.runtimeChannel === "telegram";
508506
const telegramRichTextEnabled = telegramRuntime && params.richTextEnabled;
509507
const hasSessionsSpawn = params.availableTools.has("sessions_spawn");
@@ -539,8 +537,8 @@ function buildMessagingSection(params: {
539537
"",
540538
"### message tool",
541539
"- Use `message` for proactive sends + channel actions (polls, reactions, etc.).",
542-
discordGroupMessageToolOnly
543-
? "- Discord group/thread etiquette: a mention plus message-tool-only delivery does not require visible output. For stale threads, jokes, lightweight acknowledgements, or low-value chatter, prefer a reaction or no channel message; post only when you have concrete value to add."
540+
groupMessageToolOnly
541+
? "- Group/channel etiquette: message-tool-only delivery does not require visible output. For stale threads, jokes, lightweight acknowledgements, or low-value chatter, prefer a reaction when available or no channel message; post only when you have concrete value to add."
544542
: "",
545543
messageToolOnly
546544
? params.requireExplicitMessageTarget

0 commit comments

Comments
 (0)