Skip to content

Clean up health check dead code and timeout#4791

Merged
ChrisJBurns merged 1 commit intostacklok:mainfrom
gkatz2:fix/healthcheck-cleanup-4790
Apr 14, 2026
Merged

Clean up health check dead code and timeout#4791
ChrisJBurns merged 1 commit intostacklok:mainfrom
gkatz2:fix/healthcheck-cleanup-4790

Conversation

@gkatz2
Copy link
Copy Markdown
Contributor

@gkatz2 gkatz2 commented Apr 13, 2026

Summary

  • PR Make transparent proxy health check parameters configurable #4108 made health check parameters configurable. During review, jhrozek identified two remaining cleanup items and agreed to a follow-up PR.
  • Remove two dead zero-value guards in transparent_proxy.go — the constructor and functional options guarantee positive values, making these unreachable.
  • Remove the redundant context.WithTimeout(ctx, 5*time.Second) in checkMCPStatus — the MCPPinger already enforces its own timeout internally (http.Client.Timeout for the transparent proxy pinger, non-blocking send for the httpsse pinger). The hardcoded 5s context timeout silently capped TOOLHIVE_HEALTH_CHECK_PING_TIMEOUT at 5s.

Fixes #4790

Type of change

  • Bug fix

Test plan

  • Unit tests (task test)
  • Linting (task lint-fix)

Special notes for reviewers

The redundant context timeout in checkMCPStatus is removed rather than plumbed with the configured value. Both existing MCPPinger implementations own their timeouts: the transparent proxy pinger sets http.Client.Timeout to the configured ping timeout, and the httpsse pinger is non-blocking (fire-and-forget channel send that returns immediately). The HealthChecker doesn't need to duplicate timeout enforcement that the pinger already handles. The equivalent dead guard for retryDelay was already removed in PR #4108 (commit a41f8a8).

Generated with Claude Code

Copy link
Copy Markdown
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.93%. Comparing base (052ecdd) to head (c9fc505).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...g/transport/proxy/transparent/transparent_proxy.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4791      +/-   ##
==========================================
+ Coverage   68.90%   68.93%   +0.02%     
==========================================
  Files         517      517              
  Lines       54803    54795       -8     
==========================================
+ Hits        37764    37772       +8     
+ Misses      14129    14117      -12     
+ Partials     2910     2906       -4     

☔ 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.

jhrozek
jhrozek previously approved these changes Apr 13, 2026
Copy link
Copy Markdown
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean dead code removal

@jhrozek
Copy link
Copy Markdown
Contributor

jhrozek commented Apr 13, 2026

@gkatz2 oh, sorry, there is a conflict now, would you mind resolving it? The code looks good itself!

The constructor and functional options guarantee positive values
for healthCheckInterval and healthCheckPingTimeout, making two
zero-value guards unreachable. The redundant context timeout in
checkMCPStatus capped the configurable ping timeout at 5s; the
MCPPinger already enforces its own timeout internally.

Fixes stacklok#4790

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Greg Katz <gkatz@indeed.com>
@gkatz2 gkatz2 force-pushed the fix/healthcheck-cleanup-4790 branch from 948b70c to c9fc505 Compare April 13, 2026 22:22
@github-actions github-actions bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 13, 2026
@gkatz2
Copy link
Copy Markdown
Contributor Author

gkatz2 commented Apr 13, 2026

@jhrozek, just pushed a fix for the conflict.

@ChrisJBurns ChrisJBurns merged commit c49ec9e into stacklok:main Apr 14, 2026
64 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove dead code and redundant ping timeout in health check

3 participants