mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2155] [Engine] serve: answer GET /models/sse (llama.cpp's model status feed) #3889
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3889
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2155
Author: @Daniel-Aaron-Bloom
Created: 10/12/2026
Status: 🔄 Open
Base:
main← Head:serve-models-sse📝 Commits (4)
e76fcf1serve: answer GET /models/sse (llama.cpp's model status feed) so front-ends that watch model loads get events (#2154)e8a3710serve: /models/sse: a load that fails sends unloaded too, so a watcher does not stay on "loading" (#2154)41f474dMerge remote-tracking branch 'origin/main' into serve-models-sse08e30a6Merge remote-tracking branch 'origin/main' into serve-models-sse📊 Changes
3 files changed (+121 additions, -4 deletions)
View changed files
📝
docs/DETAILS.md(+8 -0)📝
serve/server.py(+58 -4)📝
serve/test_lifecycle.py(+55 -0)📄 Description
Issue: Resolves #2154
Problem and result
Front-ends that watch model status the way llama.cpp's router does GET
/models/sseand get a 404, so they reconnect forever and never see the model (#2154). NowGET /models/ssestreams llama.cpp-shapedstatus_changeevents -loading,loaded(with the modelinfo),unloaded(with the exit code) - and quiet stretches get the usual SSE-comment keep-alive. A load that fails sendsunloadedtoo, so a watcher does not stay on "loading".Related discussion
Resolves #2154. Review point on this PR by @qiuzan2001: a failed load left the watcher on "loading" forever; fixed in
e8a37109with a new test (test_models_sse_reports_a_failed_load_as_unloaded).Approach
Purely additive: a per-watcher queue on
Service(sse_lock/sse_clients) andsse_notify(), andstatus_changeemissions on the transitions the server already has:loadingandloadedaround a load,unloaded(exit code 0) on unload,unloadedwith the exit code when the engine had died and is started again, andunloadedwhen a start fails./modelsnow builds its entry through a newService.model_entry(), which the SSEinforeuses; the/modelsanswer itself is unchanged. No default changes, no C++ files touched, so nothing to build for CUDA, HIP or SYCL.Validation
Passed:
python -m pytest serve/test_lifecycle.py -q-> 13 passed (9 existing + 4 SSE tests), on this branch at08e30a6e(merged withmainat011c9e60), macOS, Python 3.11.python -m pytest serve/ -q-> 919 passed, 12 skipped, 2 failed (listed under Failed), same revision.Failed:
serve/test_gpu_roles_server.py::Roles::test_every_card_off(expectsSystemExit, not raised) andserve/test_server.py::VisionArgs::test_min_tokens_is_passed_only_when_set(serve/lifeline.pyAttributeErroron a mockedProcwithout.pid). Both fail identically on a clean checkout oforigin/main011c9e60: pre-existing on main in this environment, not caused by this change.Not run:
Limits
The feed covers the transitions this server has (load, unload, an engine that had died being started again, a failed start); llama.cpp's router also reports per-slot details this single-slot feed does not. One watcher queue per connection; a watcher that hangs up is dropped by its own handler.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.