Skip to content

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

fix(core): handle missing delivery channel in bus routing

Steven Enamakelecc562e197ff
diff --git a/crates/openhuman-core/src/channels/bus/delivery.rs b/crates/openhuman-core/src/channels/bus/delivery.rs
index 51a0bb1118..be43e5f994 100644
--- a/crates/openhuman-core/src/channels/bus/delivery.rs
+++ b/crates/openhuman-core/src/channels/bus/delivery.rs
@@ -217,9 +217,8 @@ pub(super) async fn build_channel_client() -> Option<(crate::backend::BackendCli
return None;
}
};
- let api_url = crate::api::config::effective_backend_api_url(&config.api_url);
let jwt = relay_session_token(&config, "send")?;
- match crate::backend::BackendClient::new(&api_url) {
+ match crate::backend::BackendClient::from_config(&config) {
Ok(c) => Some((c, jwt)),
Err(e) => {
tracing::error!("[channel-inbound] failed to create API client: {}", e);
@@ -238,12 +237,11 @@ pub(super) async fn send_channel_reply(channel: &str, text: &str) {
}
};
- let api_url = crate::api::config::effective_backend_api_url(&config.api_url);
let Some(jwt) = relay_session_token(&config, "reply") else {
return;
};
- let client = match crate::backend::BackendClient::new(&api_url) {
+ let client = match crate::backend::BackendClient::from_config(&config) {
Ok(c) => c,
Err(e) => {
tracing::error!("[channel-inbound] failed to create API client: {}", e);
diff --git a/crates/openhuman-core/src/config/ops/model.rs b/crates/openhuman-core/src/config/ops/model.rs
index 9d1b6b051a..5d21212f1d 100644
--- a/crates/openhuman-core/src/config/ops/model.rs
+++ b/crates/openhuman-core/src/config/ops/model.rs
@@ -715,13 +715,16 @@ pub async fn get_composio_trigger_settings() -> Result<RpcOutcome<serde_json::Va
))
}
-/// Resolve the hosted backend URL, excluding local or third-party inference
-/// overrides that must never receive OpenHuman session credentials.
-pub(crate) fn resolve_backend_api_url(config: &Config) -> String {
- crate::api::config::effective_backend_api_url(&config.api_url)
+/// Resolve the hosted backend URL through the installed backend transport,
+/// which excludes local or third-party inference overrides that must never
+/// receive OpenHuman session credentials. `None` when no transport is
+/// installed (no hosted backend).
+pub(crate) fn resolve_backend_api_url(config: &Config) -> Option<String> {
+ crate::backend::base_url(&config.api_url).ok()
}
-/// Resolves the effective backend API URL from configuration or defaults.
+/// Resolves the effective backend API URL from configuration or defaults;
+/// `api_url` is `null` when the core has no hosted backend.
pub async fn load_and_resolve_api_url() -> Result<RpcOutcome<serde_json::Value>, String> {
let config = load_config_with_timeout().await?;
let resolved = resolve_backend_api_url(&config);
diff --git a/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rs b/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rs
index d5e5cf70d3..b5e586e14d 100644
--- a/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rs
+++ b/crates/openhuman-core/src/config/ops_voice_and_autonomy_tests.rs
@@ -227,16 +227,15 @@ async fn load_and_resolve_api_url_returns_api_url_in_response() {
}
#[test]
-fn resolve_api_url_keeps_inference_overrides_away_from_backend_credentials() {
+fn resolve_api_url_comes_from_the_backend_transport() {
+ // The override guard itself lives with the transport
+ // (`openhuman-tinyhumans`); the core only forwards the configured value.
let mut config = Config::default();
- let expected_backend = crate::api::config::effective_backend_api_url(&None);
-
- for inference_url in ["http://localhost:11434/v1", "https://openrouter.ai/api/v1"] {
- config.api_url = Some(inference_url.to_string());
- let resolved = resolve_backend_api_url(&config);
- assert_ne!(resolved, inference_url);
- assert_eq!(resolved, expected_backend);
- }
+ config.api_url = Some("http://127.0.0.1:4010".to_string());
+ assert_eq!(
+ resolve_backend_api_url(&config).as_deref(),
+ Some("http://127.0.0.1:4010")
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/core/jsonrpc.rs b/crates/openhuman-core/src/core/jsonrpc.rs
index 03c751071c..1b9b8c3d71 100644
--- a/crates/openhuman-core/src/core/jsonrpc.rs
+++ b/crates/openhuman-core/src/core/jsonrpc.rs
@@ -1327,9 +1327,10 @@ async fn domain_events_handler(headers: axum::http::HeaderMap) -> Response {
/// Handler for the root endpoint, returning server information and available endpoints.
#[cfg(feature = "http-server")]
async fn root_handler() -> impl IntoResponse {
+ // `null` when no backend transport is installed.
let api_server = match crate::config::Config::load_or_init().await {
- Ok(cfg) => crate::api::config::effective_backend_api_url(&cfg.api_url),
- Err(_) => crate::api::config::effective_backend_api_url(&None),
+ Ok(cfg) => crate::backend::base_url(&cfg.api_url).ok(),
+ Err(_) => crate::backend::base_url(&None).ok(),
};
(
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index 7901d322da..9878d57911 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -443,7 +443,10 @@ pub fn spawn_socket_auto_connect(
log::debug!("[socket] No backend transport installed — skipping auto-connect");
return;
}
- let api_url = crate::api::config::effective_backend_api_url(&config.api_url);
+ let Ok(api_url) = crate::backend::base_url(&config.api_url) else {
+ log::debug!("[socket] No backend base URL — skipping auto-connect");
+ return;
+ };
let initial_token = match crate::security::credentials::jwt::get_session_token(&config) {
Ok(Some(t))
if crate::security::credentials::session_support::is_local_session_token(