Model picker stores a malformed model/provider pair for non-default providers

Author: Jfakih1983Created Sep 26, 2026Updated Oct 1, 2026
Labelsbugsprint-candidate

Summary

Selecting a model belonging to a non-default provider in the model picker produces a malformed (model, model_provider) pair on the session, and every send then fails. Two distinct defects are involved; the second is masked by the first until the first is worked around.

Both are reproducible on a session created in the WebUI itself, so this is not limited to imported/foreign sessions.

Version: v0.52.113, gateway backend (HERMES_WEBUI_CHAT_BACKEND=gateway, HERMES_WEBUI_GATEWAY_USE_RUNS_API=true), Hermes Agent v0.21.4.

Environment

  • Two providers configured: openai-codex (account default) and claude-subscription-directsdk-experimental.
  • The catalog exposes the second provider's models fully qualified, e.g. @claude-subscription-directsdk-experimental:claude-opus-5-5[1m], with provider_id on the group.

Defect 1 — provider is not updated to match the selected model

Create a session while the default provider is openai-codex, then pick a Claude model from the picker. The session is stored as:

jsonc
// /var/lib/hermes/webui/sessions/<id>.json
{
  "model": "claude-opus-5-5",
  "model_provider": "openai-codex"   // ← unchanged, still the account default
}

The send is routed to Codex with a Claude model name. Because our Codex quota was exhausted, this surfaced as:

Provider rate-limited: Codex provider quota exhausted (429)

…which reads as a credentials/quota problem and is not one. The request should never have gone to that provider.

_modelProviderForSend() (src/static/ui.js:2941) consults the session provider before anything else, so a session that was created under one provider keeps sending there regardless of what is later selected:

javascript
function _modelProviderForSend(modelId){
  const sessionProvider=(S&&S.session&&S.session.model_provider)||null;
  if(sessionProvider) return sessionProvider;   // stale value wins
  ...

Defect 2 — the raw catalog id is stored as the model name

Once the provider is correct, the next send fails differently. Changing to a different model of the same provider persists:

jsonc
{
  "model": "@claude-subscription-directsdk-experimental:claude-sonnet-5[1m]",
  "model_provider": "claude-subscription-directsdk-experimental"
}

The [1m] suffix is stripped, but the @provider: prefix is not, so the provider is specified twice and the provider receives a model id it does not recognise:

Model not found: … status 404 … upstream said:
model: @claude-subscription-directsdk-experimental:claude-sonnet-5
API Error: 400 HERMES_MODEL_ADMISSION_CONSUMED

_modelStateForSelect() (src/static/ui.js:2896) falls back to the raw option value when the option carries no data-model:

javascript
const routedModel=selected&&selected.dataset&&selected.dataset.model;
...
return {model:routedModel||value, model_provider:routedProvider||explicitProvider};

opt.dataset.model is set in the custom-option builder (src/static/ui.js:3333, if(requestedProvider) opt.dataset.model=bareModel;), but appears not to be set for catalog-driven options, so routedModel is empty and the qualified value becomes the model name.

Observed sequence

One session, three states, same picker:

Stored model Stored model_provider Result
claude-opus-5-5 openai-codex 429 from Codex
@claude-…-experimental:claude-sonnet-5[1m] claude-…-experimental 404 HERMES_MODEL_ADMISSION_CONSUMED
claude-sonnet-5 claude-…-experimental works

Both bare names (claude-sonnet-5, claude-opus-5-5) were verified working against the provider directly, so the models are valid — only the stored string was malformed.

Expected

Selecting @provider:model[suffix] should split it and store:

jsonc
{ "model": "model", "model_provider": "provider" }

…and a later selection should override a stale session provider rather than be overridden by it.

Workaround

Set the desired model as the default (model.default + model.provider in config.yaml, and default_model_provider in the WebUI settings.json) and create a new session without touching the picker. A session that never involves the picker inherits a valid pair and works.

Editing model_provider in the session JSON server-side does not hold — the browser holds the authoritative copy and writes its own value back on the next send.

Note

The client already has everything needed: the catalog carries provider_id on the group and the qualified id per model. The data is correct on the way in and malformed on the way out.