Skip to content

Conversation

@yrobla
Copy link
Contributor

@yrobla yrobla commented Dec 23, 2025

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.

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.
@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Dec 23, 2025
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 size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Dec 23, 2025
@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 53.44828% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.06%. Comparing base (24a6b2c) to head (598e21d).

Files with missing lines Patch % Lines
...perator/controllers/virtualmcpserver_controller.go 39.78% 54 Missing and 2 partials ⚠️
cmd/vmcp/app/commands.go 0.00% 8 Missing ⚠️
pkg/vmcp/health/monitor.go 0.00% 6 Missing ⚠️
pkg/vmcp/server/adapter/handler_factory.go 72.72% 3 Missing and 3 partials ⚠️
cmd/thv-operator/pkg/vmcpconfig/converter.go 0.00% 3 Missing ⚠️
pkg/vmcp/discovery/manager.go 66.66% 1 Missing and 1 partial ⚠️
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.
📢 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 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 StatusProvider interface and IsBackendUsable helper 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.

@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 23, 2025
@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 dismissed their stale review December 23, 2025 10:26

Large PR justification has been provided. Thank you!

@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from 3575642 to 0855c9c Compare December 23, 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 Dec 23, 2025
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from 0855c9c to df89ac9 Compare December 23, 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 23, 2025
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from df89ac9 to f7712f5 Compare December 23, 2025 11:35
@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 23, 2025
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from f7712f5 to b52a5e8 Compare December 23, 2025 11:59
@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 23, 2025
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from b52a5e8 to 9aa99c5 Compare January 2, 2026 10:21
@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 Jan 2, 2026
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from 9aa99c5 to 9171950 Compare January 2, 2026 10:29
@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 Jan 2, 2026
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from 9171950 to 17fd776 Compare January 2, 2026 11: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 Jan 2, 2026
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from 17fd776 to 1178d74 Compare January 2, 2026 11:51
@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 Jan 2, 2026
@yrobla yrobla force-pushed the feat/issue-3036-healthcheck-circuitbreaker-remove-unhealthy branch from 1178d74 to 598e21d Compare January 2, 2026 12:30
@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 Jan 2, 2026
@yrobla yrobla requested a review from Copilot January 2, 2026 14:03
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 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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants