Repository navigation
test(coderd/x/chatd): fold the effort clamp fixture into the pending-user test - #30942
Conversation
…e pending-user environment test
|
@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. Can't wait for the next one! 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". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
…#31042) 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_tokens` with the provider maximum, 128,000 for `claude-opus-5-5`, so each summary request sent `max_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. `compactionSummaryCall` now 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. `GenerateCompaction` still lowers the cap to the remaining context window when that is smaller. Closes [CODAGT-1428](https://linear.app/codercom/issue/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** - New `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 with `expected: 128000 actual: 192000`. - `TestBuildTurnEnvironmentClampsRequestedReasoningEffortToMax` and the compaction hook tests now expect the unchanged default cap (32,000 instead of 48,000). #30942 rewrites the first test and keeps a `3 * defaultChatMaxOutputTokens / 2` expectation, so whichever PR merges second drops that factor. **Validation** - `go test ./coderd/x/chatd/ ./coderd/x/chatd/chatloop/ -count=1`: passes - `make pre-commit`: passes - Remote dogfood UAT against `claude-opus-5-5` with a 128,000 cap: on `main`, 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 turn `max_tokens` was the same on both. UAT ran on `9230a6e9fa1`; the head `3633adef53e` only adds a comment edit. - No new dependencies. The polish pass and the test audit changed no files. - Codex review on `3633adef53e`: no findings. > Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.
Resolve the conflict in turn_environment_internal_test.go with this branch's side. #31042 keeps the chat call's output cap on compaction summaries, so the expected summary call is now the call template with ToolChoice none, without the raised MaxOutputTokens.
|
@codex review
|
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
TestBuildTurnEnvironmentClampsRequestedReasoningEffortToMaxbuilt its own database fixture (OpenAI provider, model config, chat created throughchatstate.CreateChat) only to callbuildTurnEnvironment, whichTestBuildTurnEnvironmentSplitsPendingUserRowsFromCompactionPromptalready does with the same kind of fixture. This PR deletes the clamp test and moves its checks into the pending-user test. That test's model config now carries the clamp test's options (OpenAIUsersentinel, reasoning effort defaultlowand maxmedium), and its unanswered user message storeshigheffort. The message is the last one, soInsertChatMessagescopies its effort intochats.last_reasoning_effort, the valuebuildTurnEnvironmentreads.Why it is safe
medium, theUsersentinel, the default max output tokens, compaction tool definitions equal toBuildToolDefinitions, and the compaction summary call. The exception isrequire.NotNil(prepared.Compaction), which was redundant because the test already dereferencedprepared.Compactionearlier.go test -overlayagainst the old test onmainand the extended test. The mutants drop the requested effort at the call site or inchatRequestedEffort, skip the clamp inResolveReasoningEffort, map the unresolved effort inProviderOptionsForCall, drop the config provider options, or remove the default output cap. Others replace the summary call withnewCall(), drop its tool choice, raise its output cap by half or drop it, or pass nil or truncated tool definitions. Both tests fail on all 12 and pass without a mutant.Review focus
The summary call is now checked with one equality: the call template with tool choice
none. Since #31042 the summary call keeps the chat call's output cap, so the equality pins that cap too, along with the template's sampling fields, which the old field checks did not.Validation
go test -count=1 ./coderd/x/chatd/: passesgo vet ./coderd/x/chatd/...: cleangolangci-lint run --fix=false ./coderd/x/chatd/...: 0 issuesparalleltestctx -custom-funcs="testutil.Context,chatdTestContext" ./coderd/x/chatd/...: clean