From 87120f743a199637c84f1fdb818a42d232dacbeb Mon Sep 17 00:00:00 2001 From: Eason Liang Date: Sun, 30 Aug 2026 02:04:16 +0800 Subject: [PATCH] refactor(api): route geminiCli explicitly to the Anthropic handler (#1029) buildApiHandler had no case for geminiCli, so the provider silently fell through to the default Anthropic handler. Add an explicit case with a comment documenting the intentional fallback until a dedicated Gemini CLI handler exists. Runtime behavior is unchanged; the existing factory tests already pin geminiCli to AnthropicHandler, and the spec comment now reflects that the routing is explicit. --- src/api/__tests__/index.spec.ts | 2 +- src/api/index.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/__tests__/index.spec.ts b/src/api/__tests__/index.spec.ts index 2fe940f53a..10bfc2a133 100644 --- a/src/api/__tests__/index.spec.ts +++ b/src/api/__tests__/index.spec.ts @@ -77,7 +77,7 @@ const expectedHandlers = { [providerIdentifiers.ollama]: NativeOllamaHandler, [providerIdentifiers.lmstudio]: LmStudioHandler, [providerIdentifiers.gemini]: GeminiHandler, - // Gemini CLI currently relies on the factory's default Anthropic handler. + // Gemini CLI has no dedicated handler yet; the factory routes it explicitly to the Anthropic handler. [providerIdentifiers.geminiCli]: AnthropicHandler, [providerIdentifiers.openaiCodex]: OpenAiCodexHandler, [providerIdentifiers.openaiNative]: OpenAiNativeHandler, diff --git a/src/api/index.ts b/src/api/index.ts index 8e7f20d66f..6962842456 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -235,6 +235,11 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler { return new BasetenHandler(options) case providerIdentifiers.poe: return new PoeHandler(options) + // Gemini CLI has no dedicated handler yet. Route it explicitly to the + // Anthropic handler (the current runtime behavior) so the fallback is + // documented instead of falling through the default implicitly (#1029). + case providerIdentifiers.geminiCli: + return new AnthropicHandler(options) default: return new AnthropicHandler(options) }