Repository navigation
[lint-monster] Set a timeout on the MCP inspect HTTP client - #78894
Conversation
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review. Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Detected threat types: prompt injection. Review the workflow run logs for details. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
🟢 Approval recommended
No active issues are recorded, and the change centralizes bounded timeout and header transport configuration with focused unit coverage.
No open issues 🎉
What changed in this PR
This PR fixes the MCP inspect HTTP client timeout finding by centralizing custom client creation, applying the existing bounded timeout, and preserving MCP header injection.
Changes:
- Added
newMCPInspectHTTPClientwithMCPServerHTTPTimeout. - Updated HTTP MCP inspection to use the helper for custom headers.
- Added focused unit coverage for timeout and transport configuration.
| File | Description |
|---|---|
| pkg/cli/mcp_inspect_mcp.go | Adds the timeout-configured HTTP client helper and uses it for header-enabled MCP connections. |
| pkg/cli/mcp_inspect_http_client_test.go | Verifies the configured timeout and header-injecting transport. |
Review effort: Lite (adaptive)
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output. Detected threat types: prompt injection.
Review the workflow run logs for details.
Reviewed the timeout client refactor and focused unit test. The header-injecting transport is preserved, the 30-minute client timeout matches the existing MCP HTTP timeout, and the change is limited to the configured-header path. No actionable correctness or maintainability issues found in the changed lines.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.5K
Comment /review to run again
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. Requesting changes: the timeout covers only the header branch, and the new test does not exercise header injection.
📋 Key Themes & Highlights
Key Themes
- Incomplete timeout coverage: When
config.Headersis empty,transport.HTTPClientstays nil and the SDK falls back tohttp.DefaultClient, which has noTimeout. - Test gap:
TestNewMCPInspectHTTPClientchecks the struct fields only. It never runsRoundTrip, so it cannot catch a broken header path.
Positive Highlights
- ✅ Extracting
newMCPInspectHTTPClientmakes the client construction testable. - ✅ Reusing
MCPServerHTTPTimeoutkeeps one source of truth for the timeout value. - ✅ Preserves the nil
http.DefaultTransportguard and the existing header-injection behavior. - ✅ The targeted test passes locally, and
gofmtis clean.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.7K
Comment /matt to run again
| }, | ||
| } | ||
| // Create a custom HTTP client with header injection and a bounded request duration. | ||
| transport.HTTPClient = newMCPInspectHTTPClient(config.Headers) |
There was a problem hiding this comment.
[/diagnosing-bugs] The header-less path is still unbounded: transport.HTTPClient stays nil, so the SDK falls back to http.DefaultClient, which has no Timeout. The lint finding is fixed only for the header branch, so servers without headers can still hang the inspect request.
💡 Suggested fix
Always assign the client and drop the if guard. headerRoundTripper already skips header injection when headers is nil, and http.DefaultClient resolves to http.DefaultTransport, so behavior is otherwise unchanged:
transport.HTTPClient = newMCPInspectHTTPClient(config.Headers)@copilot please address this.
| if transport.base == nil { | ||
| t.Fatal("client transport has no base transport") | ||
| } | ||
| if got := transport.headers["X-Test"]; got != "value" { |
There was a problem hiding this comment.
[/tdd] This asserts the stored header map, not that the header reaches the wire. headerRoundTripper.RoundTrip never runs in this test, so a broken injection path would still pass. The timeout is checked as a field value rather than enforced.
💡 Suggested test
Send a request to an httptest server and assert the header it receives:
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if got := r.Header.Get("X-Test"); got != "value" {
t.Errorf("server received X-Test = %q, want %q", got, "value")
}
}))
defer srv.Close()
resp, err := newMCPInspectHTTPClient(map[string]string{"X-Test": "value"}).Get(srv.URL)
if err != nil {
t.Fatal(err)
}
resp.Body.Close()@copilot please address this.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "35493b84a39da7235b2f490a2befcc5220ffae38",
"kind": "requested",
"schema_version": "1",
"state": "98ad2520d0fcee22cd33a98f1dd894a4b12c866ec09b99e24e112162bf0bfdfe",
"work": [
"41c633c50467b0f2dc87116833139ebf287e1ad59f1a015d8d1dfedd9d1b23f1",
"42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
],
"workflow": "pr-sous-chef"
}
|
…ent-timeout-35ce8c0be5d1d09a Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Merged the latest |
Evidence
The pre-check reported one
net/http.Client literal has no Timeout fieldfinding atpkg/cli/mcp_inspect_mcp.go:225. The custom HTTP client used when MCP headers are configured had no request timeout.Change
Factor the custom client construction into
newMCPInspectHTTPClient, preserve the header-injecting transport, and setTimeoutto the existingMCPServerHTTPTimeout. Add a focused unit test for the timeout and header transport.Validation
make fmtpassed.go test ./pkg/cli -run '^TestNewMCPInspectHTTPClient$' -count=1passed.git diff --cached --checkpassed.make golint-customran and exited 2 because 2,963 other findings remain from the supplied 2,964-finding scan. The selected timeout diagnostic is absent from the current output.