Merge pull request #544 from jeffersonwarrior/fix/cloud-code-assist-api-errors
Fix Cloud Code Assist API errors (429/400)
This commit is contained in:
@@ -67,6 +67,7 @@ import {
|
||||
ensureSessionHeader,
|
||||
formatAssistantErrorText,
|
||||
isAuthAssistantError,
|
||||
isCloudCodeAssistFormatError,
|
||||
isContextOverflowError,
|
||||
isFailoverAssistantError,
|
||||
isFailoverErrorMessage,
|
||||
@@ -1527,9 +1528,14 @@ export async function runEmbeddedPiAgent(params: {
|
||||
const assistantFailoverReason = classifyFailoverReason(
|
||||
lastAssistant?.errorMessage ?? "",
|
||||
);
|
||||
const cloudCodeAssistFormatError = lastAssistant?.errorMessage
|
||||
? isCloudCodeAssistFormatError(lastAssistant.errorMessage)
|
||||
: false;
|
||||
|
||||
// Treat timeout as potential rate limit (Antigravity hangs on rate limit)
|
||||
const shouldRotate = (!aborted && failoverFailure) || timedOut;
|
||||
const shouldRotate =
|
||||
(!aborted && (failoverFailure || cloudCodeAssistFormatError)) ||
|
||||
timedOut;
|
||||
|
||||
if (shouldRotate) {
|
||||
// Mark current profile for cooldown before rotating
|
||||
@@ -1550,6 +1556,11 @@ export async function runEmbeddedPiAgent(params: {
|
||||
`Profile ${lastProfileId} timed out (possible rate limit). Trying next account...`,
|
||||
);
|
||||
}
|
||||
if (cloudCodeAssistFormatError) {
|
||||
log.warn(
|
||||
`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
const rotated = await advanceAuthProfile();
|
||||
if (rotated) {
|
||||
|
||||
Reference in New Issue
Block a user