ChatGPT / Codex macOS App: Quicksilver WebRTC, 2x catch-up buffering and Sonora AEC3
Inside com.openai.codex: Webview Quicksilver v2 WebRTC with 2x boxcar catch-up buffering, bem_item_promoted handoffs, and Rust codex-voice-host Sonora AEC3.
- 2x catch-up buffer or Sonora AEC3
- Quicksilver WebRTC intermediary
- Backend Codex item promotion
Investigation question
How does OpenAI’s unified macOS ChatGPT / Codex app achieve headphone-free full-duplex terminal voice without speaker echo, prevent clipped first words during WebRTC setup, and hand off coding work between a live voice model and a background Codex executor?
Observed
Static inspection of the unified ChatGPT.app bundle (CFBundleIdentifier = com.openai.codex, v26.1103.32239, Codex Framework.framework, app.asar, bundled codex App-Server commit c40729ea5cf8e947481b130c59807273eda2f8e9, and the 9.57 MB Rust codex-voice-host Mach-O paired with 18 GStreamer/Opus dylibs) uncovers two complementary voice-to-voice stacks. First, for CLI/TUI sessions, codex-voice-host eliminates speaker-echo deafness without headphones by pairing macOS CoreAudio render loopback (com.cpal.LoopbackRecordAggregateDevice.) with pure-Rust WebRTC EchoCanceller3 (sonora-aec3-0.2.0 + ARM64 NEON matched filter), AGC2 + GRU/FC RNN-VAD (sonora-agc2-0.2.0), Noise Suppression (sonora-ns-0.2.0), SincResampler, FramePacker::discard_capture_gap, webrtc-0.20.3, and GStreamer Opus plc=true / use-inband-fec=true. Second, in the Webview Quicksilver v2 stack (/wham/realtime/calls?intent=quicksilver&architecture=avas, gpt-live-1.1-codex), startup latency is masked by caching an ECDSA P-256 DTLS certificate in IndexedDB for 365 days (prewarmPeerConnection) while realtime-buffered-audio-worklet captures up to 10s of speech ("buffering"), trims leading silence (findFirstSignalOffset + preRollSamples), and replays buffered audio at 2x speed via 2-sample boxcar decimation ((i + this.shift()) / 2) ("replaying") until seamlessly caught up ("live"). Over the oai-events data channel, the voice model acts as an Intermediary (conversation.handoff.requested) while codex executes in the background and promotes finished diffs and markdown back into the live call via realtime.bem_item_promoted.
Inferred
Replaying pre-connect audio at 2x via 2-sample boxcar decimation solves a fundamental voice UX dilemma: dropping pre-connect audio clips the user’s opening sentence, while replaying at 1x leaves the conversation permanently lagged behind wall-clock time, whereas 2x decimated PCM remains intelligible to a multimodal audio model (gpt-live-1.1-codex) and converges to real time in one buffer length. Likewise, decoupling the low-latency voice Intermediary from the deep-reasoning codex Backend Executor prevents multi-minute code edits from stalling spoken turn-taking.
Unknown & limitations
Static bundle, Mach-O, and symbol/AST inspection only; no live /wham/realtime/calls session, microphone audio, SDP payload, or user account token was captured. Server-side avas / gpt-live-1.1-codex turn-detection thresholds and server-side BEM promotion scheduling remain uninspected.
Architecture
Two voice stacks co-reside in com.openai.codex: (1) Desktop Webview Quicksilver v2 — Browser RTCPeerConnection (prewarmPeerConnection + 365-day IndexedDB ECDSA P-256 cert) + realtime-buffered-audio-worklet + oai-events WebRTC data channel bridged via Electron IPC (preload.js + @worklouder/device-kit-oai hardware PTT HID support) to the codex App-Server; and (2) Native Terminal Voice (codex-voice-host) — standalone Rust sidecar linking cpal CoreAudio aggregate loopback, sonora-{aec3,agc2,ns}, webrtc-0.20.3, and 18 bundled GStreamer/Opus libraries.
Domain & data models
realtime-buffered-audio-worklet transitions deterministically across "buffering" (<= 10s ring + findFirstSignalOffset + preRollSamples) -> "replaying" (2-sample boxcar decimation (i + this.shift()) / 2 while queuing live mic samples) -> "live". Backend executor prompts explicitly instruct codex: "You are operating as a backend executor behind an intermediary. The user does not talk to you directly...", reconciling residual user speech via <source>transcript_tail_flush</source>.
Workflows & state machines
During a live coding call: (1) user speaks immediately on hotkey/click while ICE/DTLS completes; (2) 2x catch-up drains buffered speech into gpt-live-1.1-codex without clipping first words; (3) Quicksilver emits conversation.handoff.requested (delegation: { type: "client" }) to codex App-Server while staying conversationally responsive; and (4) completed codex artifacts surface mid-call via realtime.bem_item_promoted, with lockscreen/PTT hardware mute safety and SDP/audio diagnostic redaction.
API & protocol surfaces
/wham/realtime/calls?intent=quicksilver&architecture=avas (WebRTC SDP + oai-events JSON data channel carrying conversation.handoff.requested, realtime.bem_item_promoted, VAD, and barge-in events), codex App-Server JSON-RPC realtime methods, codex-voice-host Rust IPC control frames, and @worklouder/device-kit-oai USB HID push-to-talk key events.