Skip to content

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

refactor(web_chat): adjust config loading in turn host

Steven Enamakele18b48d4695a
diff --git a/crates/openhuman-core/src/web_chat/turn_host.rs b/crates/openhuman-core/src/web_chat/turn_host.rs
index 20280fb5da..151a79beef 100644
--- a/crates/openhuman-core/src/web_chat/turn_host.rs
+++ b/crates/openhuman-core/src/web_chat/turn_host.rs
@@ -89,17 +89,18 @@ impl WebHost {
let ctx = Self::ctx_of(request)?;
let id = request.request_id.as_str();
let payload = &request.payload;
- let lease_config = self
- .shared
- .with(id, |slot| slot.config.clone())
- .ok_or_else(|| "web chat turn started without resolved configuration".to_owned())?;
+ // The runner has not checked out a session yet, so per-request state
+ // cannot contain a resolved config at this point. Load it from the
+ // request's trusted dispatch context before deriving the durable
+ // session identity; the resolved copy is saved in the slot below.
+ let mut config = ctx.load_config().await?;
// The harness lock is local to this WebRuntime. Native channel and
// relay runners use the same agent-domain lease before checking out
// this durable identity, so separate surface runners cannot resume
// and commit the same transcript concurrently.
let tenant = ctx.tenant().map_err(|error| error.to_string())?;
let tenant_scope = crate::core::runtime::tenant::tenant_key(&tenant, "");
- let agent_id = super::session::pick_target_agent_id(&lease_config);
+ let agent_id = super::session::pick_target_agent_id(&config);
// A parallel fork has its own transcript identity, while the other
// queue modes resume the canonical thread session.
let session_identity = if policy == CheckoutPolicy::Fork {
@@ -144,7 +145,6 @@ impl WebHost {
return Ok(session);
}
- let mut config = ctx.load_config().await?;
// A thread started in a chosen folder acts there, not in the global
// `action_dir`. Applied before checkout so the session agent, its
// security policy (which grants `action_dir` as a trusted root) and its