Skip to content

fix(provider): reject unsupported image MIME attachments#30023

Open
he-yufeng wants to merge 1 commit into
anomalyco:devfrom
he-yufeng:fix/unsupported-image-mime
Open

fix(provider): reject unsupported image MIME attachments#30023
he-yufeng wants to merge 1 commit into
anomalyco:devfrom
he-yufeng:fix/unsupported-image-mime

Conversation

@he-yufeng
Copy link
Copy Markdown

Issue for this PR

Closes #30016

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Persisted .ico attachments can be replayed as image/vnd.microsoft.icon file parts. Before this change, the provider transform treated every image/* MIME type as image modality input, so any multimodal-capable model would receive the unsupported ICO payload instead of a recoverable user-visible error.

This keeps the existing supported image set to JPEG, PNG, GIF, and WebP when building model messages. Other image MIME types are converted to an error text part, so old sessions containing ICO files can continue and the model can tell the user the attachment is unsupported.

How did you verify your code works?

  • bun --cwd packages/opencode test test/provider/transform.test.ts
  • bun run --cwd packages/opencode typecheck
  • bunx prettier --check packages/opencode/src/provider/transform.ts packages/opencode/test/provider/transform.test.ts
  • bunx oxlint packages/opencode/src/provider/transform.ts packages/opencode/test/provider/transform.test.ts (exit 0; existing warnings remain in this file)
  • git diff --check

Screenshots / recordings

No screenshot. This changes model-message transformation for persisted unsupported image attachments, not UI layout.

Checklist

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICO image attachments can make multimodal sessions get stuck in thinking

1 participant