Repository navigation
fix(ai): omit maxTokens for Nova 2 at high reasoning effort - #51150
Merged
Merged
Conversation
4 of 6 tasks
rekram1-node
force-pushed
the
nova-high-effort
branch
from
September 24, 2026 15:31
a1cc935 to
3d741ae
Compare
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.
Issue for this PR
N/A. Found while testing default output limits for #51021.
Type of change
What does this PR do?
Amazon Nova 2 Lite rejects any request that sets
maxTokenswhile extended thinking runs at high effort:AWS documents the rule in Extended thinking in Amazon Nova 2: with
"high", temperature, topP and maxTokens must be unset, because high-effort output can exceed 65k tokens.Our
highvariant for Nova 2 setsadditionalModelRequestFields.reasoningConfig.maxReasoningEffort: "high"through the request's HTTP body. The Converse protocol can see that body when it builds the request, so for Nova 2 model IDs (amazon.nova-2-*, with or without a region prefix) it now leavesmaxTokensout in that case. Every other request keeps it.maxTokens: 40000. Our variants also sendreasoningConfigto Grok 4.6 on Bedrock, and I checked live that it acceptsmaxTokens: 256000athighandxhigh, so it keeps the limit.maxTokens: AWS also disallows temperature, topP and topK at high effort. An agent that sets them already fails today, and this PR doesn't change that.maxTokenson Bedrock when a hook sets it. feat(core): fit output limits to the context window #51021 sends a default output limit on every step, which would make every Nova 2highrequest fail without this change.How did you verify your code works?
Unit test: builds models with the variant's body overlay, the way core does. Nova 2
highdropsmaxTokens; Nova 2lowand Grok 4.6highkeep it.Checks: the
packages/aiConverse suite passes.Live against Bedrock, with the default output limits from feat(core): fit output limits to the context window #51021 applied:
maxTokenssenthigh, beforemaxTokensmust be unset…"high, afterlowhigh/xhighScreenshots / recordings
N/A
Checklist