-
Notifications
You must be signed in to change notification settings - Fork 166
Implement runtime health filtering for vMCP backend requests #3144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/issue-3036-healthcheck-circuitbreaker
Are you sure you want to change the base?
Implement runtime health filtering for vMCP backend requests #3144
Conversation
Add two-layer health-based filtering to prevent tool calls to unhealthy backends. This protects users from timeouts and connection failures when backends become unhealthy during active sessions.
There was a problem hiding this 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 transformationAlternative:
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.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/issue-3036-healthcheck-circuitbreaker #3144 +/- ##
============================================================================
Coverage 57.05% 57.06%
============================================================================
Files 342 343 +1
Lines 34332 34434 +102
============================================================================
+ Hits 19589 19650 +61
- Misses 13126 13167 +41
Partials 1617 1617 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 implements two-layer health-based filtering to protect users from timeouts and connection failures when backends become unhealthy during active sessions. Layer 1 filters backends at capability discovery time (in the middleware), excluding unhealthy backends' tools/resources/prompts from being advertised to clients. Layer 2 performs runtime health checks before executing tool/resource/prompt requests, rejecting calls to backends that became unhealthy after session initialization.
Key changes:
- Added
StatusProviderinterface andIsBackendUsablehelper function for health status queries - Implemented backend health filtering in discovery middleware
- Added runtime health checks in handler factory before tool/resource/prompt execution
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/vmcp/health/monitor.go |
Adds StatusProvider interface and IsBackendUsable helper for health status queries |
pkg/vmcp/discovery/health_filter.go |
Implements backend filtering logic to exclude unhealthy/unauthenticated backends from capabilities |
pkg/vmcp/discovery/health_filter_test.go |
Comprehensive unit tests for health filtering logic including edge cases |
pkg/vmcp/discovery/middleware.go |
Integrates health filtering into discovery middleware (Layer 1 filtering) |
pkg/vmcp/discovery/middleware_test.go |
Tests for middleware health filtering behavior |
pkg/vmcp/server/adapter/handler_factory.go |
Adds runtime health checks before tool/resource/prompt execution (Layer 2 filtering) |
pkg/vmcp/server/adapter/handler_factory_test.go |
Tests for runtime health checks in handler factory |
pkg/vmcp/server/server.go |
Updates health monitor initialization order and middleware setup |
test/e2e/thv-operator/virtualmcp/virtualmcp_circuit_breaker_test.go |
E2E tests verifying both filtering layers work correctly |
examples/vmcp-config.yaml |
Updates comments to document health monitoring and capability filtering behavior |
examples/operator/virtual-mcps/vmcp_health_monitoring.yaml |
Enhanced documentation explaining capability filtering when health monitoring is enabled |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/e2e/thv-operator/virtualmcp/virtualmcp_circuit_breaker_test.go
Outdated
Show resolved
Hide resolved
|
✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review. |
Large PR justification has been provided. Thank you!
3575642 to
0855c9c
Compare
0855c9c to
df89ac9
Compare
df89ac9 to
f7712f5
Compare
f7712f5 to
b52a5e8
Compare
b52a5e8 to
9aa99c5
Compare
9aa99c5 to
9171950
Compare
9171950 to
17fd776
Compare
17fd776 to
1178d74
Compare
1178d74 to
598e21d
Compare
There was a problem hiding this 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 22 out of 22 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add two-layer health-based filtering to prevent tool calls to unhealthy backends. This protects users from timeouts and connection failures when backends become unhealthy during active sessions.
Large PR Justification
This is a complex feature that involves filtering unhealthy backends and remove them from capabilities. It also requires complex testing, so the PR can't be splitted.