Skip to content

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

feat(integrations): add periodic task source

Steven Enamakelb007600513ea
diff --git a/crates/openhuman-app/src/artifact_commands.rs b/crates/openhuman-app/src/artifact_commands.rs
index 80ba28622f..e6d572b3f6 100644
--- a/crates/openhuman-app/src/artifact_commands.rs
+++ b/crates/openhuman-app/src/artifact_commands.rs
@@ -62,7 +62,7 @@ pub async fn download_artifact_to_downloads(
if artifact_id.trim().is_empty() {
return Err("artifact_id must not be empty".to_string());
}
- let config = openhuman_rpc::embed::config::load_config_with_timeout().await?;
+ let config = openhuman_rpc::embed::config::load_host_config().await?;
let roots = openhuman_rpc::embed::artifacts::FileRoots::from_config(&config);
let source = resolve_source(&config.workspace_dir, &roots, &artifact_id).await?;
if filename.trim().is_empty() {
diff --git a/crates/openhuman-app/src/gateway/provision.rs b/crates/openhuman-app/src/gateway/provision.rs
index dbb40fca0c..6c2ce979d3 100644
--- a/crates/openhuman-app/src/gateway/provision.rs
+++ b/crates/openhuman-app/src/gateway/provision.rs
@@ -28,7 +28,7 @@ pub(super) async fn provision(
) -> Result<Provisioned, String> {
// This is intentionally loaded through the curated facade: gateway
// activation happens before the embedded RPC server may exist.
- let config = openhuman_rpc::embed::config::load_config_with_timeout().await?;
+ let config = openhuman_rpc::embed::config::load_host_config().await?;
let token = crate::core_process::generate_rpc_token();
progress("reserving the box");
diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic.rs b/crates/openhuman-core/src/integrations/task_sources/periodic.rs
index f965de8f74..9efe3fb0bf 100644
--- a/crates/openhuman-core/src/integrations/task_sources/periodic.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/periodic.rs
@@ -81,7 +81,9 @@ pub fn start_periodic_poll() {
tracing::debug!("[task_sources:periodic] scheduler already running, skipping start");
return;
}
- crate::core::runtime::DispatchCtx::ambient().spawn(async move {
+ // The loop acts for the host: every tick visits `host_default()` and then
+ // each live agent scope itself, so the spawned task needs no ambient scope.
+ DispatchCtx::host_default().spawn(async move {
tracing::info!(
tick_seconds = TICK_SECONDS,
"[task_sources:periodic] scheduler starting"
diff --git a/crates/openhuman-embed/src/config.rs b/crates/openhuman-embed/src/config.rs
index 0482ae4a27..018f52efaa 100644
--- a/crates/openhuman-embed/src/config.rs
+++ b/crates/openhuman-embed/src/config.rs
@@ -85,11 +85,17 @@ pub async fn load_or_init() -> anyhow::Result<RuntimeConfig> {
RuntimeConfig::load_or_init().await
}
-/// [`load_or_init`] under the core's RPC load timeout, honouring an
-/// embedder-scoped config in the ambient context. The error is
-/// user-presentable.
-pub async fn load_config_with_timeout() -> Result<RuntimeConfig, String> {
- openhuman_core::config::rpc::load_config_with_timeout().await
+/// [`load_or_init`] under the core's RPC load timeout, for a host entry that
+/// runs outside any turn (a desktop command, gateway activation): it reads the
+/// host's own context ([`DispatchCtx::host_default`]), honouring an
+/// embedder-supplied config on it. The error is user-presentable.
+///
+/// [`DispatchCtx::host_default`]: openhuman_core::core::runtime::DispatchCtx::host_default
+pub async fn load_host_config() -> Result<RuntimeConfig, String> {
+ openhuman_core::config::ops::load_config_in(
+ &openhuman_core::core::runtime::DispatchCtx::host_default(),
+ )
+ .await
}
/// The OpenHuman root (`~/.openhuman`, or `OPENHUMAN_WORKSPACE`'s root) that
diff --git a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
index c593c9d042..01125ac652 100644
--- a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
@@ -397,7 +397,7 @@ enabled = true
#[tokio::test(flavor = "current_thread")]
async fn tool_registry_entries_fall_back_on_current_thread_runtime() {
- let entries = registry_entries();
+ let entries = registry_entries(&openhuman_core::core::runtime::DispatchCtx::host_default());
assert!(entries
.iter()
.any(|entry| entry.tool_id == "tools.web_search"));