Repository navigation
fix(ai): register provider instances live on add/toggle (were dead until restart) + S9 7-provider wiring - #30
Merged
Conversation
…til restart) + wire S9 to 7 providers REAL BUG (found via the S9 pre-flight): POST /api/ai/providers stored the key in the DB but never registered a runtime provider INSTANCE. The runtime registry (_INSTANCES) — which BOTH /chat and the research loop (resolve_agent_llm → get_provider) resolve against — was only populated at startup (restore_providers_from_db). So a user who added an API key could not actually use it until the server restarted (get_provider returned None → provider-not-found / silent fallback). Fixed: * add_provider → register the instance live (_register_live with the request's plaintext key). * toggle_provider → register on activate, remove_provider on deactivate (registry stays in sync). * delete → remove the runtime instance too, not just the DB row. S9 (multi-model comparison): expanded to 7 providers (added zhipu / moonshot / byteplus) and switched to pre-flight-VALIDATED reasoning models — o3 / claude-sonnet-4-6 / gemini-2.5-pro / deepseek-reasoner / glm-5 / kimi-k2.5-thinking / seed-2-0-pro. Notes captured from the pre-flight: gemini uses gemini-2.5-pro because the catalog's gemini-3-pro is Vertex-only and 404s on an AI-Studio key; the run now passes the configured provider NAME (the registry key), not the type. Model overridable via E2E_<PROVIDER>_MODEL. 749 unit tests pass, ruff clean, import-linter 7/7. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug (found via the S9 pre-flight)
POST /api/ai/providersstored the key in the DB but never registered a runtime provider instance. The runtime registry (_INSTANCES) — which both/chatand the research loop (resolve_agent_llm → get_provider) resolve against — is only populated at startup (restore_providers_from_db). So a user who added an API key couldn't use it until the server restarted (get_provider→None→ provider-not-found / silent fallback). A real demo/prod bug.Fix
add_provider→ register the instance live (_register_livewith the request's plaintext key).toggle_provider→ register on activate,remove_provideron deactivate (registry stays in sync).delete→ drop the runtime instance too, not just the DB row.S9 wiring
Expanded to 7 providers (added Z.ai / Moonshot / BytePlus) with pre-flight-validated reasoning models:
o3/claude-sonnet-4-6/gemini-2.5-pro/deepseek-reasoner/glm-5/kimi-k2.5-thinking/seed-2-0-pro. Gemini usesgemini-2.5-probecause the catalog'sgemini-3-prois Vertex-only and 404s on an AI-Studio key. The run now passes the configured provider name (the registry key), not the type. Any model overridable viaE2E_<PROVIDER>_MODEL.749 unit tests pass, ruff clean, import-linter 7/7.
🤖 Generated with Claude Code