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,
|
||||
threadId: string,
|
||||
prompt: string,
|
||||
retryCount = 0,
|
||||
): Promise<{ result: string | null; error?: string }> {
|
||||
let lastProgressMessage: string | null = null;
|
||||
const activeTurn = await client.startTurn(threadId, parseAppServerInput(prompt), {
|
||||
@@ -352,6 +353,10 @@ async function executeAppServerTurn(
|
||||
if (state.status === 'interrupted' && consumeCloseSentinel()) {
|
||||
return { result };
|
||||
}
|
||||
if (state.status === 'interrupted' && retryCount < 1) {
|
||||
log('Codex turn interrupted, retrying once...');
|
||||
return executeAppServerTurn(client, threadId, prompt, retryCount + 1);
|
||||
}
|
||||
return {
|
||||
result,
|
||||
error: state.errorMessage || `Codex turn finished with status ${state.status}`,
|
||||
|
||||
Reference in New Issue
Block a user