The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(profiles): release turn gate when relay task fails
Steven Enamakel6e6828e3939f
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex 98dee66cac..22660f4fd9 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -106,7 +106,7 @@ pub(crate) async fn run_relay_turn(request_id: String,) -> Vec<String> {// One turn at a time per profile: wait behind its chat and cron turns.- let _turn = crate::profiles::turn_gate::acquire().await;+ let _turn = crate::profiles::turn_gate::acquire(&dispatch_ctx).await;let workspace_dir = config.workspace_dir.clone();// The thread is busy for the whole turn, so a background result due on it// waits instead of landing mid-turn. The pipeline's session id does notdiff --git a/crates/openhuman-core/src/profiles/turn_gate.rs b/crates/openhuman-core/src/profiles/turn_gate.rsindex 9ac7fd032d..7cb57a940f 100644--- a/crates/openhuman-core/src/profiles/turn_gate.rs+++ b/crates/openhuman-core/src/profiles/turn_gate.rs@@ -37,8 +37,8 @@ pub async fn acquire_profile(profile: &str) -> TurnGuard {/// Wait for the gate of the profile the calling task runs for, or return/// `None` at once when it runs for no profile.-pub async fn acquire() -> Option<TurnGuard> {- let profile = crate::core::runtime::current_tenant().ok()?.profile?;+pub async fn acquire(ctx: &crate::core::runtime::DispatchCtx) -> Option<TurnGuard> {+ let profile = ctx.tenant().ok()?.profile?;Some(acquire_profile(&profile).await)}diff --git a/crates/openhuman-core/src/profiles/turn_gate_tests.rs b/crates/openhuman-core/src/profiles/turn_gate_tests.rsindex 2e65ef4ebf..66f1b85742 100644--- a/crates/openhuman-core/src/profiles/turn_gate_tests.rs+++ b/crates/openhuman-core/src/profiles/turn_gate_tests.rs@@ -27,5 +27,5 @@ async fn other_profiles_are_not_held_up() {#[tokio::test]async fn work_without_a_profile_is_not_gated() {- assert!(acquire().await.is_none());+ assert!(acquire(&crate::core::runtime::DispatchCtx::ambient()).await.is_none());}diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rsindex d1ab7aae51..d10871f1b5 100644--- a/crates/openhuman-core/src/web_chat/run_task.rs+++ b/crates/openhuman-core/src/web_chat/run_task.rs@@ -52,7 +52,7 @@ pub(crate) async fn run_chat_task(approval: crate::security::approval::ApprovalTurnContext,) -> Result<WebChatTaskResult, String> {// One turn at a time per profile: wait behind its relay and cron turns.- let _turn = crate::profiles::turn_gate::acquire().await;+ let _turn = crate::profiles::turn_gate::acquire(ctx).await;#[cfg(any(test, debug_assertions))]{