-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Summary
First message in a new workspace can bypass mux‑gateway and fail with “API key not found for anthropic.” Retry succeeds after gateway state syncs. Root cause is frontend/localStorage timing; fix by moving routing decision to backend.
Observed
- First message fails with
API key not found for anthropic - Manual retry succeeds via mux-gateway
Root Cause (frontend race)
Gateway routing is determined in the browser via toGatewayModel() + localStorage:
gateway-availabledefaults to falseuseProvidersConfig()loads asyncuseGateway()writesgateway-availableafter config loads- First send can happen before sync → model stays
anthropic:*
Why name generation still works
Name generation runs on the backend (nameGeneration.generate) and selects a model server‑side via aiService.createModel(), which reads providers.jsonc every time. It can choose mux‑gateway variants even if frontend localStorage is stale.
Proposed Fix
Move gateway routing to the backend:
- Backend receives canonical
provider:model - Backend decides mux‑gateway routing from provider config on disk
- Backend rewrites to
mux-gateway:provider/modelwhen enabled - Frontend toggles remain UI + send flags, but routing becomes authoritative server‑side
Metadata
Metadata
Assignees
Labels
No labels