fix: auto-retry Codex turn once on interrupted status
When the Codex SDK returns 'interrupted' (API-side timeout/disconnect), retry the turn once before reporting failure. Prevents unnecessary "요청을 완료하지 못했습니다" messages for transient issues.
This commit is contained in:
@@ -281,6 +281,7 @@ async function executeAppServerTurn(
|
|||||||
client: CodexAppServerClient,
|
client: CodexAppServerClient,
|
||||||
threadId: string,
|
threadId: string,
|
||||||
prompt: string,
|
prompt: string,
|
||||||
|
retryCount = 0,
|
||||||
): Promise<{ result: string | null; error?: string }> {
|
): Promise<{ result: string | null; error?: string }> {
|
||||||
let lastProgressMessage: string | null = null;
|
let lastProgressMessage: string | null = null;
|
||||||
const activeTurn = await client.startTurn(threadId, parseAppServerInput(prompt), {
|
const activeTurn = await client.startTurn(threadId, parseAppServerInput(prompt), {
|
||||||
@@ -352,6 +353,10 @@ async function executeAppServerTurn(
|
|||||||
if (state.status === 'interrupted' && consumeCloseSentinel()) {
|
if (state.status === 'interrupted' && consumeCloseSentinel()) {
|
||||||
return { result };
|
return { result };
|
||||||
}
|
}
|
||||||
|
if (state.status === 'interrupted' && retryCount < 1) {
|
||||||
|
log('Codex turn interrupted, retrying once...');
|
||||||
|
return executeAppServerTurn(client, threadId, prompt, retryCount + 1);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
result,
|
result,
|
||||||
error: state.errorMessage || `Codex turn finished with status ${state.status}`,
|
error: state.errorMessage || `Codex turn finished with status ${state.status}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user