The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(registry): cover context-form registry entries
Steven Enamakele8e2fd8cf07e
diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic.rs b/crates/openhuman-core/src/integrations/task_sources/periodic.rsindex 9efe3fb0bf..75b19ad46b 100644--- a/crates/openhuman-core/src/integrations/task_sources/periodic.rs+++ b/crates/openhuman-core/src/integrations/task_sources/periodic.rs@@ -102,11 +102,12 @@ async fn run_loop() {ticker.tick().await;// `local`, then every agent that keeps its sources in its own storage// scope (`crate::storage::agents`).- for (agent, result) in- crate::storage::agents::for_each_live_scope(&DispatchCtx::host_default(), "task_sources", |ctx| async move {- run_one_tick(&ctx).await- })- .await+ for (agent, result) in crate::storage::agents::for_each_live_scope(+ &DispatchCtx::host_default(),+ "task_sources",+ |ctx| async move { run_one_tick(&ctx).await },+ )+ .await{if let Err(e) = result {tracing::warn!(error = %e, agent = agent.as_deref().unwrap_or("local"), "[task_sources:periodic] tick failed (continuing)");diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs b/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rsindex dc2bece709..bcf968301a 100644--- a/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs@@ -196,7 +196,13 @@ async fn manual_fetch_still_returns_the_explanatory_error() {std::fs::create_dir_all(&config.workspace_dir).expect("workspace");let s = source("ts-manual-path-xyz", 1800);- let outcome = pipeline::run_source_once(&crate::core::runtime::DispatchCtx::host_default(), &config, &s, FetchReason::Manual).await;+ let outcome = pipeline::run_source_once(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &s,+ FetchReason::Manual,+ )+ .await;let error = outcome.errordiff --git a/crates/openhuman-core/src/tools/registry/ops.rs b/crates/openhuman-core/src/tools/registry/ops.rsindex ee5a5f83fe..266bae2fae 100644--- a/crates/openhuman-core/src/tools/registry/ops.rs+++ b/crates/openhuman-core/src/tools/registry/ops.rs@@ -285,9 +285,7 @@ fn build_registry_entries(source: McpSource<'_>) -> Vec<ToolRegistryEntry> {McpSource::Config(config) => {connections::all_connected_tools_for_config(config).await}- McpSource::Ctx(ctx) => {- connections::all_connected_tools(ctx).await- }+ McpSource::Ctx(ctx) => connections::all_connected_tools(ctx).await,}})})diff --git a/crates/openhuman-core/src/tools/registry/ops_tests.rs b/crates/openhuman-core/src/tools/registry/ops_tests.rsindex 87fcf56837..feaa22e65c 100644--- a/crates/openhuman-core/src/tools/registry/ops_tests.rs+++ b/crates/openhuman-core/src/tools/registry/ops_tests.rs@@ -1,6 +1,7 @@use super::*;use crate::config::schema::{CapabilityProviderConfig, CapabilityProviderTrustState, Config};use crate::config::test_env::EnvVarGuard;+use crate::core::runtime::DispatchCtx;use crate::core::{FieldSchema, TypeSchema};#[test]@@ -235,7 +236,8 @@ fn get_tool_trims_and_returns_exact_entry() {#[cfg(not(feature = "mcp"))]let tool_id = "tools.web_search";- let outcome = get_tool(&DispatchCtx::host_default(), &format!(" {tool_id} ")).expect("registry lookup");+ let outcome =+ get_tool(&DispatchCtx::host_default(), &format!(" {tool_id} ")).expect("registry lookup");assert_eq!(outcome.value.tool_id, tool_id);}@@ -247,7 +249,8 @@ fn get_tool_rejects_blank_id() {#[test]fn get_tool_reports_unknown_id() {- let err = get_tool(&DispatchCtx::host_default(), "missing.tool").expect_err("unknown id should fail");+ let err =+ get_tool(&DispatchCtx::host_default(), "missing.tool").expect_err("unknown id should fail");assert!(err.contains("missing.tool"));}@@ -414,3 +417,22 @@ async fn diagnostics_report_denials_recorded_through_tinytools() {.expect("recorded denial surfaces in diagnostics");assert_eq!(denial.reason, "probe denial reason");}++#[test]+fn registry_entries_read_the_handed_context_and_agree_with_the_config_form() {+ // The context form and the config form differ only in where connected MCP+ // client servers are read from; with none connected the snapshots match, and+ // neither consults the calling task's ambient scope.+ let from_ctx = registry_entries(&DispatchCtx::unbound());+ let from_host = registry_entries(&DispatchCtx::host_default());+ let ids = |entries: &[ToolRegistryEntry]| {+ entries+ .iter()+ .map(|entry| entry.tool_id.clone())+ .collect::<Vec<_>>()+ };+ assert!(!from_ctx.is_empty());+ assert_eq!(ids(&from_ctx), ids(&from_host));+ let listed = list_tools(&DispatchCtx::host_default());+ assert_eq!(ids(&listed.value.tools), ids(&from_host));+}diff --git a/crates/openhuman-rpc/src/http_host/http_host_tests.rs b/crates/openhuman-rpc/src/http_host/http_host_tests.rsindex c2dbad0d0e..ebc3fcefe4 100644--- a/crates/openhuman-rpc/src/http_host/http_host_tests.rs+++ b/crates/openhuman-rpc/src/http_host/http_host_tests.rs@@ -5,6 +5,7 @@ use std::sync::Mutex;use axum::http::StatusCode;+use crate::core_host::core::runtime::DispatchCtx;use crate::http_host::auth::{resolve_default_auth_username_from_user_value, sanitize_basic_auth_username,};@@ -13,7 +14,6 @@ use crate::http_host::ops::{stop_hosted_dir_server,};use crate::http_host::path_utils::resolve_request_path;-use crate::core_host::core::runtime::DispatchCtx;use crate::http_host::types::StartHostedDirParams;// Serializes tests that share the process-global server registry; the guard is@@ -56,14 +56,17 @@ async fn start_serves_files_with_basic_auth() {let mut file = std::fs::File::create(&file_path).unwrap();writeln!(file, "hello from hosted dir").unwrap();- let server = start_hosted_dir_server(&DispatchCtx::host_default(), StartHostedDirParams {- directory: tmp.path().display().to_string(),- port: 0,- bind_host: "127.0.0.1".to_string(),- server_name: Some("test".to_string()),- disable_auth: false,- username: Some("tester".to_string()),- })+ let server = start_hosted_dir_server(+ &DispatchCtx::host_default(),+ StartHostedDirParams {+ directory: tmp.path().display().to_string(),+ port: 0,+ bind_host: "127.0.0.1".to_string(),+ server_name: Some("test".to_string()),+ disable_auth: false,+ username: Some("tester".to_string()),+ },+ ).await.unwrap();diff --git a/crates/openhuman-rpc/src/session_store/mod.rs b/crates/openhuman-rpc/src/session_store/mod.rsindex f5c0d3004e..f8fb1e8b8e 100644--- a/crates/openhuman-rpc/src/session_store/mod.rs+++ b/crates/openhuman-rpc/src/session_store/mod.rs@@ -102,9 +102,7 @@ async fn configured_storage_url() -> anyhow::Result<Option<String>> {&crate::core_host::core::runtime::DispatchCtx::host_default(),).await- .map_err(|error| {- anyhow::anyhow!("loading the config to resolve the storage url: {error}")- })?;+ .map_err(|error| anyhow::anyhow!("loading the config to resolve the storage url: {error}"))?;Ok(storage_url_from(env, &config))}