Skip to content

feat(config): require an explicit context window instead of assuming 16384 - #229

Merged
Max17190 merged 1 commit into
mainfrom
explicit-context-window
Aug 19, 2026
Merged

feat(config): require an explicit context window instead of assuming 16384#229
Max17190 merged 1 commit into
mainfrom
explicit-context-window

Conversation

@Max17190

@Max17190 Max17190 commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Why

context_tokens defaulted to 16384, a window sized for the small local models the loop was first hardened against. Everything derived from it (the transcript budget, the compaction trigger, the max_tokens clamp) then treated a 128k or 500k model as a 16k one, so the harness's own context protection became the constraint on the models it now targets. A larger default is wrong the other way for a small model, and nothing is queried from the server, so the honest answer is the one base_url and model already give: no default.

Summary

  • Settings.context_tokens is Option<usize> with no default; old files still parse.
  • providers::resolve returns ResolveError::MissingContextTokens when neither the model's providers.json entry nor settings.json sets a window; the message names both places and the launch-read rule. Every surface that shows resolve errors (turn start, -p/--stdio fail-fast, /status, /provider) inherits it.
  • openmax --check now warns on a settings file that parses but cannot resolve (endpoint, model, window, provider), and reports the resolved window on a healthy one.
  • README, docs/configuration.md, config.rs module doc, and --spec settings updated; the README example sets context_tokens.

Test Plan

  • New a_context_window_is_required_from_settings_or_the_model_entry: flat and named-provider resolution refuse without a window, a per-model entry satisfies it, settings.json satisfies it for an unsized model.
  • check_names_a_settings_file_that_would_brick_the_next_launch extended: warns with the reason when the window is missing, prints the window when resolvable.
  • Every fixture that relied on the old default now sets a window explicitly (unit, integration, and CLI tests).
  • End to end on the built binary: -p refuses with the message; --check prints the warn line.
  • cargo test --workspace green; clippy at zero warnings.

Note for reviewers: users upgrading with a settings.json that omits context_tokens get a one-time resolve error naming the field; the external rigs already set it.

Greptile Summary

This change removes the assumed context-window size and requires each model to declare its actual window through settings or a provider model entry. A local endpoint check confirmed that a model-specific provider window starts successfully, while unsized configurations stop before sending a model request.

Confidence Score: 5/5

No blocking failure remains.

No accepted blocking findings remain. The exercised configuration paths correctly allow a provider model's declared window and reject missing windows before network use.

T-Rex T-Rex Logs

What T-Rex did

  • Built the open-max-tui package with cargo --locked and executed the context-window harness against the built binary.
  • Observed that the harness produced a streamed response and emitted 'no context window configured' for missing-window scenarios, with the probe staying on a single request.
  • Ran the unit test for the open-max-core context-window requirement; the test passed.
  • Reviewed the CLI harness source and the two context-window logs to verify the observed behavior.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "feat(config): require an explicit contex..." | Re-trigger Greptile

…16384

`context_tokens` defaulted to 16384, a window sized for the small local
models the loop was first hardened against. Every setting derived from it
(the transcript budget, the compaction trigger, the max_tokens clamp) then
treated a 128k or 500k model as a 16k one, so the harness's own context
protection became the constraint on the models it now targets. A larger
default is wrong the other way for a small model, and nothing is queried
from the server, so the honest answer is the one base_url and model
already give: no default, and a resolve error that names both places the
window can be set (settings.json, or the model's providers.json entry,
which wins). Old files still parse; a turn refuses with the reason until
one is set, and `openmax --check` warns on a settings file that parses but
cannot resolve, naming the reason where the reader is looking.

Tests: resolve refuses without a window and accepts either source; --check
warns on the unresolvable file and reports the window on a resolvable one;
every fixture that relied on the old default now sets a window.
@Max17190
Max17190 force-pushed the explicit-context-window branch from 4b74832 to 138a839 Compare August 19, 2026 03:45
@Max17190
Max17190 merged commit 17d78a8 into main Aug 19, 2026
4 checks passed
@Max17190
Max17190 deleted the explicit-context-window branch August 19, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant