Skip to content

fix(ai): omit maxTokens for Nova 2 at high reasoning effort - #51150

Merged
rekram1-node merged 1 commit into
v2from
nova-high-effort
Sep 24, 2026
Merged

rekram1-node merged 1 commit into
v2from
nova-high-effort

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

N/A. Found while testing default output limits for #51021.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Amazon Nova 2 Lite rejects any request that sets maxTokens while extended thinking runs at high effort:

maxTokens must be unset when reasoningConfig type is 'enabled' and maxReasoningEffort is 'high'

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 high variant for Nova 2 sets additionalModelRequestFields.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 leaves maxTokens out in that case. Every other request keeps it.

  • Only Nova 2: the rule is from AWS's Nova 2 docs. The older Nova 1.5 docs even show high effort with maxTokens: 40000. Our variants also send reasoningConfig to Grok 4.6 on Bedrock, and I checked live that it accepts maxTokens: 256000 at high and xhigh, so it keeps the limit.
  • Only 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.
  • Why now: V2 only sends maxTokens on 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 2 high request 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 high drops maxTokens; Nova 2 low and Grok 4.6 high keep it.

  • Checks: the packages/ai Converse suite passes.

  • Live against Bedrock, with the default output limits from feat(core): fit output limits to the context window #51021 applied:

    Variant Requests maxTokens sent Result
    high, before step and compaction 65,535 / 32,000 400, "maxTokens must be unset…"
    high, after title, two steps, compaction none all 200
    low title, two steps, compaction 65,535 / 32,000 all 200
    Grok 4.6 high / xhigh step 256,000 200

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@rekram1-node
rekram1-node merged commit 6afcc88 into v2 Sep 24, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the nova-high-effort branch September 24, 2026 15:45
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