Skip to content

[Bug]: Control UI model switcher applies the current provider to the selected model #46859

@xiaoHEI-312

Description

@xiaoHEI-312

Bug type

Regression (worked before, now fails)

Summary

Bug Description

When switching models from the WebUI / Control UI chat header picker, the selected model can be sent as a bare model id instead of a full provider/model reference.

If the current session is already pinned to another provider, the gateway resolves the bare model id against that current/default provider and rejects the request with an error like:

GatewayRequestError: model not allowed: openai-codex/glm-4.7

This makes valid models from other providers impossible to select from the picker.

Steps to Reproduce

  1. Open the WebUI / Control UI.
  2. Use a session currently associated with openai-codex/gpt-5.4 or another provider-specific model.
  3. Open the chat header model picker.
  4. Select a model that belongs to another provider, for example glm-4.7.
  5. Observe that the request fails with a model not allowed error using the wrong provider prefix.

Expected Behavior

The model picker should submit the selected model as a full provider/model reference based on the catalog entry shown in the picker.

Selecting glm-4.7 should resolve to its configured provider, not inherit the current session provider.

Environment

  • OpenClaw WebUI / Control UI
  • Reproduced on March 15, 2026
  • Session currently pinned to openai-codex/gpt-5.4
  • Another provider exposes glm-4.7

Root Cause

The chat header model picker stored entry.id as the <option> value and only used the provider for the visible label.

When the selection changed, WebUI sent sessions.patch({ model: "<bare-model-id>" }) instead of sessions.patch({ model: "<provider>/<model>" }).

Proposed Fix

  • Build picker option values from the catalog's full provider/model identity
  • Preserve the provider in the locally cached selected value
  • Add a regression test to ensure the picker submits the full model reference

Steps to reproduce

  1. open webui - chat
  2. change to another provider/model, like openai to glm
  3. error shows

Expected behavior

no error

Actual behavior

Image

OpenClaw version

3.14 source code (commit 8aaafa0)

Operating system

Macos 26.3

Install method

pnpm dev

Model

openai-codex / glm

Provider / routing chain

openai-codex

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

03:50:29 info gateway/ws {"subsystem":"gateway/ws"} ⇄ res ✗ sessions.patch 29ms errorCode=INVALID_REQUEST errorMessage=model not allowed: openai-codex/glm-4.7 conn=f1084474…4add id=8c3f5cc6…7404

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions