fix(agent): resolve thinking level from model refs
This commit is contained in:
parent
84e42d6904
commit
2b9d858357
2 changed files with 56 additions and 1 deletions
|
|
@ -157,7 +157,7 @@ func NewAgentInstance(
|
||||||
}
|
}
|
||||||
|
|
||||||
var thinkingLevelStr string
|
var thinkingLevelStr string
|
||||||
if mc, err := cfg.GetModelConfig(model); err == nil {
|
if mc := lookupModelConfigByRef(cfg, model); mc != nil {
|
||||||
thinkingLevelStr = mc.ThinkingLevel
|
thinkingLevelStr = mc.ThinkingLevel
|
||||||
}
|
}
|
||||||
thinkingLevel := parseThinkingLevel(thinkingLevelStr)
|
thinkingLevel := parseThinkingLevel(thinkingLevelStr)
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,61 @@ func TestNewAgentInstance_PreservesDistinctLimiterIdentityForSharedResolvedModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewAgentInstance_ResolvesThinkingLevelFromModelReference(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
primary string
|
||||||
|
wantThinking ThinkingLevel
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "full protocol reference",
|
||||||
|
primary: "anthropic/claude-sonnet-4.6",
|
||||||
|
wantThinking: ThinkingHigh,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bare model id",
|
||||||
|
primary: "claude-sonnet-4.6",
|
||||||
|
wantThinking: ThinkingHigh,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
tmpDir := t.TempDir()
|
||||||
|
|
||||||
|
cfg := &config.Config{
|
||||||
|
Agents: config.AgentsConfig{
|
||||||
|
Defaults: config.AgentDefaults{
|
||||||
|
Workspace: tmpDir,
|
||||||
|
ModelName: "main-model",
|
||||||
|
},
|
||||||
|
List: []config.AgentConfig{
|
||||||
|
{
|
||||||
|
ID: "main",
|
||||||
|
Model: &config.AgentModelConfig{
|
||||||
|
Primary: tt.primary,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ModelList: []*config.ModelConfig{
|
||||||
|
{
|
||||||
|
ModelName: "main-model",
|
||||||
|
Model: "anthropic/claude-sonnet-4.6",
|
||||||
|
ThinkingLevel: "high",
|
||||||
|
APIBase: "https://example.invalid",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
agent := NewAgentInstance(&cfg.Agents.List[0], &cfg.Agents.Defaults, cfg, &mockProvider{})
|
||||||
|
if agent.ThinkingLevel != tt.wantThinking {
|
||||||
|
t.Fatalf("ThinkingLevel = %q, want %q", agent.ThinkingLevel, tt.wantThinking)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestNewAgentInstance_AllowsMediaTempDirForReadListAndExec(t *testing.T) {
|
func TestNewAgentInstance_AllowsMediaTempDirForReadListAndExec(t *testing.T) {
|
||||||
workspace := t.TempDir()
|
workspace := t.TempDir()
|
||||||
mediaDir := media.TempDir()
|
mediaDir := media.TempDir()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue