Added a configurable timeout knob

This commit is contained in:
2026-05-04 22:38:20 -05:00
parent ea05945457
commit c5ce270090
15 changed files with 215 additions and 34 deletions

View File

@@ -117,11 +117,12 @@ func TestRunnerRunSuccessful(t *testing.T) {
Version: "1.0.0",
OutputFormat: domain.FormatMarkdown,
ModelDefaults: domain.ModelTarget{
Endpoint: "ep1",
Model: "model-default",
Temperature: 0.4,
MaxTokens: 200,
TopP: 0.9,
Endpoint: "ep1",
Model: "model-default",
Temperature: 0.4,
MaxTokens: 200,
TopP: 0.9,
TimeoutSeconds: 90,
},
Validation: domain.OutputContract{
ValidationMode: domain.ValidationBasic,
@@ -158,9 +159,10 @@ func TestRunnerRunSuccessful(t *testing.T) {
"glossary": {Type: domain.ArtifactRefFile, URI: "a://g"},
},
Model: &domain.ModelTarget{
Model: "model-override",
Temperature: 0,
MaxTokens: 0,
Model: "model-override",
Temperature: 0,
MaxTokens: 0,
TimeoutSeconds: 0,
},
})
if err != nil {
@@ -214,6 +216,9 @@ func TestRunnerRunSuccessful(t *testing.T) {
if llmClient.lastReq.Target.Temperature != 0.4 {
t.Fatalf("expected zero-valued request field not to override default temperature, got %v", llmClient.lastReq.Target.Temperature)
}
if llmClient.lastReq.Target.TimeoutSeconds != 90 {
t.Fatalf("expected zero-valued request timeout not to override default timeout, got %d", llmClient.lastReq.Target.TimeoutSeconds)
}
}
func TestRunnerRunProfileLoadFailure(t *testing.T) {
@@ -231,6 +236,16 @@ func TestRunnerRunProfileLoadFailure(t *testing.T) {
}
}
func TestMergeModelTargetTimeoutOverride(t *testing.T) {
base := domain.ModelTarget{TimeoutSeconds: 30}
override := &domain.ModelTarget{TimeoutSeconds: 75}
got := mergeModelTarget(base, override)
if got.TimeoutSeconds != 75 {
t.Fatalf("expected timeout override to apply, got %d", got.TimeoutSeconds)
}
}
func TestRunnerRunArtifactLoadFailure(t *testing.T) {
runner := NewRunner(
&fakeProfileRepo{profile: minimalProfile()},