From bce7ac0797f0eeba5884f2e1d393e2403601a465 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Date: Fri, 16 Oct 2026 23:59:06 +0300 Subject: [PATCH] fix(cli): repair doctor's Google ping target after a merge race #662 added a Google ping target with a 'base' field while #663 changed PingTarget to a full 'url' plus 'checksKey', so main stopped type-checking. Gemini's /models needs the key, so a 200 proves it. Co-Authored-By: Claude Opus 5.5 --- src/cli/doctorChecks.ts | 2 +- src/cli/doctorCore.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/doctorChecks.ts b/src/cli/doctorChecks.ts index 701bbb1f..3556a455 100644 --- a/src/cli/doctorChecks.ts +++ b/src/cli/doctorChecks.ts @@ -312,7 +312,7 @@ function pingTargets(env: DoctorEnvironment): PingTarget[] { } if (vars.GOOGLE_GENERATIVE_AI_API_KEY) { const headers = { 'x-goog-api-key': vars.GOOGLE_GENERATIVE_AI_API_KEY }; - targets.push({ provider: 'google', envKey: 'GOOGLE_GENERATIVE_AI_API_KEY', base: 'https://generativelanguage.googleapis.com/v1beta', headers }); + targets.push({ provider: 'google', envKey: 'GOOGLE_GENERATIVE_AI_API_KEY', url: 'https://generativelanguage.googleapis.com/v1beta/models', headers, checksKey: true }); } if (vars.OPENROUTER_API_KEY) { const url = 'https://openrouter.ai/api/v1/key'; diff --git a/src/cli/doctorCore.test.ts b/src/cli/doctorCore.test.ts index c1848d0d..d0c22f4e 100644 --- a/src/cli/doctorCore.test.ts +++ b/src/cli/doctorCore.test.ts @@ -502,7 +502,7 @@ describe('OpenAI base URL and --ping', () => { const report = await runDoctor(makeEnv({ env: { GOOGLE_GENERATIVE_AI_API_KEY: SECRET }, fetch }), { ping: true }); expect(fetch.mock.calls.map(([url]) => url)).toEqual(['https://generativelanguage.googleapis.com/v1beta/models']); expect(fetch.mock.calls[0][1].headers).toEqual({ 'x-goog-api-key': SECRET }); - expect(report.checks.find((c) => c.id === 'ping.google')).toMatchObject({ status: 'ok', finding: 'reachable (HTTP 200)' }); + expect(report.checks.find((c) => c.id === 'ping.google')).toMatchObject({ status: 'ok', finding: 'reachable, key accepted (HTTP 200)' }); }); it('--ping with no provider configured says so', async () => {