fix: Align silent reply prompt guidance (#70954)

* Align silent reply prompt guidance

* Pass explicit silent reply conversation types

* Handle dm alias in direct prompt guidance

* Respect policy session type for routed replies

* Preserve routed silent reply policy type

* Propagate silent reply dispatcher chat type

* Align prompt silent reply target policy

* Avoid direct silent fallback prompt token

* Use inbound key for prompt silent policy

* Rewrite direct silent replies in dispatcher
This commit is contained in:
Tak Hoffman
2026-04-24 12:06:54 -05:00
committed by GitHub
parent c9f2403547
commit cc57d56b92
24 changed files with 604 additions and 123 deletions

View File

@@ -10,7 +10,11 @@ import { resolveBootstrapContextForRun } from "../../../src/agents/bootstrap-fil
import { buildEmbeddedSystemPrompt } from "../../../src/agents/pi-embedded-runner/system-prompt.js";
import { buildAgentSystemPrompt } from "../../../src/agents/system-prompt.js";
import { createStubTool } from "../../../src/agents/test-helpers/pi-tool-stubs.js";
import { buildGroupChatContext, buildGroupIntro } from "../../../src/auto-reply/reply/groups.js";
import {
buildDirectChatContext,
buildGroupChatContext,
buildGroupIntro,
} from "../../../src/auto-reply/reply/groups.js";
import {
buildInboundMetaSystemPrompt,
buildInboundUserContextPrefix,
@@ -118,6 +122,14 @@ function buildAutoReplySystemPrompt(params: {
}) {
const extraSystemPromptParts = [
buildInboundMetaSystemPrompt(params.sessionCtx),
params.sessionCtx.ChatType === "direct" || params.sessionCtx.ChatType === "dm"
? buildDirectChatContext({
sessionCtx: params.sessionCtx,
silentToken: SILENT_REPLY_TOKEN,
silentReplyPolicy: "disallow",
silentReplyRewrite: true,
})
: "",
params.includeGroupChatContext ? buildGroupChatContext({ sessionCtx: params.sessionCtx }) : "",
params.includeGroupIntro
? buildGroupIntro({
@@ -179,7 +191,7 @@ function createDirectScenario(workspaceDir: string): PromptScenario {
OriginatingChannel: "slack",
OriginatingTo: "D123",
AccountId: "A1",
ChatType: "direct",
ChatType: "dm",
SenderId: "U1",
SenderName: "Alice",
Body: "hi",