#92688: fix(qwen): use DashScope native image format for Qwen vision models#92704
#92688: fix(qwen): use DashScope native image format for Qwen vision models#92704sheyanmin wants to merge 1 commit into
Conversation
DashScope's OpenAI-compatible endpoint rejects the standard `image_url` content part type with 'Unexpected item type in content' for Qwen vision models. Convert to DashScope native format (`type: image` with direct data URI string) when the provider or baseUrl indicates a DashScope endpoint. Detection: provider includes 'dashscope', provider is 'qwen' or 'qwen-dashscope', or baseUrl includes 'dashscope.aliyuncs.com'. Closes openclaw#92688
|
Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 2:02 PM ET / 18:02 UTC. Summary PR surface: Source +33. Total +33 across 1 file. Reproducibility: yes. for the PR regression: source and provider-contract inspection show the patch changes compatible-mode image requests away from documented Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep DashScope compatible-mode image serialization on Do we have a high-confidence way to reproduce the issue? Yes for the PR regression: source and provider-contract inspection show the patch changes compatible-mode image requests away from documented Is this the best way to solve the issue? No: switching the shared OpenAI-compatible serializer to Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a0b16f37e835. Label changesLabel justifications:
Evidence reviewedPR surface: Source +33. Total +33 across 1 file. 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
|
|
Thanks @sheyanmin for jumping on the Qwen/DashScope image failure in #92704. I am closing this as superseded by #92770 because that PR keeps the fix on the narrower canonical path for #92688: placing the Qwen/DashScope image prompt in user content, with the focused media-understanding regression test and passing proof/checks. This PR's native-format serializer approach is still recorded as a source PR in the cluster, so Clownfish can preserve attribution and credit for the contributor context it added. If this branch contains a distinct reproduction detail or provider behavior that #92770 does not cover, please reply here and we can reopen or split that follow-up back out. |
Summary
Fix Qwen vision models returning 400 "Unexpected item type in content" on DashScope by converting image content parts from standard OpenAI format (
type: image_url) to DashScope native format (type: image).Root Cause
DashScope's OpenAI-compatible chat completions endpoint (
/compatible-mode/v1/chat/completions) does not support the standardimage_urlcontent part type for Qwen vision models (qwen3.7-max, qwen3.7-plus, etc.). When the image tool sends multimodal requests, the image is formatted as{type: "image_url", image_url: {url: "data:..."}}which DashScope rejects with HTTP 400:The DashScope native multimodal API expects images as
{type: "image", image: "data:..."}— a flat structure where the image field is a direct data URI string rather than a{url: ...}wrapper object. This fix detects DashScope endpoints (by provider name or base URL) and converts the image format accordingly, while preserving standard OpenAI format for all other providers.Real behavior proof
behavior
Detect DashScope endpoints and convert image content parts from OpenAI
image_urlformat to DashScope nativeimageformat.environment
steps
convertMessagesfrom production code (src/llm/providers/openai-completions.js)convertMessageswith each model and inspect the content formattype: "image"while OpenAI models keeptype: "image_url"observedResult
Reproduction script output (
./node_modules/.bin/tsx scripts/repro-92688.ts):Production change:
Regression Test Plan
pnpm test -- --run src/llm/providers/openai-completions.test.ts— existing OpenAI completions streaming tests pass unchangedimage_urlformat (no regression)AI-assisted: built with Claude Code