fix(sglang): implement Status RPC to unblock backend-monitor polling#10867
Merged
mudler merged 1 commit intoJul 16, 2026
Merged
Conversation
The sglang Python backend inherits the default Status RPC from
backend_pb2_grpc.BackendServicer, which raises NotImplementedError.
LocalAI's backend-monitor polls /backend.Backend/Status periodically on
every registered backend; when the call fails, /backend/monitor returns
HTTP 500 and downstream inference requests to the sglang backend are
blocked even though the model is loaded and answering directly via the
gRPC endpoint.
Add a minimal Status shim that mirrors the existing Health method and
returns StatusResponse{state=READY} unconditionally. This unblocks the
monitor path; a state-aware follow-up (UNINITIALIZED during load, BUSY
under active inference) is left for a subsequent change.
Reproduced on DGX Spark (GB10, arm64-l4t-cuda-13 image) with the sglang
v0.5.15 backend and Qwen3-Coder-Next-NVFP4-GB10; verified locally that
patching the shim in place immediately restores /backend/monitor and
inference across the sglang slot.
localai-bot
approved these changes
Jul 16, 2026
localai-bot
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed against the codebase — the fix is correct and verified:
core/services/monitoring/backend_monitor.go:93does pollStatuson every registered backend, and the sglang servicer indeed inherits the unimplemented default, so the failure mode described (500 on/backend/monitorfor a healthy loaded model) is real.- The shim matches the established pattern in other Python backends (
speaker-recognition,insightface,rfdetrall implement the same minimalStatus). - Unconditional
READYis the right call here rather than a state-aware variant:self.llmonly exists afterLoadModel, and the monitor only samples models that already passedCheckIsLoaded, soHealth-mirroring behavior is consistent.
One blocker before merge: the DCO check is failing — please amend your commit with a Signed-off-by line (git commit --amend -s and force-push). Cosmetic nit, feel free to ignore: there's a double blank line before Status and none between it and LoadModel.
cc @mudler — good to merge once DCO is fixed.
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.
Problem
The sglang Python backend inherits the default
StatusRPC frombackend_pb2_grpc.BackendServicer, which raisesNotImplementedError. LocalAI's backend-monitor polls/backend.Backend/Statusperiodically on every registered backend; when the call fails,/backend/monitorreturns HTTP 500 and downstream inference requests to the sglang backend get blocked — even though the model is loaded and answering fine on its direct gRPC endpoint.Fix
Add a minimal
Statusshim that mirrors the existingHealthmethod and returnsStatusResponse{state=READY}unconditionally. This unblocks the monitor path immediately. A state-aware follow-up (UNINITIALIZEDduring load,BUSYunder active inference) would be an improvement but is intentionally out of scope for this MVP — the current change matches whatHealthdoes today, which is what registered backends have effectively been telling the monitor loop anyway.Reproducer / verification
Hardware: DGX Spark (GB10, arm64-l4t-cuda-13 image). Backend:
cuda13-nvidia-l4t-arm64-sglangat sglang v0.5.15, modelucbye/Qwen3-Coder-Next-NVFP4-GB10(80B NVFP4). Before the shim,/backend/monitorreturns 500 and inference requests routed via LocalAI hang; direct gRPC-level calls to the sglang server work. Patching the shim in place on the running container instantly restores both/backend/monitorand inference to the sglang slot. Same pattern has been carrying prod for the sglang coder there since 2026-07-15 (~24 h uptime).Notes for reviewers
backend/python/sglang/backend.py; nothing else is touched.vllm,llama-cpp-python) also don't implementStatustoday — if the monitor polls them too, the same shim would apply. I've only reproduced the failure end-to-end with sglang so this PR is intentionally sglang-only; happy to file follow-ups if useful.function.argumentsstring→dict parse).