mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-22 15:51:18 -07:00
fix(core): clear 5-minute timeouts in oauth flow to prevent memory leaks (#24968)
This commit is contained in:
@@ -305,6 +305,28 @@ describe('oauth-flow', () => {
|
||||
'Invalid value for OAUTH_CALLBACK_PORT',
|
||||
);
|
||||
});
|
||||
|
||||
it('should settle on timeout without keeping the process alive', async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
const server = startCallbackServer('timeout-state');
|
||||
await server.port;
|
||||
|
||||
const responsePromise = server.response.catch((e: Error) => {
|
||||
if (e.message !== 'OAuth callback timeout') throw e;
|
||||
return e;
|
||||
});
|
||||
|
||||
// Advance timers by 5 minutes to trigger the timeout
|
||||
await vi.advanceTimersByTimeAsync(5 * 60 * 1000);
|
||||
|
||||
const error = await responsePromise;
|
||||
expect(error).toBeInstanceOf(Error);
|
||||
expect((error as Error).message).toBe('OAuth callback timeout');
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('exchangeCodeForToken', () => {
|
||||
|
||||
Reference in New Issue
Block a user