[GH-ISSUE #3850] [TUI] strata connect writes a 15,000-token compaction point into every app config, whatever the server's context #1640

Closed
opened 2026-11-04 01:52:50 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @demetree on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3850

Area

[TUI] (the Terminal: strata connect)

Desktop app, Terminal or source?

Terminal (the strata command)

What happened

strata connect <app> --context 256k gives the app a 256K window and then tells it to compact its conversation at
15,000 tokens. Every app the command configures gets the same flat number:

App field written value
OpenCode compaction.buffer max(1024, input_limit - 15000)
Codex model_auto_compact_token_limit 15000
omp compaction.thresholdTokens 15000
pi compaction.reserveTokens max(1024, context - 15000)
Hermes compression.threshold_tokens 15000

COMPACT_AT = 15000 in strata_cli/launch/harness.py line 24. Its own comment says where it came from: the configs
"were tested for real against a Strata server at 32K context (... plus streaming, thinking and compaction at about
15K)". It is the point a 32K config was tested at, and it is applied at every context size.

At 32K, 15,000 is reasonable: OpenCode's own system prompt and tools take about 7.4K tokens
(_limits_opencode), so 15,000 + 7.4K + 4,096 output still fits a 32K window - which is what #1648 was about.

On a 256K server the same 15,000 is 5.8% of the window. The conversation is summarised roughly every 15,000 tokens,
each time into a hardcoded 4,096-token summary, and the rest of the window is never used. For agentic coding that is
the opposite of what a large context is for.

The apps' own defaults sit near the top of the window, not the bottom: OpenCode documents buffer as "tokens to keep
free below the model's limit", default 10% of the limit - a ~232K compaction point on a 256K window - with
keep.tokens (default 15,000) controlling how much recent conversation survives beside the summary.

What is not scaling is the share. The tests fix the flat value even at a wider window:
tests/terminal/test_launch.py:1204 asserts that a 64K --context produces "reserveTokens": 50536
(65536 ? 15000) - still a 15,000-token point, in a test. openclaw in the same file is the counter-example: its
contextTokens is already scaled to the window (int(t.context * 23192 / 32768)). Only the compaction points were
left flat.

0.2.3's "the agent chat copes with a full context" is in the app's own chat. strata_cli/launch/harness.py is
unchanged between 0.2.2 and 0.2.3.1, so every config strata connect writes today still carries the flat 15,000.

Smallest steps or command that reproduce it

strata connect opencode --url http://127.0.0.1:8080 --context 256k --show-key

Then read "compaction" in the printed config: buffer is input_limit - 15000, so the app compacts at 15,000
tokens while limit.context says 262144.

Reproduction status

Unconfirmed static analysis (I read code or ran a scanner; I did not see it fail)

I have not watched a live session's compaction request in a server log. The arithmetic above follows the generator
and OpenCode's published description of buffer / keep.tokens; if you want the observation before choosing a rule,
I can run a 256K server with OpenCode and show the point the summary request actually arrives at.

Strata version

Strata 0.2.3.1 ? Control 0.1.48.1 ? engine 0.1.48

Graphics card, memory and system

Intel Arc Pro B70 32 GB ? 64 GB RAM ? Windows 11 25H2 (the generated config was observed here; the code path is
platform-independent)

Model, size and settings

Qwen3.8-Flash-Next Coder IQ1_M ? 256K context ? --kv-resident 32768


A rule that fixes all five at once

Keep the share the tested 32K configs used (15,000 of a 28,672 input limit = 52.3%) and scale it with the input
limit, so the summarising request - which carries the whole conversation - still fits the window:

context today with the rule
32K 15,000 15,000 (unchanged)
64K 15,000 32,142
256K 15,000 135,000

A patch is ready for review (linked below). A 32K server stays byte-identical to what was tested; a 64K or 256K
server gets different bytes, which is the point. Alternatives: match each app's own default instead of one rule, or
use a larger share (80%, a 206,438-token point on a 256K window).

  • #1648 - why the 15,000 exists at all (OpenCode's long prompt against a 32K window).
  • #3694 - the same class of bug elsewhere: dsh-compaction-basic's fixed 65,536-token headroom leaves no pressure
    budget on a 64K window.
  • #3701 - the cost side: a compaction leaves a 154.6K-token re-read behind it, an argument for compacting less often.
Originally created by @demetree on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3850 ### Area [TUI] (the Terminal: `strata connect`) ### Desktop app, Terminal or source? Terminal (the `strata` command) ### What happened `strata connect <app> --context 256k` gives the app a 256K window and then tells it to compact its conversation at 15,000 tokens. Every app the command configures gets the same flat number: | App | field written | value | | --- | --- | --- | | OpenCode | `compaction.buffer` | `max(1024, input_limit - 15000)` | | Codex | `model_auto_compact_token_limit` | `15000` | | omp | `compaction.thresholdTokens` | `15000` | | pi | `compaction.reserveTokens` | `max(1024, context - 15000)` | | Hermes | `compression.threshold_tokens` | `15000` | `COMPACT_AT = 15000` in `strata_cli/launch/harness.py` line 24. Its own comment says where it came from: the configs "were tested for real against a Strata server at 32K context (... plus streaming, thinking and compaction at about 15K)". It is the point a **32K** config was tested at, and it is applied at every context size. At 32K, 15,000 is reasonable: OpenCode's own system prompt and tools take about 7.4K tokens (`_limits_opencode`), so 15,000 + 7.4K + 4,096 output still fits a 32K window - which is what #1648 was about. On a 256K server the same 15,000 is 5.8% of the window. The conversation is summarised roughly every 15,000 tokens, each time into a hardcoded 4,096-token summary, and the rest of the window is never used. For agentic coding that is the opposite of what a large context is for. The apps' own defaults sit near the top of the window, not the bottom: OpenCode documents `buffer` as "tokens to keep free below the model's limit", default 10% of the limit - a ~232K compaction point on a 256K window - with `keep.tokens` (default 15,000) controlling how much recent conversation survives beside the summary. What is not scaling is the **share**. The tests fix the flat value even at a wider window: `tests/terminal/test_launch.py:1204` asserts that a 64K `--context` produces `"reserveTokens": 50536` (65536 ? 15000) - still a 15,000-token point, in a test. `openclaw` in the same file is the counter-example: its `contextTokens` is already scaled to the window (`int(t.context * 23192 / 32768)`). Only the compaction points were left flat. 0.2.3's "the agent chat copes with a full context" is in the app's own chat. `strata_cli/launch/harness.py` is unchanged between 0.2.2 and 0.2.3.1, so every config `strata connect` writes today still carries the flat 15,000. ### Smallest steps or command that reproduce it ``` strata connect opencode --url http://127.0.0.1:8080 --context 256k --show-key ``` Then read `"compaction"` in the printed config: `buffer` is `input_limit - 15000`, so the app compacts at 15,000 tokens while `limit.context` says 262144. ### Reproduction status Unconfirmed static analysis (I read code or ran a scanner; I did not see it fail) I have not watched a live session's compaction request in a server log. The arithmetic above follows the generator and OpenCode's published description of `buffer` / `keep.tokens`; if you want the observation before choosing a rule, I can run a 256K server with OpenCode and show the point the summary request actually arrives at. ### Strata version Strata 0.2.3.1 ? Control 0.1.48.1 ? engine 0.1.48 ### Graphics card, memory and system Intel Arc Pro B70 32 GB ? 64 GB RAM ? Windows 11 25H2 (the generated config was observed here; the code path is platform-independent) ### Model, size and settings Qwen3.8-Flash-Next Coder IQ1_M ? 256K context ? `--kv-resident 32768` --- ### A rule that fixes all five at once Keep the share the tested 32K configs used (15,000 of a 28,672 input limit = 52.3%) and scale it with the input limit, so the summarising request - which carries the whole conversation - still fits the window: | context | today | with the rule | | --- | --- | --- | | 32K | 15,000 | 15,000 (unchanged) | | 64K | 15,000 | 32,142 | | 256K | 15,000 | 135,000 | A patch is ready for review (linked below). A 32K server stays byte-identical to what was tested; a 64K or 256K server gets different bytes, which is the point. Alternatives: match each app's own default instead of one rule, or use a larger share (80%, a 206,438-token point on a 256K window). ### Related * #1648 - why the 15,000 exists at all (OpenCode's long prompt against a 32K window). * #3694 - the same class of bug elsewhere: `dsh-compaction-basic`'s fixed 65,536-token headroom leaves no pressure budget on a 64K window. * #3701 - the cost side: a compaction leaves a 154.6K-token re-read behind it, an argument for compacting less often.
Author
Owner

@nabe2030 commented on GitHub (Oct 25, 2026):

A data point from the other side of this: with a hand-written OpenCode v2 (2.0.24) config that only sets limit.context = 262144 and limit.output = 32768 (no compaction override, not written by strata connect), a 6 h 18 min agent session against Strata 0.2.4.1 let the conversation grow to 230,007 tokens (largest single request 234,941) before OpenCode compacted it, and it came out the other side at 77k to 85k. There was no HTTP 400 (fit_max_tokens was left at its default). So the flat 15,000-token point is only in what strata connect writes, not in OpenCode's own defaults.

<!-- gh-comment-id:6391639244 --> @nabe2030 commented on GitHub (Oct 25, 2026): A data point from the other side of this: with a hand-written OpenCode v2 (2.0.24) config that only sets `limit.context = 262144` and `limit.output = 32768` (no compaction override, not written by `strata connect`), a 6 h 18 min agent session against Strata 0.2.4.1 let the conversation grow to 230,007 tokens (largest single request 234,941) before OpenCode compacted it, and it came out the other side at 77k to 85k. There was no HTTP 400 (`fit_max_tokens` was left at its default). So the flat 15,000-token point is only in what `strata connect` writes, not in OpenCode's own defaults.
Author
Owner

@Niko1221 commented on GitHub (Oct 26, 2026):

Fixed in 0.2.5: strata connect keeps the share the tested 32K configs used (about half of the input limit) instead of a flat 15,000 tokens, so a 256K server compacts at about 135,000. Please update and run strata connect again to rewrite the app's config.

<!-- gh-comment-id:6423327920 --> @Niko1221 commented on GitHub (Oct 26, 2026): Fixed in 0.2.5: strata connect keeps the share the tested 32K configs used (about half of the input limit) instead of a flat 15,000 tokens, so a 256K server compacts at about 135,000. Please update and run strata connect again to rewrite the app's config.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1640
No description provided.