Refactor launcher connection error logging into internal/launcher#7276
Merged
Conversation
7 tasks
Copilot
AI
changed the title
[WIP] Fix duplicate code pattern in launcher log prefix
Refactor launcher connection error logging into Jun 9, 2026
internal/launcher
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates launcher-specific connection failure diagnostics into internal/launcher, removing [LAUNCHER]-style console logging and hinting from internal/mcp so ownership and future evolution of launcher logs are localized to the launcher subsystem.
Changes:
- Added
internal/launcher/connection_error_log.goimplementingConnectionErrorContextandLogConnectionError(launcher-owned connection failure formatting/hints). - Updated
internal/launcher/log_helpers.goto call launcher-localLogConnectionErrorinstead ofmcp.LogConnectionError. - Removed launcher-specific connection error logging from
internal/mcp/connection_logging.goand updatedinternal/mcp/connection.goto emit MCP-scoped structured error logs (including sanitized stderr) without[LAUNCHER]conventions. - Moved/updated tests into
internal/launcher/connection_error_log_test.go.
Show a summary per file
| File | Description |
|---|---|
| internal/mcp/connection.go | Replaces launcher-style error reporting on connect failure with MCP-scoped structured error logs and sanitized stderr logging. |
| internal/mcp/connection_logging.go | Removes launcher-owned ConnectionErrorContext / LogConnectionError from the mcp package. |
| internal/launcher/log_helpers.go | Switches launch-failure logging to use launcher-owned connection error logging helpers. |
| internal/launcher/connection_error_log.go | Introduces launcher-local connection error context + diagnostic logging/hints. |
| internal/launcher/connection_error_log_test.go | Relocates/updates coverage for launcher connection error logging behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
internal/launcher/connection_error_log_test.go:334
- In the stderr-output table, the "whitespace-only stderr is empty" case doesn't actually validate the intended behavior because the test passes the untrimmed whitespace string into LogConnectionError and provides no notInLog assertions. Trimming in the test and asserting that the stderr block is omitted will make this case meaningful and prevent regressions.
- Files reviewed: 5/5 changed files
- Comments generated: 0
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.
[LAUNCHER]-prefixed connection failure logs were split acrossinternal/mcpandinternal/launcher, which blurred ownership and made launcher log behavior harder to find and evolve. This change consolidates launcher-specific error diagnostics in the launcher package and removes launcher-prefixed behavior from mcp internals.Logging ownership realignment
internal/launcher/connection_error_log.gowith:ConnectionErrorContextLogConnectionError[LAUNCHER]connection-failure formatting and hint logic into the launcher subsystem.Launcher call-site update
internal/launcher/log_helpers.go:logLaunchErrornow invokes launcher-localLogConnectionError(...)mcp.ConnectionErrorContext/mcp.LogConnectionError.mcp package decoupling
internal/mcp/connection_logging.go.internal/mcp/connection.goconnection-failure branch to emit mcp-scoped structured errors (including sanitized stderr) without[LAUNCHER]console conventions.Test ownership alignment
internal/mcp/errors_test.gotointernal/launcher/connection_error_log_test.goso behavior coverage lives with the owning package.