fix: ignore fallback model during auto fallback

This commit is contained in:
ayattara
2026-09-09 01:29:57 +00:00
parent 6dba59d7a5
commit 649b4fa222
2 changed files with 14 additions and 0 deletions
@@ -113,6 +113,9 @@ func applyStartModelPolicy(
if policy.Model == "" {
return ModelSelectionDecision{Outcome: ModelSelectionOutcomeNone}, nil
}
if policy.AutoFallback {
policy.FallbackModel = ""
}
decision := ModelSelectionDecision{
RequestedModel: policy.Model,
@@ -87,6 +87,14 @@ func TestApplyStartModelPolicyExecutorAuthority(t *testing.T) {
wantReason: ModelSelectionReasonRequestedNotAdvertised,
wantWarning: true,
},
{
name: "auto fallback ignores configured fallback model",
state: modelState("executor-default", "fallback"),
policy: StartModelPolicy{Model: "host-only-model", FallbackModel: "fallback", AutoFallback: true},
wantOutcome: ModelSelectionOutcomeProviderDefault,
wantReason: ModelSelectionReasonRequestedNotAdvertised,
wantWarning: true,
},
{
name: "advertised apply error is explicit",
state: modelState("requested"),
@@ -139,6 +147,9 @@ func TestApplyStartModelPolicyExecutorAuthority(t *testing.T) {
if decision.Warning != tt.wantWarning {
t.Errorf("warning = %v, want %v", decision.Warning, tt.wantWarning)
}
if tt.policy.AutoFallback && decision.FallbackModel != "" {
t.Errorf("auto-fallback fallback model = %q, want empty", decision.FallbackModel)
}
})
}
}