fix: self-check gateway probe misreports connection-refused as pass#29
Merged
Conversation
… as pass The gateway probe uses 000 to default the HTTP code on failure. When curl returns (connection refused) AND the fallback fires, stdout gets concatenated as (6 chars). Bash string comparison then evaluates as true, causing the gateway to be reported as ✅ up when it is actually down. Fix: replace with + bash parameter expansion . This avoids stdout concatenation entirely — curl's output stays clean, and only empty results get the 000 default.
…ties and health checks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One-line fix to
docker/self-check.sh— the Hermes gateway health check was incorrectly reporting✅ Gateway HTTP 000000when the dashboard/gateway port (9119) was unreachable, because of a bash stdout-concatenation bug in the curl fallback pattern.The Bug
When curl to an unreachable port returns
000(from-w %{http_code}) AND the|| echo "000"fallback fires, stdout gets concatenated:000+000=000000(6 chars).The downstream check:
Then evaluates
"000000" != "000"as true (bash string comparison), so the gateway is reported as✅even though it is actually down.The Fix
|| trueprevents the non-zero exit from killing theset -escript, but adds nothing to stdout"${has_gateway:-000}"only substitutes000when the result is truly empty000stays000→[ "000" != "000" ]is false → gateway correctly reported as❌How to Test Locally
HERMES_GATEWAY_URL=http://localhost:9119 ./docker/self-check.sh✅ Gateway HTTP 000000 at http://localhost:9119❌ Gateway no response from http://localhost:9119Checklist