Repository navigation
fix(coderd/x/chatd): keep the chat output cap on compaction summaries - #31042
Open
ibetitsmike wants to merge 2 commits into
Open
ibetitsmike wants to merge 2 commits into
ibetitsmike wants to merge 2 commits into
Conversation
Compaction summary requests asked for 1.5x the chat model's max_output_tokens. When the configured cap equals the provider maximum (as the known-model catalog seeds it), providers such as Anthropic reject the summary with HTTP 400, so the chat can never compact. Summaries now use the same output cap as chat turns; GenerateCompaction still lowers it to the remaining context window.
Collaborator
Author
|
@codex review
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ibetitsmike
marked this pull request as ready for review
October 20, 2026 08:49
This branch has not been deployed
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.
Compaction summaries asked the provider for 1.5 times the model's configured output cap. When an admin adds a known model, the form fills
max_output_tokenswith the provider maximum, 128,000 forclaude-opus-5-5, so each summary request sentmax_tokens: 192000. Anthropic rejected it with HTTP 400 (max_tokens: 192000 > 128000, which is the maximum allowed number of output tokens for claude-opus-5-5), so compaction failed and the chat could not shrink its context.compactionSummaryCallnow keeps the chat call's cap. The 50% headroom came from #28886, which accepted the overshoot for caps set at a provider ceiling as a tradeoff. With catalog defaults, that case is the common one.GenerateCompactionstill lowers the cap to the remaining context window when that is smaller.Closes CODAGT-1428.
The ticket also shows "Your input exceeds the context window" on a summary request. That is a separate failure, which #30766 handles (merged after the ticket was filed), so this PR does not change it.
Tests
TestActiveServer_ManualCompaction/summary keeps the configured output cap: a 128,000 cap reaches both the chat turn and the summary request unchanged. On the old code it fails withexpected: 128000 actual: 192000.TestBuildTurnEnvironmentClampsRequestedReasoningEffortToMaxand the compaction hook tests now expect the unchanged default cap (32,000 instead of 48,000). test(coderd/x/chatd): fold the effort clamp fixture into the pending-user test #30942 rewrites the first test and keeps a3 * defaultChatMaxOutputTokens / 2expectation, so whichever PR merges second drops that factor.Validation
go test ./coderd/x/chatd/ ./coderd/x/chatd/chatloop/ -count=1: passesmake pre-commit: passesclaude-opus-5-5with a 128,000 cap: onmain, manual, automatic, and compaction-model-override summaries asked for 192,000 tokens and failed with the 400 above. On this branch, all 16 summary requests (the same flows plus an unset cap and a small context window) succeeded, and none asked for more than its configured cap. Chat turnmax_tokenswas the same on both. UAT ran on9230a6e9fa1; the head3633adef53eonly adds a comment edit.3633adef53e: no findings.