@@ -535,6 +535,82 @@ describe("AcpxRuntime fresh reset wrapper", () => {
535535 } ) ;
536536 } ) ;
537537
538+ it ( "disables delegate prompt timeout for OpenClaw-managed turns" , async ( ) => {
539+ const baseStore : TestSessionStore = {
540+ load : vi . fn ( async ( ) => ( {
541+ acpxRecordId : "agent:codex:acp:test" ,
542+ agentCommand : CODEX_ACP_COMMAND ,
543+ } ) ) ,
544+ save : vi . fn ( async ( ) => { } ) ,
545+ } ;
546+ const { runtime, delegate } = makeRuntime ( baseStore , {
547+ timeoutMs : 1 ,
548+ agentRegistry : {
549+ resolve : ( agentName : string ) => ( agentName === "codex" ? CODEX_ACP_COMMAND : agentName ) ,
550+ list : ( ) => [ "codex" ] ,
551+ } ,
552+ } ) ;
553+ const runTurn = vi . spyOn ( delegate , "runTurn" ) . mockImplementation ( async function * ( ) {
554+ yield { type : "done" } ;
555+ } ) ;
556+ const startTurn = vi . spyOn ( delegate , "startTurn" ) . mockImplementation (
557+ ( input ) : AcpRuntimeTurn => ( {
558+ requestId : input . requestId ,
559+ events : ( async function * ( ) {
560+ yield { type : "done" as const , stopReason : "end_turn" } ;
561+ } ) ( ) ,
562+ result : Promise . resolve ( {
563+ status : "completed" as const ,
564+ stopReason : "end_turn" ,
565+ } ) ,
566+ cancel : vi . fn ( async ( ) => { } ) ,
567+ closeStream : vi . fn ( async ( ) => { } ) ,
568+ } ) ,
569+ ) ;
570+
571+ for await ( const _event of runtime . runTurn ( {
572+ handle : {
573+ sessionKey : "agent:codex:acp:test" ,
574+ backend : "acpx" ,
575+ runtimeSessionName : "agent:codex:acp:test" ,
576+ acpxRecordId : "agent:codex:acp:test" ,
577+ } ,
578+ text : "Reply exactly OK" ,
579+ mode : "prompt" ,
580+ requestId : "turn-1" ,
581+ } ) ) {
582+ // no-op
583+ }
584+
585+ expect ( runTurn ) . toHaveBeenCalledWith (
586+ expect . objectContaining ( {
587+ timeoutMs : 0 ,
588+ } ) ,
589+ ) ;
590+
591+ const turn = runtime . startTurn ( {
592+ handle : {
593+ sessionKey : "agent:codex:acp:test" ,
594+ backend : "acpx" ,
595+ runtimeSessionName : "agent:codex:acp:test" ,
596+ acpxRecordId : "agent:codex:acp:test" ,
597+ } ,
598+ text : "Reply exactly OK" ,
599+ mode : "prompt" ,
600+ requestId : "turn-2" ,
601+ } ) ;
602+ for await ( const _event of turn . events ) {
603+ // no-op
604+ }
605+ await turn . result ;
606+
607+ expect ( startTurn ) . toHaveBeenCalledWith (
608+ expect . objectContaining ( {
609+ timeoutMs : 0 ,
610+ } ) ,
611+ ) ;
612+ } ) ;
613+
538614 it ( "does not normalize model startup for non-Codex ACP agents" , async ( ) => {
539615 const baseStore : TestSessionStore = {
540616 load : vi . fn ( async ( ) => undefined ) ,
0 commit comments