fix: ignore fallback model during auto fallback
This commit is contained in:
@@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user