Serve: providers route to the live local engine (WOR-1680 slice 2)#582
Merged
Conversation
… slice 2) Wires the certified model-host runtime into the request path so a provider with a serve: block actually hosts its model on this box. - server/model_host.rs: a process-global ModelHostRuntime<ProcessEngineLauncher> built once from the union of every provider's serve: block (one node, one GPU, one residency) and surviving hot reload so a resident model is not killed on an unrelated config change. The GPU probe is feature-selected: NvmlGpuProbe under `gpu-nvidia`, else a zero-GPU probe so a CPU-only build rejects serve: admission cleanly instead of pretending to serve. served_upstream() is the request-path entry point. - handle_ai_proxy cascade: after selecting a provider, a served provider is brought to ready and its base_url overwritten with the live loopback URL; if the engine cannot start, it fails over like any provider error (a lone served provider then yields the existing "no provider" 502). - gpu-nvidia / model-weights features threaded core -> model-host and binary -> core. - CPU fake-engine round-trip test (sbproxy-ai): a serve:-only provider with no address resolves to a live fake engine and completes a real HTTP chat round trip (the WOR-1680 acceptance). CPU-verified: round-trip test, merged-config construction, served_upstream None for a proxied provider, existing 29 ai_dispatch tests still pass. The full serve->token path through the running gateway on a GPU (and which surfaces beyond the chat cascade route through it) is the on-box proof, tracked as a follow-up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UdeqdRCz9B7a5qLYRU3uxQ
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.
Wires the certified model-host runtime into the request path, so a provider with a
serve:block actually hosts its model on this box and requests route to its live loopback port. Builds on slice 1 (#581, the resolution layer).What changed
server/model_host.rs: a process-globalModelHostRuntime<ProcessEngineLauncher>, built once from the union of every provider'sserve:block (one node = one GPU = one residency) and surviving hot reload so a resident model is not killed on an unrelated config change. The GPU probe is feature-selected:NvmlGpuProbeundergpu-nvidia, else a zero-GPU probe so a CPU-only build rejects serve admission cleanly instead of pretending to serve.served_upstream()is the request-path entry point.handle_ai_proxycascade seam: after a provider is selected, a served provider is brought to ready and itsbase_urloverwritten with the live loopback URL; if the engine cannot start it fails over like any provider error (a lone served provider then yields the existing "no provider" 502). The cascade is the failover chat path, which is where the epic places serve: ("provider zero in the fallback chain").gpu-nvidia/model-weightsthreaded core → model-host and binary → core.Verification
CPU-verified: the round-trip test, merged-config construction,
served_upstreamreturnsNonefor a proxied provider, and the existing 29ai_dispatchtests still pass. Full gate green: fmt, build, workspace nextest (6085 passed, 0 failed), doctests, clippy-D warnings(default and--features gpu-nvidia), docs.On-box proof (follow-up)
The full serve→token path through the running gateway on a GPU (and whether surfaces beyond the chat cascade route through this path) is the on-box certification, tracked as the next slice.