Skip to content

Fix health-check close failing auth in vMCP BackendClient#4613

Open
yrobla wants to merge 2 commits intomainfrom
issue-4573
Open

Fix health-check close failing auth in vMCP BackendClient#4613
yrobla wants to merge 2 commits intomainfrom
issue-4573

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Apr 7, 2026

Summary

mcp-go's StreamableHTTP.Close() creates a DELETE request with context.Background(), discarding the health-check marker and identity from the original call context. The identityPropagatingRoundTripper only stored identity, so when ListCapabilities deferred c.Close(), the DELETE hit auth strategies with neither a health-check marker nor an identity, producing "no identity found in context" errors.

Fix by capturing isHealthCheck at transport creation time and re-injecting both identity and the health-check marker into every outgoing request, including the synthetic DELETE from Close().

Fixes #4573

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Changes

File Change

Does this introduce a user-facing change?

Special notes for reviewers

mcp-go's StreamableHTTP.Close() creates a DELETE request with
context.Background(), discarding the health-check marker and identity
from the original call context. The identityPropagatingRoundTripper
only stored identity, so when ListCapabilities deferred c.Close(),
the DELETE hit auth strategies with neither a health-check marker nor
an identity, producing "no identity found in context" errors.

Fix by capturing isHealthCheck at transport creation time and
re-injecting both identity and the health-check marker into every
outgoing request, including the synthetic DELETE from Close().

Fixes #4573
@yrobla yrobla requested review from Copilot and removed request for JAORMX, amirejaz, jerm-dro and jhrozek April 7, 2026 13:56
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes vMCP backend session close requests failing authentication during health checks by ensuring the backend HTTP transport consistently re-injects the originating request’s identity (when present) and the health-check context marker onto all outgoing requests—including the synthetic DELETE request generated by mcp-go’s StreamableHTTP.Close().

Changes:

  • Extend identityPropagatingRoundTripper to propagate both identity and the health-check marker on every request.
  • Capture isHealthCheck at client/transport creation time and re-apply it during RoundTrip, covering Close()’s context-less DELETE.
  • Add focused unit tests verifying identity propagation, health-check marker propagation, and propagation of both together.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/vmcp/client/client.go Propagates health-check marker (in addition to identity) via transport to prevent auth failures on Close() DELETE.
pkg/vmcp/client/client_test.go Adds unit tests validating identity + health-check marker propagation behavior in the transport.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.86%. Comparing base (f5d8015) to head (6a505b7).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4613      +/-   ##
==========================================
+ Coverage   68.85%   68.86%   +0.01%     
==========================================
  Files         505      506       +1     
  Lines       52425    52434       +9     
==========================================
+ Hits        36096    36109      +13     
- Misses      13536    13537       +1     
+ Partials     2793     2788       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Apr 7, 2026
@yrobla yrobla requested a review from Copilot April 7, 2026 14:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vMCP session close fails auth: no identity in termination context

3 participants