From becb258c84093f62ddcf5dffaa6b8494687d61b9 Mon Sep 17 00:00:00 2001 From: elkaix Date: Sat, 22 Aug 2026 05:02:12 -0400 Subject: [PATCH] test(agent-core): give the sweep-resilience wait the full test budget --- packages/agent-core/test/mcp/oauth-service.test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/agent-core/test/mcp/oauth-service.test.ts b/packages/agent-core/test/mcp/oauth-service.test.ts index be5fa7173..6a863573a 100644 --- a/packages/agent-core/test/mcp/oauth-service.test.ts +++ b/packages/agent-core/test/mcp/oauth-service.test.ts @@ -158,8 +158,12 @@ async function deliverCallback(flow: BeginAuthorizationResult): Promise { await response.text(); } -async function waitFor(condition: () => boolean, description: string): Promise { - const deadline = Date.now() + 5000; +async function waitFor( + condition: () => boolean, + description: string, + timeoutMs = 5000, +): Promise { + const deadline = Date.now() + timeoutMs; while (!condition()) { if (Date.now() > deadline) throw new Error(`timed out waiting for ${description}`); await new Promise((resolve) => setTimeout(resolve, 10)); @@ -618,9 +622,13 @@ describe('McpOAuthService sweepProactiveRefresh resilience', () => { await writeFile(join(fixture.storeDir, 'corrupt-meta.json'), '{not json', 'utf-8'); expect(() => fixture.service.sweepProactiveRefresh()).not.toThrow(); + // The immediate refresh spans two localhost HTTP round-trips plus token + // writes; on a loaded CI runner that can outlast the default 5s budget + // while staying well inside this test's own 15s timeout. await waitFor( () => authServer.counts.refresh === 1, 'the swept credential to refresh immediately', + 12_000, ); }, 15000); });