Skip to content

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

fix(security): handle missing gated service credentials gracefully

Steven Enamakel9c3af2f1b1b3
diff --git a/crates/openhuman-core/src/inference/ops.rs b/crates/openhuman-core/src/inference/ops.rs
index 2aea7207e4..e56029829f 100644
--- a/crates/openhuman-core/src/inference/ops.rs
+++ b/crates/openhuman-core/src/inference/ops.rs
@@ -278,7 +278,23 @@ pub async fn inference_update_local_settings(
debug!("{LOG_PREFIX} update_local_settings:start");
let result = config_rpc::load_and_apply_local_ai_settings(update).await;
match &result {
- Ok(_) => debug!("{LOG_PREFIX} update_local_settings:ok"),
+ Ok(_) => {
+ debug!("{LOG_PREFIX} update_local_settings:ok");
+ // The endpoint, provider or models may have changed: drop the
+ // cached probe verdict so the next status poll re-probes the
+ // user's runtime instead of reporting the old endpoint's state.
+ match config_rpc::load_config_with_timeout().await {
+ Ok(config) => {
+ let runtime = crate::inference::local_runtime_config(&config);
+ local_runtime::global(&config).reset_to_idle(&runtime);
+ debug!("{LOG_PREFIX} update_local_settings:probe_reset");
+ }
+ Err(err) => warn!(
+ error = %err,
+ "{LOG_PREFIX} update_local_settings:probe_reset_skipped (config reload failed)"
+ ),
+ }
+ }
Err(err) => warn!(error = %err, "{LOG_PREFIX} update_local_settings:error"),
}
result
diff --git a/crates/openhuman-core/src/security/credentials/ops/gated_services.rs b/crates/openhuman-core/src/security/credentials/ops/gated_services.rs
index dbf0bf4cbd..7411393ba7 100644
--- a/crates/openhuman-core/src/security/credentials/ops/gated_services.rs
+++ b/crates/openhuman-core/src/security/credentials/ops/gated_services.rs
@@ -94,8 +94,9 @@ pub async fn start_credential_gated_services(config: &Config) {
// the specific stage rather than an anonymous "a service failed".
let mut tasks: Vec<(&'static str, tokio::task::JoinHandle<()>)> = Vec::new();
- // 1. Local AI (Ollama, embeddings) — the heaviest single warm-up,
- // so keeping it off the critical path for the others is the biggest win.
+ // 1. Local AI — a read-only probe of the user's own runtime endpoint
+ // (`bootstrap` never spawns a runtime or pulls a model). Kept off the
+ // critical path so a slow endpoint cannot delay the other services.
{
let config = config.clone();
tasks.push((
@@ -103,13 +104,13 @@ pub async fn start_credential_gated_services(config: &Config) {
tokio::spawn(async move {
if config.local_ai.runtime_enabled {
let step = std::time::Instant::now();
- log::debug!("[services] local AI bootstrap starting");
+ log::debug!("[services] local AI endpoint probe starting");
let runtime = crate::inference::local_runtime_config(&config);
crate::inference::host_runtime::global(&config)
.bootstrap(&runtime)
.await;
log::debug!(
- "[services] local AI bootstrapped after login ({} ms)",
+ "[services] local AI endpoint probed after login ({} ms)",
step.elapsed().as_millis()
);
} else {
@@ -192,9 +193,10 @@ pub async fn stop_credential_gated_services(config: &Config) {
log::info!("[services] voice server stopped on logout");
}
- // 4. Local AI — reset state to idle. We don't kill the Ollama process
- // (it may be serving other clients or mid-download), but we clear
- // the internal state so it re-bootstraps on next login.
+ // 4. Local AI — reset state to idle. OpenHuman never owns the local
+ // runtime process (the user runs Ollama / LM Studio / MLX), so there is
+ // nothing to stop; we only clear the cached probe verdict so the
+ // endpoint is re-probed on next login.
if config.local_ai.runtime_enabled {
let service = crate::inference::host_runtime::global(config);
let runtime = crate::inference::local_runtime_config(config);