Skip to content

[lint-monster] Set a timeout on the MCP inspect HTTP client - #78894

Merged
pelikhan merged 2 commits into
mainfrom
lint-monster/http-client-timeout-35ce8c0be5d1d09a
Nov 18, 2026
Merged

pelikhan merged 2 commits into
mainfrom
lint-monster/http-client-timeout-35ce8c0be5d1d09a

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Evidence

The pre-check reported one net/http.Client literal has no Timeout field finding at pkg/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 set Timeout to the existing MCPServerHTTPTimeout. Add a focused unit test for the timeout and header transport.

Validation

  • make fmt passed.
  • go test ./pkg/cli -run '^TestNewMCPInspectHTTPClient$' -count=1 passed.
  • git diff --cached --check passed.
  • make golint-custom ran 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.

Generated by 🧌 LintMonster · codex · gpt60 · ~6 AIC · ⌖ ~1 AIC · ⊞ 17.2K · ◷

@github-actions github-actions Bot added automation cookie Issue Monster Loves Cookies! lint labels Nov 18, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 18, 2026 07:25
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 07:25
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

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.

Generated by PR Specification Reviewer for #78894 · copilot · gpt56 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.3K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.7K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

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.

PR Code Quality Reviewer

Outcome: reported_action

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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated by Ponytail Reviewer for #78894 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 newMCPInspectHTTPClient with MCPServerHTTPTimeout.
  • 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)

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-b6022ff3-c55e-4598-9e4c-2be7a2cd8f79","parents":[],"payload":{"id":"ldg-d9ae9ebc-a068-455c-96bd-f9f091214ec1","operation":"append","value":{"finding_count":0,"head_sha":"35493b84a39da7235b2f490a2befcc5220ffae38","outcome":"aligned"}},"sha":"sha256:e10fb19c3fb5de3ab4fdf649443cb4b8da4f7a9a7a7e897b0f1bcd0f3d25daf5","timestamp":"2026-11-18T07:31:41.721Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-e1c6fd70-3754-4e90-bde3-14435da3555e","parents":[],"payload":{"id":"ldg-beccc99f-8b9f-4d2b-b367-fea1c9f4a241","operation":"append","value":{"finding_count":0,"head_sha":"35493b84a39da7235b2f490a2befcc5220ffae38","outcome":"no_findings"}},"sha":"sha256:2671706924460c09c105bc78d6c12b7348c3842bd1fb70fd78a53c660f147daa","timestamp":"2026-11-18T07:32:50.087Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Headers is empty, transport.HTTPClient stays nil and the SDK falls back to http.DefaultClient, which has no Timeout.
  • Test gap: TestNewMCPInspectHTTPClient checks the struct fields only. It never runs RoundTrip, so it cannot catch a broken header path.

Positive Highlights

  • ✅ Extracting newMCPInspectHTTPClient makes the client construction testable.
  • ✅ Reusing MCPServerHTTPTimeout keeps one source of truth for the timeout value.
  • ✅ Preserves the nil http.DefaultTransport guard and the existing header-injection behavior.
  • ✅ The targeted test passes locally, and gofmt is 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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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" {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check impacted-go-tests (FAILURE): Check run.
  3. Fix failing check lint-go-custom (FAILURE): Check run.

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"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

…ent-timeout-35ce8c0be5d1d09a

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged the latest main in f49fb68. It includes the audit test fix and updates the custom-linter workflow to build its runner in a temporary directory, addressing both reported failures. The build and impacted tests pass; the local final gate still reports pre-existing custom-linter findings in pkg/cli/mcp_inspect_mcp.go.

@pelikhan
pelikhan merged commit 90a2565 into main Nov 18, 2026
68 checks passed
@pelikhan
pelikhan deleted the lint-monster/http-client-timeout-35ce8c0be5d1d09a branch November 18, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants