mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 02:50:26 +00:00
fix: clamp copilot auth refresh overflow (#55360) (thanks @michael-abdo)
This commit is contained in:
24
src/agents/runtime-auth-refresh.test.ts
Normal file
24
src/agents/runtime-auth-refresh.test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { clampRuntimeAuthRefreshDelayMs } from "./runtime-auth-refresh.js";
|
||||
|
||||
describe("clampRuntimeAuthRefreshDelayMs", () => {
|
||||
it("clamps far-future refresh delays to a timer-safe ceiling", () => {
|
||||
expect(
|
||||
clampRuntimeAuthRefreshDelayMs({
|
||||
refreshAt: 12_345_678_901_000,
|
||||
now: 0,
|
||||
minDelayMs: 60_000,
|
||||
}),
|
||||
).toBe(2_147_483_647);
|
||||
});
|
||||
|
||||
it("still respects the configured minimum delay", () => {
|
||||
expect(
|
||||
clampRuntimeAuthRefreshDelayMs({
|
||||
refreshAt: 1_000,
|
||||
now: 900,
|
||||
minDelayMs: 60_000,
|
||||
}),
|
||||
).toBe(60_000);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user