mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5011] [Other] Cloud API models trigger automatic compaction too early because model output capability becomes a request limit #2315
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#2315
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 @RomixERR on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5011
Area
[Other] — agent runtime configuration and the bundled Harness adapter.
Desktop app, Terminal or source?
Desktop app (Windows).
What happened
When using cloud API models through Lachuga, Strata can compact the conversation very early, even though the model advertises a 128K context window.
On Strata 0.2.8, GPT-6 Luna returned max_output_tokens: 128000 in the provider's model catalogue, while no context-window field was provided. Strata assumed a 128,000-token context window and calculated an output budget of 123,904 tokens.
That value was then passed as maxTokens in the Harness model profile. The bundled @deepseek-ai/dsh-llm-pi-ai adapter treats an explicitly configured maxTokens as a per-request default output limit. The compaction plugin reads that limit from the request header and reserves it when calculating the compaction threshold.
With a 128,000-token context, a 123,904-token request reservation and 512 tokens of compaction headroom, the plugin's threshold calculation leaves only about 3,584 tokens before compaction can trigger. The UI showed compaction starting at approximately 8.7K tokens out of 128K. The UI meter and the plugin's token counter may not use exactly the same accounting, but both indicated premature compaction.
The same cloud models behaved normally in Open WebUI. Local models with large context windows did not show this problem.
Expected behaviour
The model's declared output capability and the default output limit sent with an individual request should be separate values.
A model catalogue's max_output_tokens describes the model's output capability. It should not automatically become the maximum output limit for every Harness request.
The request limit should be configurable independently, and the compaction policy should reserve space based on that actual request limit.
Proposed approach
A local prototype of the fix separates these two values:
maxTokens remains the model's declared output capability.
A new optional defaultMaxTokens field controls the per-request output limit.
Cloud API models receive a conservative request default of 32,768 tokens.
Compaction headroom is calculated using that request budget rather than the model's full advertised output capability.
The existing local-model calculation remains unchanged.
This also preserves the distinction between a model's capabilities and the deployment's chosen request limits.
One implementation detail may need maintainer input: the prototype changes the bundled @deepseek-ai/dsh-llm-pi-ai adapter's handling of maxTokens. The maintainers may prefer to make that change in the adapter's upstream source, or implement the separation entirely within Strata.
Reproduction status
Observed on the installed application; mechanism confirmed by code inspection and session data.
Environment:
Strata Desktop 0.2.8
Engine 0.1.54
Harness 0.2.1-alpha.3
Windows 10
NVIDIA RTX 3090 24 GB
64 GB system RAM
Cloud provider: Lachuga
Model: GPT-6 Luna
The session request header showed:
contextWindow: 128000
config.maxTokens: 123904
After applying the local prototype, a long task completed without the same early-compaction behaviour. The prompt-reading log reached approximately 109,429 tokens. This is a successful local test, not a claim of compatibility across every provider or model.
Validation performed
Passed:
node --check on the modified profile.mjs, Harness adapter index.js, and adapter catalog.js.
A long task completed after the local changes.
The local-model branch was left on its previous calculation.
Not run:
Automated regression tests for the new defaultMaxTokens field.
A clean source build of the current repository version.
Tests across other cloud providers and all supported API protocols.
Scope
This report concerns premature compaction for cloud API models when model output capability is treated as a per-request output limit. It is related to, but distinct from, the broader compaction-policy discussion in #4744 and the external-client output-cap issue in #5006.