@@ -498,42 +498,15 @@ describe("runCodexAppServerAttempt", () => {
498498 ) ;
499499 } ) ;
500500
501- it ( "forces the message dynamic tool for message-tool-only source replies" , async ( ) => {
501+ it ( "forces the message dynamic tool for message-tool-only source replies" , ( ) => {
502502 const workspaceDir = path . join ( tempDir , "workspace" ) ;
503503 const params = createParams ( path . join ( tempDir , "session.jsonl" ) , workspaceDir ) ;
504- params . disableTools = false ;
505- params . config = { tools : { profile : "coding" } } ;
506504 params . sourceReplyDeliveryMode = "message_tool_only" ;
507- params . messageProvider = "whatsapp" ;
508- params . runtimePlan = buildCodexRuntimePlan ( params , workspaceDir ) ;
509- let seenForceMessageTool : boolean | undefined ;
510- __testing . setOpenClawCodingToolsFactoryForTests ( ( options ) => {
511- seenForceMessageTool = options ?. forceMessageTool ;
512- return [
513- {
514- name : "message" ,
515- description : "message test tool" ,
516- parameters : { type : "object" , properties : { } } ,
517- execute : vi . fn ( ) ,
518- } ,
519- ] as never ;
520- } ) ;
521505
522- const dynamicTools = await __testing . buildDynamicTools ( {
523- params,
524- resolvedWorkspace : workspaceDir ,
525- effectiveWorkspace : workspaceDir ,
526- sandboxSessionKey : "agent:main:session-1" ,
527- sandbox : null ,
528- runAbortController : new AbortController ( ) ,
529- sessionAgentId : "main" ,
530- pluginConfig : { } ,
531- onYieldDetected : ( ) => undefined ,
532- } ) ;
533- const dynamicToolNames = dynamicTools . map ( ( tool ) => tool . name ) ;
506+ expect ( __testing . shouldForceMessageTool ( params ) ) . toBe ( true ) ;
534507
535- expect ( seenForceMessageTool ) . toBe ( true ) ;
536- expect ( dynamicToolNames ) . toContain ( "message" ) ;
508+ params . sourceReplyDeliveryMode = "automatic" ;
509+ expect ( __testing . shouldForceMessageTool ( params ) ) . toBe ( false ) ;
537510 } ) ;
538511
539512 it ( "passes the live run session key to Codex dynamic tools when sandbox policy uses another key" , async ( ) => {
@@ -1713,87 +1686,6 @@ describe("runCodexAppServerAttempt", () => {
17131686 await run ;
17141687 } ) ;
17151688
1716- it ( "routes MCP approval elicitations through the native bridge" , async ( ) => {
1717- let notify : ( notification : CodexServerNotification ) => Promise < void > = async ( ) => undefined ;
1718- let handleRequest :
1719- | ( ( request : { id : string ; method : string ; params ?: unknown } ) => Promise < unknown > )
1720- | undefined ;
1721- const bridgeSpy = vi
1722- . spyOn ( elicitationBridge , "handleCodexAppServerElicitationRequest" )
1723- . mockResolvedValue ( {
1724- action : "accept" ,
1725- content : null ,
1726- _meta : null ,
1727- } ) ;
1728- const request = vi . fn ( async ( method : string ) => {
1729- if ( method === "thread/start" ) {
1730- return threadStartResult ( ) ;
1731- }
1732- if ( method === "turn/start" ) {
1733- return turnStartResult ( ) ;
1734- }
1735- return { } ;
1736- } ) ;
1737- __testing . setCodexAppServerClientFactoryForTests (
1738- async ( ) =>
1739- ( {
1740- request,
1741- addNotificationHandler : ( handler : typeof notify ) => {
1742- notify = handler ;
1743- return ( ) => undefined ;
1744- } ,
1745- addRequestHandler : (
1746- handler : ( request : {
1747- id : string ;
1748- method : string ;
1749- params ?: unknown ;
1750- } ) => Promise < unknown > ,
1751- ) => {
1752- handleRequest = handler ;
1753- return ( ) => undefined ;
1754- } ,
1755- } ) as never ,
1756- ) ;
1757-
1758- const run = runCodexAppServerAttempt (
1759- createParams ( path . join ( tempDir , "session.jsonl" ) , path . join ( tempDir , "workspace" ) ) ,
1760- ) ;
1761- await vi . waitFor ( ( ) => expect ( handleRequest ) . toBeTypeOf ( "function" ) , { interval : 1 } ) ;
1762-
1763- const result = await handleRequest ?.( {
1764- id : "request-elicitation-1" ,
1765- method : "mcpServer/elicitation/request" ,
1766- params : {
1767- threadId : "thread-1" ,
1768- turnId : "turn-1" ,
1769- serverName : "codex_apps__github" ,
1770- mode : "form" ,
1771- } ,
1772- } ) ;
1773-
1774- expect ( result ) . toEqual ( {
1775- action : "accept" ,
1776- content : null ,
1777- _meta : null ,
1778- } ) ;
1779- expect ( bridgeSpy ) . toHaveBeenCalledWith (
1780- expect . objectContaining ( {
1781- threadId : "thread-1" ,
1782- turnId : "turn-1" ,
1783- } ) ,
1784- ) ;
1785-
1786- await notify ( {
1787- method : "turn/completed" ,
1788- params : {
1789- threadId : "thread-1" ,
1790- turnId : "turn-1" ,
1791- turn : { id : "turn-1" , status : "completed" } ,
1792- } ,
1793- } ) ;
1794- await run ;
1795- } ) ;
1796-
17971689 it ( "routes request_user_input prompts through the active run follow-up queue" , async ( ) => {
17981690 let notify : ( notification : CodexServerNotification ) => Promise < void > = async ( ) => undefined ;
17991691 let handleRequest :
0 commit comments