Skip to content

Commit 537b132

Browse files
authored
[Repo Assist] fix(mcp): remove duplicate debug log statements in HTTP transport (#4592)
🤖 *This PR was created by Repo Assist, an automated AI assistant.* Removes 5 redundant debug log lines identified in issues #4584 and #4585. ## Root Cause Two recent commits introduced debug logging inside `http_transport.go` that duplicated existing logs already present at the call sites in `connection.go`: 1. **Issue #4584**: `connection.go` logged `"Attempting X transport for %s"` before calling each `try*Transport` function, while `http_transport.go` already logged the same event at function entry — with *more* context (`serverID`, `connectTimeout`). 2. **Issue #4585**: `sendHTTPRequest` logged `"Sending HTTP request"` and `"Received HTTP response"` at the wrapper level, while the inner `executeHTTPRequest` function already logged `"Executing HTTP request"` and `"HTTP response received"` with equivalent (or more granular) information. ## Fix - `connection.go`: removed 3 call-site `logConn.Printf("Attempting ... transport")` lines (258, 267, 277). The failure logs (`"Streamable HTTP failed"`, etc.) are kept. - `http_transport.go`: removed 2 wrapper-level logs from `sendHTTPRequest` (lines 646, 653). The per-function-entry logs in `executeHTTPRequest` are retained. ## Trade-offs - **Retained**: all failure/error logs, success logs, reconnect logs — nothing diagnostic is lost. - **Removed**: purely duplicated "attempt started" and "request sent/received" lines. - Net effect: `DEBUG=mcp:*` traces produce one log per transport attempt and one log per HTTP round-trip instead of two. ## Test Status ⚠️ The CI environment for this run does not have Go 1.25.0 available, so the build and tests could not be run locally. The changes are pure deletions of log statements with no logic changes — no tests exercise debug log output, and the removed lines contain no side effects. Closes #4584 Closes #4585 > [!WARNING] > **⚠️ Firewall blocked 1 domain** > > The following domain was blocked by the firewall during workflow execution: > > - `proxy.golang.org` > > To allow these domains, add them to the `network.allowed` list in your workflow frontmatter: > > ```yaml > network: > allowed: > - defaults > - "proxy.golang.org" > ``` > > See [Network Configuration](https://github.github.com/gh-aw/reference/network/) for more information. > Generated by [Repo Assist](https://github.com/github/gh-aw-mcpg/actions/runs/24956675401/agentic_workflow) · ● 3M · [◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+repo-assist%22&type=pullrequests) > > To install this [agentic workflow](https://github.com/githubnext/agentics/blob/851905c06e905bf362a9f6cc54f912e3df747d55/workflows/repo-assist.md), run > ``` > gh aw add githubnext/agentics@851905c > ``` <!-- gh-aw-agentic-workflow: Repo Assist, engine: copilot, version: 1.0.21, model: auto, id: 24956675401, workflow_id: repo-assist, run: https://github.com/github/gh-aw-mcpg/actions/runs/24956675401 --> <!-- gh-aw-workflow-id: repo-assist -->
2 parents af26058 + 7dd8203 commit 537b132

2 files changed

Lines changed: 0 additions & 6 deletions

File tree

internal/mcp/connection.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ func NewHTTPConnection(ctx context.Context, serverID, url string, headers map[st
255255
// Try standard transports in order: streamable HTTP → SSE → plain JSON-RPC
256256

257257
// Try 1: Streamable HTTP (2025-03-26 spec)
258-
logConn.Printf("Attempting streamable HTTP transport for %s", url)
259258
conn, err := tryStreamableHTTPTransport(ctx, cancel, serverID, url, headers, headerClient, keepAlive, connectTimeout)
260259
if err == nil {
261260
logger.LogInfo("backend", "Successfully connected using streamable HTTP transport, url=%s", url)
@@ -264,7 +263,6 @@ func NewHTTPConnection(ctx context.Context, serverID, url string, headers map[st
264263
logConn.Printf("Streamable HTTP failed: %v", err)
265264

266265
// Try 2: SSE (2024-11-05 spec)
267-
logConn.Printf("Attempting SSE transport for %s", url)
268266
conn, err = trySSETransport(ctx, cancel, serverID, url, headers, headerClient, keepAlive, connectTimeout)
269267
if err == nil {
270268
logger.LogWarn("backend", "⚠️ MCP over SSE (2024-11-05 spec) is DEPRECATED for url=%s. Please migrate to streamable HTTP transport (2025-03-26 spec).", url)
@@ -274,7 +272,6 @@ func NewHTTPConnection(ctx context.Context, serverID, url string, headers map[st
274272
logConn.Printf("SSE transport failed: %v", err)
275273

276274
// Try 3: Plain JSON-RPC over HTTP (non-standard, for fallback)
277-
logConn.Printf("Attempting plain JSON-RPC transport for %s", url)
278275
conn, err = tryPlainJSONTransport(ctx, cancel, serverID, url, headers, headerClient)
279276
if err == nil {
280277
logger.LogInfo("backend", "Successfully connected using plain JSON-RPC transport, url=%s", url)

internal/mcp/http_transport.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,15 +643,12 @@ func (c *Connection) sendHTTPRequest(ctx context.Context, method string, params
643643
headerModifier := c.buildSessionHeaderModifier(ctx)
644644

645645
requestID := atomic.AddUint64(&requestIDCounter, 1)
646-
logConn.Printf("Sending HTTP request to %s: method=%s, id=%d", c.httpURL, method, requestID)
647646

648647
result, err := c.executeHTTPRequest(ctx, method, params, requestID, headerModifier)
649648
if err != nil {
650649
return nil, err
651650
}
652651

653-
logConn.Printf("Received HTTP response: status=%d, body_len=%d", result.StatusCode, len(result.ResponseBody))
654-
655652
// If the backend reported that the session has expired, reconnect and retry once.
656653
if isSessionNotFoundHTTPResponse(result.StatusCode, result.ResponseBody) {
657654
logConn.Printf("Session not found from %s (serverID=%s), attempting reconnect", c.httpURL, c.serverID)

0 commit comments

Comments
 (0)