Skip to content

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

fix(config): build the context-aware config load on load_config_with_timeout (#7032)

oxoxDev19aff4fa1c97
diff --git a/crates/openhuman-core/src/config/ops/loader/load.rs b/crates/openhuman-core/src/config/ops/loader/load.rs
index dc01179acd..b406739f93 100644
--- a/crates/openhuman-core/src/config/ops/loader/load.rs
+++ b/crates/openhuman-core/src/config/ops/loader/load.rs
@@ -59,24 +59,22 @@ pub async fn load_config_with_timeout() -> Result<Config, String> {
/// its context, else the persisted config (initialised on first run).
///
/// The context-aware counterpart of [`Config::load_or_init`] for code that
-/// runs inside a turn. Unlike [`load_config_with_timeout`], it keeps the
-/// `anyhow` error and adds no timeout.
+/// runs inside a turn: [`load_config_with_timeout`] with the context's
+/// inference route applied.
pub async fn load_current_or_init() -> anyhow::Result<Config> {
- if let Some(mut config) = crate::core::runtime::context::CoreContext::current_embedder_config()
- {
+ let mut config = load_config_with_timeout()
+ .await
+ .map_err(anyhow::Error::msg)?;
+ if let Some(route) = config.ephemeral_route.clone() {
tracing::trace!(
agent = crate::core::runtime::agent_scope::current_agent_id()
.as_deref()
.unwrap_or(""),
- "[config] using the context's config"
+ "[config] applying the context's inference route"
);
- normalize_loaded_config(&mut config).await;
- if let Some(route) = config.ephemeral_route.clone() {
- crate::config::schema::ephemeral_route::apply(&mut config, route);
- }
- return Ok(config);
+ crate::config::schema::ephemeral_route::apply(&mut config, route);
}
- Config::load_or_init().await
+ Ok(config)
}
/// Loads the config that belongs to `workspace_dir`, rather than whichever one
diff --git a/scripts/ci/saas-ambient-baseline.json b/scripts/ci/saas-ambient-baseline.json
index 23c17845eb..8af3111d4f 100644
--- a/scripts/ci/saas-ambient-baseline.json
+++ b/scripts/ci/saas-ambient-baseline.json
@@ -174,13 +174,6 @@
"text": "match tokio::time::timeout(CONFIG_LOAD_TIMEOUT, Config::load_or_init()).await {",
"occurrence": 1
},
- {
- "rule": "ambient-config",
- "path": "crates/openhuman-core/src/config/ops/loader/load.rs",
- "line": 79,
- "text": "Config::load_or_init().await",
- "occurrence": 1
- },
{
"rule": "env-mutation",
"path": "crates/openhuman-core/src/config/ops/loader/runtime_flags.rs",