Skip to content

Commit 072e23c

Browse files
committed
fix(bedrock): request progress-update text from Opus 5.5 and Fable with reasoning off
Fixes the Bedrock half of Zoo-Code-Org#1820 where Opus 5.5 appeared to ignore requests to explain commands before running them. These models think even when Zoo omits the thinking field (they reject "disabled"), and they write their between-tool-call progress updates as separate thinking blocks. At the default display those blocks arrive empty, so the explanation never reaches the UI. Send thinking.display "updates" with the thinking-display-updates-2026-08-18 beta, which returns only the progress-update text while reasoning stays hidden. https://platform.claude.com/docs/en/build-with-claude/thinking#progress-updates https://platform.claude.com/docs/en/models/opus-5-5/migration-guide#text-between-tool-calls
1 parent 215d410 commit 072e23c

2 files changed

Lines changed: 65 additions & 5 deletions

File tree

‎src/api/providers/__tests__/bedrock.spec.ts‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,8 +1849,8 @@ describe("AwsBedrockHandler", () => {
18491849
"anthropic.claude-fable-5-1",
18501850
"anthropic.claude-opus-5-5",
18511851
"global.anthropic.claude-opus-5-5",
1852-
])("omits thinking for adaptive-only %s when reasoning is disabled", async (apiModelId) => {
1853-
// These models reject thinking.type "disabled" with a 400.
1852+
])("requests progress-update text for adaptive-only %s when reasoning is disabled", async (apiModelId) => {
1853+
// These models reject thinking.type "disabled" and think anyway; the default display leaves progress updates empty.
18541854
const provider = new AwsBedrockHandler({
18551855
apiModelId,
18561856
enableReasoningEffort: false,
@@ -1859,10 +1859,29 @@ describe("AwsBedrockHandler", () => {
18591859
await collectStream(provider.createMessage("System prompt", messages))
18601860

18611861
const commandArg = mockConverseStreamCommand.mock.calls[0][0]
1862-
expect(commandArg.additionalModelRequestFields ?? {}).not.toHaveProperty("thinking")
1862+
const additionalFields = commandArg.additionalModelRequestFields as
1863+
| { thinking?: unknown; anthropic_beta?: string[] }
1864+
| undefined
1865+
expect(additionalFields?.thinking).toEqual({ type: "adaptive", display: "updates" })
1866+
expect(additionalFields?.anthropic_beta).toContain("thinking-display-updates-2026-08-18")
1867+
expect(additionalFields).not.toHaveProperty("output_config")
18631868
expect(commandArg.inferenceConfig?.temperature).toBeUndefined()
18641869
})
18651870

1871+
it.each(["anthropic.claude-sonnet-5", "anthropic.claude-opus-5", "anthropic.claude-opus-4-8"])(
1872+
"does not request the updates display beta for %s",
1873+
async (apiModelId) => {
1874+
const provider = new AwsBedrockHandler({ apiModelId, enableReasoningEffort: false })
1875+
await collectStream(provider.createMessage("System prompt", messages))
1876+
1877+
const commandArg = mockConverseStreamCommand.mock.calls[0][0]
1878+
const additionalFields = commandArg.additionalModelRequestFields as
1879+
| { anthropic_beta?: string[] }
1880+
| undefined
1881+
expect(additionalFields?.anthropic_beta ?? []).not.toContain("thinking-display-updates-2026-08-18")
1882+
},
1883+
)
1884+
18661885
// Unlike the getModel() tests above, these pin the budget that reaches the wire.
18671886
it("should send the model's full output ceiling for Claude Opus 5 with reasoning disabled", async () => {
18681887
const opus5Handler = new AwsBedrockHandler({

‎src/api/providers/bedrock.ts‎

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,26 @@ interface BedrockInferenceConfig {
6868
temperature?: number
6969
}
7070

71+
/**
72+
* Models that write short user-facing progress updates between tool calls
73+
* ("what I found, what I'm doing next") as separate `thinking` blocks rather than `text` blocks.
74+
*
75+
* At the default `thinking.display` ("omitted" on these models), those blocks come back with an
76+
* empty `thinking` field, so explanations the user asks for before a tool call never reach the UI.
77+
* `display: "updates"` (beta) returns the progress-update text while reasoning stays hidden.
78+
* See #1820.
79+
*
80+
* - https://platform.claude.com/docs/en/build-with-claude/thinking#progress-updates
81+
* - https://platform.claude.com/docs/en/models/opus-5-5/migration-guide#text-between-tool-calls
82+
* - https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-opus-5-5#user-facing-progress-updates
83+
*/
84+
const PROGRESS_UPDATE_MODEL_PATTERNS = [
85+
"opus-5-5", // Claude Opus 5.5
86+
"fable-5", // Claude Fable 5 and 5.1
87+
"mythos-5-1", // Claude Mythos 5.1
88+
] as const
89+
const THINKING_DISPLAY_UPDATES_BETA = "thinking-display-updates-2026-08-18"
90+
7191
// Define interface for Bedrock additional model request fields
7292
// This includes thinking configuration, 1M context beta, and other model-specific parameters
7393
interface BedrockAdditionalModelFields {
@@ -79,8 +99,8 @@ interface BedrockAdditionalModelFields {
7999
| {
80100
// Claude 4.7+ adaptive thinking — no budget_tokens, uses output_config.effort instead
81101
type: "adaptive"
82-
// "summarized" shows thinking content in UI; omit to keep thinking internal only
83-
display?: "summarized" | "none"
102+
// "updates" returns only progress-update text, "summarized" also reasoning summaries.
103+
display?: "summarized" | "updates" | "omitted"
84104
}
85105
| { type: "disabled" }
86106
output_config?: {
@@ -364,6 +384,11 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
364384
* Accepts a model ID (with or without a cross-region/global prefix) and strips
365385
* the prefix via parseBaseModelId before matching.
366386
*/
387+
private writesProgressUpdates(modelId: string): boolean {
388+
const baseModelId = this.parseBaseModelId(modelId)
389+
return PROGRESS_UPDATE_MODEL_PATTERNS.some((pattern) => baseModelId.includes(pattern))
390+
}
391+
367392
private isAdaptiveThinkingModel(modelId: string): boolean {
368393
const baseModelId = this.getCapabilityModelId(modelId)
369394
return (
@@ -517,6 +542,17 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
517542
// Omitting thinking enables it by default on these models. Adaptive-only
518543
// models (Fable 5/5.1, Opus 5.5) reject "disabled", so they keep the omit behavior.
519544
additionalModelRequestFields = { thinking: { type: "disabled" } }
545+
} else if (this.writesProgressUpdates(modelConfig.id)) {
546+
// Omitting `thinking` doesn't turn thinking off on these models (they reject "disabled"),
547+
// it only leaves the default display, which empties the progress updates.
548+
// See PROGRESS_UPDATE_MODEL_PATTERNS.
549+
additionalModelRequestFields = { thinking: { type: "adaptive", display: "updates" } }
550+
logger.info("Requesting progress-update text for Bedrock request with reasoning off", {
551+
ctx: "bedrock",
552+
modelId: modelConfig.id,
553+
thinking: additionalModelRequestFields.thinking,
554+
beta: THINKING_DISPLAY_UPDATES_BETA,
555+
})
520556
}
521557

522558
const inferenceConfig: BedrockInferenceConfig = {
@@ -559,6 +595,11 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
559595
anthropicBetas.push("fine-grained-tool-streaming-2025-05-14")
560596
}
561597

598+
const thinkingDisplay = additionalModelRequestFields?.thinking
599+
if (thinkingDisplay?.type === "adaptive" && thinkingDisplay.display === "updates") {
600+
anthropicBetas.push(THINKING_DISPLAY_UPDATES_BETA)
601+
}
602+
562603
// Apply anthropic_beta to additionalModelRequestFields if any betas are needed
563604
if (anthropicBetas.length > 0) {
564605
if (!additionalModelRequestFields) {

0 commit comments

Comments
 (0)