Skip to content

Commit 14ef91a

Browse files
committed
fix(reply): pass silent-empty policy to CLI fallback runs
1 parent b8adc11 commit 14ef91a

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/auto-reply/reply/agent-runner-execution.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,38 @@ describe("runAgentTurnWithFallback", () => {
18651865
});
18661866
});
18671867

1868+
it("forwards silent-empty reply allowance to CLI backends for message-tool-only turns", async () => {
1869+
state.isCliProviderMock.mockReturnValue(true);
1870+
state.runWithModelFallbackMock.mockImplementationOnce(async (params: FallbackRunnerParams) => ({
1871+
result: await params.run("claude-cli", "sonnet-4.6"),
1872+
provider: "claude-cli",
1873+
model: "sonnet-4.6",
1874+
attempts: [],
1875+
}));
1876+
state.runCliAgentMock.mockResolvedValueOnce({
1877+
payloads: [],
1878+
meta: {},
1879+
});
1880+
1881+
const runAgentTurnWithFallback = await getRunAgentTurnWithFallback();
1882+
const followupRun = createFollowupRun();
1883+
followupRun.run.provider = "claude-cli";
1884+
followupRun.run.model = "sonnet-4.6";
1885+
followupRun.run.sourceReplyDeliveryMode = "message_tool_only";
1886+
followupRun.run.allowEmptyAssistantReplyAsSilent = true;
1887+
followupRun.originatingChannel = "telegram";
1888+
1889+
const result = await runAgentTurnWithFallback(createMinimalRunAgentTurnParams({ followupRun }));
1890+
1891+
expect(result.kind).toBe("success");
1892+
expectMockCallArgFields(state.runCliAgentMock, 0, "CLI run params", {
1893+
sourceReplyDeliveryMode: "message_tool_only",
1894+
allowEmptyAssistantReplyAsSilent: true,
1895+
messageChannel: "telegram",
1896+
messageProvider: "telegram",
1897+
});
1898+
});
1899+
18681900
it("passes prepared CLI user turns to the runtime persistence boundary", async () => {
18691901
state.isCliProviderMock.mockReturnValue(true);
18701902
state.runWithModelFallbackMock.mockImplementationOnce(async (params: FallbackRunnerParams) => ({

src/auto-reply/reply/agent-runner-execution.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,8 @@ export async function runAgentTurnWithFallback(params: {
21862186
lane: runLane,
21872187
extraSystemPrompt: params.followupRun.run.extraSystemPrompt,
21882188
sourceReplyDeliveryMode: params.followupRun.run.sourceReplyDeliveryMode,
2189+
allowEmptyAssistantReplyAsSilent:
2190+
params.followupRun.run.allowEmptyAssistantReplyAsSilent,
21892191
silentReplyPromptMode: params.followupRun.run.silentReplyPromptMode,
21902192
extraSystemPromptStatic: params.followupRun.run.extraSystemPromptStatic,
21912193
ownerNumbers: params.followupRun.run.ownerNumbers,

0 commit comments

Comments
 (0)