Skip to content

fix(ai): register provider instances live on add/toggle (were dead until restart) + S9 7-provider wiring - #30

Merged
EmilHerzberg merged 1 commit into
mainfrom
fix/provider-live-registration
Jul 12, 2026
Merged

EmilHerzberg merged 1 commit into
mainfrom
fix/provider-live-registration

Conversation

@EmilHerzberg

Copy link
Copy Markdown
Owner

The 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 — 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_live with the request's plaintext key).
  • toggle_provider → register on activate, remove_provider on 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 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. Any model overridable via E2E_<PROVIDER>_MODEL.

749 unit tests pass, ruff clean, import-linter 7/7.

🤖 Generated with Claude Code

…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>
@EmilHerzberg
EmilHerzberg merged commit a854e33 into main Jul 12, 2026
@EmilHerzberg
EmilHerzberg deleted the fix/provider-live-registration branch July 12, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant