Skip to content
Merged
Prev Previous commit
Next Next commit
fix: propagate model-cost providers into evals awf config
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
  • Loading branch information
Copilot and pelikhan authored Jul 26, 2026
commit 1296ec001651aec2ae10f32c3b2a271418df0e5a
3 changes: 3 additions & 0 deletions pkg/workflow/evals_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ func (c *Compiler) buildEvalsEngineSteps(data *WorkflowData) []string {
// ModelMappings is propagated so the evals awf-config.json includes the alias map
// (apiProxy.models). Without it, copilot_harness.cjs cannot resolve alias model names
// (e.g. "small") to concrete ids before spawning the engine in the evals job.
// ModelCosts is propagated so evals awf-config.json includes provider pricing overlays
// (apiProxy.providers), allowing max-ai-credits pricing lookup for custom/BYOK models.
evalsData := &WorkflowData{
Tools: map[string]any{
"bash": []any{"*"},
Expand All @@ -211,6 +213,7 @@ func (c *Compiler) buildEvalsEngineSteps(data *WorkflowData) []string {
IsEvalsRun: true,
RunnerConfig: data.RunnerConfig, // propagate runner.topology (e.g. arc-dind) to the evals job
ModelMappings: data.ModelMappings, // propagate alias map so evals awf-config.json can resolve model aliases
ModelCosts: data.ModelCosts, // propagate pricing providers so evals awf-config.json can resolve AI-credit costs
NetworkPermissions: &NetworkPermissions{
Allowed: getThreatDetectionAdditionalAllowedDomains(data),
},
Expand Down
40 changes: 40 additions & 0 deletions pkg/workflow/evals_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ func TestBuildEvalsEngineStepsModelMappingsPropagated(t *testing.T) {
if !strings.Contains(steps, `\"models\"`) {
t.Errorf("expected evals engine steps to include AWF config with \"models\" key when ModelMappings is set;\ngot:\n%s", steps)
}

})

t.Run("model mappings absent from evals AWF config when nil on parent WorkflowData", func(t *testing.T) {
Expand All @@ -431,3 +432,42 @@ func TestBuildEvalsEngineStepsModelMappingsPropagated(t *testing.T) {
}
})
}

func TestBuildEvalsEngineStepsModelCostsProvidersPropagated(t *testing.T) {
compiler := NewCompiler()

data := &WorkflowData{
AI: "claude",
Model: "accounts/fireworks/models/minimax-m3",
EngineConfig: &EngineConfig{
ID: "claude",
},
ModelCosts: map[string]any{
"providers": map[string]any{
"anthropic": map[string]any{
"models": map[string]any{
"accounts/fireworks/models/minimax-m3": map[string]any{
"cost": map[string]any{
"input": "3e-07",
"output": "1.5e-06",
},
},
},
},
},
},
Evals: &EvalsConfig{
Questions: []EvalDefinition{
{ID: "check", Question: "Did the agent complete the task?"},
},
},
}

steps := strings.Join(compiler.buildEvalsEngineSteps(data), "")
if !strings.Contains(steps, "providers") {
t.Errorf("expected evals awf-config.json to contain apiProxy.providers; got:\n%s", steps)
}
if !strings.Contains(steps, "accounts/fireworks/models/minimax-m3") {
t.Errorf("expected evals awf-config.json to contain custom model pricing key; got:\n%s", steps)
}
}
Loading