@@ -6369,6 +6369,71 @@ describe("CodexAdapterV2 post-settle continuation", () => {
63696369 ) ,
63706370 ) ;
63716371
6372+ it . effect ( "settles the run when Codex never answers the expiry pause" , ( ) =>
6373+ Effect . gen ( function * ( ) {
6374+ const prompt = "Keep going" ;
6375+ const transcript = makeCodexReplayTranscript ( {
6376+ scenario : "goal-expiry-pause-unanswered" ,
6377+ entries : [
6378+ ...codexReplayPreamble ( { nativeThreadId, nativeTurnId : "goal-turn" , prompt } ) ,
6379+ notification ( "goal active" , "thread/goal/updated" , {
6380+ threadId : nativeThreadId ,
6381+ turnId : "goal-turn" ,
6382+ goal : codexGoal ( "active" , 10 ) ,
6383+ } ) ,
6384+ notification ( "turn done" , "turn/completed" , {
6385+ threadId : nativeThreadId ,
6386+ turn : makeCodexReplayTurn ( { id : "goal-turn" , status : "completed" } ) ,
6387+ } ) ,
6388+ notification ( "goal accounted" , "thread/goal/updated" , {
6389+ threadId : nativeThreadId ,
6390+ turnId : null ,
6391+ goal : codexGoal ( "active" , 11 ) ,
6392+ } ) ,
6393+ {
6394+ type : "expect_outbound" ,
6395+ label : "pause" ,
6396+ frame : {
6397+ id : 4 ,
6398+ method : "thread/goal/set" ,
6399+ params : { threadId : nativeThreadId , status : "paused" } ,
6400+ } ,
6401+ } ,
6402+ ] ,
6403+ } ) ;
6404+ const harness = yield * makeCodexReplayHarness ( transcript ) ;
6405+ yield * harness . runtime . startTurn (
6406+ makeCodexTestTurnInput ( {
6407+ threadId : harness . threadId ,
6408+ providerThread : harness . providerThread ,
6409+ now : yield * DateTime . now ,
6410+ attemptId : RunAttemptId . make ( "goal-unanswered-attempt" ) ,
6411+ text : prompt ,
6412+ } ) ,
6413+ ) ;
6414+ yield * harness . until ( ( ) =>
6415+ harness . events . some (
6416+ ( event ) =>
6417+ event . type === "provider_thread.updated" &&
6418+ event . providerThread . goal ?. tokensUsed === 11 ,
6419+ ) ,
6420+ ) ;
6421+ yield * TestClock . adjust ( "5 seconds" ) ;
6422+ yield * TestClock . adjust ( "10 seconds" ) ;
6423+ yield * harness . firstTerminal ;
6424+
6425+ assert . deepEqual (
6426+ harness . terminalEvents ( ) . map ( ( event ) => event . status ) ,
6427+ [ "completed" ] ,
6428+ ) ;
6429+ } ) . pipe (
6430+ Effect . scoped ,
6431+ Effect . provide (
6432+ Layer . mergeAll ( IdAllocator . layer , McpProviderSessions . layer , NodeServices . layer ) ,
6433+ ) ,
6434+ ) ,
6435+ ) ;
6436+
63726437 it . effect ( "pauses an active goal before Stop interrupts its turn" , ( ) =>
63736438 Effect . gen ( function * ( ) {
63746439 const prompt = "Keep going" ;
0 commit comments