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
refactor(web_chat): pass host turn env into run_chat_task
Steven Enamakel324985921643
diff --git a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rsindex 2a4a78292c..23f8eebb0e 100644--- a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs+++ b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs@@ -67,19 +67,22 @@ pub(crate) async fn spawn_parallel_turn(task_cancel_token,origin.clone(),approval_ctx,- run_chat_task(- &client_id_task,- &thread_id_task,- &request_id_task,- &user_message,- model_override,- temperature,- locale,- run_queue,- metadata,- origin.clone(),- /* fork */ true,- ),+ |host_env| {+ run_chat_task(+ &client_id_task,+ &thread_id_task,+ &request_id_task,+ &user_message,+ model_override,+ temperature,+ locale,+ run_queue,+ metadata,+ origin.clone(),+ /* fork */ true,+ host_env,+ )+ },).await;diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rsindex d7c26a812c..6a202a8bd2 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs@@ -510,19 +510,22 @@ async fn start_chat_inner(task_cancel_token,origin.clone(),approval_ctx,- run_chat_task(- &client_id_task,- &thread_id_task,- &request_id_task,- &user_message,- model_override,- temperature,- locale,- turn_run_queue_task,- metadata,- origin.clone(),- /* fork */ false,- ),+ |host_env| {+ run_chat_task(+ &client_id_task,+ &thread_id_task,+ &request_id_task,+ &user_message,+ model_override,+ temperature,+ locale,+ turn_run_queue_task,+ metadata,+ origin.clone(),+ /* fork */ false,+ host_env,+ )+ },).await;diff --git a/crates/openhuman-core/src/web_chat/ops/turn_guards.rs b/crates/openhuman-core/src/web_chat/ops/turn_guards.rsindex facf2c2e96..4a85d7dfcf 100644--- a/crates/openhuman-core/src/web_chat/ops/turn_guards.rs+++ b/crates/openhuman-core/src/web_chat/ops/turn_guards.rs@@ -7,6 +7,7 @@ use std::time::Duration;use tokio_util::sync::CancellationToken;use super::super::types::WebChatTaskResult;+use crate::agent::turn_env::HostTurnEnv;/// Resolve the per-turn wall-clock backstop. Returns `None` when disabled/// (env `OPENHUMAN_WEB_TURN_TIMEOUT_SECS=0`).diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rsindex 6e3eea847f..7b18f1b185 100644--- a/crates/openhuman-core/src/web_chat/run_task.rs+++ b/crates/openhuman-core/src/web_chat/run_task.rs@@ -41,6 +41,9 @@ pub(crate) async fn run_chat_task(// cache, so a concurrent same-thread (parallel) turn cannot clobber — or be// clobbered by — the primary turn's cached agent. See `QueueMode::Parallel`.fork: bool,+ // This turn's host environment (its Stop cancellation, the wall-clock+ // backstop's deadline), handed to the session so the whole run tree sees it.+ host_env: crate::agent::turn_env::HostTurnEnv,) -> 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;@@ -157,6 +160,7 @@ pub(crate) async fn run_chat_task(agent.set_on_progress(Some(progress_tx));agent.set_run_queue(Some(run_queue));agent.set_thread_id(Some(thread_id));+ agent.set_host_env(host_env);// Also the turn's workspace, so attachment reads and delegated sub-agents// (which load a fresh config) use the folder its uploads were staged in// (#7714). Same pattern as `agent_chat`'s per-turn cwd.