#5474·openwork

[Feature]: Audio & video attachments never reach the model as multimodal input — modelFacingAttachmentMime() returns null for video/* and audio/*

Author: surapuramakhilCreated Sep 30, 2026Updated Sep 30, 2026

Summary

Chat attachments with audio/* and video/* MIME types are dropped before they ever reach the model, even when the configured model explicitly declares modalities.input: ["text", "image", "video", "audio"]. The attachment still renders a preview card and is copied into the workspace inbox, but the model receives no multimodal file part for it — so a fully omni-modal model can never see or hear the file.

This is a gap in the attachment pipeline's hard-coded "what counts as model-ingestible" rule, not a provider or model limitation.

Root cause

apps/app/src/react-app/domains/session/sync/attachment-file-part.ts — modelFacingAttachmentMime():

typescript
export function modelFacingAttachmentMime(mimeType: string): string | null {
  const mime = normalizedMime(mimeType);
  if (isTextLikeAttachmentMime(mime)) return "text/plain";
  if (mime.startsWith("image/") || mime === "application/pdf" || isOfficeMime(mime)) return mime;
  return null; // <-- video/* and audio/* land here
}

Only text/*, image/*, application/pdf, and the three Office MIMEs are forwarded. Everything else returns null, and uploadedAttachmentFilePart() then emits no file part at all:

typescript
// Binary/unknown mimes get no model-facing file part. A `text/plain`
// `file://` part would make opencode run the Read tool on the bytes, which
// refuses with "Cannot read binary file" as a session error and drops the
// part anyway; the synthetic workspace-path note already gives tools the file.
const modelMime = modelFacingAttachmentMime(item.mime);
if (!modelMime) return null;

The stated justification above the function is a historical AI SDK constraint:

AI SDK provider adapters only accept image/*, application/pdf, and text/plain file parts; anything else throws UnsupportedFunctionalityError server-side and poisons the session history.

That constraint is no longer uniformly true — several providers now accept video/* and audio/* file parts (e.g. Xiaomi MiMo-V2.6, Gemini, and other omni-modal models served over OpenAI-compatible endpoints). The allow-list is now silently blocking capability that both the model and the provider actually support.

Supporting evidence in the repo

  1. apps/app/tests/attachment-file-part.test.ts:245 — audio is explicitly asserted to be dropped:
    typescript
    expect(modelFacingAttachmentMime("audio/mpeg")).toBeNull();
  2. apps/app/tests/attachment-file-part.test.ts:508 — video is explicitly asserted to have no model-facing part:
    typescript
    test("video upload preserves a display card without a model-facing binary part", ...)
  3. apps/server/src/pdf-attachments/capabilities.ts — ModelInputSupport only models two modalities:
    typescript
    export type ModelInputSupport = {
      pdf: boolean;
      image: boolean;
      known: boolean;
      npm: string | null;
      contextTokens: number | null;
    };
    There is no audio or video field, so even if the file part were forwarded, downstream capability checks cannot express "this model takes audio/video".
  4. EXTENSION_MIME_TYPES in attachment-file-part.ts maps video extensions (mp4, mov, webm, m4v, avi, mkv) but contains no audio extensions at all (mp3, wav, m4a, aac, ogg, flac → fall through to application/octet-stream).

Reproduced on 0.18.x desktop

Config (~/.config/opencode/opencode.json) — correctly declares the modalities and attachments:

jsonc
"mimo-tokenplan": {
  "models": {
    "mimo-v2.6-pro": {
      "attachment": true,
      "modalities": {
        "input": ["text", "image", "video", "audio"],
        "output": ["text"]
      }
    }
  }
}

Xiaomi MiMo-V2.6-Pro is natively omni-modal (text/image/video/audio input). Per its model card it ships dedicated audio encoders (AudioTokenizer 308M, audio patch encoder 127M) and a 681M vision encoder.

Observed:

Modality Attachment reaches model? Notes
image/png ✅ Yes Reads as a real vision input; the agent can describe the image contents
application/pdf ✅ Yes Native or derived
text/*, Office ✅ Yes Re-mimed / rewritten as documented
video/mp4 ❌ No Preview card + workspace path only; no file part
audio/wav (PCM 16-bit mono 8 kHz) ❌ No Preview card + workspace path only; no file part

The downstream symptom matches the code comment exactly — the only way to reach the bytes is the Read tool, which rejects them with "Cannot read binary file", so the model gets a path note and no content.

Note the modalities.input declaration in config appears to be advisory for the picker/UI and is not consulted by modelFacingAttachmentMime(). Even a model that advertises video/audio input gets those parts stripped.

Impact

  • Any user with an audio- or video-capable model cannot use that capability through chat attachments at all.
  • The failure is silent: the user sees a normal attachment chip and gets no error, so it reads as "the model is dumb" rather than "the app dropped the bytes".
  • The workarounds are all worse than the feature: transcribe externally and paste text, or extract frames to PNGs and attach those.
  • This is an increasingly common case as omni-modal models (MiMo-V2.6, Gemini, GPT-Astra-class) move audio/video input from exotic to standard.

Proposed direction

Not prescribing an implementation, but the shape seems clear from the existing code:

  1. Extend ModelInputSupport in apps/server/src/pdf-attachments/capabilities.ts with audio: boolean and video: boolean, read from the same capabilities.input / modalities.input catalog shapes it already understands.
  2. Make modelFacingAttachmentMime() model-aware rather than a global allow-list: pass the target model's ModelInputSupport and forward video/* when support.video, audio/* when support.audio. Keep returning null for models that don't declare them, so the current safe fallback is preserved.
  3. Add the missing audio extensions to EXTENSION_MIME_TYPES (mp3, wav, m4a, aac, ogg, flac) so audio isn't mis-typed as application/octet-stream in the first place.
  4. Update the two tests at attachment-file-part.test.ts:245 and :508 — they currently lock in the drop behavior as correct. A case asserting video/*/audio/* do forward for a model with those modalities would be the regression guard.

A narrower first step that would already unblock users: only change (2) and (3), gating on the config-declared modalities.input for the selected model, and leave the catalog plumbing to a follow-up.

Related issues

  • #1777 — path-injection convention for non-multimodal attachments (web composer). Shares the "bytes vs. path" theme but is about tool-mediated access to files the model can't ingest (Excel, CSV, logs), not about forwarding audio/video to models that can. A good design companion.
  • #4166 — vision model not listed / modalities gate requiring manual config edits. Same family: capability flags that the app doesn't read dynamically.
  • #4788 — model list and capabilities hardcoded/stale. If this lands, the capability source for (1) above becomes live rather than hand-edited.

Not a duplicate of: #3506 (image/video generation, i.e. output), #4547 (local dictation → text), #625 (Telegram/Slack voice notes transcribed to text), #780 (Matrix media transport), #5355 (attachment storage lifecycle).

Docs gap

There is no documentation of attachment handling — which file types are supported, and whether the design intent is "bytes via multimodal only" or "path-mediated for everything else". #1777 raised this in May and it is still open. A short "Supported attachment types" page would prevent each new team from rediscovering this by trial and error.

Happy to test a fix against the MiMo-V2.6 config above if that's useful.