[PR #3852] [CLOSED] [TUI] scale the app configs' compaction point with the server's context #4802

Closed
opened 2026-11-07 15:39:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3852
Author: @demetree
Created: 10/23/2026
Status: ❌ Closed

Base: main ← Head: fix-compaction-point


📝 Commits (1)

  • 076fca8 strata connect: scale the app configs' compaction point with the server's context

📊 Changes

2 files changed (+34 additions, -9 deletions)

View changed files

📝 strata_cli/launch/harness.py (+21 -8)
📝 tests/terminal/test_launch.py (+13 -1)

📄 Description

Fixes #3850.

Problem

strata connect <app> --context 256k gives the app a 256K window and tells it to compact its conversation at 15,000
tokens. COMPACT_AT = 15000 (strata_cli/launch/harness.py:24) is the point a 32K config was tested at - its own
comment says so - and it is written into every app's config at every context size: OpenCode's compaction.buffer,
Codex's model_auto_compact_token_limit, omp's thresholdTokens, pi's reserveTokens, Hermes'
threshold_tokens.

At 256K that summarises the conversation every 15,000 tokens - 5.8% of the window - into a hardcoded 4,096-token
summary. tests/terminal/test_launch.py:1204 locks it in at a wider window too: a 64K --context asserts
"reserveTokens": 50536, i.e. still a 15,000-token point.

Result

The compaction point follows the window, keeping the share the tested configs used (15,000 of a 28,672 input limit =
52.3%):

context before after
32K 15,000 15,000 - unchanged
64K 15,000 32,142
256K 15,000 135,000

The share is what carries over because the summarising request carries the whole conversation: the headroom has to
grow with the point. A 32K server stays byte-identical to what was tested, so one existing expectation changes (the
64K one) and the rest are untouched.

Approach

One helper, compact_at(t), next to Target.input_limit, and every field above is computed from it. The two
plain-words limits lines that quoted "15K" now quote the real number (_limits_pi) or refer to it without a number
(_limits_hermes). openclaw is untouched: it has no threshold field and its contextTokens is already scaled to
the window.

Validation

Passed

  • python -m pytest tests/terminal/test_launch.py -q - 109 passed, 1 skipped (includes a new test,
    test_the_compaction_point_scales_with_the_window, which pins 135,000 at 256K and 15,000 at 32K).
  • The nine other Terminal files that touch the config generator (test_launch_tui, test_tuiqa_launch,
    test_tuiqa_wizard, test_launch_monitor, test_data_dir_choice, test_discovery, test_flow2_022,
    test_issues_022, test_launch_engine_first) - 213 passed, 3 skipped.

Failed

  • None.

Not run

  • The rest of tests/terminal as one command. The first attempt collected 8 errors (the monitor files need
    requirements-monitor.txt; rich/textual were not installed), and after installing it the full run exceeded the
    time I gave it, so I have no result for it. Nothing in it reads harness.py except the files above, but that is an
    argument, not a result.
  • No live client. OpenCode's buffer semantics come from its published documentation ("tokens to keep free below the
    model's limit", default 10% of the limit) and the arithmetic in this diff - I did not observe a compaction request in
    a server log. The other four apps' fields are set by the same rule; I did not run those apps.
  • Engine builds and python tools/test_setup_*.py: untouched by this change (Terminal-only, no engine or setup code).

Limits

  • The rule is a product judgement, not a measurement: 52.3% is the tested pair's share, not a measured optimum. A
    larger share (80%) is the obvious alternative; so is leaving OpenCode's buffer out entirely so its own default
    applies.
  • Only a 32K server is byte-identical. A 64K or 256K server gets different bytes from the same checkout - that is the
    point of the change, and it is why this was raised as an issue first.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3852 **Author:** [@demetree](https://github.com/demetree) **Created:** 10/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-compaction-point` --- ### 📝 Commits (1) - [`076fca8`](https://github.com/Niko1221/Strata/commit/076fca88e32a6b92c32fc3345938c289e5d16862) strata connect: scale the app configs' compaction point with the server's context ### 📊 Changes **2 files changed** (+34 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `strata_cli/launch/harness.py` (+21 -8) 📝 `tests/terminal/test_launch.py` (+13 -1) </details> ### 📄 Description Fixes #3850. ### Problem `strata connect <app> --context 256k` gives the app a 256K window and tells it to compact its conversation at 15,000 tokens. `COMPACT_AT = 15000` (`strata_cli/launch/harness.py:24`) is the point a **32K** config was tested at - its own comment says so - and it is written into every app's config at every context size: OpenCode's `compaction.buffer`, Codex's `model_auto_compact_token_limit`, omp's `thresholdTokens`, pi's `reserveTokens`, Hermes' `threshold_tokens`. At 256K that summarises the conversation every 15,000 tokens - 5.8% of the window - into a hardcoded 4,096-token summary. `tests/terminal/test_launch.py:1204` locks it in at a wider window too: a 64K `--context` asserts `"reserveTokens": 50536`, i.e. still a 15,000-token point. ### Result The compaction point follows the window, keeping the share the tested configs used (15,000 of a 28,672 input limit = 52.3%): | context | before | after | | --- | --- | --- | | 32K | 15,000 | 15,000 - unchanged | | 64K | 15,000 | 32,142 | | 256K | 15,000 | 135,000 | The share is what carries over because the summarising request carries the whole conversation: the headroom has to grow with the point. A 32K server stays byte-identical to what was tested, so one existing expectation changes (the 64K one) and the rest are untouched. ### Approach One helper, `compact_at(t)`, next to `Target.input_limit`, and every field above is computed from it. The two plain-words `limits` lines that quoted "15K" now quote the real number (`_limits_pi`) or refer to it without a number (`_limits_hermes`). `openclaw` is untouched: it has no threshold field and its `contextTokens` is already scaled to the window. ### Validation **Passed** * `python -m pytest tests/terminal/test_launch.py -q` - 109 passed, 1 skipped (includes a new test, `test_the_compaction_point_scales_with_the_window`, which pins 135,000 at 256K *and* 15,000 at 32K). * The nine other Terminal files that touch the config generator (`test_launch_tui`, `test_tuiqa_launch`, `test_tuiqa_wizard`, `test_launch_monitor`, `test_data_dir_choice`, `test_discovery`, `test_flow2_022`, `test_issues_022`, `test_launch_engine_first`) - 213 passed, 3 skipped. **Failed** * None. **Not run** * The rest of `tests/terminal` as one command. The first attempt collected 8 errors (the monitor files need `requirements-monitor.txt`; `rich`/`textual` were not installed), and after installing it the full run exceeded the time I gave it, so I have no result for it. Nothing in it reads `harness.py` except the files above, but that is an argument, not a result. * No live client. OpenCode's `buffer` semantics come from its published documentation ("tokens to keep free below the model's limit", default 10% of the limit) and the arithmetic in this diff - I did not observe a compaction request in a server log. The other four apps' fields are set by the same rule; I did not run those apps. * Engine builds and `python tools/test_setup_*.py`: untouched by this change (Terminal-only, no engine or setup code). ### Limits * The rule is a product judgement, not a measurement: 52.3% is the tested pair's share, not a measured optimum. A larger share (80%) is the obvious alternative; so is leaving OpenCode's `buffer` out entirely so its own default applies. * Only a 32K server is byte-identical. A 64K or 256K server gets different bytes from the same checkout - that is the point of the change, and it is why this was raised as an issue first. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:39:09 +07:00
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#4802
No description provided.