Skip to content

fix(config): reject doubled provider prefixes in agent model ids #334

Description

@w7-mgfcode

Sub-issue of #380 (umbrella: fix(repo): platform reliability hardening — agents, config, ui, forecast). Foundation — blocks Epics #335, #332, #268, #237.

Purpose

Reject doubled provider prefixes in validate_model_identifier (config + core settings paths) with regression tests. Foundation epic: removes a confirmed root cause of one #335 failure leg and stabilizes the failure surface the E2 error-classification work tests against.

Sub-tasks

To be decomposed via issue-to-subtasks when this epic is picked up.


Summary

Runtime config accepted a malformed agent model id with a doubled provider prefix, which then produced a 404 from the Gemini API at agent-run time.

Details

  • PATCH /config/ai persisted agent_default_model = google-gla:google-gla:gemini-3-flash-preview (returned 200).
  • PydanticAI treated the first google-gla: as the provider and sent google-gla:gemini-3-flash-preview as the model name.
  • Google returned: 404 NOT_FOUND — models/google-gla:gemini-3-flash-preview is not found for API version v1beta, or is not supported for generateContent.
  • Net effect: the primary model is unusable until the id is hand-corrected; the failure only surfaces when the agent is invoked (not at config-save time).

Expected

Config validation should reject or normalize a doubled provider prefix in agent_default_model / agent_fallback_model:

  • Reject (422) ids where the provider prefix appears more than once (e.g. google-gla:google-gla:...), or
  • Normalize by collapsing a duplicated leading provider prefix.
  • Apply to all supported providers (google-gla, google-vertex, anthropic, openai).

Tests

  • Schema-level: validator rejects/normalizes doubled-prefix ids.
  • Service-level: PATCH /config/ai with a doubled prefix returns 422 (or stores the normalized value).
  • Route-level: happy path + the doubled-prefix error path.

Context

Found while investigating an experiment-agent stream failure ("All models from FallbackModel failed"). The doubled prefix was the primary-model leg of that failure. Companion issue covers surfacing fallback sub-errors to the UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicEpic — a delivery surface under an umbrellafixBug fixflowflow: command-suite work

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions