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
+5 -3
View File
@@ -605,7 +605,7 @@ def generate_v2_all(schema_dir: Path, *, format_output: bool = True) -> None:
+ (["--formatters", "ruff-format"] if format_output else []),
cwd=sdk_root() if format_output else Path(td),
)
_preserve_inline_image_class_names(out_path)
_preserve_inline_media_class_names(out_path)
_add_legacy_image_generation_thread_item_alias(out_path)
_preserve_open_enum(out_path, "CodexErrorInfoValue", allow_empty=True)
_preserve_reasoning_effort_enum(out_path)
@@ -614,13 +614,15 @@ def generate_v2_all(schema_dir: Path, *, format_output: bool = True) -> None:
_normalize_generated_timestamps(out_path)
def _preserve_inline_image_class_names(out_path: Path) -> None:
"""Keep the public class names used before ImageReference was introduced."""
def _preserve_inline_media_class_names(out_path: Path) -> None:
"""Keep the public inline class names used before file references were introduced."""
source = out_path.read_text()
stable_names = {
"UrlUserInput": "ImageUserInput",
"ImageUrlContentItem": "InputImageContentItem",
"ImageUrlFunctionCallOutputContentItem": "InputImageFunctionCallOutputContentItem",
"UrlUserInput1": "AudioUserInput",
"AudioUrlContentItem": "InputAudioContentItem",
}
for generated_name, stable_name in stable_names.items():
if source.count(f"class {generated_name}(") != 1: