feat(cli): add gllm health so a container can probe itself #57

Merged
rcsheets merged 1 commit from feat/gllm-health into main 2026-07-25 07:58:47 +00:00
Owner

The server has exposed /livez and /readyz since the probe split, but nothing
in the images can call them. A container healthcheck runs INSIDE the
container, and the CPU image is FROM scratch -- no curl, no shell, nothing.
The CUDA image has a shell but no HTTP client either: no curl, no wget, no
python, only dash. So the obvious healthcheck,
curl -fsS localhost:8000/readyz, fails permanently while the server serves
fine, reporting the container unhealthy for a reason that has nothing to do
with the server.

The binary is the one tool guaranteed to be present, so it carries the probe:

HealthCmd=/gllm health

Readiness is the default, being what decides whether traffic should arrive:
503 while the model loads and once a drain begins. --live selects /livez for
callers that want "is the process answering HTTP at all". /healthz is
deliberately not offered -- it is a deprecated alias of /readyz that warns
per probing IP in the server log, and a new probe should not be adding
itself to that list.

--endpoint takes a full URL, a bare host:port, or the :port that --addr
itself takes, since copying the server's own flag value across is the
obvious thing to try and should not be a usage error. Failures distinguish
not-listening from listening-but-not-ready from answering-something-else,
because the exit status alone cannot and a person debugging by hand is
asking exactly that.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

The server has exposed /livez and /readyz since the probe split, but nothing in the images can call them. A container healthcheck runs INSIDE the container, and the CPU image is FROM scratch -- no curl, no shell, nothing. The CUDA image has a shell but no HTTP client either: no curl, no wget, no python, only dash. So the obvious healthcheck, `curl -fsS localhost:8000/readyz`, fails permanently while the server serves fine, reporting the container unhealthy for a reason that has nothing to do with the server. The binary is the one tool guaranteed to be present, so it carries the probe: HealthCmd=/gllm health Readiness is the default, being what decides whether traffic should arrive: 503 while the model loads and once a drain begins. --live selects /livez for callers that want "is the process answering HTTP at all". /healthz is deliberately not offered -- it is a deprecated alias of /readyz that warns per probing IP in the server log, and a new probe should not be adding itself to that list. --endpoint takes a full URL, a bare host:port, or the `:port` that --addr itself takes, since copying the server's own flag value across is the obvious thing to try and should not be a usage error. Failures distinguish not-listening from listening-but-not-ready from answering-something-else, because the exit status alone cannot and a person debugging by hand is asking exactly that. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
feat(cli): add gllm health so a container can probe itself
Some checks failed
ci / test_and_build (pull_request) Has been cancelled
7b2272e3db
The server has exposed /livez and /readyz since the probe split, but nothing
in the images can call them. A container healthcheck runs INSIDE the
container, and the CPU image is FROM scratch -- no curl, no shell, nothing.
The CUDA image has a shell but no HTTP client either: no curl, no wget, no
python, only dash. So the obvious healthcheck,
`curl -fsS localhost:8000/readyz`, fails permanently while the server serves
fine, reporting the container unhealthy for a reason that has nothing to do
with the server.

The binary is the one tool guaranteed to be present, so it carries the probe:

    HealthCmd=/gllm health

Readiness is the default, being what decides whether traffic should arrive:
503 while the model loads and once a drain begins. --live selects /livez for
callers that want "is the process answering HTTP at all". /healthz is
deliberately not offered -- it is a deprecated alias of /readyz that warns
per probing IP in the server log, and a new probe should not be adding
itself to that list.

--endpoint takes a full URL, a bare host:port, or the `:port` that --addr
itself takes, since copying the server's own flag value across is the
obvious thing to try and should not be a usage error. Failures distinguish
not-listening from listening-but-not-ready from answering-something-else,
because the exit status alone cannot and a person debugging by hand is
asking exactly that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.41.0 | Safety Check | Claude Sonnet 5 | tracking id r-646c5d-3c038c
This is an AI-generated review and may contain mistakes.

Status: Completed


⚠️ The primary review (Mistral Small) failed. The review below is from Claude Sonnet 5, which reviewed the same diff.

Verdict: LGTM — Purely additive CLI health-check command with reasonable input validation and body-size capping; no secrets, breaking changes, or security issues found.

This PR adds a gllm health subcommand that HTTP-probes a running server's /readyz or /livez endpoint and reflects success/failure via exit status. It's a straightforward, well-scoped CLI addition:

  • resolveEndpoint normalizes various endpoint forms (full URL, host:port, bare :port) into a base URL, with sane validation (rejects empty, non-http/https schemes).
  • probe issues a GET, distinguishes connection failure vs non-200 status, caps response body read at 256 bytes to avoid unbounded allocation from a malicious/wrong endpoint.
  • Tests cover resolveEndpoint edge cases, probe status handling, not-listening case, path selection for --live, and failure exit behavior.
  • main.go just registers the new command — no changes to existing commands/behavior.
  • No secrets, no large binaries, no obviously dangerous code paths. The http.DefaultClient usage is fine for a CLI healthcheck tool run standalone in a container.

This is purely additive (new subcommand + README docs), doesn't touch server logic, and doesn't introduce any breaking changes to existing commands. Nothing alarming stands out.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.41.0 | Safety Check | Claude Sonnet 5 | tracking id `r-646c5d-3c038c`* *This is an AI-generated review and may contain mistakes.* **Status:** ✅ Completed --- > ⚠️ The primary review (**Mistral Small**) failed. The review below is from **Claude Sonnet 5**, which reviewed the same diff. **✅ Verdict: LGTM** — Purely additive CLI health-check command with reasonable input validation and body-size capping; no secrets, breaking changes, or security issues found. This PR adds a `gllm health` subcommand that HTTP-probes a running server's /readyz or /livez endpoint and reflects success/failure via exit status. It's a straightforward, well-scoped CLI addition: - `resolveEndpoint` normalizes various endpoint forms (full URL, host:port, bare :port) into a base URL, with sane validation (rejects empty, non-http/https schemes). - `probe` issues a GET, distinguishes connection failure vs non-200 status, caps response body read at 256 bytes to avoid unbounded allocation from a malicious/wrong endpoint. - Tests cover resolveEndpoint edge cases, probe status handling, not-listening case, path selection for --live, and failure exit behavior. - main.go just registers the new command — no changes to existing commands/behavior. - No secrets, no large binaries, no obviously dangerous code paths. The `http.DefaultClient` usage is fine for a CLI healthcheck tool run standalone in a container. This is purely additive (new subcommand + README docs), doesn't touch server logic, and doesn't introduce any breaking changes to existing commands. Nothing alarming stands out.
rcsheets force-pushed feat/gllm-health from 7b2272e3db
Some checks failed
ci / test_and_build (pull_request) Has been cancelled
to 874a608555
All checks were successful
ci / test_and_build (pull_request) Successful in 21s
2026-07-25 07:57:25 +00:00
Compare
rcsheets deleted branch feat/gllm-health 2026-07-25 07:58:48 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
brooktrails/gllm!57
No description provided.