From 3b64953775c54646b19667b46a3aeab66a851533 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Apr 2026 16:07:55 +0000 Subject: [PATCH] Fix: log HTTP connection errors to stderr for operator visibility When an HTTP backend connection fails (e.g., 401 auth errors), log the error to stderr via log.Printf so operators can see the reason. The error chain includes the backend response body with specific messages like "Missing API key" or "Invalid API key". This fixes TestTavilyAuthFailure integration tests which check stderr for these error messages. Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/40888e44-12ac-4b0d-b93b-083f02fe9a52 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --- internal/launcher/launcher.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/launcher/launcher.go b/internal/launcher/launcher.go index 8ee9a7da..d1bd0cff 100644 --- a/internal/launcher/launcher.go +++ b/internal/launcher/launcher.go @@ -143,6 +143,7 @@ func GetOrLaunch(l *Launcher, serverID string) (*mcp.Connection, error) { // Create an HTTP connection conn, err := mcp.NewHTTPConnection(l.ctx, serverID, serverCfg.URL, serverCfg.Headers, oidcProvider, oidcAudience, l.config.Gateway.HTTPKeepaliveInterval()) if err != nil { + log.Printf("FAILED to create HTTP connection for server %q: %v", serverID, err) logger.LogErrorWithServer(serverID, "backend", "Failed to create HTTP connection: %s, error=%v", serverID, err) l.recordError(serverID, err.Error()) return nil, fmt.Errorf("failed to create HTTP connection: %w", err)