[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.
This commit is contained in:
Peter Steinberger
2026-04-29 05:16:21 +01:00
committed by GitHub
parent 0382ac5f7d
commit ab39f2b272
3 changed files with 7 additions and 0 deletions

View File

@@ -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");

View File

@@ -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" },

View File

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