Skip to content

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

refactor(flows): use dedicated function for sandbox object path creation

Steven Enamakel54a696381c06
diff --git a/crates/openhuman-core/src/flows/builder_host.rs b/crates/openhuman-core/src/flows/builder_host.rs
index 66583dc7d3..b2894c5387 100644
--- a/crates/openhuman-core/src/flows/builder_host.rs
+++ b/crates/openhuman-core/src/flows/builder_host.rs
@@ -165,11 +165,9 @@ impl SandboxRunner for FlowsHost {
.await
.map_err(|error| error.to_string())?;
let connection = runtime.connection().clone();
- let path = format!(
- "/ai/tinyhumans/openhuman/FlowSandbox/{}",
- uuid::Uuid::new_v4()
- );
- let object_path = ObjectPath::new(&path).map_err(|error| error.to_string())?;
+ let object_path = sandbox_callback_object_path(uuid::Uuid::new_v4())
+ .map_err(|error| error.to_string())?;
+ let path = object_path.to_string();
let served_path = object_path.clone();
let callback = SandboxToolPreflight {
config: self.config.clone(),
@@ -222,6 +220,13 @@ impl SandboxRunner for FlowsHost {
const SANDBOX_CALLBACK_BUS: &str = "ai.tinyhumans.openhuman.FlowSandboxHost";
+fn sandbox_callback_object_path(id: uuid::Uuid) -> Result<tinybus::ObjectPath, tinybus::Error> {
+ tinybus::ObjectPath::new(format!(
+ "/ai/tinyhumans/openhuman/FlowSandbox/{}",
+ id.simple()
+ ))
+}
+
struct SandboxToolPreflight {
config: Arc<Config>,
dispatch: crate::core::runtime::DispatchCtx,
diff --git a/crates/openhuman-core/src/flows/builder_host_tests.rs b/crates/openhuman-core/src/flows/builder_host_tests.rs
index a06e05344c..3af7fc1aee 100644
--- a/crates/openhuman-core/src/flows/builder_host_tests.rs
+++ b/crates/openhuman-core/src/flows/builder_host_tests.rs
@@ -3,6 +3,13 @@ use super::*;
use std::sync::atomic::{AtomicUsize, Ordering};
use tokio::sync::{oneshot, Notify};
+#[test]
+fn sandbox_callback_path_is_accepted_by_tinybus() {
+ let path = super::sandbox_callback_object_path(uuid::Uuid::new_v4())
+ .expect("generated callback path is a valid TinyBus object path");
+ assert!(path.as_str().starts_with("/ai/tinyhumans/openhuman/FlowSandbox/"));
+}
+
struct DropNotice {
drops: Arc<AtomicUsize>,
completed: Arc<Notify>,