fix(server): cap how long a Codex turn waits on a silent retry #33076
ClosedBleedingDev(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/33076/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -4702,0 +4723,21 @@4723+ yield* Effect.sleep(CODEX_RETRY_WAIT_CAP);4724+ if (4725+ (yield* Ref.get(activeTurns)).get(context.nativeTurnId) !== context ||4726+ (yield* Ref.get(providerRetries)).get(context.providerTurnId) !== state4727+ )4728+ return;4729+ context.latestProviderFailure = {4730+ nativeMessage: state.nativeMessage,4731+ nativeCode: state.nativeCode,4732+ failure: makeProviderFailure({4733+ message: `Codex reported no retry progress for 10 minutes after: ${state.nativeMessage}`,4734+ code: state.nativeCode,4735+ class:4736+ state.failure.class === "transport_error" ? "transport_error" : "provider_error",4737+ retryable: false,4738+ }),4739+ };4740+ yield* client4741+ .request("turn/interrupt", { threadId: nativeThreadId, turnId: context.nativeTurnId })4742+ .pipe(4743+ Effect.catch((cause) =>
- @@ -4702,0 +4724,21 @@4724+ if (4725+ (yield* Ref.get(activeTurns)).get(context.nativeTurnId) !== context ||4726+ (yield* Ref.get(providerRetries)).get(context.providerTurnId) !== state4727+ )4728+ return;4729+ context.latestProviderFailure = {4730+ nativeMessage: state.nativeMessage,4731+ nativeCode: state.nativeCode,4732+ failure: makeProviderFailure({4733+ message: `Codex reported no retry progress for 10 minutes after: ${state.nativeMessage}`,4734+ code: state.nativeCode,4735+ class:4736+ state.failure.class === "transport_error" ? "transport_error" : "provider_error",4737+ retryable: false,4738+ }),4739+ };4740+ yield* client4741+ .request("turn/interrupt", { threadId: nativeThreadId, turnId: context.nativeTurnId })4742+ .pipe(4743+ Effect.catch((cause) =>4744+ Effect.logWarning("orchestration-v2.codex-stalled-retry-interrupt-failed", {@@ -6573,8 +6631,12 @@65736631 return;65746632 }65756633 const nativeStatus = mapCodexTurnStatus(payload.turn.status);6634+ const interrupting = (yield* Ref.get(interruptingNativeTurns)).has(payload.turn.id);6635+ // An interrupt nobody asked for after a recorded failure is the stalled-retry cap firing.65766636 const status =6577- nativeStatus === "completed" &&6578- (yield* Ref.get(interruptingNativeTurns)).has(payload.turn.id)6637+ nativeStatus === "completed" && interrupting65796638 ? "interrupted"6580- : nativeStatus;6639+ : nativeStatus === "interrupted" &&6640+ !interrupting &&6641+ context.latestProviderFailure !== undefined6642+ ? "failed"
BleedingDev(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
5f3b8f9ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.