Repository navigation
Description
Bug description
PR #4108 made health check parameters configurable but left behind two cleanup items identified during review:
-
Two dead zero-value guards in
transparent_proxy.gothat can never trigger, since the constructor and functional options guarantee positive values forhealthCheckIntervalandhealthCheckPingTimeout. -
A hardcoded
context.WithTimeout(ctx, 5*time.Second)inhealthcheck.go:checkMCPStatusthat redundantly wraps the ping call. TheMCPPingeralready enforces its own timeout viahttp.Client.Timeout(set to the configured value throughTOOLHIVE_HEALTH_CHECK_PING_TIMEOUT). The redundant context timeout silently caps the configured ping timeout at 5s — if a user setsTOOLHIVE_HEALTH_CHECK_PING_TIMEOUT=10sfor a slow backend, the context cancels first and the configured value is ineffective.
Steps to reproduce
- Set
TOOLHIVE_HEALTH_CHECK_PING_TIMEOUT=10s - The transparent proxy's
MCPPingeris correctly created with a 10s HTTP client timeout - But
checkMCPStatuswraps the ping incontext.WithTimeout(ctx, 5*time.Second), which fires first
Expected behavior
The configured ping timeout should be the effective timeout for health check pings.
Actual behavior
The hardcoded 5s context timeout in checkMCPStatus overrides any configured value above 5s.
Additional context
- jhrozek identified both issues during PR Make transparent proxy health check parameters configurable #4108 review (inline comment, review comment) and agreed a follow-up PR is fine (comment).
- The fix removes the redundant context timeout rather than plumbing the configured value through
HealthChecker. Both existingMCPPingerimplementations handle timeouts internally: the transparent proxy pinger useshttp.Client.Timeout, and the httpsse pinger is non-blocking (fire-and-forget channel send). TheHealthCheckerdoesn't need to duplicate timeout enforcement that the pinger already owns. - The equivalent dead guard for
retryDelaywas already removed in PR Make transparent proxy health check parameters configurable #4108 commita41f8a87.
Activity
Clean up health check dead code and timeout
Clean up health check dead code and timeout
Clean up health check dead code and timeout (#4791)