Skip to content

Commit c60fedd

Browse files
grenmango51claude
andcommitted
fix(server): Codex retry label no longer counts past its max
Codex switches from numbered "Reconnecting... N/M" retries to an open-ended "Reconnecting... waiting for network" phase. Those messages have no N/M, so the adapter kept the earlier maxAttempts while the attempt counter grew, rendering "Retrying provider (34/5)". Take maxAttempts only from the current message so the label reads "Retrying provider (34)". Fixes #30791 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8b44f42 commit c60fedd

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts‎

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,25 +3403,30 @@ describe("CodexAdapterV2 post-settle continuation", () => {
34033403
nativeTurnId,
34043404
prompt: "Open github.com.",
34053405
}),
3406-
{
3407-
type: "emit_inbound",
3408-
label: "error/retry",
3406+
...[
3407+
"Reconnecting... 2/5",
3408+
"Reconnecting... 5/5",
3409+
"Reconnecting... waiting for network",
3410+
"Reconnecting... waiting for network",
3411+
].map((message, index) => ({
3412+
type: "emit_inbound" as const,
3413+
label: `error/retry/${index}`,
34093414
frame: {
34103415
method: "error",
34113416
params: {
34123417
threadId: nativeThreadId,
34133418
turnId: nativeTurnId,
34143419
willRetry: true,
34153420
error: {
3416-
message: "Reconnecting... 2/5",
3421+
message,
34173422
additionalDetails: "The response stream disconnected.",
34183423
codexErrorInfo: {
34193424
responseStreamDisconnected: { httpStatusCode: 529 },
34203425
},
34213426
},
34223427
},
34233428
},
3424-
},
3429+
})),
34253430
{
34263431
type: "emit_inbound",
34273432
label: "item/started/after-retry",
@@ -3505,17 +3510,21 @@ describe("CodexAdapterV2 post-settle continuation", () => {
35053510
? [event.turnItem]
35063511
: [],
35073512
);
3508-
assert.lengthOf(retryItems, 2);
3513+
assert.lengthOf(retryItems, 5);
35093514
assert.equal(retryItems[0]?.status, "running");
35103515
assert.equal(retryItems[0]?.failure.code, "responseStreamDisconnected");
3511-
assert.deepEqual(retryItems[0]?.retry, {
3512-
attempt: 2,
3513-
maxAttempts: 5,
3514-
retryDelayMs: null,
3515-
});
3516-
assert.equal(retryItems[1]?.id, retryItems[0]?.id);
3517-
assert.equal(retryItems[1]?.status, "completed");
3518-
assert.equal(retryItems[1]?.title, "Provider recovered");
3516+
assert.deepEqual(
3517+
retryItems.slice(0, 4).map((item) => item.retry),
3518+
[
3519+
{ attempt: 2, maxAttempts: 5, retryDelayMs: null },
3520+
{ attempt: 5, maxAttempts: 5, retryDelayMs: null },
3521+
{ attempt: 6, maxAttempts: null, retryDelayMs: null },
3522+
{ attempt: 7, maxAttempts: null, retryDelayMs: null },
3523+
],
3524+
);
3525+
assert.equal(retryItems[4]?.id, retryItems[0]?.id);
3526+
assert.equal(retryItems[4]?.status, "completed");
3527+
assert.equal(retryItems[4]?.title, "Provider recovered");
35193528

35203529
const recoveredIndex = harness.events.findIndex(
35213530
(event) =>

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4710,7 +4710,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
47104710
const progress = parseCodexRetryProgress(payload.error.message);
47114711
const retry: OrchestrationV2ProviderRetry = {
47124712
attempt: progress?.attempt ?? (previous?.retry.attempt ?? 0) + 1,
4713-
maxAttempts: progress?.maxAttempts ?? previous?.retry.maxAttempts ?? null,
4713+
maxAttempts: progress?.maxAttempts ?? null,
47144714
retryDelayMs: null,
47154715
};
47164716
const code = codexErrorInfoCode(payload.error.codexErrorInfo);

0 commit comments

Comments
 (0)