Add audio file references with explicit runtime rejection (#58430)

## What changed

- Allow audio inputs to carry uploaded file references via `fileId` in the app-server API and `file_id` in model content, preserving existing inline audio shapes and Python class names.
- Preserve mixed inline and file-backed audio ordering through history reconstruction and migration, and budget file-backed audio conservatively when duration is unknown.
- Keep uploaded audio disabled at runtime: reject it before inference or raw history injection, preserve accompanying text, and prevent rejected attachments from reaching follow-up or resumed requests.

## Testing

Add coverage for wire-format round trips, SDK compatibility, mixed audio history ordering, and rejection during turn start, steering, task completion, and raw injection.

GitOrigin-RevId: 70895c47a2494c0c9936348ad1250eb1b7b892a6
This commit is contained in:
Hung
2026-10-30 20:53:25 +00:00
committed by copyberry
parent b9858217d8
commit 2546265e3e
83 changed files with 2122 additions and 300 deletions
+10 -3
View File
@@ -1,3 +1,4 @@
use codex_protocol::models::AudioReference;
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
@@ -854,7 +855,9 @@ async fn local_attachments_are_snapshotted_before_enqueue_and_update() -> anyhow
detail: Some(ImageDetail::Original),
},
UserInput::Audio {
audio_url: "data:audio/mpeg;base64,YXVkaW8=".to_string(),
audio: AudioReference::Inline {
audio_url: "data:audio/mpeg;base64,YXVkaW8=".to_string(),
},
},
);
@@ -896,7 +899,9 @@ async fn local_attachments_are_snapshotted_before_enqueue_and_update() -> anyhow
detail: Some(ImageDetail::High),
},
UserInput::Audio {
audio_url: "data:audio/mp4;base64,ZWRpdGVkIGF1ZGlv".to_string(),
audio: AudioReference::Inline {
audio_url: "data:audio/mp4;base64,ZWRpdGVkIGF1ZGlv".to_string(),
},
},
);
@@ -935,7 +940,9 @@ async fn invalid_local_attachments_do_not_mutate_queue() -> anyhow::Result<()> {
detail: Some(ImageDetail::Original),
},
UserInput::Audio {
audio_url: "data:audio/mpeg;base64,YXVkaW8=".to_string(),
audio: AudioReference::Inline {
audio_url: "data:audio/mpeg;base64,YXVkaW8=".to_string(),
},
},
);