From 32585804ddc514ea9f60fc0c7d56496bccc766f5 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 17 Jun 2026 21:07:51 -0400 Subject: [PATCH] fix: remove Gemini CLI from fallback chain (CLI shutting down June 18 2026) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gemini CLI is being replaced by Antigravity CLI; no users have gemini_cli or gemini_api models in their registries. Drop claude→gemini from _FALLBACK so Claude CLI failures surface directly instead of routing to a dead binary. Gemini API orchestrator (google-genai SDK) is unaffected. Co-Authored-By: Claude Sonnet 4.6 --- cortex/config.py | 2 +- cortex/llm_client.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cortex/config.py b/cortex/config.py index 4b275db..dba6e90 100644 --- a/cortex/config.py +++ b/cortex/config.py @@ -38,7 +38,7 @@ class Settings(BaseSettings): default_model: str = "claude-sonnet-4-6" default_tier: int = 2 max_history_messages: int = 40 # rolling window — 20 turns (user + assistant) - primary_backend: str = "claude" # "claude" or "gemini" — other is always fallback + primary_backend: str = "claude" # "claude" | "local" — gemini CLI removed June 2026 # Local model backend — OpenAI-compatible API (Open WebUI / Ollama) # Set LOCAL_API_URL in .env to enable; leave blank to disable diff --git a/cortex/llm_client.py b/cortex/llm_client.py index 1763d6b..1a0ddbc 100644 --- a/cortex/llm_client.py +++ b/cortex/llm_client.py @@ -34,15 +34,17 @@ async def cleanup() -> None: # Map from registry model type → dispatch function key _TYPE_TO_BACKEND = { "claude_cli": "claude", - "gemini_cli": "gemini", - "gemini_api": "gemini", # gemini_api falls back to CLI in this context + "gemini_cli": "gemini", # Gemini CLI is being replaced by Antigravity CLI (June 2026) + "gemini_api": "gemini", # routes to CLI subprocess — no users configured; kept for compat "local_openai": "local", "anthropic_api": "anthropic_api", } # Explicit UI toggle values (kept for backward compat) _EXPLICIT_BACKENDS = ("claude", "gemini", "local") -_FALLBACK = {"claude": "gemini", "gemini": "claude", "local": "claude", "anthropic_api": "claude"} +# Gemini CLI removed from the claude fallback — it's shutting down June 18 2026. +# claude failures now surface directly; gemini backend still falls back to claude. +_FALLBACK: dict[str, str | None] = {"claude": None, "gemini": "claude", "local": "claude", "anthropic_api": "claude"} async def complete( @@ -110,6 +112,10 @@ async def complete( if resolved_cfg is not None: logger.error("%s failed (no fallback — model explicitly configured): %s", primary, e) raise + # No fallback defined for this backend — surface the error directly. + if not fallback: + logger.error("%s failed (no fallback configured): %s", primary, e) + raise logger.warning("%s failed (%s) — falling back to %s", primary, e, fallback) response = await _dispatch(fallback, system_prompt, messages, None, token_sink=token_sink) return response, fallback