Skip to content

Conversation

@yrobla
Copy link
Contributor

@yrobla yrobla commented Nov 27, 2025

when using the discovered mode on vmcp, we discovered that it was not working because identity was not propagated. Add a fix and add proper testing to validate

Large PR Justification

This is a complete fix of the feature, including unit tests. The fixes are atomic and need to come together to solve the issue

@yrobla yrobla requested review from Copilot and jhrozek November 27, 2025 16:33
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification [Explain why this PR must be large, such as:] - Generated code that cannot be split - Large refactoring that must be atomic - Multiple related changes that would break if separated - Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Nov 27, 2025
@yrobla yrobla requested review from JAORMX and amirejaz November 27, 2025 16:34
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.56%. Comparing base (00c066e) to head (373ed73).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/vmcp/client/client.go 54.54% 5 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## main #2769 +/- ## ========================================== - Coverage 56.56% 56.56% -0.01%  ========================================== Files 320 320 Lines 30873 30882 +9 ========================================== + Hits 17464 17468 +4  - Misses 11908 11913 +5  Partials 1501 1501 

☔ 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.
Copy link
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 token exchange for discovery mode in the Virtual MCP (vmcp) system by addressing configuration format issues and adding comprehensive end-to-end testing with mock servers deployed as Kubernetes resources.

Key Changes:

  • Fixes vmcp configuration YAML format conversion to use a flat token_cache.config structure instead of separate memory/redis sections, aligning with the YAML loader's expected format
  • Adds discovery logic for incoming OIDC configuration from backend MCPServers, enabling vMCP to authenticate to backends that require OIDC
  • Implements comprehensive E2E tests with mock HTTP, OAuth token exchange, and OIDC servers deployed as Kubernetes pods to validate authentication flows

Reviewed changes

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

Show a summary per file
File Description
test/e2e/thv-operator/virtualmcp/virtualmcp_auth_discovery_test.go Replaces simple httptest mock with Kubernetes-deployed mock servers (HTTP, OAuth, OIDC) for realistic E2E testing of auth discovery and token exchange flows
test/e2e/thv-operator/virtualmcp/helpers.go Adds GetPodLogs helper function to retrieve logs from specific pods for debugging test failures
test/e2e/oidc_mock.go Implements proper JWKS endpoint with RSA public key export and adds client_credentials grant type support
pkg/vmcp/workloads/k8s.go Adds discoverIncomingOIDCConfig method to discover and populate OIDC configuration from backend MCPServers, enabling vMCP→backend authentication
pkg/vmcp/types.go Adds IncomingOIDCConfig field to Backend and BackendTarget types for storing discovered OIDC configuration
pkg/vmcp/registry.go Propagates IncomingOIDCConfig field when converting Backend to BackendTarget
cmd/thv-operator/controllers/virtualmcpserver_vmcpconfig.go Implements convertToCLIFormat to transform Go config structs into vmcp CLI-compatible YAML format with flat token_cache.config structure

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

@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@github-actions github-actions bot dismissed their stale review November 28, 2025 08:45

Large PR justification has been provided. Thank you!

@github-actions
Copy link
Contributor

✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review.

@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from 7c3263b to 68da4c9 Compare November 28, 2025 10:11
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from 68da4c9 to b3ff79c Compare November 28, 2025 10:13
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from b3ff79c to 28615db Compare November 28, 2025 10:36
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from 28615db to bfe83b2 Compare November 28, 2025 10:39
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from bfe83b2 to 5c6563b Compare November 28, 2025 11:32
@github-actions github-actions bot removed the size/XL Extra large PR: 1000+ lines changed label Nov 28, 2025
Copy link
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 8 out of 8 changed files in this pull request and generated 3 comments.


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

@yrobla yrobla force-pushed the fix/auth_discovery_test branch from a27d766 to c7327cd Compare November 28, 2025 16:02
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from c7327cd to 76eec1d Compare November 28, 2025 16:03
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from 76eec1d to 7cf6767 Compare November 28, 2025 16:12
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 28, 2025
when using the discovered mode on vmcp, we discovered that it was not working for several problems. Add a fix and add proper testing to validate
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from 7cf6767 to ee2dd99 Compare December 1, 2025 10:36
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 1, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from 0fe205d to 102c340 Compare December 1, 2025 10:45
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 1, 2025
@yrobla yrobla force-pushed the fix/auth_discovery_test branch from 102c340 to 373ed73 Compare December 1, 2025 10:50
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 1, 2025
@yrobla yrobla changed the title fix: properly implement token exchange for discovery fix: propagate identity for token exchange + add real integration tests Dec 1, 2025
@yrobla yrobla merged commit 996f475 into main Dec 1, 2025
33 checks passed
@yrobla yrobla deleted the fix/auth_discovery_test branch December 1, 2025 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Extra large PR: 1000+ lines changed

4 participants