Map mcp-go sentinel errors and poll registry version for timely status reports#4317
Map mcp-go sentinel errors and poll registry version for timely status reports#4317
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4317 +/- ##
==========================================
+ Coverage 69.09% 69.12% +0.02%
==========================================
Files 477 477
Lines 48074 48099 +25
==========================================
+ Hits 33216 33247 +31
+ Misses 12276 12268 -8
- Partials 2582 2584 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR improves vMCP health/status accuracy when using mcp-go by mapping specific transport-layer sentinel errors to vmcp sentinel errors and by making status reporting react quickly to dynamic backend registry changes (fixing cases where backends could remain “unhealthy” after startup races or registry removals).
Changes:
- Map mcp-go transport sentinel errors (
ErrUnauthorized,ErrLegacySSEServer) to vmcp sentinel errors inwrapBackendErrorprior to string-based fallbacks. - Expand
IsAuthenticationErrormatching to include mcp-go’s"unauthorized (401)"string format. - Add registry-version polling (every 2s) to trigger immediate status reports when dynamic backend registries change, plus new unit tests for the behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/vmcp/client/client.go | Maps mcp-go transport sentinel errors to vmcp sentinel errors before string fallbacks. |
| pkg/vmcp/client/client_test.go | Adds unit tests validating the new wrapBackendError sentinel mappings. |
| pkg/vmcp/errors.go | Extends auth error string detection to match "unauthorized (401)". |
| pkg/vmcp/health/checker_test.go | Adds test coverage for the new auth error string format and health categorization expectations. |
| pkg/vmcp/server/status_reporting.go | Polls dynamic registry version to trigger immediate status reports on backend add/remove changes. |
| pkg/vmcp/server/status_reporting_test.go | Adds unit test to ensure version changes trigger a status report without waiting for the full interval. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…s reports - Map transport.ErrUnauthorized to ErrAuthenticationFailed and transport.ErrLegacySSEServer to ErrBackendUnavailable in wrapBackendError, before the string-based fallback. This ensures 401 responses from mcp-go reach health monitoring as BackendUnauthenticated rather than BackendUnhealthy. - Add "unauthorized (401)" pattern to IsAuthenticationError to match mcp-go's ErrUnauthorized string format (reversed order vs "401 unauthorized"). - Poll DynamicRegistry.Version() every 2s in periodicStatusReporting and trigger an immediate status report when the version changes, so backend additions/removals are reflected without waiting for the full 30s interval. Related-to: #4278
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jhrozek
left a comment
There was a problem hiding this comment.
Code review comment on version-polling interval configuration.
jhrozek
left a comment
There was a problem hiding this comment.
that was really just a nit
Summary
Fixes #4278
Type of change
Test plan
task test)task test-e2e)task lint-fix)Changes
Does this introduce a user-facing change?
Special notes for reviewers