mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(github-copilot): preserve cumulative poll backoff (#103434)
This commit is contained in:
committed by
GitHub
parent
71a33f07a9
commit
2a57e1a1af
@@ -370,7 +370,7 @@ describe("runGitHubCopilotDeviceFlow — polling intervals", () => {
|
||||
const pollTimes: number[] = [];
|
||||
const pollResponses = [
|
||||
{ error: "authorization_pending" },
|
||||
{ error: "slow_down" },
|
||||
{ error: "slow_down", interval: 7 },
|
||||
{ error: "slow_down" },
|
||||
{ access_token: "test-access-token", token_type: "bearer" },
|
||||
];
|
||||
|
||||
@@ -222,9 +222,11 @@ async function pollForAccessToken(params: {
|
||||
continue;
|
||||
}
|
||||
if (err === "slow_down") {
|
||||
intervalMs =
|
||||
positiveSecondsToSafeMilliseconds(json.interval) ??
|
||||
Math.min(Number.MAX_SAFE_INTEGER, intervalMs + GITHUB_DEVICE_FLOW_SLOW_DOWN_INCREMENT_MS);
|
||||
// slow_down is cumulative; a returned interval may raise but never lower the required floor.
|
||||
intervalMs = Math.max(
|
||||
Math.min(Number.MAX_SAFE_INTEGER, intervalMs + GITHUB_DEVICE_FLOW_SLOW_DOWN_INCREMENT_MS),
|
||||
positiveSecondsToSafeMilliseconds(json.interval) ?? 0,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (err === "expired_token") {
|
||||
|
||||
Reference in New Issue
Block a user