The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(inference): allow TTS output paths under not-yet-created roots
Steven Enamakel7353d630ce4e
diff --git a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs b/crates/openhuman-core/src/inference/host_runtime/service/speech.rsindex a8b5a25554..a3073a5291 100644--- a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs+++ b/crates/openhuman-core/src/inference/host_runtime/service/speech.rs@@ -183,6 +183,10 @@ async fn validated_tts_output_path(&config.workspace_dir,&config.action_dir,);+ policy.trusted_roots.push(crate::security::TrustedRoot {+ path: config.workspace_dir.display().to_string(),+ access: crate::security::TrustedAccess::ReadWrite,+ });policy.trusted_roots.push(crate::security::TrustedRoot {path: model_root.display().to_string(),access: crate::security::TrustedAccess::ReadWrite,@@ -200,20 +204,7 @@ async fn validated_tts_output_path(.map_err(|error| format!("invalid output_path: {error}"))?;for root in [&config.workspace_dir, &model_root] {- let root_probe = root.join(".openhuman-tts-root-check");- let root_probe_string = root_probe- .to_str()- .ok_or_else(|| "could not resolve allowed TTS path root".to_string())?;- let resolved_probe = policy- .validate_parent_path(root_probe_string)- .await- .map_err(|error| format!("could not resolve allowed TTS path root: {error}"))?;- let resolved_root = resolved_probe.parent().ok_or_else(|| {- format!(- "could not resolve allowed TTS path root: {}",- root.display()- )- })?;+ let resolved_root = canonicalize_path_with_missing_suffix(root).await?;if resolved.starts_with(&resolved_root) {return Ok(resolved);}@@ -224,6 +215,33 @@ async fn validated_tts_output_path()}+async fn canonicalize_path_with_missing_suffix(path: &std::path::Path) -> Result<PathBuf, String> {+ let mut ancestor = path;+ let mut missing = Vec::new();+ while tokio::fs::metadata(ancestor).await.is_err() {+ let name = ancestor.file_name().ok_or_else(|| {+ format!(+ "could not resolve allowed TTS path root: {}",+ path.display()+ )+ })?;+ missing.push(name.to_os_string());+ ancestor = ancestor.parent().ok_or_else(|| {+ format!(+ "could not resolve allowed TTS path root: {}",+ path.display()+ )+ })?;+ }+ let mut resolved = tokio::fs::canonicalize(ancestor)+ .await+ .map_err(|error| format!("could not resolve allowed TTS path root: {error}"))?;+ for component in missing.iter().rev() {+ resolved.push(component);+ }+ Ok(resolved)+}+#[cfg(test)]#[path = "speech_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs b/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rsindex 587a36620f..665a495999 100644--- a/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs+++ b/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs@@ -44,6 +44,8 @@ async fn tts_output_path_allows_workspace_and_local_ai_models_roots() {let mut config = enabled_config(&tmp);config.autonomy.enabled = true;config.autonomy.workspace_only = true;+ config.action_dir = tmp.path().join("action");+ std::fs::create_dir_all(&config.action_dir).unwrap();let runtime = crate::inference::local_runtime_config(&config);let model_root = tinyinference_local::service::paths::config_root_dir(&runtime).join("models")