Skip to content

Legacy model_type values break custom model credential management #36426

@QuantumGhost

Description

@QuantumGhost

AI disclosure: This issue was drafted and analyzed with Codex using GPT-5.4. I have reviewed the analysis, and I am responsible for the content.

Summary

Custom model credential management breaks for workspaces that still have legacy model_type values in provider-related tables. Requests with canonical query values such as model_type=llm can return Credential with id ... not found, which prevents users from loading, updating, switching, or deleting OpenAI-compatible custom model credentials.

Root cause

The EnumText(ModelType) migration removed legacy query normalization from several read paths while keeping only result deserialization compatibility.

ModelType.value_of("text-generation") still deserializes legacy rows to ModelType.LLM, but SQL bind parameters are emitted as canonical values such as llm. Rows that still store legacy values such as text-generation or embeddings are therefore skipped by read queries.

The regression affects mixed datasets in tables including:

  • provider_models
  • tenant_default_models
  • provider_model_settings
  • provider_model_credentials
  • load_balancing_model_configs

Reproduction

  1. Persist a custom model credential row with provider_model_credentials.model_type = 'text-generation'.
  2. Open the custom model credential endpoint with model_type=llm.
  3. Observe Credential with id ... not found.

Impact

  • Users cannot load, update, switch, or delete affected custom model credentials.
  • Available credential lists can appear empty.
  • Default model and load balancing lookups can also miss legacy rows.

Proposed fix

Use a shared read-path helper that matches both canonical and legacy model_type values during queries, while keeping new writes on canonical enum values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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