Skip to content

fix(core): preserve unsupported image attachments as text instead of dropping them - #41723

Open
Robin1987China wants to merge 1 commit into
anomalyco:v2from
Robin1987China:preserve-unsupported-images
Open

fix(core): preserve unsupported image attachments as text instead of dropping them#41723
Robin1987China wants to merge 1 commit into
anomalyco:v2from
Robin1987China:preserve-unsupported-images

Conversation

@Robin1987China

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #41722

Type of change

  • Bug fix

What does this PR do?

In V2, to-llm-message.ts only lowers image/png|jpeg|gif|webp attachments to provider media; any other image mime (e.g. image/avif, image/tiff) returned [] from attachmentContent, silently dropping the attachment. The TUI file picker accepts .avif and inserts an [Image N] mention, so the model saw the label but never the content (or a notice that it was dropped).

This PR lowers unsupported image formats to a descriptive text attachment (mime + name + reason) instead of dropping them, so the model is aware the user attached an image it cannot view and can respond appropriately instead of referencing a nonexistent image.

How did you verify your code works?

  • Added a regression test in packages/core/test/session-runner-message.test.ts covering an image/avif attachment
  • bun test test/session-runner-message.test.ts — 19 pass
  • bun typecheck (packages/core) — clean

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@Robin1987China
Robin1987China force-pushed the preserve-unsupported-images branch from 834a515 to 984f5c1 Compare August 12, 2026 07:30
@Robin1987China

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest v2 — #41789 (expose local attachment paths) has landed, so the two changes now coexist in the same lowering path: supported images get the Attached file: <path> prefix, and unsupported formats (avif/tiff) get an explicit text notice that also resolves local file:// paths via the same attachmentLocation helper.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant