Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(voice): remove the dictation WebSocket endpoint

Steven Enamakelc95d4320d49f
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index 6db1739dc9..52c1c13d59 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -619,8 +619,7 @@ storage-file = []
# `--no-default-features --features flows` and never reads this list.
default = ["media", "skills", "flows", "mcp", "channels", "http-server", "scheduler-gate", "file-logging", "modules", "tinymemes", "storage-sqlite"]
# The core's domain-owned HTTP surfaces (#5048): the `/v1` OpenAI-compatible
-# router (`inference::http`), the WebSocket dictation handler
-# (`voice::streaming`), the `openhuman text-input run` dev server, and the MCP
+# router (`inference::http`), the `openhuman text-input run` dev server, and the MCP
# Streamable-HTTP transport (`mcp::server::http`, additionally gated by `mcp`).
# The JSON-RPC server that mounts them — `/rpc`, auth, CORS, SSE, Socket.IO,
# the listener — lives in `openhuman-rpc`, whose `server` feature turns this
diff --git a/crates/openhuman-core/src/voice/mod.rs b/crates/openhuman-core/src/voice/mod.rs
index 9673b7f7c9..175b2fa5a9 100644
--- a/crates/openhuman-core/src/voice/mod.rs
+++ b/crates/openhuman-core/src/voice/mod.rs
@@ -15,7 +15,7 @@
//! is gated behind the default-ON `voice` Cargo feature. When the feature is
//! off, [`stub`] takes its place and exposes the same public surface that
//! always-on / other-gated callers depend on (`server`, `dictation_listener`,
-//! `streaming`, `create_stt_provider`,
+//! `create_stt_provider`,
//! `effective_stt_provider`, `publish_ptt_transcript_committed`) with
//! no-op / disabled-error bodies. Keeping the two surfaces in lockstep is
//! enforced by the disabled-build check
@@ -61,13 +61,6 @@ mod types;
pub mod local_speech;
#[cfg(feature = "voice")]
pub mod postprocess;
-// `streaming` (the dictation WebSocket handler) is axum-only, so it is compiled
-// only when BOTH `voice` and `http-server` are on (#5048). With `http-server`
-// off, its sole caller (the gated core HTTP router) is absent too, so nothing
-// needs `voice::streaming`.
-#[cfg(all(feature = "voice", feature = "http-server"))]
-pub mod streaming;
-
#[cfg(feature = "voice")]
pub use factory::{
create_stt_provider, create_tts_provider, effective_stt_provider, effective_tts_provider,
diff --git a/crates/openhuman-core/src/voice/stub.rs b/crates/openhuman-core/src/voice/stub.rs
index 04ef8650b8..9daa3dbc9c 100644
--- a/crates/openhuman-core/src/voice/stub.rs
+++ b/crates/openhuman-core/src/voice/stub.rs
@@ -191,26 +191,6 @@ pub mod always_on {
pub async fn shutdown() {}
}
-// ---------------------------------------------------------------------------
-// streaming::handle_dictation_ws (provided by the real voice host adapter)
-// ---------------------------------------------------------------------------
-
-// axum-only, and its sole caller (`openhuman_rpc::server::http::dictation::dictation_ws_handler`) is
-// gated the same way, so the stub's dictation-WS surface is exclusive to the
-// `http-server` feature too (#5048): voice-OFF + http-server-OFF needs no
-// `voice::streaming` at all.
-#[cfg(feature = "http-server")]
-pub mod streaming {
- use std::sync::Arc;
-
- use axum::extract::ws::WebSocket;
-
- use crate::config::Config;
-
- /// Drop the upgraded socket immediately — there is nothing to transcribe.
- pub async fn handle_dictation_ws(_socket: WebSocket, _config: Arc<Config>) {}
-}
-
// `live::ws::handle_live_voice_ws`: with voice off there are no live
// providers, so the upgraded socket is dropped immediately.
#[cfg(feature = "http-server")]
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index 0a66c73ee0..072671125e 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -476,10 +476,8 @@ pub mod voice {
subscribe_dictation_events, subscribe_transcription_results,
};
}
- // The core carries the live-voice and dictation sockets only with voice and
- // the HTTP server compiled in. Where its features differ from embed's (a
- // workspace build unifies them separately), rpc still names these paths, so
- // embed supplies a socket-dropping stand-in rather than a missing item.
+ // Where feature unification differs between embed and core, rpc still names
+ // the live-voice path; embed supplies a socket-dropping stand-in.
pub mod live {
pub mod ws {
#[cfg(all(feature = "voice", feature = "http-server"))]
@@ -488,12 +486,6 @@ pub mod voice {
pub async fn handle_live_voice_ws<S, X, C>(_socket: S, _ctx: X, _config: C) {}
}
}
- pub mod streaming {
- #[cfg(all(feature = "voice", feature = "http-server"))]
- pub use openhuman_core::voice::streaming::handle_dictation_ws;
- #[cfg(not(all(feature = "voice", feature = "http-server")))]
- pub async fn handle_dictation_ws<S, C>(_socket: S, _config: C) {}
- }
}
pub mod web3 {
diff --git a/crates/openhuman-embed/src/host_internals_tests.rs b/crates/openhuman-embed/src/host_internals_tests.rs
index f7b6063749..1b546a1a7f 100644
--- a/crates/openhuman-embed/src/host_internals_tests.rs
+++ b/crates/openhuman-embed/src/host_internals_tests.rs
@@ -1,18 +1,8 @@
use super::*;
-// Without voice and the HTTP server the core has no socket handlers; the
-// stand-ins accept and drop whatever rpc hands them.
-#[cfg(not(all(feature = "voice", feature = "http-server")))]
-#[tokio::test]
-async fn the_voice_socket_stand_ins_drop_their_arguments() {
- voice::live::ws::handle_live_voice_ws((), (), ()).await;
- voice::streaming::handle_dictation_ws((), ()).await;
-}
-
-// With both features the real handlers are re-exported under the same paths.
+// The live voice handler and its disabled-feature stand-in share the same path.
#[cfg(all(feature = "voice", feature = "http-server"))]
#[test]
-fn the_voice_socket_handlers_are_the_cores() {
+fn the_live_voice_socket_handler_is_the_core() {
let _live = voice::live::ws::handle_live_voice_ws;
- let _dictation = voice::streaming::handle_dictation_ws;
}
diff --git a/crates/openhuman-rpc/src/server/auth.rs b/crates/openhuman-rpc/src/server/auth.rs
index 6c0fcc0fa5..1bc20148bb 100644
--- a/crates/openhuman-rpc/src/server/auth.rs
+++ b/crates/openhuman-rpc/src/server/auth.rs
@@ -10,9 +10,6 @@
//! - `GET /dev/connect` — dev-only core handoff; see `server::dev_connect`
//! - `GET /events` — SSE stream; browser `EventSource` cannot set
//! headers, so the handler enforces a bind-token / bearer credential itself
-//! - `GET /ws/dictation` — WebSocket upgrade; browser WS API cannot set
-//! headers, so the handler enforces the bearer (header or `?token=`) +
-//! origin itself before the upgrade (C4 / issue #1924)
//! - `OPTIONS *` — CORS preflight (handled by outer CORS middleware)
//!
//! Endpoints that accept the bearer either via header **or** `?token=…` query
@@ -97,7 +94,7 @@ fn is_public_path(path: &str) -> bool {
/// Add new entries here only for SSE / WebSocket routes whose clients cannot
/// send headers and that carry per-user data. The follow-up approvals stream
/// (#1339) is the next planned addition.
-const QUERY_TOKEN_PATHS: &[&str] = &["/events/webhooks", "/ws/dictation", "/ws/live-voice"];
+const QUERY_TOKEN_PATHS: &[&str] = &["/events/webhooks", "/ws/live-voice"];
/// Axum middleware: enforce `Authorization: Bearer <token>` on all protected
/// endpoints.
diff --git a/crates/openhuman-rpc/src/server/http/mod.rs b/crates/openhuman-rpc/src/server/http/mod.rs
index 7a150644f3..5d85c4a5a0 100644
--- a/crates/openhuman-rpc/src/server/http/mod.rs
+++ b/crates/openhuman-rpc/src/server/http/mod.rs
@@ -15,7 +15,6 @@ use serde_json::json;
use crate::core_host::core::types::AppState;
pub(crate) mod cors;
-mod dictation;
mod events;
mod health;
mod live_voice;
@@ -65,7 +64,6 @@ pub fn build_core_http_router(socketio_enabled: bool) -> Router {
"/rpc",
post(rpc_handler::rpc_handler).route_layer(DefaultBodyLimit::max(MAX_RPC_BODY_BYTES)),
)
- .route("/ws/dictation", get(dictation::dictation_ws_handler))
.route("/ws/live-voice", get(live_voice::live_voice_ws_handler))
.route(
"/oauth/mcp/callback",
diff --git a/docs/gitbooks/en/features/cloud-deploy.md b/docs/gitbooks/en/features/cloud-deploy.md
index eb37cce52c..278b59f01c 100644
--- a/docs/gitbooks/en/features/cloud-deploy.md
+++ b/docs/gitbooks/en/features/cloud-deploy.md
@@ -116,7 +116,6 @@ The running container exposes these endpoints:
| `GET /schema` | None. Read-only schema discovery. |
| `POST /rpc` | The bearer token. This is the executable surface. |
| `GET /events` | Exempt from the header check, because a browser `EventSource` cannot set headers, but the handler enforces its own credential. Not an open stream. |
-| `GET /ws/dictation` | The bearer token, as a header or `?token=`, checked before the WebSocket upgrade. |
| `GET /oauth/mcp/callback` | Exempt from the bearer middleware: an external authorization server posts back here with no bearer. The one-time `state`, minted in `oauth_begin`, is the guard. |
| `GET /dev/connect` | Exempt from the middleware, guarded in the handler instead: a debug build or an explicit opt-in, a loopback `app` origin and `Host`, and no cross-site navigation. It should not be reachable on a deployed core. |
| `POST /v1/chat/completions`, `GET /v1/models` | The OpenAI-compatible surface, behind core's `http-server` gate. These accept the core bearer or an external provider key, so they are executable too, not just `/rpc`. |