Repository navigation
Studio: one owner for every request to llama-server, so a crashed server recovers on every API route - #15138
Conversation
|
Reached Codex review convergence at oobabooga#412. |
|
The The non-streaming passthrough no longer calls |
|
One more from this PR's latest run, |
|
The latest They monkeypatch |
|
@codex review |
1 similar comment
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Every Studio route that proxies to llama-server built its own URL, auth header, per-request client, cancel watcher and crash-respawn retry: eight copies across
/v1/chat/completions,/v1/messages,/v1/responses,/v1/completionsand/v1/embeddings, holding 20 hand-built llama-server URLs and headers inroutes/inference.py. Fixes landed one copy at a time:/v1/chat/completionsthe respawn/v1/messagesalready had, and stopped there./v1/completions,/v1/embeddings, the Responses stream and/v1/messagesstill sending no per-launch key.So when llama-server was killed and relaunched on a new port, only chat recovered fully.
/v1/messagesrecovered from a refused connection but not from a connection dropped before upstream response headers, and every other route failed each request until something else reloaded the model.Changes
_LlamaUpstreamowns a request's calls to llama-server:_monitored_llama_callreplaces the swap-gate and API-monitor shell that/v1/completionsand/v1/embeddingseach spelled out._llama_stream_clientreplaces four streaming client constructions that disagreed on keep-alive.routes/inference.pygoes through_LlamaUpstream. The source scan that counted call sites for the key now checks that instead.Crash recovery
/v1/responses(Codex) now respawns. It had no retry, so after a crash every Codex request failed with "Lost connection to the model server" until a chat request or a manual reload./v1/completionsand/v1/embeddingsnow respawn. Non-streaming, they previously surfaced the rawConnectErroras a 500./v1/messagesnow retries lost connections (RemoteProtocolError,ReadError), not only a refused connection, which is the rule chat already used. Streaming recovery applies only before upstream response headers arrive; a server can send those headers before prefill finishes. A failure after headers is not replayed. Its non-streaming nudge retry shares the request's one respawn./tokenizecall or a/v1/messagesnudge retry sent after the Stop closed the client.Reloads still run in the shared thread pool and are serialized by the backend. Burst-load behavior during a reload is unmeasured.
Validation
routes/inference.py(CI's serial-only and live-server exclusions applied). 23,011 passed and 386 skipped.mainwith this sandbox's broken torch. None fails only on this branch.trust_envscan and the direct-counter placement scan). They now check the one owner instead.test_llama_upstream_single_owner.pyexercises refused connections and connections dropped before upstream headers, along with blocked reloads that verify keepalives and prompt Stop/disconnect cleanup without a retry after cancellation.scripts/run_ruff_format.py(ruff 0.6.9);ruff check(0.16.10) is clean.Initial live crash check: a real stand-in llama-server process on a real port, either SIGKILLed or exiting mid-request, then relaunched by
_respawn_if_deadon a new port with a new key. Each route was driven over real sockets./v1/responsesstream (Codex), server killedresponse.failed: "Lost connection to the model server"/v1/completions, server killedConnectError)/v1/completionsstream, server killed/v1/embeddings, server killedConnectError)/v1/messages, server dies mid-prefillRemoteProtocolError)/v1/messagesstream, connection drops before upstream headerserrorevent: "Lost connection…"/v1/chat/completions, stream and non-stream, both crashes