From ab39f2b272a1f794d0cb4ed2aed78a9e763be889 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 29 Apr 2026 05:16:21 +0100 Subject: [PATCH] [codex] Bias group chat prompts toward subagent delegation (#74046) Bias group-chat prompt composition toward using subagents for tool-heavy work, keeping maintainer-channel responsiveness higher.\n\nValidated locally with focused prompt/auto-reply tests before opening the PR. --- src/agents/prompt-composition.test.ts | 2 ++ src/auto-reply/reply/groups.test.ts | 2 ++ src/auto-reply/reply/groups.ts | 3 +++ 3 files changed, 7 insertions(+) diff --git a/src/agents/prompt-composition.test.ts b/src/agents/prompt-composition.test.ts index bc0e7f65182..57134427353 100644 --- a/src/agents/prompt-composition.test.ts +++ b/src/agents/prompt-composition.test.ts @@ -63,10 +63,12 @@ describe("prompt composition invariants", () => { const eventTurn = getTurn(groupScenario!, "t3"); expect(first.systemPrompt).toContain("You are in a Slack group chat."); + expect(first.systemPrompt).toContain("prefer delegating bounded side investigations early"); expect(first.systemPrompt).toContain("Activation: trigger-only"); expect(first.systemPrompt).toContain('reply with exactly "NO_REPLY"'); expect(first.systemPrompt).not.toContain("## Silent Replies"); expect(steady.systemPrompt).toContain("You are in a Slack group chat."); + expect(steady.systemPrompt).toContain("prefer delegating bounded side investigations early"); expect(steady.systemPrompt).toContain('reply with exactly "NO_REPLY"'); expect(steady.systemPrompt).not.toContain("## Silent Replies"); expect(steady.systemPrompt).not.toContain("Activation: trigger-only"); diff --git a/src/auto-reply/reply/groups.test.ts b/src/auto-reply/reply/groups.test.ts index 51bbf1cf842..74c442e3ad2 100644 --- a/src/auto-reply/reply/groups.test.ts +++ b/src/auto-reply/reply/groups.test.ts @@ -31,6 +31,8 @@ describe("group runtime loading", () => { "You are in a WhatsApp group chat. Your replies are automatically sent to this group chat. Do not use the message tool to send to this same group - just reply normally.", ); expect(groupChatContext).toContain("Minimize empty lines and use normal chat conventions"); + expect(groupChatContext).toContain("prefer delegating bounded side investigations early"); + expect(groupChatContext).toContain("Keep the critical path local"); expect(groupChatContext).toContain('reply with exactly "NO_REPLY"'); const toolOnlyContext = groups.buildGroupChatContext({ sessionCtx: { ChatType: "group", Provider: "discord" }, diff --git a/src/auto-reply/reply/groups.ts b/src/auto-reply/reply/groups.ts index e8866130204..81037f68a61 100644 --- a/src/auto-reply/reply/groups.ts +++ b/src/auto-reply/reply/groups.ts @@ -245,6 +245,9 @@ export function buildGroupChatContext(params: { lines.push( "Write like a human. Avoid Markdown tables. Minimize empty lines and use normal chat conventions, not document-style spacing. Don't type literal \\n sequences; use real line breaks sparingly.", ); + lines.push( + "When subagent or session-spawn tools are available and a directly requested group-chat task will require several tool calls, prefer delegating bounded side investigations early so the channel gets a responsive path forward. Keep the critical path local, avoid subagents for simple one-step work, and only surface concise group-visible updates when they add value.", + ); const canUseSilentReply = !messageToolOnly && params.silentToken &&