Skip to content

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

fix(cli): initialize default core context before agent dispatch

Steven Enamakeld43266076c6d
diff --git a/crates/openhuman-core/src/core/cli.rs b/crates/openhuman-core/src/core/cli.rs
index d7b8431134..1c4398a166 100644
--- a/crates/openhuman-core/src/core/cli.rs
+++ b/crates/openhuman-core/src/core/cli.rs
@@ -494,6 +494,23 @@ fn run_call_command(args: &[String]) -> Result<()> {
.map_err(|error| error.to_string())?;
}
crate::security::credentials::seed_api_key_from_env(&config);
+ // An agent turn spawns sub-agents, whose session store opens under
+ // the dispatch's resolved storage scope. Boot the process default
+ // context the way a server does, or `spawn_subagent` answers "no
+ // resolved owner scope".
+ if crate::core::runtime::CoreContext::default_context().is_none() {
+ crate::core::runtime::CoreContext::init_with_config(
+ crate::core::types::HostKind::Cli,
+ &crate::core::runtime::TokenSource::Fixed(std::sync::Arc::new(
+ uuid::Uuid::new_v4().to_string(),
+ )),
+ crate::core::runtime::DomainSet::full(),
+ Default::default(),
+ Some(config.clone()),
+ )
+ .await
+ .map_err(|error| error.to_string())?;
+ }
}
let dispatch = DispatchCtx::process_default();
let dispatch = if headless_agent_chat {