Add live WebRTC voice conversations to the TUI (#43581)

## What changed

- Add feature-gated `/voice`, `/voice mute`, and `/voice stop` commands with local WebRTC audio and app-server signaling.
- Show live transcripts, conversation status, and microphone and speaker levels. Preserve captions and undelivered answers across thread switches.
- Speak final answers from voice handoffs while keeping delegated reasoning and commentary hidden and typed answers unspoken.
- Retry eligible startup failures once and clean up voice sessions on thread switches and disconnects.
- Stop voice and block late handoffs after a misalignment policy violation. Remove realtime event payloads and spoken text from receipt and debug logs.

## Testing

Add coverage for voice command mapping, rejected starts, disconnect cleanup, delegated final-answer speech, late handoff rejection, and transcript and footer rendering.

GitOrigin-RevId: 11def1f86b0e023b21d0d92072d6636ccad89815
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-07 20:25:30 +00:00
1 parent 4110342321
commit b01c3986fd
70 files changed
+4421 -69

No files matched your search

@@ -3175,6 +3175,35 @@ async fn experimental_popup_loading_snapshot() {
assert!(rx.try_recv().is_err());
}
#[tokio::test]
async fn experimental_popup_available_snapshot() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.thread_id = Some(ThreadId::new());
chat.open_experimental_popup();
let AppEvent::FetchExperimentalFeatures { response_tx, .. } = rx.try_recv().unwrap() else {
panic!("expected experimental discovery request");
};
let features = [
("network_proxy", "Network proxy", "Apply network proxy restrictions to sandboxed sessions that already have network access."),
("prevent_idle_sleep", "Prevent sleep while running", "Keep your computer awake while Codex is running a thread."),
]
.into_iter()
.map(|(name, display_name, description)| codex_app_server_protocol::ExperimentalFeature {
name: name.to_string(),
stage: codex_app_server_protocol::ExperimentalFeatureStage::Beta,
display_name: Some(display_name.to_string()),
description: Some(description.to_string()),
announcement: None,
enabled: false,
default_enabled: false,
})
.collect();
response_tx.send(Ok(features)).unwrap();
chat.pre_draw_tick();
let popup = render_bottom_popup(&chat, /*width*/ 80);
assert_chatwidget_snapshot!("experimental_features_available_popup", popup);
}
#[tokio::test]
async fn feature_enable_prompts_snapshot() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;