Skip to content

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

feat(config): add chat_agent_id field to agent settings patch

Steven Enamakelda27461d670e
diff --git a/crates/openhuman-core/src/config/ops/agent.rs b/crates/openhuman-core/src/config/ops/agent.rs
index b807febba4..1c84e851c8 100644
--- a/crates/openhuman-core/src/config/ops/agent.rs
+++ b/crates/openhuman-core/src/config/ops/agent.rs
@@ -46,6 +46,16 @@ pub struct AgentSettingsPatch {
/// Tool/action wall-clock timeout in seconds. Validated to
/// `tool_timeout::MIN_TIMEOUT_SECS..=tool_timeout::MAX_TIMEOUT_SECS`.
pub agent_timeout_secs: Option<u64>,
+ /// Agent the web-chat path routes a turn to (`[agent] chat_agent_id`).
+ /// `Some("")`/whitespace clears the override and reverts to the
+ /// orchestrator; `Some(id)` sets it; `None` leaves it unchanged.
+ ///
+ /// Settable over RPC and not only in the TOML because the file on disk is
+ /// not reliably the file the core reads: once a user dir is active its
+ /// per-user `config.toml` takes precedence, so a value pre-written to the
+ /// root (or to a guessed user dir) is silently ignored. Going through the
+ /// running core writes wherever `Config::save` actually points.
+ pub chat_agent_id: Option<String>,
}
/// Partial update for the agent's editable filesystem roots.
@@ -220,6 +230,15 @@ pub async fn apply_agent_settings(
config.agent.agent_timeout_secs = timeout_secs;
}
+ if let Some(chat_agent_id) = update.chat_agent_id {
+ let trimmed = chat_agent_id.trim();
+ config.agent.chat_agent_id = (!trimmed.is_empty()).then(|| trimmed.to_string());
+ log::debug!(
+ "[config][agent] chat_agent_id -> {:?}",
+ config.agent.chat_agent_id
+ );
+ }
+
config.save().await.map_err(|e| e.to_string())?;
let effective = crate::tools::timeout::set_tool_timeout_secs(config.agent.agent_timeout_secs);
diff --git a/crates/openhuman-core/src/config/schemas/controllers/agent.rs b/crates/openhuman-core/src/config/schemas/controllers/agent.rs
index 875ffb43e4..87432b48bf 100644
--- a/crates/openhuman-core/src/config/schemas/controllers/agent.rs
+++ b/crates/openhuman-core/src/config/schemas/controllers/agent.rs
@@ -76,6 +76,7 @@ pub(super) fn handle_update_agent_settings(params: Map<String, Value>) -> Contro
};
let patch = config_rpc::AgentSettingsPatch {
agent_timeout_secs: update.agent_timeout_secs,
+ chat_agent_id: update.chat_agent_id,
};
match config_rpc::load_and_apply_agent_settings(patch).await {
Ok(outcome) => {