Repository navigation
fix(bedrock): honor adaptive model max tokens - #97343
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 27, 2026, 9:53 PM ET / 01:53 UTC. Summary PR surface: Source +19, Tests +62. Total +81 across 2 files. Reproducibility: yes. at source level: current main only sends Bedrock inferenceConfig.maxTokens from resolved options, and the Fable/adaptive branches do not derive that value from model.maxTokens. I did not run a live AWS Bedrock request in this read-only review. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one focused Bedrock runtime fix, likely this branch if CI finishes cleanly and maintainers accept the source-level/terminal proof plus the Bedrock quota behavior, then close overlapping candidate PRs once the canonical fix lands. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main only sends Bedrock inferenceConfig.maxTokens from resolved options, and the Fable/adaptive branches do not 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? Yes, this is the best fix shape among the candidates inspected: it stays inside the Bedrock simple option resolver, preserves explicit request caps, and avoids turning known synthetic fallback caps into explicit Bedrock request caps. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 78f7de01c1aa. Label changesLabel justifications:
Evidence reviewedPR surface: Source +19, Tests +62. Total +81 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
(cherry picked from commit a083c76)
(cherry picked from commit a083c76)
Summary
maxTokenswhen no per-request cap is supplied.maxTokensstill wins over the model-level value.Change Type
Scope
Verification
node scripts/run-vitest.mjs extensions/amazon-bedrock/stream.runtime.test.ts-> passed 1 Vitest shard in 12.80s.node scripts/run-vitest.mjs extensions/amazon-bedrock/discovery.test.ts-> passed 1 Vitest shard in 22.64s.git diff --check-> passed.Real behavior proof
Behavior addressed: Bedrock adaptive-thinking options now carry configured high output-token caps while leaving fallback caps unset.
Environment tested: Node runtime on Linux in the local
fix/97176-bedrock-adaptive-max-tokensbranch.Steps run after the patch: Ran a
node --import tsx --no-warnings -ecommand that importstestingfrom./extensions/amazon-bedrock/stream.runtime.tsand callsresolveSimpleBedrockOptionsplusbuildAdditionalModelRequestFieldswith configured, explicit, and fallback max-token cases.Evidence after fix:
Observed result: The configured model cap resolves to
128000, the explicit request cap remains32000, fallback caps4096,8192, and16384remain unset, and adaptive request fields are still produced.Not tested: Live AWS Bedrock request with real credentials was not run.
Impact Assessment
#97176before implementation.Root Cause
maxTokens, so configured model-level output caps were not forwarded when callers omitted a per-request cap.Regression Test Plan
User-visible / Behavior Changes
Users with Bedrock adaptive-thinking models and configured high
maxTokensvalues can receive the intended response budget without adding a per-request override. OpenClaw fallback caps are still left to Bedrock defaults instead of reducing native capacity.Security Impact
Closes #97176