diff --git a/internal/runtime/executor/github_copilot_executor.go b/internal/runtime/executor/github_copilot_executor.go index fe724a62..b86146a3 100644 --- a/internal/runtime/executor/github_copilot_executor.go +++ b/internal/runtime/executor/github_copilot_executor.go @@ -653,6 +653,7 @@ func normalizeGitHubCopilotChatTools(body []byte) []byte { } func normalizeGitHubCopilotResponsesInput(body []byte) []byte { + body = stripGitHubCopilotResponsesUnsupportedFields(body) input := gjson.GetBytes(body, "input") if input.Exists() { // If input is already a string or array, keep it as-is. @@ -825,6 +826,12 @@ func normalizeGitHubCopilotResponsesInput(body []byte) []byte { return body } +func stripGitHubCopilotResponsesUnsupportedFields(body []byte) []byte { + // GitHub Copilot /responses rejects service_tier, so always remove it. + body, _ = sjson.DeleteBytes(body, "service_tier") + return body +} + func normalizeGitHubCopilotResponsesTools(body []byte) []byte { tools := gjson.GetBytes(body, "tools") if tools.Exists() { diff --git a/internal/runtime/executor/github_copilot_executor_test.go b/internal/runtime/executor/github_copilot_executor_test.go index 1055eab6..66d5ce92 100644 --- a/internal/runtime/executor/github_copilot_executor_test.go +++ b/internal/runtime/executor/github_copilot_executor_test.go @@ -132,6 +132,19 @@ func TestNormalizeGitHubCopilotResponsesInput_NonStringInputStringified(t *testi } } +func TestNormalizeGitHubCopilotResponsesInput_StripsServiceTier(t *testing.T) { + t.Parallel() + body := []byte(`{"input":"user text","service_tier":"default"}`) + got := normalizeGitHubCopilotResponsesInput(body) + + if gjson.GetBytes(got, "service_tier").Exists() { + t.Fatalf("service_tier should be removed, got %s", gjson.GetBytes(got, "service_tier").Raw) + } + if gjson.GetBytes(got, "input").String() != "user text" { + t.Fatalf("input = %q, want %q", gjson.GetBytes(got, "input").String(), "user text") + } +} + func TestNormalizeGitHubCopilotResponsesTools_FlattenFunctionTools(t *testing.T) { t.Parallel() body := []byte(`{"tools":[{"type":"function","function":{"name":"sum","description":"d","parameters":{"type":"object"}}},{"type":"web_search"}]}`)