Repository navigation
Conversation
…imi K3 Only Amazon Nova and Anthropic Claude accept images nested in toolResult.content (per the AWS ToolResultContentBlock docs). Invert the selector so those routes keep the nested layout and every other route, including unknown and opaque inference-profile routes, gets the existing labeled sibling-image relocation instead of a GPT-5.6-only special case. The relocation moves into tool-result-images.ts to keep stream.runtime.ts within the line-cap ratchet. Closes openclaw#186753
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesThis PR keeps tool-returned images nested for recognized Nova and Claude models and relocates them into labeled sibling blocks for other Bedrock routes. Example: An agent using global.openai.gpt-6.1-sol reads shapes.png and status.txt.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR repairs a demonstrated Bedrock failure without an identified code defect; replacing the previously approved default for unknown routes still needs an owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Amazon Bedrock provider converts agent conversation and tool results into ConverseStream requests, then converts streamed responses into agent events. flowchart LR
A[Agent conversation] --> B[Bedrock serializer]
B --> C[Recognized Nova or Claude]
B --> D[Other or opaque route]
C --> E[Nested tool images]
D --> F[Labeled sibling images]
E --> G[Bedrock ConverseStream]
F --> G
Technical reviewBest possible solution: Keep one provider-local serializer and its existing relocation algorithm, with an owner-approved rule for unknown and opaque routes. Do we have a high-confidence way to reproduce the issue? Current-main source selects relocation only for GPT-5.6 Sol, matching the official-release report and supplied before-fix validation errors on the other affected routes; no target code was executed during this review. Is this the best way to solve the issue? The existing relocation is reused without a competing path, and its small extraction is justified by the runtime file's enforced size limit; the broader route default is a defensible owner choice rather than an established defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 00125bb5bbc0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +21, Tests 0. Total +21 across 3 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 29, 2026, 3:57 AM ET / 07:57 UTC (Revision 2). |
Table the nested-vs-lifted expectations per route so the regression adds no net test lines (test-lines ratchet).
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@obviyus: you merged #149336, which scoped Bedrock tool-result image relocation to GPT-5.6 Sol and kept unknown routes nested. This PR (fixing #186753) reverses that default: only Nova and Claude stay nested, which matches the AWS |
…GPT-6/6.1 Sol and Kimi K3 (#186834) Root cause: `extensions/amazon-bedrock/stream.runtime.ts:970` moved tool-returned images out of `toolResult.content` only when `model.id.includes("openai.gpt-5.6-sol")`, so every other route sent them nested, a layout AWS documents only for Claude and Nova and that GPT-6/6.1 Sol and Kimi K3 reject with `ValidationException`. Fixes #186753 ## What Problem This Solves Fixes: on Amazon Bedrock, a turn fails with "The agent run failed before producing a reply." after a tool such as `read` returns an image, on GPT-6 Sol, GPT-6.1 Sol, Kimi K3 and any application inference profile that points at them. ## User Impact User impact: image-returning tools work on every non-Claude Bedrock route, including opaque application-inference-profile ARNs and models that ship later, without a code change per model. Claude requests are byte-for-byte unchanged. No config or migration. ## Why This Change Was Made #149336 added the sibling layout (tool results first, then a labeled user image group per result, no history rewrite) for one route name. Each new route that rejects nested images was a user-visible failure until someone added its name, and opaque ARNs never matched. This flips the default: only Claude keeps images nested, using the `isAnthropicClaudeModel` predicate this file already uses for signatures and caching. Every other route gets the sibling layout, which the reporter's 24-request Converse matrix shows every tested route accepts. A wrong guess now still completes the turn instead of failing it. Production change: one line, net 0. Two consequences, named on purpose: - **Nova moves from nested to sibling.** AWS documents nested images for Nova, and only Nova Pro has been seen to accept the sibling layout (#187159's live run). I chose not to add an `amazon.nova` name match: sibling user images are documented for Converse, and the tool-free replay path in this file already sends tool images as plain user images on every model. - **`isAnthropicClaudeModel` also matches a model whose `name` contains "claude".** A non-Claude profile named, say, "claude-replacement" would keep the nested layout. That is the same exposure signature replay has today. A non-Claude session that already holds a tool image gets one prompt-cache miss on its next request, because the replayed layout changes once. Credit: @beezly reported this with the full route matrix and proposed this exact inversion (#187159); @yousan opened the first fix and ran a live Kimi K3 ConverseStream turn with the sibling layout. This PR keeps yousan's commit and replaces its name list with the inverted default. ## Evidence - Regression: `stream.runtime.test.ts` › "lifts non-Claude tool images into user content, keeping result associations" now uses an opaque application-inference-profile ARN for the lifted case (red on base: images stay nested) and a Claude id for the nested control. - End to end, built `dist/` on both sides, isolated Gateway, one `openclaw agent` turn whose `read` returns a PNG, against a local ConverseStream server that enforces the observed rule (nested image on a non-Claude/non-Nova model -> 400 `ValidationException` with AWS's message; otherwise the reply carries the SHA-256 of each image it received). Results: #186834 (comment) - Limit: the local server encodes the observed rule, so it cannot prove that Nova accepts the sibling layout; only a live AWS call can. Merge danger: two-way door. A revert restores the old layout; nothing is stored or migrated (transcript rows are unchanged; only the request built from them differs). Blast radius: Bedrock ConverseStream requests that replay a tool result containing an image, on non-Claude models. Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: clord-dispatch <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…GPT-6/6.1 Sol and Kimi K3 (#186834) Root cause: `extensions/amazon-bedrock/stream.runtime.ts:970` moved tool-returned images out of `toolResult.content` only when `model.id.includes("openai.gpt-5.6-sol")`, so every other route sent them nested, a layout AWS documents only for Claude and Nova and that GPT-6/6.1 Sol and Kimi K3 reject with `ValidationException`. Fixes #186753 ## What Problem This Solves Fixes: on Amazon Bedrock, a turn fails with "The agent run failed before producing a reply." after a tool such as `read` returns an image, on GPT-6 Sol, GPT-6.1 Sol, Kimi K3 and any application inference profile that points at them. ## User Impact User impact: image-returning tools work on every non-Claude Bedrock route, including opaque application-inference-profile ARNs and models that ship later, without a code change per model. Claude requests are byte-for-byte unchanged. No config or migration. ## Why This Change Was Made #149336 added the sibling layout (tool results first, then a labeled user image group per result, no history rewrite) for one route name. Each new route that rejects nested images was a user-visible failure until someone added its name, and opaque ARNs never matched. This flips the default: only Claude keeps images nested, using the `isAnthropicClaudeModel` predicate this file already uses for signatures and caching. Every other route gets the sibling layout, which the reporter's 24-request Converse matrix shows every tested route accepts. A wrong guess now still completes the turn instead of failing it. Production change: one line, net 0. Two consequences, named on purpose: - **Nova moves from nested to sibling.** AWS documents nested images for Nova, and only Nova Pro has been seen to accept the sibling layout (#187159's live run). I chose not to add an `amazon.nova` name match: sibling user images are documented for Converse, and the tool-free replay path in this file already sends tool images as plain user images on every model. - **`isAnthropicClaudeModel` also matches a model whose `name` contains "claude".** A non-Claude profile named, say, "claude-replacement" would keep the nested layout. That is the same exposure signature replay has today. A non-Claude session that already holds a tool image gets one prompt-cache miss on its next request, because the replayed layout changes once. Credit: @beezly reported this with the full route matrix and proposed this exact inversion (#187159); @yousan opened the first fix and ran a live Kimi K3 ConverseStream turn with the sibling layout. This PR keeps yousan's commit and replaces its name list with the inverted default. ## Evidence - Regression: `stream.runtime.test.ts` › "lifts non-Claude tool images into user content, keeping result associations" now uses an opaque application-inference-profile ARN for the lifted case (red on base: images stay nested) and a Claude id for the nested control. - End to end, built `dist/` on both sides, isolated Gateway, one `openclaw agent` turn whose `read` returns a PNG, against a local ConverseStream server that enforces the observed rule (nested image on a non-Claude/non-Nova model -> 400 `ValidationException` with AWS's message; otherwise the reply carries the SHA-256 of each image it received). Results: #186834 (comment) - Limit: the local server encodes the observed rule, so it cannot prove that Nova accepts the sibling layout; only a live AWS call can. Merge danger: two-way door. A revert restores the old layout; nothing is stored or migrated (transcript rows are unchanged; only the request built from them differs). Blast radius: Bedrock ConverseStream requests that replay a tool result containing an image, on non-Claude models. Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: clord-dispatch <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 95e6470)
…GPT-6/6.1 Sol and Kimi K3 (#186834) Root cause: `extensions/amazon-bedrock/stream.runtime.ts:970` moved tool-returned images out of `toolResult.content` only when `model.id.includes("openai.gpt-5.6-sol")`, so every other route sent them nested, a layout AWS documents only for Claude and Nova and that GPT-6/6.1 Sol and Kimi K3 reject with `ValidationException`. Fixes #186753 ## What Problem This Solves Fixes: on Amazon Bedrock, a turn fails with "The agent run failed before producing a reply." after a tool such as `read` returns an image, on GPT-6 Sol, GPT-6.1 Sol, Kimi K3 and any application inference profile that points at them. ## User Impact User impact: image-returning tools work on every non-Claude Bedrock route, including opaque application-inference-profile ARNs and models that ship later, without a code change per model. Claude requests are byte-for-byte unchanged. No config or migration. ## Why This Change Was Made #149336 added the sibling layout (tool results first, then a labeled user image group per result, no history rewrite) for one route name. Each new route that rejects nested images was a user-visible failure until someone added its name, and opaque ARNs never matched. This flips the default: only Claude keeps images nested, using the `isAnthropicClaudeModel` predicate this file already uses for signatures and caching. Every other route gets the sibling layout, which the reporter's 24-request Converse matrix shows every tested route accepts. A wrong guess now still completes the turn instead of failing it. Production change: one line, net 0. Two consequences, named on purpose: - **Nova moves from nested to sibling.** AWS documents nested images for Nova, and only Nova Pro has been seen to accept the sibling layout (#187159's live run). I chose not to add an `amazon.nova` name match: sibling user images are documented for Converse, and the tool-free replay path in this file already sends tool images as plain user images on every model. - **`isAnthropicClaudeModel` also matches a model whose `name` contains "claude".** A non-Claude profile named, say, "claude-replacement" would keep the nested layout. That is the same exposure signature replay has today. A non-Claude session that already holds a tool image gets one prompt-cache miss on its next request, because the replayed layout changes once. Credit: @beezly reported this with the full route matrix and proposed this exact inversion (#187159); @yousan opened the first fix and ran a live Kimi K3 ConverseStream turn with the sibling layout. This PR keeps yousan's commit and replaces its name list with the inverted default. ## Evidence - Regression: `stream.runtime.test.ts` › "lifts non-Claude tool images into user content, keeping result associations" now uses an opaque application-inference-profile ARN for the lifted case (red on base: images stay nested) and a Claude id for the nested control. - End to end, built `dist/` on both sides, isolated Gateway, one `openclaw agent` turn whose `read` returns a PNG, against a local ConverseStream server that enforces the observed rule (nested image on a non-Claude/non-Nova model -> 400 `ValidationException` with AWS's message; otherwise the reply carries the SHA-256 of each image it received). Results: #186834 (comment) - Limit: the local server encodes the observed rule, so it cannot prove that Nova accepts the sibling layout; only a live AWS call can. Merge danger: two-way door. A revert restores the old layout; nothing is stored or migrated (transcript rows are unchanged; only the request built from them differs). Blast radius: Bedrock ConverseStream requests that replay a tool result containing an image, on non-Claude models. Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: clord-dispatch <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 95e6470) Co-authored-by: RomneyDa <[email protected]>
…GPT-6/6.1 Sol and Kimi K3 (openclaw#186834) Root cause: `extensions/amazon-bedrock/stream.runtime.ts:970` moved tool-returned images out of `toolResult.content` only when `model.id.includes("openai.gpt-5.6-sol")`, so every other route sent them nested, a layout AWS documents only for Claude and Nova and that GPT-6/6.1 Sol and Kimi K3 reject with `ValidationException`. Fixes openclaw#186753 ## What Problem This Solves Fixes: on Amazon Bedrock, a turn fails with "The agent run failed before producing a reply." after a tool such as `read` returns an image, on GPT-6 Sol, GPT-6.1 Sol, Kimi K3 and any application inference profile that points at them. ## User Impact User impact: image-returning tools work on every non-Claude Bedrock route, including opaque application-inference-profile ARNs and models that ship later, without a code change per model. Claude requests are byte-for-byte unchanged. No config or migration. ## Why This Change Was Made openclaw#149336 added the sibling layout (tool results first, then a labeled user image group per result, no history rewrite) for one route name. Each new route that rejects nested images was a user-visible failure until someone added its name, and opaque ARNs never matched. This flips the default: only Claude keeps images nested, using the `isAnthropicClaudeModel` predicate this file already uses for signatures and caching. Every other route gets the sibling layout, which the reporter's 24-request Converse matrix shows every tested route accepts. A wrong guess now still completes the turn instead of failing it. Production change: one line, net 0. Two consequences, named on purpose: - **Nova moves from nested to sibling.** AWS documents nested images for Nova, and only Nova Pro has been seen to accept the sibling layout (openclaw#187159's live run). I chose not to add an `amazon.nova` name match: sibling user images are documented for Converse, and the tool-free replay path in this file already sends tool images as plain user images on every model. - **`isAnthropicClaudeModel` also matches a model whose `name` contains "claude".** A non-Claude profile named, say, "claude-replacement" would keep the nested layout. That is the same exposure signature replay has today. A non-Claude session that already holds a tool image gets one prompt-cache miss on its next request, because the replayed layout changes once. Credit: @beezly reported this with the full route matrix and proposed this exact inversion (openclaw#187159); @yousan opened the first fix and ran a live Kimi K3 ConverseStream turn with the sibling layout. This PR keeps yousan's commit and replaces its name list with the inverted default. ## Evidence - Regression: `stream.runtime.test.ts` › "lifts non-Claude tool images into user content, keeping result associations" now uses an opaque application-inference-profile ARN for the lifted case (red on base: images stay nested) and a Claude id for the nested control. - End to end, built `dist/` on both sides, isolated Gateway, one `openclaw agent` turn whose `read` returns a PNG, against a local ConverseStream server that enforces the observed rule (nested image on a non-Claude/non-Nova model -> 400 `ValidationException` with AWS's message; otherwise the reply carries the SHA-256 of each image it received). Results: openclaw#186834 (comment) - Limit: the local server encodes the observed rule, so it cannot prove that Nova accepts the sibling layout; only a live AWS call can. Merge danger: two-way door. A revert restores the old layout; nothing is stored or migrated (transcript rows are unchanged; only the request built from them differs). Blast radius: Bedrock ConverseStream requests that replay a tool result containing an image, on non-Claude models. Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: clord-dispatch <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #186753
What Problem This Solves
Fixes: image-reading tools fail with
Validation error: This model doesn't support the image field for user messageson Amazon Bedrock GPT-6 Sol, GPT-6.1 Sol and Kimi K3 (and any other non-Nova/non-Claude route), because OpenClaw nests tool-returned images insidetoolResult.content.User Impact
User impact: agents on any Bedrock route can read images returned by tools; Nova and Claude keep today's nested layout unchanged.
Why This Change Was Made
AWS documents
ToolResultContentBlock.imageas supported only by Amazon Nova and Anthropic Claude. The previous fix (#149336) special-casedopenai.gpt-5.6-sol, so every new route needed another name match (as #186834 / #186835 propose). This change inverts the selector: Nova and Claude keep nested images, and every other route, including unknown routes and opaque application-inference-profile ARNs, uses the existing labeled sibling-image relocation, which was accepted by every route tested, Nova and Claude included. Claude detection reuses the existingisAnthropicClaudeModel, so Claude behind an application profile with a Claude name/canonical id stays nested.The relocation body moved unchanged into
tool-result-images.ts.stream.runtime.tswas already over its line cap, and the line-cap ratchet rejects any growth there.Route policy: why unknown routes default to sibling images
The earlier fix (#149336) kept unknown and opaque routes on the nested layout. This PR deliberately reverses that default, for three reasons:
ValidationException, retries hit the same error, and the user's turn fails. That is the bug in Bedrock tool-returned images fail on GPT-6/6.1 Sol and Kimi K3; workaround only covers GPT-5.6 Sol #186753, and it has now been reported for four routes.Images from tool result <id>label and the placeholder text. This layout was accepted on every route tested: Nova Pro and Claude Sonnet/Opus 5.5 in this PR's ConverseStream runs, and eight Claude routes in the issue's Converse comparison.Opaque inference profiles: Claude behind an application profile is still recognised by its name or canonical model id (the existing
isAnthropicClaudeModel), so it keeps the nested layout. Nova behind an opaque ARN gets the sibling layout. Nova accepts that, so the only cost is losing nested placement, not the request.The change is limited to the Bedrock provider, adds no config option, and can be reverted in one line if a maintainer prefers the old default.
Evidence
Regression test (
stream.runtime.test.ts: the existing relocation test is now a route table. GPT-6.1 Sol, Kimi K3 and an opaque profile ARN are lifted; Nova and Claude stay nested. Net zero test lines, to satisfy the test-lines ratchet): red onorigin/main(global.openai.gpt-6.1-solassertion), green with the fix.Live Bedrock ConverseStream through
streamSimpleBedrock(us-east-1, synthetic 64×64 PNG with a red square and a blue circle; one assistant turn with two parallel tool calls, one returning the image and one returningstatus: GREEN-42):mainglobal.openai.gpt-6-solglobal.openai.gpt-6.1-solglobal.moonshotai.kimi-k3global.openai.gpt-5.6-solus.amazon.nova-pro-v1:0(nested)global.anthropic.claude-sonnet-5-5(nested)global.anthropic.claude-opus-5-5(nested)The input context was byte-identical after every request, so stored history is not rewritten.
Real agent turn (
openclaw agent exec --config <pinned bedrock config> --cwd <dir with shapes.png + status.txt>, prompt asks for both files to be read with thereadtool in one step):main, GPT-6.1 Sol:status: "error",Validation error: This model doesn't support the image field for user messages. Remove image and try again.after 5 retried model requests.ok, "The image shows a red square on the left and a blue circle on the right. “status: GREEN-42”"ok, "…a red square on the left and a blue circle on the right. Status line:status: GREEN-42"ok, "…a red square on the left and a blue circle on the right, on a white background. The status line reads: "status: GREEN-42""Gates:
pnpm check:changed: all lanes green (typecheck extensions/tests, lint, format, line-cap ratchet, plugin boundaries) exceptdead export scan. That lane reports 86 existing unused exports, all undersrc/(gateway, infra, agents, sessions), and none inextensions/amazon-bedrock.git diff --checkclean.Gap: the live agent proof used the embedded
agent execpath rather than a separate Gateway process. The provider stream path exercised is the same.