Repository navigation
fix(sse): align reactive compaction ceiling to input cap - #16627
Merged
diegosouzapw merged 2 commits intoOct 16, 2026
Merged
diegosouzapw merged 2 commits into
diegosouzapw merged 2 commits into
Conversation
Junior-HJ
force-pushed
the
fix/compaction-input-cap
branch
from
October 16, 2026 15:50
010dcb0 to
8b2bfbb
Compare
The input-cap hoist and the later output-budget block both declared contextWindowChecksDisabled in the same function, so the file failed to parse. The second call now uses effectiveInputCap. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
merged commit Oct 16, 2026
f3b68bd
into
cheaper-inference:release/v3.8.52
6 of 7 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a model defines a separate
maxInputTokensthat is smaller than its fullcontextLength(e.g.codex/gpt-5.6-sol-mediumwith 372k input cap vs 872k context window), prompts landing in the dead band[maxInputTokens, contextLength)previously bypassed proactive and last-resort compaction because compaction thresholds were computed strictly againstcontextLimit. The request would subsequently fail atenforceOutputTokenBudgetwith an HTTP 400 (estimated X input tokens, max input Y).This aligns both proactive compression threshold and last-resort context compaction to
effectiveCompactionCeiling = Math.min(contextLimit, effectiveInputCap), ensuring oversized histories are auto-compacted down to the concrete input limit instead of hard-rejecting.Validation
npm run typecheck:corepassed cleancheck:file-sizemaintained within budget (-2 lines delta onchatCore.ts)tests/unit/compaction-input-cap-alignment.test.tsverifying that a request exceedingmax_input_tokensbut withincontextLengthauto-compacts and succeeds instead of 400