fix(openai): 단일 selector 도구를 required로 정규화한다

This commit is contained in:
toki 2026-08-15 16:11:40 +09:00
parent a200e0051c
commit 178539590f
2 changed files with 4 additions and 11 deletions

View file

@ -184,9 +184,7 @@ func prepareHotPathSelectorCanonicalTools(tunnel edgeservice.SubmitProviderTunne
},
},
}}
root["tool_choice"] = map[string]any{
"type": "function", "function": map[string]any{"name": hotPathArtifactPairToolName},
}
root["tool_choice"] = "required"
delete(root, "parallel_tool_calls")
return json.Marshal(root)
}

View file

@ -388,9 +388,7 @@ func TestHotPathSelectorCanonicalWriteToolReplacesCallerCommandSchema(t *testing
if function["name"] != hotPathArtifactPairToolName || properties["goal"] == nil || properties["steps"] == nil || properties["verification"] == nil || properties["command"] != nil {
t.Fatalf("canonical write function=%+v", function)
}
choice := request["tool_choice"].(map[string]any)
chosenFunction := choice["function"].(map[string]any)
if choice["type"] != "function" || chosenFunction["name"] != hotPathArtifactPairToolName || request["parallel_tool_calls"] != nil {
if request["tool_choice"] != "required" || request["parallel_tool_calls"] != nil {
t.Fatalf("pair-write must force one atomic tool call: %+v", request)
}
}
@ -443,8 +441,7 @@ func TestAnthropicCallerWorkspaceSelectorUsesCanonicalProviderOperation(t *testi
t.Fatalf("OpenAI selector tunnel=%+v", prepared)
}
tool := tools[0].(map[string]any)
choice := request["tool_choice"].(map[string]any)
if tool["name"] != hotPathArtifactPairToolName || choice["type"] != "function" || choice["name"] != hotPathArtifactPairToolName || request["max_output_tokens"] != float64(maxHotPathSelectorOutputTokens) {
if tool["name"] != hotPathArtifactPairToolName || request["tool_choice"] != "required" || request["max_output_tokens"] != float64(maxHotPathSelectorOutputTokens) {
t.Fatalf("OpenAI selector request=%+v", request)
}
if !strings.Contains(request["instructions"].(string), "Operation: pair-write") {
@ -456,9 +453,7 @@ func TestAnthropicCallerWorkspaceSelectorUsesCanonicalProviderOperation(t *testi
t.Fatalf("Gemini selector tunnel=%+v", prepared)
}
function := tools[0].(map[string]any)["function"].(map[string]any)
choice := request["tool_choice"].(map[string]any)
chosenFunction := choice["function"].(map[string]any)
if function["name"] != hotPathArtifactPairToolName || choice["type"] != "function" || chosenFunction["name"] != hotPathArtifactPairToolName || request["max_tokens"] != float64(maxHotPathSelectorOutputTokens) {
if function["name"] != hotPathArtifactPairToolName || request["tool_choice"] != "required" || request["max_tokens"] != float64(maxHotPathSelectorOutputTokens) {
t.Fatalf("Gemini selector request=%+v", request)
}
messages := anySlice(request["messages"])