fix: codex rate-limit retry immediately instead of next request
This commit is contained in:
@@ -428,22 +428,26 @@ export async function runAgentForGroup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Codex may report success but have streamed a rate-limit error.
|
// Codex may report success but have streamed a rate-limit error.
|
||||||
// Rotate token so the NEXT request uses a fresh account.
|
// Rotate token and retry immediately with the new account.
|
||||||
if (
|
if (
|
||||||
!isClaudeCodeAgent &&
|
!isClaudeCodeAgent &&
|
||||||
primaryAttempt.streamedTriggerReason &&
|
primaryAttempt.streamedTriggerReason &&
|
||||||
getCodexAccountCount() > 1
|
getCodexAccountCount() > 1 &&
|
||||||
|
rotateCodexToken()
|
||||||
) {
|
) {
|
||||||
if (rotateCodexToken()) {
|
logger.info(
|
||||||
logger.info(
|
{
|
||||||
{
|
chatJid,
|
||||||
chatJid,
|
group: group.name,
|
||||||
group: group.name,
|
runId,
|
||||||
runId,
|
reason: primaryAttempt.streamedTriggerReason.reason,
|
||||||
reason: primaryAttempt.streamedTriggerReason.reason,
|
},
|
||||||
},
|
'Codex rate-limited (streamed), retrying with rotated account',
|
||||||
'Codex rate-limited (streamed), rotated account for next request',
|
);
|
||||||
);
|
const retryAttempt = await runAttempt('codex');
|
||||||
|
if (!retryAttempt.error) {
|
||||||
|
markCodexTokenHealthy();
|
||||||
|
return 'success';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user