Skip to content

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

fix(agent): deliver background results to the originating channel

Steven Enamakelb300fc7ed8ee
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index af60bb8c4f..cf08cbc236 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -200,7 +200,7 @@ fn drain_target(event: &DomainEvent) -> Option<(&String, Option<&String>, Durati
task_id,
..
} => Some((parent_session, Some(task_id), DEBOUNCE)),
- _ => return None,
+ _ => None,
}
}
diff --git a/crates/openhuman-core/src/channels/providers/relay/store.rs b/crates/openhuman-core/src/channels/providers/relay/store.rs
index 82179c54d0..b224d81d9f 100644
--- a/crates/openhuman-core/src/channels/providers/relay/store.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/store.rs
@@ -36,11 +36,13 @@ pub fn reply_message_id(message_id: &str) -> String {
format!("assistant:{message_id}")
}
+/// The per-`(workspace, thread)` async locks [`thread_lock`] hands out.
+type ThreadLocks = Mutex<HashMap<(PathBuf, String), Arc<tokio::sync::Mutex<()>>>>;
+
/// One async lock per `(workspace, thread)`, so the duplicate check and the
/// append in [`record_inbound`] are atomic against a concurrent gateway retry.
fn thread_lock(workspace_dir: &Path, thread_id: &str) -> Arc<tokio::sync::Mutex<()>> {
- static LOCKS: OnceLock<Mutex<HashMap<(PathBuf, String), Arc<tokio::sync::Mutex<()>>>>> =
- OnceLock::new();
+ static LOCKS: OnceLock<ThreadLocks> = OnceLock::new();
let mut map = LOCKS
.get_or_init(|| Mutex::new(HashMap::new()))
.lock()