Skip to content

fix(llm): forward bedrock.thinking provider option to Bedrock Converse#33631

Open
Robin1987China wants to merge 2 commits into
anomalyco:devfrom
Robin1987China:bedrock-thinking
Open

fix(llm): forward bedrock.thinking provider option to Bedrock Converse#33631
Robin1987China wants to merge 2 commits into
anomalyco:devfrom
Robin1987China:bedrock-thinking

Conversation

@Robin1987China

@Robin1987China Robin1987China commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #33634

Type of change

  • Bug fix

What does this PR do?

The Bedrock Converse route already parses extended-thinking/reasoning from Bedrock responses, but has no way to request it. This adds providerOptions.bedrock.thinking support, following the existing Anthropic providerOptions.anthropic.thinking pattern. The thinking config is lowered into additionalModelRequestFields.thinking with budget_tokens (snake_case per the Bedrock Converse API).

How did you verify your code works?

  • bun typecheck in packages/llm passes
  • bun test test/provider/bedrock-converse.test.ts — 31 tests pass (3 new: thinking alone, thinking + topK, rejects missing budgetTokens)
  • Full turbo typecheck across 29 packages — 23 successful

Checklist

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

select() partitions the conversation into head (summarized) and recent
(kept) at a token budget. When the boundary lands mid-message, that message
is split into splitPrefix (head) and splitSuffix (recent). The split branch
set split = index + 1 and reused it for both head's slice end and recent's
slice start, so head = slice(0, index + 1) included the full boundary
message AND splitPrefix (a truncated copy) — duplicating it.

head is the exact text fed to the summarizer, so on every overflow-triggered
compaction where the boundary lands mid-message the boundary message was
sent twice (full + truncated), wasting tokens and risking pushing the
summary prompt past the context limit so compaction silently fails.

Track two boundaries: headEnd (end of head's full-message slice) and
recentStart (start of recent's slice). They differ only in the split case
(headEnd = index, recentStart = index + 1); all other paths keep them
equal, preserving existing behavior. Export select and add a regression
test for the duplication plus a fully-fitting sanity case.

Closes anomalyco#33329
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bedrock extended thinking config has no effect

1 participant