@@ -2735,17 +2735,18 @@ describe("runCodexAppServerAttempt", () => {
27352735 } ) ;
27362736
27372737 it ( "does not drop turn completion notifications emitted while turn/start is in flight" , async ( ) => {
2738- let harness : ReturnType < typeof createAppServerHarness > ;
2739- harness = createAppServerHarness ( async ( method ) => {
2740- if ( method === "thread/start" ) {
2741- return threadStartResult ( ) ;
2742- }
2743- if ( method === "turn/start" ) {
2744- await harness . completeTurn ( { threadId : "thread-1" , turnId : "turn-1" } ) ;
2745- return turnStartResult ( "turn-1" , "completed" ) ;
2746- }
2747- return { } ;
2748- } ) ;
2738+ const harness : ReturnType < typeof createAppServerHarness > = createAppServerHarness (
2739+ async ( method ) => {
2740+ if ( method === "thread/start" ) {
2741+ return threadStartResult ( ) ;
2742+ }
2743+ if ( method === "turn/start" ) {
2744+ await harness . completeTurn ( { threadId : "thread-1" , turnId : "turn-1" } ) ;
2745+ return turnStartResult ( "turn-1" , "completed" ) ;
2746+ }
2747+ return { } ;
2748+ } ,
2749+ ) ;
27492750
27502751 const result = await runCodexAppServerAttempt (
27512752 createParams ( path . join ( tempDir , "session.jsonl" ) , path . join ( tempDir , "workspace" ) ) ,
@@ -2755,30 +2756,31 @@ describe("runCodexAppServerAttempt", () => {
27552756 } ) ;
27562757
27572758 it ( "does not fail when a buffered terminal notification is followed by client close" , async ( ) => {
2758- let harness : ReturnType < typeof createAppServerHarness > ;
27592759 let resolveBufferedTerminal ! : ( ) => void ;
27602760 const bufferedTerminal = new Promise < void > ( ( resolve ) => {
27612761 resolveBufferedTerminal = resolve ;
27622762 } ) ;
2763- harness = createAppServerHarness ( async ( method ) => {
2764- if ( method === "thread/start" ) {
2765- return threadStartResult ( ) ;
2766- }
2767- if ( method === "turn/start" ) {
2768- await harness . notify ( {
2769- method : "item/started" ,
2770- params : {
2771- threadId : "thread-1" ,
2772- turnId : "turn-1" ,
2773- item : { id : "tool-1" , type : "commandExecution" } ,
2774- } ,
2775- } ) ;
2776- await harness . completeTurn ( { threadId : "thread-1" , turnId : "turn-1" } ) ;
2777- resolveBufferedTerminal ( ) ;
2778- return turnStartResult ( "turn-1" , "inProgress" ) ;
2779- }
2780- return { } ;
2781- } ) ;
2763+ const harness : ReturnType < typeof createAppServerHarness > = createAppServerHarness (
2764+ async ( method ) => {
2765+ if ( method === "thread/start" ) {
2766+ return threadStartResult ( ) ;
2767+ }
2768+ if ( method === "turn/start" ) {
2769+ await harness . notify ( {
2770+ method : "item/started" ,
2771+ params : {
2772+ threadId : "thread-1" ,
2773+ turnId : "turn-1" ,
2774+ item : { id : "tool-1" , type : "commandExecution" } ,
2775+ } ,
2776+ } ) ;
2777+ await harness . completeTurn ( { threadId : "thread-1" , turnId : "turn-1" } ) ;
2778+ resolveBufferedTerminal ( ) ;
2779+ return turnStartResult ( "turn-1" , "inProgress" ) ;
2780+ }
2781+ return { } ;
2782+ } ,
2783+ ) ;
27822784
27832785 const run = runCodexAppServerAttempt (
27842786 createParams ( path . join ( tempDir , "session.jsonl" ) , path . join ( tempDir , "workspace" ) ) ,
@@ -2795,24 +2797,25 @@ describe("runCodexAppServerAttempt", () => {
27952797 } ) ;
27962798
27972799 it ( "does not time out when turn progress arrives before turn/start returns" , async ( ) => {
2798- let harness : ReturnType < typeof createAppServerHarness > ;
2799- harness = createAppServerHarness ( async ( method ) => {
2800- if ( method === "thread/start" ) {
2801- return threadStartResult ( ) ;
2802- }
2803- if ( method === "turn/start" ) {
2804- await harness . notify ( {
2805- method : "turn/started" ,
2806- params : {
2807- threadId : "thread-1" ,
2808- turnId : "turn-1" ,
2809- turn : { id : "turn-1" , status : "inProgress" } ,
2810- } ,
2811- } ) ;
2812- return turnStartResult ( "turn-1" , "inProgress" ) ;
2813- }
2814- return { } ;
2815- } ) ;
2800+ const harness : ReturnType < typeof createAppServerHarness > = createAppServerHarness (
2801+ async ( method ) => {
2802+ if ( method === "thread/start" ) {
2803+ return threadStartResult ( ) ;
2804+ }
2805+ if ( method === "turn/start" ) {
2806+ await harness . notify ( {
2807+ method : "turn/started" ,
2808+ params : {
2809+ threadId : "thread-1" ,
2810+ turnId : "turn-1" ,
2811+ turn : { id : "turn-1" , status : "inProgress" } ,
2812+ } ,
2813+ } ) ;
2814+ return turnStartResult ( "turn-1" , "inProgress" ) ;
2815+ }
2816+ return { } ;
2817+ } ,
2818+ ) ;
28162819 const params = createParams (
28172820 path . join ( tempDir , "session.jsonl" ) ,
28182821 path . join ( tempDir , "workspace" ) ,
0 commit comments