fix: use ignoreRateLimits in retryClaudeWithRotation loops

Without this, token rotation was blocked by stale cooldowns even
when the target token had available usage.
This commit is contained in:
Eyejoker
2026-03-24 03:47:22 +09:00
parent 120f16e9e1
commit 6a73421d4f
2 changed files with 30 additions and 30 deletions

View File

@@ -351,7 +351,7 @@ export async function runAgentForGroup(
while (
shouldRotateClaudeToken(trigger.reason) &&
getTokenCount() > 1 &&
rotateToken(lastRotationMessage)
rotateToken(lastRotationMessage, { ignoreRateLimits: true })
) {
logger.info(
{ chatJid, group: group.name, runId, reason: trigger.reason },
@@ -422,7 +422,9 @@ export async function runAgentForGroup(
retryAfterMs: retryAttempt.streamedTriggerReason.retryAfterMs,
};
lastRotationMessage =
typeof retryOutput.result === 'string' ? retryOutput.result : undefined;
typeof retryOutput.result === 'string'
? retryOutput.result
: undefined;
continue;
}

View File

@@ -450,7 +450,7 @@ async function runTask(
while (
shouldRotateClaudeToken(trigger.reason) &&
getTokenCount() > 1 &&
rotateToken(lastRotationMessage)
rotateToken(lastRotationMessage, { ignoreRateLimits: true })
) {
logger.info(
{
@@ -534,7 +534,6 @@ async function runTask(
error = 'Claude usage exhausted';
// Fall through to task completion handling below
} else {
const attempt = await runTaskAttempt(provider);
result = attempt.attemptResult;
error = attempt.attemptError;
@@ -562,7 +561,6 @@ async function runTask(
} else if (attempt.output.status === 'error') {
error = attempt.attemptError || 'Unknown error';
}
} // end else (non-exhausted path)
logger.info(