Repository navigation
Conversation
Channels may report image attachments with content_type application/octet-stream (QQ C2C does this, sometimes with a .png filename over JPEG bytes). materialize_image_part trusted that value, so the data URL sent to the model carried an unsupported media type and the provider returned 400. Apply the existing sniff_image_media_type() magic-byte detection as a fallback when the reported mime is application/octet-stream or empty, at all three materialization sites: inline data, downloaded URL content, and path-backed workspace refs. Fixes TencentCloud#1640
dda63ce to
f6130e9
Compare
…e-sniff-fallback # Conflicts: # CHANGELOG.md
|
Friendly follow-up — the MIME fallback fix covers inline/downloaded images and request-time expansion of historical workspace references, while preserving explicit image types. The 46 focused image-pipeline tests passed locally; broader-suite limitations are disclosed in the PR. The current fork CI run is awaiting maintainer approval, with no merge conflict reported. Could a maintainer approve CI and review the patch when convenient? Happy to address feedback. |
Resolve CHANGELOG.md conflict: adopt the 1.0.2b7 release structure and re-add the image MIME sniffing entry under [Unreleased] until this PR lands.
…e-sniff-fallback # Conflicts: # CHANGELOG.md
…e-sniff-fallback # Conflicts: # CHANGELOG.md
…e-sniff-fallback # Conflicts: # CHANGELOG.md
…e-sniff-fallback # Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
|
This is ready to squash-merge; there is no reviewer assigned, so flagging it in case it fell off the queue.
Scope is unchanged from the original description: Happy to adjust anything, or to split it if you would rather take the sniffing helper without the request-time expansion. |
Keep the MIME sniffing fallback from this branch and adopt develop's _vision_image_needs_fit() gate (replaces the raw VISION_MAX_BYTES length check in both the inline-data and rematerialize paths).
Fixes #1640
Why
Image attachments reported as
application/octet-streamor with missing MIME can reach the model with an unsupported or incorrect data URL type. Stored workspace image references repeat this failure when they are rematerialized on later requests.What changed
cc52ef2e).Surface area
Bug fix verification
Earlier validation (before the 2026-10-09 sync)
git diff --checkpassed. Upstream CI still needs maintainer authorization and execution.This fixes rematerializable workspace references. It does not migrate arbitrary legacy inline data URLs or redesign channel-wide MIME normalization.
AI assistance
Tool(s) used: AI coding agent
How you used it: read the issue's request-time reproduction, traced inline/download/workspace paths, repaired MIME fallback ordering, added red/green and preservation tests, and ran the checks above.
Latest synchronization and validation (2026-11-18)
Head
348b6c032c20399ca17c9a1b17d326084235359amerges develop3d85f07e76122c7323448527809422f42a9f3666. Relative to that baseline, the PR contains only its implementation, regression tests and Unreleased fix entry.NODE_OPTIONS=--max-old-space-size=4096, matching the repository build configuration.