@@ -42,6 +42,7 @@ function codexTurnCompletionIdleTimeoutAttempt(
4242 promptErrorSource : "prompt" ,
4343 codexAppServerFailure : {
4444 kind : "turn_completion_idle_timeout" ,
45+ turnWatchTimeoutKind : "completion" ,
4546 transport : "stdio" ,
4647 threadId : "thread-1" ,
4748 turnId : "turn-1" ,
@@ -172,6 +173,35 @@ describe("runEmbeddedAgent Codex app-server recovery", () => {
172173 expect ( mockedRunEmbeddedAttempt ) . toHaveBeenCalledTimes ( 2 ) ;
173174 } ) ;
174175
176+ it ( "does not retry non-completion Codex turn watch timeouts" , async ( ) => {
177+ mockedRunEmbeddedAttempt . mockResolvedValueOnce (
178+ codexTurnCompletionIdleTimeoutAttempt ( {
179+ codexAppServerFailure : {
180+ kind : "turn_completion_idle_timeout" ,
181+ turnWatchTimeoutKind : "progress" ,
182+ transport : "stdio" ,
183+ threadId : "thread-1" ,
184+ turnId : "turn-1" ,
185+ replaySafe : true ,
186+ } ,
187+ } ) ,
188+ ) ;
189+
190+ const result = await runEmbeddedAgent ( {
191+ ...overflowBaseRunParams ,
192+ provider : "codex" ,
193+ model : "gpt-5.5" ,
194+ runId : "run-codex-progress-idle-timeout" ,
195+ } ) ;
196+
197+ expect ( result . payloads ?. [ 0 ] ) . toMatchObject ( {
198+ isError : true ,
199+ text : "Request timed out before a response was generated. Please try again, or increase `agents.defaults.timeoutSeconds` in your config." ,
200+ } ) ;
201+ expect ( mockedRunEmbeddedAttempt ) . toHaveBeenCalledTimes ( 1 ) ;
202+ expect ( mockedMarkAuthProfileFailure ) . not . toHaveBeenCalled ( ) ;
203+ } ) ;
204+
175205 it ( "returns a timeout payload after a replay-safe turn/completed idle timeout retry is exhausted" , async ( ) => {
176206 mockedRunEmbeddedAttempt
177207 . mockResolvedValueOnce ( codexTurnCompletionIdleTimeoutAttempt ( ) )
@@ -199,6 +229,7 @@ describe("runEmbeddedAgent Codex app-server recovery", () => {
199229 codexTurnCompletionIdleTimeoutAttempt ( {
200230 codexAppServerFailure : {
201231 kind : "turn_completion_idle_timeout" ,
232+ turnWatchTimeoutKind : "completion" ,
202233 transport : "websocket" ,
203234 threadId : "thread-1" ,
204235 turnId : "turn-1" ,
@@ -237,6 +268,7 @@ describe("runEmbeddedAgent Codex app-server recovery", () => {
237268 } ,
238269 codexAppServerFailure : {
239270 kind : "turn_completion_idle_timeout" ,
271+ turnWatchTimeoutKind : "completion" ,
240272 transport : "stdio" ,
241273 threadId : "thread-1" ,
242274 turnId : "turn-1" ,
0 commit comments