Skip to content

Failover model permanently locks session — agent config changes ignored #64571

Description

@OpenCodeEngineer

Problem

After a model failover, the session entry permanently locks to the fallback model via sticky model, modelProvider, modelOverride, and providerOverride fields. Subsequent messages never consult the agent's configured primary model again.

Root Cause

  1. setSessionRuntimeModel() sets entry.model/entry.modelProvider to whatever model was used (including fallback)
  2. applyFallbackCandidateSelectionToEntry() sets modelOverride/providerOverride with modelOverrideSource: "auto"
  3. resolveGatewayRunModel() checks entry.model first — if set, returns immediately without consulting agent config

Evidence

MonicaHall configured with github-copilot/claude-sonnet-4.6 but all Telegram sessions stuck on azure/kimi-k2.5-thinking or azure/gpt-5.4 after failover events.

Proposed Fix

Re-resolve from config at run start: when modelOverrideSource: "auto" and the agent config primary differs, clear the override and use config.

Impact

Any agent experiencing one failover permanently runs on the wrong model until manually fixed.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions