Skip to content

fix(core): preserve notices for unsupported attachments - #56519

Open
rudycelekli wants to merge 2 commits into
anomalyco:devfrom
rudycelekli:attachment-fallback
Open

rudycelekli wants to merge 2 commits into
anomalyco:devfrom
rudycelekli:attachment-fallback

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 17, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #41722

Type of change

  • Bug fix

What does this PR do?

Keep unsupported user attachments visible as a format notice in model context, including attachment-only prompts. Do not forward unsupported binary data.

How did you verify your code works?

  • Kept the small toLLMMessages tables for unsupported formats and attachment identifiers. Removed the provider-request compilation and durable prompt-admission tests requested in review.
  • Source-bound Linux qualification after that test reduction: 790 focused passes across 10 repetitions; full Core suite 6,343 passed, 345 skipped; AI suite 1,822 passed, 28 skipped. Both typechecks and root bun run check (34 tasks) passed.
  • No live provider call or retained provider-compilation/prompt-admission test coverage is claimed for this revised test set.

Screenshots / recordings

No visual UI code changed; behavior is asserted directly.

Checklist

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

Added by the opencode bot (AI-generated).

Related: #54600

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix works and looks right. I ran OpenCode from source with the simulated model and attached archive.zip through an @ mention. On the base branch, the model request had no trace of the attachment. With this change, it contains the unsupported attachment format notice. The changed core tests pass (81), and the core type check passes. The new unit tests fail on the base, as expected.

The notice uses the same ERROR: Cannot read … Inform the user. wording as unsupportedMedia in session/model-request.ts, and plain-text files still reach the model as text, so this is consistent.

Public API: unchanged.

Tests: 140 lines of tests is a lot for a 6-line fix. One small table-driven test in session-runner-message.test.ts covers the fixed behaviour. The test that compiles requests for three providers and the one that goes through prompt admission check things this change does not touch, so they can be dropped to keep the PR minimal.

Note: audio and video attachments (#54600) now get this notice too, even for models that accept audio or video. That's better than dropping them silently, but forwarding them to those models still needs a separate change.

Related: #54600

This branch has not been deployed

No deployments
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.

Attached AVIF images are silently dropped from model context in V2

1 participant