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:
@@ -351,7 +351,7 @@ export async function runAgentForGroup(
|
|||||||
while (
|
while (
|
||||||
shouldRotateClaudeToken(trigger.reason) &&
|
shouldRotateClaudeToken(trigger.reason) &&
|
||||||
getTokenCount() > 1 &&
|
getTokenCount() > 1 &&
|
||||||
rotateToken(lastRotationMessage)
|
rotateToken(lastRotationMessage, { ignoreRateLimits: true })
|
||||||
) {
|
) {
|
||||||
logger.info(
|
logger.info(
|
||||||
{ chatJid, group: group.name, runId, reason: trigger.reason },
|
{ chatJid, group: group.name, runId, reason: trigger.reason },
|
||||||
@@ -422,7 +422,9 @@ export async function runAgentForGroup(
|
|||||||
retryAfterMs: retryAttempt.streamedTriggerReason.retryAfterMs,
|
retryAfterMs: retryAttempt.streamedTriggerReason.retryAfterMs,
|
||||||
};
|
};
|
||||||
lastRotationMessage =
|
lastRotationMessage =
|
||||||
typeof retryOutput.result === 'string' ? retryOutput.result : undefined;
|
typeof retryOutput.result === 'string'
|
||||||
|
? retryOutput.result
|
||||||
|
: undefined;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ async function runTask(
|
|||||||
while (
|
while (
|
||||||
shouldRotateClaudeToken(trigger.reason) &&
|
shouldRotateClaudeToken(trigger.reason) &&
|
||||||
getTokenCount() > 1 &&
|
getTokenCount() > 1 &&
|
||||||
rotateToken(lastRotationMessage)
|
rotateToken(lastRotationMessage, { ignoreRateLimits: true })
|
||||||
) {
|
) {
|
||||||
logger.info(
|
logger.info(
|
||||||
{
|
{
|
||||||
@@ -534,7 +534,6 @@ async function runTask(
|
|||||||
error = 'Claude usage exhausted';
|
error = 'Claude usage exhausted';
|
||||||
// Fall through to task completion handling below
|
// Fall through to task completion handling below
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const attempt = await runTaskAttempt(provider);
|
const attempt = await runTaskAttempt(provider);
|
||||||
result = attempt.attemptResult;
|
result = attempt.attemptResult;
|
||||||
error = attempt.attemptError;
|
error = attempt.attemptError;
|
||||||
@@ -562,7 +561,6 @@ async function runTask(
|
|||||||
} else if (attempt.output.status === 'error') {
|
} else if (attempt.output.status === 'error') {
|
||||||
error = attempt.attemptError || 'Unknown error';
|
error = attempt.attemptError || 'Unknown error';
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end else (non-exhausted path)
|
} // end else (non-exhausted path)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|||||||
Reference in New Issue
Block a user