mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5006] [TUI] strata connect/launch opencode caps output at 4096 (OUTPUT_CAP), which breaks OpenCode auto-compaction on wide-context servers: "Compaction summary reached the output token limit" #2312
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#2312
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 @davidallan7121-ship-it on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5006
Area
[TUI] (the Terminal: strata launch, connect, monitor)
Desktop app, Terminal or source?
Terminal (the
stratacommand)What happened
Long OpenCode sessions against a 128K Strata server die with "reached token limits" the moment OpenCode's auto-compaction fires. The OpenCode log shows:
Once this happens the step fails and the conversation cannot continue until the client is reconfigured.
The chain, from
strata_cli/launch/harness.py(strata connect opencode --write/strata launch):OUTPUT_CAP = 4096("the output cap every tested config used") is written into the OpenCode config aslimit.output(opencode_file()), andlimit.inputis set tocontext - OUTPUT_CAP.limit.output= 4096 tokens.compact_at()carries the tested 32K ratio over: on a 131072-token server compaction fires at ≈66.4K tokens — a summarising model with thinking routinely spends the 4096-token budget on reasoning and returnsfinish_reason: "length"with an empty or truncated summary.Session.StepFailedError: Compaction summary reached the output token limit→ the step dies with "reached token limits".The cap is not only a compaction problem: the same 4096 limit had already been killing ordinary long agent turns on this setup for weeks, surfacing in older OpenCode builds as
Session.StepFailedError: Response still truncated after two output token limit continuations(three instances in my logs from 24–25 Oct, sessionsses_e91ad639...,ses_e9183dc0...,ses_e8c95f73...).The Strata server itself is fine with a larger cap:
serve/server.pyfits its thinking budget to the requestedmax_tokens, and atlimit.output = 16384the compaction succeeds and long sessions run clean (verified end-to-end withopencode run).Related but not the same: #4744 covers the same "summary capped by the headroom it protects, truncation = hard failure" design in the bundled DeepSeek Harness compaction plugin; this report is about the numbers Strata writes for the external harness configs. The same
OUTPUT_CAPis also propagated to all of them:CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096(also documented in_limits_claude),maxTokens: 4096for omp/pi/openclaw.Smallest steps or command that reproduce it
strata launcha 128K model, runstrata connect opencode --write(writeslimit: {context: 131072, input: 126976, output: 4096}into~/.config/opencode/opencode.json).Reproduction status
Reproduced locally
Strata version
strata 0.2.9 (build 0.1.55; python 3.12.15) — control component 0.1.55, engine component 0.1.52-linux-x86_64-cuda-cuda13
Graphics card, memory and system
RTX 5070 Ti 16 GB · 60 GB RAM · Omarchy (Arch-based), Linux
Model, size and settings
Qwen3.8-Flash-Next IQ3_S (profile iq3_s-128k,
--max-context 131072) · OpenCode v2.2.5Logs
Suggested fix
Raise
OUTPUT_CAP(16384 works; the server adapts its thinking budget to whatevermax_tokensit is given), or decouple the compaction/summary budget from the per-turn cap so the summary is guaranteed headroom.compact_at()'s comment ("the summarising request still fits the window") only sizes the input side of that request; its output is left at 4096 whatever the context.Workaround applied locally: set
limit.output = 16384in~/Work/opencode.jsonc(project level) and patchedOUTPUT_CAPin the two installed copies — which a component update will revert, hence the report here.@salmun-nister commented on GitHub (Nov 3, 2026):
Confirming this on another 128K setup (Qwen3.8-Flash-Next IQ3_S, Strata 0.1.55, OpenCode 2.2.5). Same failure, same cause.
The failed compaction recorded:
limit.outputfinish_reason: lengthThe conversation wasn't too long; the summary was cut off. At
max_tokens = 4096,serve/server.py's answer-room calculation is:That leaves 3,072 tokens for thinking and at most 1,024 for the structured summary. The summary needed more than that, so the model hit the cap and OpenCode correctly treats the truncated summary as a hard failure.
The config arithmetic also matches this report:
context 131072,input 126976,compact_at 66428,buffer 60548. The session was already at ~86.7K when compaction ran — the trigger is checked at step boundaries, so it overshoots — making the summary larger than in the 32K test case.Workaround confirmed: set
limit.output: 16384, leavinginputandbufferas generated. I applied that here; the server accepts 16,384 and adapts the thinking budget (12,288 thinking + 4,096 answer). The same session then re-compacted successfully at 86.7K in / 4.3K out. The summary request used ~4.3K output — just over the old 4,096 cap — so the old limit was marginal rather than far too small. 16,384 gives comfortable headroom.For the fix: 16,384 is enough at 128K (only 4.3K was used here), but a fixed constant may still be tight on much wider windows. Scaling
OUTPUT_CAPwith context, or giving compaction its own output budget, would be more robust. Either way,compact_atshould stay sized so the summary request's input + output fits with headroom.The same
OUTPUT_CAPis also propagated to the other harness configs (CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096,maxTokens: 4096for omp/pi/openclaw), so the same truncation risk applies there.The fix needs to land in the template:
strata connect opencode --writeoverwrites the workaround, and patching the installedharness.pyis reverted by component updates.@Niko1221 commented on GitHub (Nov 5, 2026):
Hello davidallan7121-ship-it,
Thank you for the clear explanation. In Strata 0.2.11 the output cap written by
strata connectandlaunchfor OpenCode (limit.output), the other connected clients' output setting andmaxTokensis the larger of 4096 and one eighth of the context (16384 at 128K), and a cap you set yourself is kept when the block is rewritten. The input limit and the compaction point are unchanged. We checked the configuration and the tests; we did not run OpenCode. Please try 0.2.11 and tell us if auto-compaction still fails.The Strata project
@davidallan7121-ship-it commented on GitHub (Nov 5, 2026):
Thanks Niko — 0.2.11 fixes the compaction output-cap issue in my setup.
Setup
0.2.11/ control0.1.57(active component~/.local/share/strata/components/control/0.1.57)2.2.5strata/qwen3.8-flash-next-iq3_s, 128K profilestrata connect opencode --context 128k --output jsonnow generateslimit: {"context": 131072, "input": 126976, "output": 16384}withcompaction: {"auto": true, "buffer": 60548}(global config already hadoutput: 16384)Real OpenCode auto-compaction test (passed)
type: compaction,reason: auto).Session.StepFailedError/ no"Compaction summary reached the output token limit").prompt 92119 tokens = 0 reused + 92119 read in 29577 ms (3114.6 tok/s), 727 generated in 7289 ms (99.7 tok/s), drafts accepted 437 of 552, 6 checkpoints.This is one-machine confirmation (the release note mentioned config-side only), but auto-compaction completed successfully here with the new 16,384 output cap. Thank you for the fix.
@Niko1221 commented on GitHub (Nov 6, 2026):
0.2.11 is out with the fix: the OpenCode output cap now grows with the context window, and a rewrite keeps a cap you set yourself. Could you check whether OpenCode's auto-config works for you now?