mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:31:24 +00:00
fix: align timeout cooldown behavior docs/tests (#22622) (thanks @vageeshkumar)
This commit is contained in:
@@ -331,6 +331,25 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("rotates on timeout without cooling down the timed-out profile", async () => {
|
||||
await withAgentWorkspace(async ({ agentDir, workspaceDir }) => {
|
||||
await writeAuthStore(agentDir);
|
||||
mockFailedThenSuccessfulAttempt("request ended without sending any chunks");
|
||||
|
||||
await runAutoPinnedOpenAiTurn({
|
||||
agentDir,
|
||||
workspaceDir,
|
||||
sessionKey: "agent:test:timeout-no-cooldown",
|
||||
runId: "run:timeout-no-cooldown",
|
||||
});
|
||||
|
||||
expect(runEmbeddedAttemptMock).toHaveBeenCalledTimes(2);
|
||||
const usageStats = await readUsageStats(agentDir);
|
||||
expect(typeof usageStats["openai:p2"]?.lastUsed).toBe("number");
|
||||
expect(usageStats["openai:p1"]?.cooldownUntil).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
it("does not rotate for compaction timeouts", async () => {
|
||||
await withAgentWorkspace(async ({ agentDir, workspaceDir }) => {
|
||||
await writeAuthStore(agentDir);
|
||||
|
||||
@@ -949,8 +949,8 @@ export async function runEmbeddedPiAgent(
|
||||
);
|
||||
}
|
||||
|
||||
// Treat timeout as potential rate limit (Antigravity hangs on rate limit)
|
||||
// But exclude post-prompt compaction timeouts (model succeeded; no profile issue)
|
||||
// Rotate on timeout to try another account/model path in this turn,
|
||||
// but exclude post-prompt compaction timeouts (model succeeded; no profile issue).
|
||||
const shouldRotate =
|
||||
(!aborted && failoverFailure) || (timedOut && !timedOutDuringCompaction);
|
||||
|
||||
@@ -973,9 +973,7 @@ export async function runEmbeddedPiAgent(
|
||||
});
|
||||
}
|
||||
if (timedOut && !isProbeSession) {
|
||||
log.warn(
|
||||
`Profile ${lastProfileId} timed out (possible rate limit). Trying next account...`,
|
||||
);
|
||||
log.warn(`Profile ${lastProfileId} timed out. Trying next account...`);
|
||||
}
|
||||
if (cloudCodeAssistFormatError) {
|
||||
log.warn(
|
||||
|
||||
Reference in New Issue
Block a user