From 4d4767f7979ae7da6f64595c80d2bb8d6fdd0c49 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Wed, 1 Apr 2026 13:03:59 -0700 Subject: [PATCH] tui: remove the voice-input crate feature (#16467) ## Why `voice-input` is the only remaining TUI crate feature, but it is also a default feature and nothing in the workspace selects it explicitly. In practice it is just acting as a proxy for platform support, which is better expressed with target-specific dependencies and cfgs. ## What changed - remove the `voice-input` feature from `codex-tui` - make `cpal` a normal non-Linux target dependency - replace the feature-based voice and audio cfgs with pure Linux-vs-non-Linux cfgs - shrink the workspace-manifest verifier allowlist to remove the remaining `codex-tui` exception ## How tested - `python3 .github/scripts/verify_cargo_workspace_manifests.py` - `cargo test -p codex-tui` - `just bazel-lock-check` - `just argument-comment-lint -p codex-tui` --- .github/scripts/verify_cargo_workspace_manifests.py | 12 +----------- codex-rs/tui/Cargo.toml | 6 +----- codex-rs/tui/src/app_command.rs | 5 +---- codex-rs/tui/src/app_event.rs | 5 +---- codex-rs/tui/src/app_event_sender.rs | 5 +---- codex-rs/tui/src/lib.rs | 10 ++++++---- 6 files changed, 11 insertions(+), 32 deletions(-) diff --git a/.github/scripts/verify_cargo_workspace_manifests.py b/.github/scripts/verify_cargo_workspace_manifests.py index 6231a1192..467b6c2ee 100644 --- a/.github/scripts/verify_cargo_workspace_manifests.py +++ b/.github/scripts/verify_cargo_workspace_manifests.py @@ -30,18 +30,8 @@ MANIFEST_FEATURE_EXCEPTIONS = { "codex-rs/otel/Cargo.toml": { "disable-default-metrics-exporter": (), }, - "codex-rs/tui/Cargo.toml": { - "default": ("voice-input",), - "voice-input": ("dep:cpal",), - }, -} -OPTIONAL_DEPENDENCY_EXCEPTIONS = { - ( - "codex-rs/tui/Cargo.toml", - 'target.cfg(not(target_os = "linux")).dependencies', - "cpal", - ), } +OPTIONAL_DEPENDENCY_EXCEPTIONS = set() INTERNAL_DEPENDENCY_FEATURE_EXCEPTIONS = { ( "codex-rs/core/Cargo.toml", diff --git a/codex-rs/tui/Cargo.toml b/codex-rs/tui/Cargo.toml index ee1309290..b005ad1c9 100644 --- a/codex-rs/tui/Cargo.toml +++ b/codex-rs/tui/Cargo.toml @@ -17,10 +17,6 @@ path = "src/bin/md-events.rs" name = "codex_tui" path = "src/lib.rs" -[features] -default = ["voice-input"] -voice-input = ["dep:cpal"] - [lints] workspace = true @@ -112,7 +108,7 @@ codex-windows-sandbox = { workspace = true } tokio-util = { workspace = true, features = ["time"] } [target.'cfg(not(target_os = "linux"))'.dependencies] -cpal = { version = "0.15", optional = true } +cpal = "0.15" [target.'cfg(unix)'.dependencies] libc = { workspace = true } diff --git a/codex-rs/tui/src/app_command.rs b/codex-rs/tui/src/app_command.rs index e01a25027..3c43c6186 100644 --- a/codex-rs/tui/src/app_command.rs +++ b/codex-rs/tui/src/app_command.rs @@ -121,10 +121,7 @@ impl AppCommand { Self(Op::RealtimeConversationStart(params)) } - #[cfg_attr( - any(target_os = "linux", not(feature = "voice-input")), - allow(dead_code) - )] + #[cfg_attr(target_os = "linux", allow(dead_code))] pub(crate) fn realtime_conversation_audio(params: ConversationAudioParams) -> Self { Self(Op::RealtimeConversationAudio(params)) } diff --git a/codex-rs/tui/src/app_event.rs b/codex-rs/tui/src/app_event.rs index 76ca3b24f..77a8c6748 100644 --- a/codex-rs/tui/src/app_event.rs +++ b/codex-rs/tui/src/app_event.rs @@ -313,10 +313,7 @@ pub(crate) enum AppEvent { }, /// Persist the selected realtime microphone or speaker to top-level config. - #[cfg_attr( - any(target_os = "linux", not(feature = "voice-input")), - allow(dead_code) - )] + #[cfg_attr(target_os = "linux", allow(dead_code))] PersistRealtimeAudioDeviceSelection { kind: RealtimeAudioDeviceKind, name: Option, diff --git a/codex-rs/tui/src/app_event_sender.rs b/codex-rs/tui/src/app_event_sender.rs index ba113656a..af95fd7de 100644 --- a/codex-rs/tui/src/app_event_sender.rs +++ b/codex-rs/tui/src/app_event_sender.rs @@ -63,10 +63,7 @@ impl AppEventSender { )); } - #[cfg_attr( - any(target_os = "linux", not(feature = "voice-input")), - allow(dead_code) - )] + #[cfg_attr(target_os = "linux", allow(dead_code))] pub(crate) fn realtime_conversation_audio(&self, params: ConversationAudioParams) { self.send(AppEvent::CodexOp( AppCommand::realtime_conversation_audio(params).into_core(), diff --git a/codex-rs/tui/src/lib.rs b/codex-rs/tui/src/lib.rs index 02b743fa8..df52f28fa 100644 --- a/codex-rs/tui/src/lib.rs +++ b/codex-rs/tui/src/lib.rs @@ -79,9 +79,10 @@ mod app_event; mod app_event_sender; mod app_server_session; mod ascii_animation; -#[cfg(all(not(target_os = "linux"), feature = "voice-input"))] +#[cfg(not(target_os = "linux"))] mod audio_device; -#[cfg(all(not(target_os = "linux"), not(feature = "voice-input")))] +#[cfg(target_os = "linux")] +#[allow(dead_code)] mod audio_device { use crate::app_event::RealtimeAudioDeviceKind; @@ -151,9 +152,10 @@ pub mod update_action; mod update_prompt; mod updates; mod version; -#[cfg(all(not(target_os = "linux"), feature = "voice-input"))] +#[cfg(not(target_os = "linux"))] mod voice; -#[cfg(all(not(target_os = "linux"), not(feature = "voice-input")))] +#[cfg(target_os = "linux")] +#[allow(dead_code)] mod voice { use crate::app_event_sender::AppEventSender; use codex_core::config::Config;