Skip to content

fix: gate non-media files to prevent converter crash - #35824

Closed
jwcrystal wants to merge 4 commits into
anomalyco:devfrom
jwcrystal:fix-file-mime-gate
Closed

fix: gate non-media files to prevent converter crash#35824
jwcrystal wants to merge 4 commits into
anomalyco:devfrom
jwcrystal:fix-file-mime-gate

Conversation

@jwcrystal

Copy link
Copy Markdown

Issue for this PR

Closes #35697

Type of change

  • Bug fix

What does this PR do?

The server gate in message-v2.ts pushes any file part through to provider converters regardless of media type. When a client sends a file with unrecognized MIME type (application/octet-stream), the converter can only handle image/* and throws UnsupportedFunctionalityError, crashing the session.

This was exposed by the custom provider image support change that set image capability to true — non-image files started flowing through when previously they were filtered out.

Fix: invert the gate condition so only actual media (image/*, application/pdf) gets pushed as a file part. Everything else becomes a text placeholder. Both copilot converters also silently skip unrecognized file types as defense-in-depth.

How did you verify your code works?

  • Ran cd packages/core && bun test test/github-copilot/ — 37/37 pass
  • Ran cd packages/opencode && bun test test/session/message-v2.test.ts — 36/36 pass
  • Ran bun turbo typecheck — 30/30 packages clean

Screenshots / recordings

N/A — logic change only

Checklist

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

@jwcrystal
jwcrystal force-pushed the fix-file-mime-gate branch from 22eec38 to 252c059 Compare July 8, 2026 01:11
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

fix(server): application/octet-stream file attachments crash the session

1 participant