mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #205] [CLOSED] fix(engine): clear stale error/cancellation string between requests and before prompt prefill #2505
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#2505
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/205
Author: @praveshkhatana
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:fix-prompt-cancel-state-leak📝 Commits (1)
c507666fix(engine): clear stale error/cancellation state between requests and before prompt prefill📊 Changes
2 files changed (+3 additions, -0 deletions)
View changed files
📝
src/prefill/prefill.cpp(+1 -0)📝
src/program/generate.cpp(+2 -0)📄 Description
Summary
In v0.1.26 and v0.1.27, if any request is cancelled while reading prompt chunks (e.g. client disconnects or times out on long contexts), the variable
erris set to"cancelled".Because
std::string erris declared inint main()(around line 1311 ofsrc/program/generate.cpp) and is never cleared at the start of a request, this string lingers into subsequent requests.In commit
c6c65947(E-9),sp.on_chunkwas changed to:Because
eis passed by reference fromPrefill::run(..., err),!e.empty()evaluates totrueon chunk 0 of the next request. This causessp.on_chunkto immediately abort without executing,Prefill::runreturnsfalse, andgenerate.cpphits:Because the current request was not stopped (
stop_reqis false), the engine outputsstrata serve: cancelled, sendsERR cancelledto stdout, and terminates with exit code 1.Reproduction Steps
strata --serveon v0.1.26 or v0.1.27.STOP->err = "cancelled").--short-read(e.g. prompt length > 64 tokens, requiring batched prefill).strata serve: cancelled, and exits with code 1.Fix
err.clear()right afterstop_req.store(false)inwhile (next_line(line))insrc/program/generate.cpp.err.clear()before iterating prompt segments infor (const int64_t to : {reread_to, root_at, turn_at, n - 1}).err.clear()on entry toPrefill::run(...)insrc/prefill/prefill.cpp.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.