Skip to content

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

chore: files changed crates/openhuman-core/src/flows/bus/run_digest.rs,crates/openhuman-core/src/mod

Steven Enamakele396ca121612
diff --git a/crates/openhuman-core/src/flows/bus/run_digest.rs b/crates/openhuman-core/src/flows/bus/run_digest.rs
index e079c59524..0fa6d34930 100644
--- a/crates/openhuman-core/src/flows/bus/run_digest.rs
+++ b/crates/openhuman-core/src/flows/bus/run_digest.rs
@@ -5,7 +5,7 @@
use crate::config::Config;
use crate::core::events::DomainEvent;
-use crate::flows::store;
+use crate::flows::{catalog_storage, store};
use crate::memory::types::{ForgetParams, ItemsListParams, MAX_LIMIT};
use async_trait::async_trait;
use std::sync::Arc;
@@ -77,26 +77,66 @@ impl FlowRunDigestSubscriber {
return;
}
- let flow_name = match store::get_flow(&config, flow_id) {
- Ok(Some(flow)) => flow.name,
- Ok(None) => {
- tracing::debug!(target: "flows", %flow_id, %run_id, "[flows] digest: flow no longer exists — skipping");
+ let storage = match catalog_storage::register(&ctx, &config).await {
+ Ok(registration) => registration.storage(),
+ Err(error) => {
+ tracing::warn!(target: "flows", %flow_id, %run_id, %error, "[flows] digest: failed to register scoped CatalogStorage");
return;
}
- Err(e) => {
- tracing::warn!(target: "flows", %flow_id, %run_id, error = %e, "[flows] digest: failed to load flow — skipping");
+ };
+ let proxy = match crate::modules::tinyflows::catalog_proxy(&config).await {
+ Ok(proxy) => proxy,
+ Err(error) => {
+ tracing::warn!(target: "flows", %flow_id, %run_id, %error, "[flows] digest: Catalog module unavailable");
return;
}
};
- let run = match store::get_flow_run(&config, run_id) {
- Ok(Some(run)) => run,
- Ok(None) => {
- tracing::warn!(target: "flows", %flow_id, %run_id, "[flows] digest: run row not found — skipping");
+ let workflow: Option<tinyflows_bus::catalog::Workflow> = match proxy
+ .call(
+ tinyflows_bus::catalog::members::GET_WORKFLOW,
+ (storage.clone(), flow_id.to_owned()),
+ )
+ .await
+ {
+ Ok(workflow) => workflow,
+ Err(error) => {
+ tracing::warn!(target: "flows", %flow_id, %run_id, error = %error, "[flows] digest: failed to load workflow");
return;
}
- Err(e) => {
- tracing::warn!(target: "flows", %flow_id, %run_id, error = %e, "[flows] digest: failed to load run — skipping");
+ };
+ let flow_name = match workflow {
+ Some(flow) => flow.name,
+ None => {
+ tracing::debug!(target: "flows", %flow_id, %run_id, "[flows] digest: flow no longer exists — skipping");
+ return;
+ }
+ };
+
+ let wire_run: Option<tinyflows_bus::catalog::FlowRun> = match proxy
+ .call(
+ tinyflows_bus::catalog::members::GET_RUN,
+ (tinyflows_bus::catalog::RunIdRequest {
+ storage,
+ id: run_id.to_owned(),
+ },),
+ )
+ .await
+ {
+ Ok(run) => run,
+ Err(error) => {
+ tracing::warn!(target: "flows", %flow_id, %run_id, error = %error, "[flows] digest: failed to load run — skipping");
+ return;
+ }
+ };
+ let Some(wire_run) = wire_run else {
+ tracing::warn!(target: "flows", %flow_id, %run_id, "[flows] digest: run row not found — skipping");
+ return;
+ };
+ let run: FlowRun = match store::roundtrip(wire_run) {
+ Ok(run) => run,
+ Err(error) => {
+ tracing::warn!(target: "flows", %flow_id, %run_id, %error, "[flows] digest: failed to decode run — skipping");
return;
}
};
diff --git a/crates/openhuman-core/src/modules/tinyflows_tests.rs b/crates/openhuman-core/src/modules/tinyflows_tests.rs
index 245092ba45..2e8dde9edf 100644
--- a/crates/openhuman-core/src/modules/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/modules/tinyflows_tests.rs
@@ -255,3 +255,90 @@ async fn single_callback_registration_unserves_when_its_guard_drops() {
);
assert!(proxy.call::<serde_json::Value>("Ping", ()).await.is_err());
}
+
+#[cfg(feature = "modules")]
+struct CapsHostManifestProbe;
+
+#[cfg(feature = "modules")]
+#[async_trait::async_trait]
+impl tinybus::service::Interface for CapsHostManifestProbe {
+ fn name(&self) -> tinybus::InterfaceName {
+ tinybus::InterfaceName::new(tinyflows_bus::runs::CAPS_INTERFACE)
+ .expect("CapsHost interface name")
+ }
+
+ fn members(&self) -> Vec<tinybus::MemberName> {
+ vec![tinybus::MemberName::new("AgentCancel").expect("member name")]
+ }
+
+ async fn call(
+ &self,
+ _member: &tinybus::MemberName,
+ _args: serde_json::Value,
+ ) -> tinybus::Result<serde_json::Value> {
+ Ok(serde_json::Value::Null)
+ }
+}
+
+#[cfg(feature = "modules")]
+#[tokio::test]
+async fn serving_caps_host_advertises_v2_without_replacing_other_peer_manifest_entries() {
+ let runtime = super::super::runtime::runtime()
+ .await
+ .expect("module runtime exists");
+ let connection = runtime.connection();
+ let other_interface = tinybus::InterfaceName::new("ai.tinyhumans.openhuman.TestPreserved")
+ .expect("interface name");
+ let caps_interface = tinybus::InterfaceName::new(tinyflows_bus::runs::CAPS_INTERFACE)
+ .expect("CapsHost interface name");
+ let mut original = connection
+ .manifest_of(HOST_BUS_NAME)
+ .await
+ .expect("manifest lookup succeeds")
+ .unwrap_or_else(|| tinybus::PeerManifest::new("openhuman-module-host"));
+ original.provides.retain(|item| item.interface != caps_interface);
+ original.provides.push(tinybus::InterfaceVersion::provided(
+ caps_interface.clone(),
+ tinybus::Version::new(1, 0, 0),
+ ));
+ original.provides.push(tinybus::InterfaceVersion::provided(
+ other_interface,
+ tinybus::Version::new(4, 2, 0),
+ ));
+ let prior_consumes = original.consumes.clone();
+ connection
+ .announce(&original)
+ .await
+ .expect("prior manifest can be announced");
+
+ let path = format!(
+ "/ai/tinyhumans/openhuman/CapsHost/{}",
+ uuid::Uuid::new_v4().simple()
+ );
+ let registration = serve_registered(path, CapsHostManifestProbe)
+ .await
+ .expect("CapsHost registration succeeds");
+ let announced = connection
+ .manifest_of(HOST_BUS_NAME)
+ .await
+ .expect("manifest lookup succeeds")
+ .expect("the module runtime peer is announced");
+
+ let caps_host = announced
+ .provided(&caps_interface)
+ .expect("CapsHost is advertised");
+ assert_eq!(caps_host.speaks, tinybus::Version::new(2, 0, 0));
+ assert!(announced
+ .provides
+ .iter()
+ .any(|item| item.interface.as_str() == "ai.tinyhumans.openhuman.TestPreserved"));
+ assert_eq!(announced.consumes, prior_consumes);
+
+ let proxy = connection
+ .proxy(HOST_BUS_NAME, &registration.0, tinyflows_bus::runs::CAPS_INTERFACE)
+ .expect("CapsHost proxy resolves");
+ proxy
+ .call::<serde_json::Value>("AgentCancel", (serde_json::json!({"client_request_id":"probe"}),))
+ .await
+ .expect("the advertised member is actually served");
+}