mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #837] [CLOSED] server: "return_progress": true puts the prompt's PP line on the stream as llama.cpp's prompt_progress #2862
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#2862
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/837
Author: @eliaskg
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:openai-prompt-progress📝 Commits (1)
8c508d9server: "return_progress": true puts the prompt's PP line on the stream as llama.cpp's prompt_progress📊 Changes
3 files changed (+130 additions, -11 deletions)
View changed files
📝
docs/DETAILS.md(+9 -0)📝
serve/server.py(+45 -8)📝
serve/test_server.py(+76 -3)📄 Description
What
"return_progress": trueon a streaming/v1/chat/completionsrequest adds llama.cpp'sprompt_progressto the stream:total,cache,processed,time_ms, same names and same meaning. A client that already draws a prefill bar for llama.cpp draws one here with no client-side change. Off unless the request asks, as it is in llama.cpp.The image is pi-prefill running against Strata on this host, needing nothing but its provider id added to a list.
The numbers were already in the server
The engine writes
PP <position> <prompt_tokens> <ms> <tok/s>after every prompt chunk (src/program/generate.cpp, the protocol note).serve/server.pyalready parses three of those four fields intoengine.progressandprefill_tok_s_mean, the web app draws its prefill bar from them (serve/web/app.js,live.prompt_read/live.prompt_total), and the server window prints them every second while a prompt is read.The one missing hop is the last.
Service.runturns a PP line into("ping", None),openai_chunksturns that intoNone, and the writer sends it as the SSE comment: keep-alive. This fills that comment in.PP'smsfield was on the wire and discarded, andRESUMEwas parsed into a local and not kept, so those two are now kept asprogress_msandreused.One constant, and why
The batched path never reports the whole prompt: up to
--short-readtokens (64 by default) are read through the verify windows instead, so its final PP stops short ofpp_total. Over 14 requests on this host every last PP was 1 or 5 tokens short, never 0, soprocessed >= totalis not the end of the read and a client would watch a bar stop just short of full.A prompt under one
--prefillchunk sends exactly one PP, and it is that line. Without the rule such a prompt shows a bar that appears already full.PP_DONE_TAIL = 64isshort_read's default; a non-default--short-readis not read back.Measured, two RTX 3090s + 91 GiB, IQ3_S,
--prefill auto(8192)A 22,056 token prompt,
return_progress: true:The step is the chunk, so the bar starts at 37% rather than at 0%. A 42,131 token prompt read in 15 s sends six lines, and a 178,084 token prompt sends about 21. The same 22,056 token prompt sent again reuses the whole prompt from its conversation checkpoint, reads in 0.17 s, and sends nothing: the tail rule, working.
Tests
Four cases in
serve/test_server.pyon the mock engine: one progress chunk per chunk with the exact four fields; nothing at all when the client does not ask, and the keep-alive still there; the tail line dropped at 64, 63 and 1 token short of the end; andcache0 when noRESUMEcame.serve.test_serverruns 143, against 139 before.serve/test_responses.py'stest_json_schema_text_format, andtools/test_setup_amd / _choices / _golden, fail the same way on an untouched v0.1.39 checkout on macOS, so they are left as they are.Not covered
Chat Completions only. The Responses API and
/v1/messageshave their own ping branches and are untouched.structured_chunkspasses a progress chunk through instead of buffering it, because it carries no content to validate.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.