Skip to content

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

fix(flows): resolve dedup flow lookups in the owning agent scope

Steven Enamakel33162036ac67
diff --git a/crates/openhuman-core/src/desktop/notifications/bus.rs b/crates/openhuman-core/src/desktop/notifications/bus.rs
index 0963e54562..7b80b1168f 100644
--- a/crates/openhuman-core/src/desktop/notifications/bus.rs
+++ b/crates/openhuman-core/src/desktop/notifications/bus.rs
@@ -538,7 +538,9 @@ impl EventHandler<DomainEvent> for NotificationBridgeSubscriber {
Err(failed) => {
// Unknown owner: not stored rather than stored in the
// wrong scope. The live broadcast below still goes out.
- log::warn!("{LOG_PREFIX} notification owner unknown ({failed}); not persisted");
+ log::warn!(
+ "{LOG_PREFIX} notification owner unknown ({failed}); not persisted"
+ );
None
}
};
diff --git a/crates/openhuman-core/src/flows/bus/dedup_commit.rs b/crates/openhuman-core/src/flows/bus/dedup_commit.rs
index 47634eabdb..c49638fb55 100644
--- a/crates/openhuman-core/src/flows/bus/dedup_commit.rs
+++ b/crates/openhuman-core/src/flows/bus/dedup_commit.rs
@@ -202,7 +202,7 @@ impl DedupCommitSubscriber {
/// a schema + call-site change bigger than this PR's scope; reported as a
/// follow-up rather than attempted here.
fn dedup_node_ids(&self, flow_id: &str) -> Vec<String> {
- match store::get_flow(&self.config, flow_id) {
+ match store::get_flow(&super::owner::config_for_scope(&self.config), flow_id) {
Ok(Some(flow)) => flow
.graph
.nodes
diff --git a/crates/openhuman-core/src/flows/bus/owner.rs b/crates/openhuman-core/src/flows/bus/owner.rs
index ceb5ae9096..84b6aea8fe 100644
--- a/crates/openhuman-core/src/flows/bus/owner.rs
+++ b/crates/openhuman-core/src/flows/bus/owner.rs
@@ -53,7 +53,12 @@ async fn resolve(config: &Config, flow_id: &str) -> Result<Option<String>, Looku
// re-check the cached scope and resolve again when it lost the flow.
match within_agent(owner.as_deref(), has_flow(config, flow_id)).await {
Some(Ok(true)) => return Ok(owner),
- Some(Err(error)) => return Err(LookupFailed { agent: owner, error }),
+ Some(Err(error)) => {
+ return Err(LookupFailed {
+ agent: owner,
+ error,
+ })
+ }
Some(Ok(false)) | None => forget(flow_id),
}
}
diff --git a/crates/openhuman-core/src/flows/bus/run_digest.rs b/crates/openhuman-core/src/flows/bus/run_digest.rs
index 8e379f8e3b..365d2dcef4 100644
--- a/crates/openhuman-core/src/flows/bus/run_digest.rs
+++ b/crates/openhuman-core/src/flows/bus/run_digest.rs
@@ -101,8 +101,7 @@ impl FlowRunDigestSubscriber {
// A machine-written run summary: searchable, but no facts or
// beliefs about the user are derived from it.
meta.derive = Some(false);
- match crate::memory::ops::store_item(&config, StoreItem::document(digest, meta)).await
- {
+ match crate::memory::ops::store_item(&config, StoreItem::document(digest, meta)).await {
Ok(receipt) => {
tracing::debug!(target: "flows", %flow_id, %run_id, replayed = receipt.replayed, "[flows] digest: run digest stored");
}
diff --git a/crates/openhuman-core/src/storage/agents.rs b/crates/openhuman-core/src/storage/agents.rs
index 2def6a3dc2..ae633eeede 100644
--- a/crates/openhuman-core/src/storage/agents.rs
+++ b/crates/openhuman-core/src/storage/agents.rs
@@ -234,7 +234,10 @@ impl std::fmt::Display for LookupFailed {
///
/// [`LookupFailed`] when no scope reported the record and at least one
/// scope's probe failed.
-pub async fn find_owner<F, Fut>(label: &str, probe: F) -> Result<Option<Option<String>>, LookupFailed>
+pub async fn find_owner<F, Fut>(
+ label: &str,
+ probe: F,
+) -> Result<Option<Option<String>>, LookupFailed>
where
F: Fn() -> Fut,
Fut: Future<Output = Result<bool, String>>,