You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[vMCP] Handle auth credential expiration with retry and proactive refresh #3869
With session-scoped clients, short-lived outgoing credentials (e.g., OAuth tokens) resolved at client creation can become stale mid-session. Implement automatic client recreation on auth failure with proper safeguards.
Phase 1 (this issue):
Detect 401/403 from backend; recreate client with fresh credentials from OutgoingAuthRegistry
Retry with exponential backoff, max 3 attempts
Circuit-breaker: after N consecutive auth failures per backend, disable retries and log a warning
Use singleflight to deduplicate concurrent recreation attempts for the same backend
Auth-failure retries add non-trivial latency — surface this overhead in distributed traces
Phase 2 (follow-up, separate issue):
Modify identityPropagatingRoundTripper to read identity from request context per-operation, eliminating the stale credential problem entirely
For credentials with a known expiry (JWT exp, OAuth expires_in): schedule proactive client recreation before expiry
Acceptance Criteria
A 401 or 403 from a backend triggers client recreation with fresh credentials
Recreation is retried with exponential backoff up to a maximum of 3 attempts
After N consecutive auth failures for a backend, the circuit breaker opens and further retries are skipped
Concurrent auth failures for the same backend result in only one recreation attempt (via singleflight)
Auth-failure retry latency is visible in distributed traces
The raw credentials are never logged
Unit tests cover: successful recreation, max retries exhausted, circuit breaker opens, concurrent failures deduplicated
Activity
feat(vmcp): add auth-retry with circuit breaker to BackendClient
feat(vmcp): add auth-retry with circuit breaker to BackendClient
feat(vmcp): add auth-retry with circuit breaker to BackendClient
feat(vmcp): add auth-retry with circuit breaker to BackendClient
feat(vmcp): add auth-retry with circuit breaker to BackendClient
feat(vmcp): add auth-retry with circuit breaker to BackendClient