@@ -1873,6 +1873,49 @@ describe("runAgentTurnWithFallback", () => {
18731873 } ) ;
18741874 } ) ;
18751875
1876+ it ( "passes silent empty-reply policy to CLI backends for message-tool-only turns" , async ( ) => {
1877+ state . isCliProviderMock . mockReturnValue ( true ) ;
1878+ state . runWithModelFallbackMock . mockImplementationOnce ( async ( params : FallbackRunnerParams ) => ( {
1879+ result : await params . run ( "claude-cli" , "claude-sonnet-4-6" ) ,
1880+ provider : "claude-cli" ,
1881+ model : "claude-sonnet-4-6" ,
1882+ attempts : [ ] ,
1883+ } ) ) ;
1884+ state . runCliAgentMock . mockResolvedValueOnce ( {
1885+ payloads : [ { text : SILENT_REPLY_TOKEN } ] ,
1886+ meta : { executionTrace : { fallbackUsed : false } } ,
1887+ } ) ;
1888+
1889+ const runAgentTurnWithFallback = await getRunAgentTurnWithFallback ( ) ;
1890+ const followupRun = createFollowupRun ( ) ;
1891+ followupRun . run . provider = "claude-cli" ;
1892+ followupRun . run . model = "claude-sonnet-4-6" ;
1893+ followupRun . run . sourceReplyDeliveryMode = "message_tool_only" ;
1894+ followupRun . run . allowEmptyAssistantReplyAsSilent = true ;
1895+ followupRun . originatingChannel = "telegram" ;
1896+
1897+ const result = await runAgentTurnWithFallback (
1898+ createMinimalRunAgentTurnParams ( {
1899+ followupRun,
1900+ sessionCtx : {
1901+ Provider : "telegram" ,
1902+ MessageSid : "msg" ,
1903+ ChatType : "group" ,
1904+ } as unknown as TemplateContext ,
1905+ } ) ,
1906+ ) ;
1907+
1908+ expect ( result . kind ) . toBe ( "success" ) ;
1909+ expectMockCallArgFields ( state . runCliAgentMock , 0 , "CLI run params" , {
1910+ provider : "claude-cli" ,
1911+ model : "claude-sonnet-4-6" ,
1912+ sourceReplyDeliveryMode : "message_tool_only" ,
1913+ allowEmptyAssistantReplyAsSilent : true ,
1914+ messageChannel : "telegram" ,
1915+ messageProvider : "telegram" ,
1916+ } ) ;
1917+ } ) ;
1918+
18761919 it ( "passes prepared CLI user turns to the runtime persistence boundary" , async ( ) => {
18771920 state . isCliProviderMock . mockReturnValue ( true ) ;
18781921 state . runWithModelFallbackMock . mockImplementationOnce ( async ( params : FallbackRunnerParams ) => ( {
0 commit comments