fix: ignore fallback model during auto fallback
This commit is contained in:
@@ -113,6 +113,9 @@ func applyStartModelPolicy(
|
|||||||
if policy.Model == "" {
|
if policy.Model == "" {
|
||||||
return ModelSelectionDecision{Outcome: ModelSelectionOutcomeNone}, nil
|
return ModelSelectionDecision{Outcome: ModelSelectionOutcomeNone}, nil
|
||||||
}
|
}
|
||||||
|
if policy.AutoFallback {
|
||||||
|
policy.FallbackModel = ""
|
||||||
|
}
|
||||||
|
|
||||||
decision := ModelSelectionDecision{
|
decision := ModelSelectionDecision{
|
||||||
RequestedModel: policy.Model,
|
RequestedModel: policy.Model,
|
||||||
|
|||||||
@@ -87,6 +87,14 @@ func TestApplyStartModelPolicyExecutorAuthority(t *testing.T) {
|
|||||||
wantReason: ModelSelectionReasonRequestedNotAdvertised,
|
wantReason: ModelSelectionReasonRequestedNotAdvertised,
|
||||||
wantWarning: true,
|
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",
|
name: "advertised apply error is explicit",
|
||||||
state: modelState("requested"),
|
state: modelState("requested"),
|
||||||
@@ -139,6 +147,9 @@ func TestApplyStartModelPolicyExecutorAuthority(t *testing.T) {
|
|||||||
if decision.Warning != tt.wantWarning {
|
if decision.Warning != tt.wantWarning {
|
||||||
t.Errorf("warning = %v, want %v", 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