Skip to content

feat(read): attach short video files for video-capable models - #44989

Draft
mossein wants to merge 1 commit into
anomalyco:devfrom
mossein:feat/read-video-attachments
Draft

feat(read): attach short video files for video-capable models#44989
mossein wants to merge 1 commit into
anomalyco:devfrom
mossein:feat/read-video-attachments

Conversation

@mossein

@mosseinmossein commented Aug 25, 2026

Copy link
Copy Markdown

Issue for this PR

Related to #10531 (video part only, this PR does not attempt audio)

Type of change

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

What does this PR do?

Right now the read tool rejects video files as binary, even when the model supports video input. The code for handling video already exists elsewhere in the codebase, it just never gets used because read refuses to attach the file. This PR fills that gap.

What changed:

  • read.ts attaches mp4/webm/mov files up to 20 MB, same as images and PDFs today. Bigger files get a clear error asking to trim or compress first.
  • media.ts treats video like other media, so compaction replaces old clips with placeholders instead of keeping them in context forever.
  • message-v2.ts sends video through the same provider checks as images. If the current model cannot handle video, the user sees a clean explanation instead of a broken request.

One thing to know: tests here are unit level. I have not yet pushed a real mp4 through a live video-capable endpoint, so how OpenAI compatible providers serialize a video file part is the piece most worth reviewer attention.

Also, #18005 covers similar ground (and adds audio support, which this one does not). Happy to close this in favor of that PR or coordinate. This one is just the narrower slice.

How did you verify your code works?

Added two tests: one checking that an mp4 comes back as a proper video attachment, one checking oversized files fail with a clear error. The full read suite (41 tests) and session suite (412 tests) pass, typecheck is clean.

Screenshots / recordings

Not a UI change

Checklist

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

The read tool attached images and PDFs but rejected video as binary, even
for models whose declared input modalities include video. The capability
plumbing already existed downstream (mimeToModality maps video/*,
capabilities.input.video, unsupportedParts gates on it) — only the tool
refused to produce the attachment.
- read: attach mp4/webm/mov up to 20 MB inline; larger clips fail with a
trim-and-retry error instead of a truncated request
- message-v2: video in tool results is provider-gated like other media —
extracted into a user message (where unsupportedParts handles models
without video) unless the provider is proven to carry inline video
- media: isMedia now covers video so compaction and stripMedia replace
clips with placeholders instead of silently retaining megabytes
Video stays a flipbook of sampled frames server-side; audio tracks are
not carried by this path.
Co-Authored-By: ox-alpha
@github-actionsgithub-actionsBot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Duplicate PR Analysis

I found one potentially related PR that may be worth reviewing for overlap:

Related PR:

The search results show that PR #44989 is quite specific in its implementation (attaching mp4/webm/mov ≤20 MB, provider-gated via modality support), and most searches return only the current PR itself, suggesting there are no direct duplicates actively in progress.

Recommendation: Review #18005 to confirm there's no overlapping work, but the current PR appears to be filling a specific gap in the existing capability pipeline rather than duplicating broader feature work.

@github-actionsgithub-actionsBot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@mosseinmossein changed the title feat(read): attach short video files for video-capable modelsfeat(read): attach short video files for video-capable models (built with ox-alpha)Aug 25, 2026
@mosseinmossein changed the title feat(read): attach short video files for video-capable models (built with ox-alpha)feat(read): attach short video files for video-capable modelsAug 25, 2026
Sign up for freeto 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.

1 participant

@mossein