mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1736] Large context window presents a problem #692
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#692
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 @galmok on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1736
I am using opencode to work with Strata and while this seems fairly solid, I am hitting one problem again and again:
While this does show the problem and also presents a solution, I am uncertain what this does. Will it continue as normal (32000 token window) until the very end and then use a token window that fits the remaining space? Or will it change more than that?
If it just fits the last window to the remaining space, shouldn't that option be enabled by default?
@AXYZE9 commented on GitHub (Oct 9, 2026):
You need to compact your context in OpenCode. Strata has nothing to do with it.
No, Strata (or any inference engine) shouldn't quietly change settings that were set.
@CC-David-CC commented on GitHub (Oct 9, 2026):
use yarn on long contexts and rope on short contexts
proof:
https://github.com/Niko1221/Strata/pull/1692
https://github.com/Niko1221/Strata/pull/1698
https://github.com/Niko1221/Strata/pull/1702
@galmok commented on GitHub (Oct 9, 2026):
Well, I changed the strata option the error message mentioned and opencode could continue using the remaining context window (from 230K to 262K). The trigger in opencode does not happen already at 230K so the error from Strata is unexpected.
I added:
"fit_max_tokens": true
to my strata json model config file and strata is now more predictable when the context window gets big.
@galmok commented on GitHub (Oct 9, 2026):
I am sorry to say, but at this point in time, I don't really know how to use this information. I am not familiar with all the different parameters to Strata.
@galmok commented on GitHub (Oct 9, 2026):
Just to make it clear: The error shown actually is sent to opencode and is displayed in the opencode session.
@GM2080 commented on GitHub (Oct 9, 2026):
You need limit.context and limit.output in your opencode config, then it will compact automatically.
context - max_tokens = point at which it compacts to prevent the model from running out of context mid-turn.
An example opencode.config (this is for llama-swap, llama.cpp and q38-27b but the same still applies)
There are probably plugins or something for opencode that will read the /v1/models response and handle context/output and modalities for you.
@galmok commented on GitHub (Oct 9, 2026):
Thanks. I'll read up on this soon. :)
@Xhen911 commented on GitHub (Oct 10, 2026):
Root cause is an arithmetic mismatch — and the repo's own docs point users straight into it.
serve/server.pygives a reply the room left after the prompt:A request whose
max_tokensexceedsroomis refused with 400, never truncated. So with--max-context 262144and a client that always asks for its full output cap, the longest prompt that can ever be sent is:That is why the error appears "unexpectedly" at ~230K — it isn't OpenCode's compaction threshold misfiring, it's the hard ceiling once the output reservation is counted. Your own numbers match exactly: 230219 + 32000 > 262144, leaving 31,917 (the same 31,917 the error quotes).
The reason it bites OpenCode users in particular is that
docs/DETAILS.mdtells them to declare the full context. The OpenCode example added in #543 reads:which contradicts itself — the comment states the rule ("prompt + output must fit") and the numbers break it by exactly the amount above. Following the docs reproduces this issue. It should be:
and the paragraph under it ("Set
limit.contextto the context you chose in setup") should say "minuslimit.output".With
limit.context= 229376, OpenCode compacts before the prompt reaches the ceiling and the 400 never happens. In my testing it compacted earlier still, since it also reservesoutputandcompaction.reservedon top — the safe direction. Verified end to end: compaction agent fires, session continues, server-side prompt drops from ~193K to ~8K.On
fit_max_tokens: a good stopgap and worth keeping as a backstop, but it isn't the fix. It shortens the reply to whatever room is left, so the turn still degrades — it just degrades quietly instead of erroring.Which also answers the original question ("shouldn't that be the default?"). The engine deliberately never truncates anything, and
fit_max_tokensonly ever clips the reply, never the prompt — so defaulting it on would silently cap output rather than resolve an over-full context. The prompt budget belongs on the client, and the docs should say so.@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.