Skip to content

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

fix(threads): correct async and sync closures in channel projection

Steven Enamakelffca449048e5
diff --git a/crates/openhuman-core/src/threads/channel_projection.rs b/crates/openhuman-core/src/threads/channel_projection.rs
index 1056bc5858..8983706f86 100644
--- a/crates/openhuman-core/src/threads/channel_projection.rs
+++ b/crates/openhuman-core/src/threads/channel_projection.rs
@@ -118,7 +118,7 @@ pub(crate) fn bind_message(
provider_message_id: &str,
openhuman_thread_id: &str,
) -> Result<(), String> {
- let result = async {
+ let result = (|| -> Result<()> {
if openhuman_thread_id.is_empty() {
return Err(anyhow!("OpenHuman thread ID must be non-empty"));
}
@@ -126,8 +126,7 @@ pub(crate) fn bind_message(
let key = binding_key(tenant_key, channel, conversation, provider_message_id)?;
let repo = repo_for(ctx, &tenant)?;
bind_in(&repo, key, openhuman_thread_id)
- }
- .await;
+ })();
result.map_err(|error| format!("{LOG_PREFIX} bind: {error:#}"))
}
@@ -180,7 +179,7 @@ pub(crate) async fn persist_activity(
target: &ProjectedMessageTarget,
event: &tinychannels_bus::ChannelEvent,
) -> Result<(), String> {
- let result = (|| -> Result<()> {
+ let result = async {
let core = ctx
.resolved()
.ok_or_else(|| anyhow!("no trusted core context for channel projection"))?;
@@ -210,7 +209,8 @@ pub(crate) async fn persist_activity(
.await
.map_err(|error| anyhow!("persist channel activity: {error}"))?;
Ok(())
- })();
+ }
+ .await;
result.map_err(|error| format!("{LOG_PREFIX} persist activity: {error:#}"))
}