From 86917faa9ba2fc8f7d08b3106080c15a04daaa89 Mon Sep 17 00:00:00 2001 From: lc6464 <64722907+lc6464@users.noreply.github.com> Date: Sat, 11 Apr 2026 02:23:35 +0800 Subject: [PATCH] fix(ci): resolve lint header casing and fallback test routing --- pkg/agent/loop_test.go | 2 +- pkg/providers/gemini_provider.go | 2 +- pkg/providers/gemini_provider_test.go | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/agent/loop_test.go b/pkg/agent/loop_test.go index 56ea000c8..7fe5836b3 100644 --- a/pkg/agent/loop_test.go +++ b/pkg/agent/loop_test.go @@ -1921,7 +1921,7 @@ func TestProcessMessage_FallbackUsesPerCandidateProvider(t *testing.T) { }, { ModelName: "gemma-fallback", - Model: "gemini/gemma-3-27b-it", + Model: "openrouter/gemma-3-27b-it", APIBase: fallbackServer.URL, APIKeys: config.SimpleSecureStrings("fallback-key"), Workspace: workspace, diff --git a/pkg/providers/gemini_provider.go b/pkg/providers/gemini_provider.go index 7b913b775..370ce5674 100644 --- a/pkg/providers/gemini_provider.go +++ b/pkg/providers/gemini_provider.go @@ -153,7 +153,7 @@ func (p *GeminiProvider) ChatStream( func (p *GeminiProvider) applyHeaders(req *http.Request) { req.Header.Set("Content-Type", "application/json") if p.apiKey != "" { - req.Header.Set("x-goog-api-key", p.apiKey) + req.Header.Set("X-Goog-Api-Key", p.apiKey) } if p.userAgent != "" { req.Header.Set("User-Agent", p.userAgent) diff --git a/pkg/providers/gemini_provider_test.go b/pkg/providers/gemini_provider_test.go index cbfb97c45..9debcd79f 100644 --- a/pkg/providers/gemini_provider_test.go +++ b/pkg/providers/gemini_provider_test.go @@ -19,8 +19,8 @@ func TestGeminiProvider_ChatSeparatesThoughtAndToolCall(t *testing.T) { if !strings.Contains(r.URL.Path, ":generateContent") { t.Fatalf("path = %s, expected generateContent endpoint", r.URL.Path) } - if got := r.Header.Get("x-goog-api-key"); got != "test-key" { - t.Fatalf("x-goog-api-key = %q, want %q", got, "test-key") + if got := r.Header.Get("X-Goog-Api-Key"); got != "test-key" { + t.Fatalf("X-Goog-Api-Key = %q, want %q", got, "test-key") } if err := json.NewDecoder(r.Body).Decode(&capturedBody); err != nil { t.Fatalf("decode request body: %v", err) @@ -489,8 +489,8 @@ func TestGeminiProvider_ChatAllowsCustomAuthHeaderWithoutAPIKey(t *testing.T) { if got := r.Header.Get("Authorization"); got != "Bearer test-token" { t.Fatalf("Authorization = %q, want %q", got, "Bearer test-token") } - if got := r.Header.Get("x-goog-api-key"); got != "" { - t.Fatalf("x-goog-api-key = %q, want empty", got) + if got := r.Header.Get("X-Goog-Api-Key"); got != "" { + t.Fatalf("X-Goog-Api-Key = %q, want empty", got) } w.Header().Set("Content-Type", "application/json") _ = json.NewEncoder(w).Encode(map[string]any{ @@ -533,8 +533,8 @@ func TestGeminiProvider_ChatAllowsCustomAuthHeaderWithoutAPIKey(t *testing.T) { func TestGeminiProvider_ChatAllowsMissingAPIKeyForCustomAPIBase(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if got := r.Header.Get("x-goog-api-key"); got != "" { - t.Fatalf("x-goog-api-key = %q, want empty", got) + if got := r.Header.Get("X-Goog-Api-Key"); got != "" { + t.Fatalf("X-Goog-Api-Key = %q, want empty", got) } w.Header().Set("Content-Type", "application/json") _ = json.NewEncoder(w).Encode(map[string]any{