Skip to content

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

fix(web_chat): handle empty session ID in session lookup

Steven Enamakel58cd38dcd7d7
diff --git a/crates/openhuman-core/src/web_chat/session.rs b/crates/openhuman-core/src/web_chat/session.rs
index 9571bab8b7..83ce07e22b 100644
--- a/crates/openhuman-core/src/web_chat/session.rs
+++ b/crates/openhuman-core/src/web_chat/session.rs
@@ -21,8 +21,26 @@ pub(super) fn model_registry_signature(config: &Config) -> String {
serde_json::to_string(&config.model_registry).unwrap_or_default()
}
-pub(super) fn pick_target_agent_id(_config: &Config) -> String {
- "orchestrator".to_string()
+/// The agent a web-chat turn runs as: `[agent] chat_agent_id` when an operator
+/// set one, `orchestrator` otherwise.
+///
+/// The parameter was threaded in and ignored, so this path was pinned to the
+/// orchestrator and its definition's `max_iterations` — no config could move
+/// it, because a definition cap *overwrites* `agent.max_tool_iterations` rather
+/// than being bounded by it (`session_host::builder::factory`). An unknown or
+/// blank id falls back rather than failing the turn: the registry answers for
+/// `orchestrator` on every install, and a typo in an optional setting should
+/// not take chat down.
+pub(super) fn pick_target_agent_id(config: &Config) -> String {
+ const DEFAULT_CHAT_AGENT_ID: &str = "orchestrator";
+ config
+ .agent
+ .chat_agent_id
+ .as_deref()
+ .map(str::trim)
+ .filter(|id| !id.is_empty())
+ .unwrap_or(DEFAULT_CHAT_AGENT_ID)
+ .to_string()
}
pub(crate) fn normalize_model_override(model_override: Option<String>) -> Option<String> {