Repository navigation
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. This PR targets a valid Bedrock maxTokens bug, but its current head is not a viable landing branch because it keeps a contradictory test and still misses the mandatory adaptive default path; the same issue is better covered by the open proof-positive candidate at #97343. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this branch as superseded and focus maintainer review on #97343 as the single canonical fix for the linked Bedrock maxTokens bug. So I’m closing this here and keeping the remaining discussion on #97343. Review detailsBest possible solution: Close this branch as superseded and focus maintainer review on #97343 as the single canonical fix for the linked Bedrock maxTokens bug. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main only sends Bedrock inferenceConfig.maxTokens from resolved options, and the affected resolver branches do not all derive that value from model.maxTokens. I did not run a live AWS Bedrock request in this read-only review. Is this the best way to solve the issue? No. The resolver is the right layer, but this branch is not the best landing path because it has a contradictory added test and misses the mandatory adaptive default branch; #97343 is the cleaner canonical candidate. Security review: Security review cleared: The diff only changes Bedrock runtime option construction and tests, with no dependency, CI, credential, package, lockfile, or script surface change. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 8d168c836af3. |
3617474 to
a116738
Compare
a116738 to
ab0fe84
Compare
What Problem This Solves
Fixes #97176.
Amazon Bedrock Claude models using adaptive thinking (Opus 4.8, Fable 5) are hard-capped at 4096 output tokens. At higher thinking levels the thinking block alone consumes the budget, causing
stop_reason: "length"before any answer or tool call is delivered.Root Cause
resolveSimpleBedrockOptionshas three Claude branches. The non-adaptive Claude branch already callsadjustMaxTokensForThinking()which factors inmodel.maxTokens. But the Fable 5 branch and adaptive-thinking branch both returnedbasewith reasoning/thinkingBudgets set but never derivedmaxTokensfrommodel.maxTokens— leaving it at the 4096 default.Changes Made
extensions/amazon-bedrock/stream.runtime.ts: AddedresolveModelBackedMaxTokens()helper (baseMaxTokens ?? model.maxTokens). Applied in Fable 5 and adaptive-thinking branches. MovedstreamSimpleBedrockafterresolveSimpleBedrockOptionsfor clarity.extensions/amazon-bedrock/stream.runtime.test.ts: Added 10 regression tests covering all branches, effort levels, edge cases, and integration-level API request verification.Evidence
node scripts/run-vitest.mjs run extensions/amazon-bedrock/stream.runtime.test.ts— 30/30 passed (2 consecutive runs, no flakes)npx oxlint --tsconfig tsconfig.json extensions/amazon-bedrock/stream.runtime.ts extensions/amazon-bedrock/stream.runtime.test.ts— cleanTest coverage
Real behavior proof
Integration tests capture the actual Bedrock Converse API request sent after the fix:
What was not tested: Live Bedrock API calls (fix is in the shared option-resolver layer, unit-level verification suffices). Fable 5 without the Bedrock contract path (direct
streamBedrockcallers —streamSimpleBedrockis the canonical entry point).AI Assistance 🤖