Skip to content

serve: GET /health returns a constant and reports healthy regardless of backend state #64

Description

@mzau

Symptom

GET /health on mlxk serve answers unconditionally:

{ "status": "healthy", "service": "mlx-knife-server-2.0" }

It reports healthy before any model has been loaded, and it keeps reporting healthy after the
inference backend has failed. The endpoint cannot distinguish a server that will answer the next
request from one that will fail it.

Cause

The handler returns a literal dict. It consults no state — not the loaded model, not the inference
backend, not the device.

Repro

mlxk serve --port 8000 &
curl -s localhost:8000/health
# {"status":"healthy","service":"mlx-knife-server-2.0"}  — no model loaded yet

Impact

The response is a liveness signal (the process is up and answering) wearing the name and the payload
of a readiness signal. A client or supervisor that polls it to decide whether to route work, retry a
failed request, or restart the process gets no usable information — and there is no other endpoint
that reports backend state.

The project already has the honest pattern on the other server: embed-serve's /health carries
model + system_fingerprint and returns 503 until its model is loaded.

docs/SERVER-HANDBOOK.md describes the endpoint as a server health check, which is how a client
reads it. Whether the fix is honest reporting or a documented liveness-only contract is open; this
issue records the endpoint.

A server in that state is the subject of #65: the process stays up and fails every request while
this endpoint keeps reporting healthy.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserverServer-related issues and functionality

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions