[PR #12871] fix: handle file stream event in session processor #14412

Open
opened 2026-02-16 18:19:12 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12871

State: open
Merged: No


Summary

  • The stream processor in processor.ts handles many Vercel AI SDK event types but the "file" event fell through to the default case and was silently discarded
  • Added a case "file" handler that creates a MessageV2.FilePart from the stream event's mediaType, url, and filename properties and persists it via Session.updatePart
  • This allows model-generated images (and other file outputs) to be captured and displayed instead of being dropped

Fixes #12859

Test plan

  • Verify that a model capable of generating images (e.g., GPT-4o with image generation) now has its output images stored as FilePart entries in the session
  • Confirm existing stream event handling (text, reasoning, tool calls, etc.) is unaffected
  • Check that the FilePart appears in the message parts and is rendered correctly in the UI
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12871 **State:** open **Merged:** No --- ## Summary - The stream processor in `processor.ts` handles many Vercel AI SDK event types but the `"file"` event fell through to the `default` case and was silently discarded - Added a `case "file"` handler that creates a `MessageV2.FilePart` from the stream event's `mediaType`, `url`, and `filename` properties and persists it via `Session.updatePart` - This allows model-generated images (and other file outputs) to be captured and displayed instead of being dropped Fixes #12859 ## Test plan - [ ] Verify that a model capable of generating images (e.g., GPT-4o with image generation) now has its output images stored as `FilePart` entries in the session - [ ] Confirm existing stream event handling (text, reasoning, tool calls, etc.) is unaffected - [ ] Check that the `FilePart` appears in the message parts and is rendered correctly in the UI
yindo added the pull-request label 2026-02-16 18:19:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14412