Conversation
…recation block - Extract logReconnectStart() and logReconnectResult(err) helpers to deduplicate the three identical logger.Log* call sites shared by reconnectPlainJSON() and reconnectSDKTransport() (issue #3632) - Consolidate the 5-line SSE deprecation warning burst into 2 concise log calls: one LogWarn with URL and spec info, one LogInfo for the connection confirmation (issue #3634) - Issue #3633 (Mixed log.Printf / logger.LogInfo) was already resolved Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/adc38ef8-8512-47c3-805e-582ed80d5993 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze and resolve duplicate code issues
refactor: deduplicate reconnect telemetry and SSE deprecation logging in connection.go
Apr 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors internal/mcp/connection.go to reduce duplicated structured logging around reconnect flows and to simplify the SSE deprecation log burst, improving maintainability of connection/transport telemetry.
Changes:
- Extracted shared reconnect lifecycle logging into
(*Connection).logReconnectStart()and(*Connection).logReconnectResult(err). - Consolidated the SSE deprecation warning burst into a single
LogWarnplus a single connection confirmationLogInfo.
Show a summary per file
| File | Description |
|---|---|
internal/mcp/connection.go |
Deduplicates reconnect telemetry logs and collapses SSE deprecation logging into fewer, clearer structured log calls. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
This was referenced Apr 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three duplicate logging patterns in
internal/mcp/connection.gocreated maintainability risk: reconnect lifecycle logs were copy-pasted verbatim across two sibling functions, and SSE deprecation connected with a 5-line near-identical warning burst.Changes
Reconnect telemetry helpers — extracted
logReconnectStart()andlogReconnectResult(err error)methods; bothreconnectPlainJSON()andreconnectSDKTransport()now delegate to them instead of duplicating threelogger.Log*call sites each:SSE deprecation warning — collapsed 5 overlapping
LogWarncalls (all saying "SSE is deprecated, please migrate") into oneLogWarnwith the URL + spec version, plus oneLogInfofor the connection confirmation. Issue [duplicate-code] Duplicate Code Pattern: Mixed log.Printf / logger.LogInfo Parallel Logging in connection.go #3633 (redundantlog.Printf/logger.LogInfopairs) was already resolved prior to this PR.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build3844589215/b514/launcher.test /tmp/go-build3844589215/b514/launcher.test -test.testlogfile=/tmp/go-build3844589215/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W .cfg elemetry.io/otel-ifaceassert x_amd64/vet ache/go/1.25.8/x/usr/libexec/docker/cli-plugins/docker-compose --gdwarf2 --64 x_amd64/vet -I .cfg om/yosida95/uritemplate/v3@v3.0.2/equals.go x_amd64/vet --gdwarf-5 g/protobuf/inter--version -o x_amd64/vet(dns block)https://api.github.com/graphql/usr/bin/gh gh issue close 3634 --comment Fixed in PR #3660: Consolidated the 5-line SSE deprecation warning burst into 2 concise log calls ��� oneLogWarncontaining the URL, spec version, and migration ask, and oneLogInfo` confirming the connection. This eliminates the near-duplicate messag ockdeduplicate the three identical logger.Log* call sites shared by
reconnectPlainJSON() and reconne` (http block)