@@ -655,9 +655,7 @@ describe("runCodexAppServerAttempt", () => {
655655 } ;
656656
657657 expect (
658- __testing
659- . filterCodexDynamicTools ( tools , { } , privateQaCodexEnv )
660- . map ( ( tool ) => tool . name ) ,
658+ __testing . filterCodexDynamicTools ( tools , { } , privateQaCodexEnv ) . map ( ( tool ) => tool . name ) ,
661659 ) . toEqual ( [ "read" , "write" , "image_generate" , "message" ] ) ;
662660 expect ( __testing . resolveCodexDynamicToolsLoading ( { } , privateQaCodexEnv ) ) . toBe ( "direct" ) ;
663661 } ) ;
@@ -1657,7 +1655,7 @@ describe("runCodexAppServerAttempt", () => {
16571655 path . join ( tempDir , "session.jsonl" ) ,
16581656 path . join ( tempDir , "workspace" ) ,
16591657 ) ;
1660- params . timeoutMs = 100 ;
1658+ params . timeoutMs = 250 ;
16611659
16621660 const result = await runCodexAppServerAttempt ( params ) ;
16631661
@@ -1694,6 +1692,13 @@ describe("runCodexAppServerAttempt", () => {
16941692 turnTerminalIdleTimeoutMs : 300 ,
16951693 } ) ;
16961694 await harness . waitForMethod ( "turn/start" ) ;
1695+ await vi . waitFor (
1696+ ( ) =>
1697+ expect ( onRunProgress ) . toHaveBeenCalledWith (
1698+ expect . objectContaining ( { reason : "turn:start" } ) ,
1699+ ) ,
1700+ fastWait ,
1701+ ) ;
16971702
16981703 await new Promise ( ( resolve ) => setTimeout ( resolve , 60 ) ) ;
16991704 await harness . notify ( {
@@ -1756,6 +1761,13 @@ describe("runCodexAppServerAttempt", () => {
17561761 turnTerminalIdleTimeoutMs : 500 ,
17571762 } ) ;
17581763 await harness . waitForMethod ( "turn/start" ) ;
1764+ await vi . waitFor (
1765+ ( ) =>
1766+ expect ( onRunProgress ) . toHaveBeenCalledWith (
1767+ expect . objectContaining ( { reason : "turn:start" } ) ,
1768+ ) ,
1769+ fastWait ,
1770+ ) ;
17591771
17601772 await new Promise ( ( resolve ) => setTimeout ( resolve , 60 ) ) ;
17611773 await harness . handleServerRequest ( {
@@ -1840,13 +1852,22 @@ describe("runCodexAppServerAttempt", () => {
18401852 path . join ( tempDir , "workspace" ) ,
18411853 ) ;
18421854 params . timeoutMs = 100 ;
1855+ const onRunProgress = vi . fn ( ) ;
1856+ params . onRunProgress = onRunProgress ;
18431857
18441858 const run = runCodexAppServerAttempt ( params , {
18451859 turnCompletionIdleTimeoutMs : 300 ,
18461860 turnAssistantCompletionIdleTimeoutMs : 300 ,
18471861 turnTerminalIdleTimeoutMs : 300 ,
18481862 } ) ;
18491863 await harness . waitForMethod ( "turn/start" ) ;
1864+ await vi . waitFor (
1865+ ( ) =>
1866+ expect ( onRunProgress ) . toHaveBeenCalledWith (
1867+ expect . objectContaining ( { reason : "turn:start" } ) ,
1868+ ) ,
1869+ fastWait ,
1870+ ) ;
18501871
18511872 await new Promise ( ( resolve ) => setTimeout ( resolve , 60 ) ) ;
18521873 await harness . handleServerRequest ( {
@@ -1879,17 +1900,26 @@ describe("runCodexAppServerAttempt", () => {
18791900 path . join ( tempDir , "session.jsonl" ) ,
18801901 path . join ( tempDir , "workspace" ) ,
18811902 ) ;
1882- params . timeoutMs = 100 ;
1903+ params . timeoutMs = 250 ;
18831904 params . onBlockReply = vi . fn ( ) ;
1905+ const onRunProgress = vi . fn ( ) ;
1906+ params . onRunProgress = onRunProgress ;
18841907
18851908 const run = runCodexAppServerAttempt ( params , {
1886- turnCompletionIdleTimeoutMs : 300 ,
1887- turnAssistantCompletionIdleTimeoutMs : 300 ,
1888- turnTerminalIdleTimeoutMs : 300 ,
1909+ turnCompletionIdleTimeoutMs : 600 ,
1910+ turnAssistantCompletionIdleTimeoutMs : 600 ,
1911+ turnTerminalIdleTimeoutMs : 600 ,
18891912 } ) ;
18901913 await harness . waitForMethod ( "turn/start" ) ;
1914+ await vi . waitFor (
1915+ ( ) =>
1916+ expect ( onRunProgress ) . toHaveBeenCalledWith (
1917+ expect . objectContaining ( { reason : "turn:start" } ) ,
1918+ ) ,
1919+ fastWait ,
1920+ ) ;
18911921
1892- await new Promise ( ( resolve ) => setTimeout ( resolve , 60 ) ) ;
1922+ await new Promise ( ( resolve ) => setTimeout ( resolve , 75 ) ) ;
18931923 const response = harness . handleServerRequest ( {
18941924 id : "request-user-input" ,
18951925 method : "item/tool/requestUserInput" ,
@@ -1913,7 +1943,7 @@ describe("runCodexAppServerAttempt", () => {
19131943 } ,
19141944 } ) ;
19151945 await vi . waitFor ( ( ) => expect ( params . onBlockReply ) . toHaveBeenCalledTimes ( 1 ) , fastWait ) ;
1916- await new Promise ( ( resolve ) => setTimeout ( resolve , 60 ) ) ;
1946+ await new Promise ( ( resolve ) => setTimeout ( resolve , 125 ) ) ;
19171947
19181948 expect ( harness . request . mock . calls . some ( ( [ method ] ) => method === "turn/interrupt" ) ) . toBe ( false ) ;
19191949 expect ( queueActiveRunMessageForTest ( "session-1" , "2" ) ) . toBe ( true ) ;
0 commit comments