mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1620] serve: a cancelled request loses the conversation cache entry it restored (take() without a park), so the next request re-reads the prompt #651
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#651
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?
Originally created by @taxah92 on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1620
Summary
A request restored from the conversation cache removes its entry from the cache (
ConversationCache::take(),include/strata/core/conversation_cache.hpp:251-256), and the entry is put back only when the conversation is parked at the end of a completed turn (put(), line 323). A request that is cancelled (client disconnect, idle timeout, an explicit stop) never parks, so the conversation loses its slot; the next request for it matches only the root checkpoint and re-reads everything after it.Companion report: #1619 — with one request turn, a queued request receives no bytes at all, which is what makes clients with a stream idle timeout abort in the first place.
Environment
--kv k8v4 --kv-resident 32768,--spec 3,--conversation-cache-mib 24576 --conversation-cache-slots 3 --prompt-cache 16 --prompt-cache-every 8192What we see
Engine log, consecutive lines of one sequence:
parked=2shows the entry was taken and not returned. The 12 166-token prefix is what looks like the system prompt plus the tool definitions (the root checkpoint), so 93-129k tokens were re-read for each conversation. Totals from one day of logs: 28 events where only the root matched, ~740k tokens re-read ≈ 9-10 minutes of prefill, plus the same again for the aborted attempts.Suggested fix
Keep the taken snapshot alive until the turn ends, or re-insert it when the request is cancelled before it parks. The image already exists — it is
take()n and dropped. Parking what a cancelled turn has (its state is valid up to the point it stopped) would preserve the slot as well. At the very least, keep the entry instead of removing it:best()matches prefixes, so a stale live image still shortens the next read.Related: #175 (explicit
strata_cache_slot) — this is the same "returning to the original chat rereads its large prompt" complaint, but on the cancel path rather than the interleaved-request path.@Niko1221 commented on GitHub (Oct 10, 2026):
Fixed in v0.1.42. A request cancelled before it has read past the conversation it restored (or between two verify windows of a short read) now leaves that conversation as the live one, so the next request continues from it or parks it on the switch, instead of the entry being lost. A cancel in the middle of a batched or pipelined prompt chunk still leaves the session between two chunks (nothing safe to keep there); the checkpoints are kept as before. Test: tools/cancel_park_test.py (restore, cancel, ask again): the follow-up reuses 1834 of 1851 prompt tokens, 0.1.41 reuses 1523. Thank you for the precise trace.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.