mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1703] Strata starts to digest a long prompt from the beginning #679
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#679
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 @fukc-gihtub on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1703
It only happens occasionally, and I'm not sure whether it's an issue with the harness (OpenCode) or Strata. Only 51% of the 512k context is being used right now, and there's no compaction, but Strata suddenly "forgets" the prompt prefix and starts over:
Strata v0.1.41
@tonydiep commented on GitHub (Oct 9, 2026):
I see this also.
Symptoms
What I've noticed is that if I leave a session for a long time. For example, I had a running context of 150k. I go for a coffee break and then return .The entire prompt is reprocessed when I add to the conversation. Nothing else has been using the model. Nothing has touched Strata or the computer so there was nothing to kick the prompt out of the cache. The only variable is time. I did not find anything in Strata like a TTL or prompt expiry. I did not find a smoking gun.
Severity
Annoying, but I've seen this with other inference engines. No work is lost.
Environment
Strata (2026-10-08 build, 1.40.1?) Pi Coding Agent. Q3-XSS
@jerry78424 commented on GitHub (Oct 9, 2026):
Opencode injects date in its system prompt, so a re-prefill after date change is expected, not sure if that's your case.
@fukc-gihtub commented on GitHub (Oct 9, 2026):
Not my case. It can happen multiple times a day.
@fukc-gihtub commented on GitHub (Oct 9, 2026):
Ah! It happens after an edit of
AGENTS.md, so it's probably the harness.@Niko1221 commented on GitHub (Oct 10, 2026):
Thanks for the log, and thanks tonydiep for the second report. Two things we can say from the code. First, there is no timer or TTL in the engine that drops the conversation, so "time passed" alone should not do it. Second, the engine only reuses a prompt when the new request starts with exactly the same tokens as what it holds (the live session, or one of its saved checkpoints). If the client changes one early token (a date or time in the system prompt, a tool list in a different order, thinking text removed from an old turn), everything after that point is read again. Or something else restarted or replaced the session in between: a side request from the client (a title or summary call to the same model), the engine being restarted after an out-of-memory kill, or --idle-unload.
Every request prints one line that tells these apart:
strata serve: prompt N tokens = X reused + Y read in .... Could you post, for one of the full re-reads, the lines from the end of the previous request to the start of the slow one? Specifically:strata serve: prompt ... reused ...line of the slow request and of the request before it (X is what was reused; if X is 0 or small, the match broke early).conversation cache:lines between them, and any line saying the engine stopped, started or loaded again (an automatic restart loses everything it held).If you can, start the engine with
--prompt-cache-tail(an extra checkpoint near the end of the prompt) as a test and tell us whether the re-reads get shorter. That only helps when the match breaks late, but it tells us which of the two cases it is.@tonydiep commented on GitHub (Oct 10, 2026):
1703-engine-process.log
1. The excerpt you asked for
All of this is inside one engine process: started
2026-10-10 10:08:09(log line 23523), next restart2026-10-10 16:52:18(log line 24342). Nothing in between.Contiguous, unedited, log lines 24286–24294 — end of the previous request through the start of the slow one:
Previous request: 31825 of 31890 reused (99.8%). Slow one: 0 of 93137. Not a late break — a total miss.
2. What is between them
engine started/ stopped / loaded line. The cold read sits between the start at line 23523 and the next start at line 24342.conversation cache:line anywhere in the log —grep -c "conversation cache"= 0 over 24,500 lines. Parking never runs, because--conversation-cache-mibis unset (default 0 = off).3. The pattern — this is the part I'd like eyes on
Same process, prompt lines only, log lines 24263–24333:
Three conversation families interleave in one process: ~14–25k, ~34–40k, ~93–97k. Each family is warm for its consecutive requests and lands on
0 reusedon the first request after the other families have been served — then immediately warm again for the rest of that family.With parking off, that is the expected behaviour: the live session holds one conversation, and the next request from a different conversation has nothing to match. Every cold read in this block follows a request from another family, so interleaving plus parking off is sufficient to explain all of it — no TTL needed. I cannot fully exclude a prefix change from these lines alone, because a re-rendered head produces the same signature (total miss, then full reuse of the new prefix).
Attached:
1703-engine-process.log— every line of the engine process these requests ran in (820 lines, 243 requests), bracketed by itsengine startedat 2026-10-10 10:08:09 and the restart that replaced it at 16:52:18, startup block included.4. Config, model, version
strata 0.1.42(strata --version). My earlier post in this thread was on 0.1.41. The log has no version banner on line 1, so I am quoting--version.engine startedlines in the log — zero occurrences of--prompt-cache,--conversation-cache-mib,--idle-unload,--batch,--slots. So defaults apply:--prompt-cache 6,--prompt-cache-every 16384,--conversation-cache-mib 0(parking off), no idle unload, no batching.5. Client
Pi 1.1.0 with pi-fabric 0.110.1. Sub-agents: yes. Side requests to the same server: yes — and the
14535 = 14198 reusedline appearing twice, byte-identical, is almost certainly one of those.One mechanism worth naming on my side: pi-fabric rebuilds the leading system prompt per request (a
before_agent_starthook returns a forced prompt = sections + guidance + the live extension-tool roster), so a roster change rewrites the head and every checkpoint misses. That is a real prefix-break path, and it would produce exactly the signature above — one cold read, then full reuse of the new head — so I cannot rule it out from these lines either.6. Why I cannot run the
--prompt-cache-tailtestThe help text says "--serve, single GPU", and the code agrees —
src/program/generate.cpp:8001:The
!multi_gputerm makes the flag inert on a layer split: the multi-GPU branch saves the stages' parts viapart_atand never takes a tail checkpoint. My engine runs a four-GPU split, so turning the flag on would change nothing measurable. Running it honestly would mean a single-GPU (3090-only) engine, and that memory layout is different enough that the numbers would not be comparable to what I already reported here. So I am not running it.Worth flagging for the multi-GPU case anyway: the per-stage checkpoint machinery is at that same site, so a multi-GPU tail checkpoint may only need extending it.
@fukc-gihtub commented on GitHub (Oct 13, 2026):
Reopening. It’s not just editing AGENTS.md that triggers a full reload. Something else does, too.
@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.