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
feat(modules): add terminal unavailability check for registry modules
Steven Enamakel037e06a66800
diff --git a/crates/openhuman-core/src/modules/runtime.rs b/crates/openhuman-core/src/modules/runtime.rsindex 1ef53c0771..f55fe210e7 100644--- a/crates/openhuman-core/src/modules/runtime.rs+++ b/crates/openhuman-core/src/modules/runtime.rs@@ -134,6 +134,38 @@ pub fn is_module_serving(id: &str) -> bool {})}+/// Whether an already-started module host has recorded a terminal state for+/// this registry module. An absent or initializing module is transient: an+/// optional background prewarm may still start or wait for it.+#[must_use]+pub fn is_module_terminally_unavailable(id: &str) -> bool {+ let Some(record) = crate::modules::registry::find(id) else {+ return true;+ };+ let Some(Ok(runtime)) = RUNTIME.get() else {+ return false;+ };+ runtime+ .host()+ .list()+ .into_iter()+ .find(|module| {+ module.manifest.bus_name.as_str() == record.bus_name+ && module.manifest.object_path.as_str() == record.object_path+ })+ .is_some_and(|module| {+ matches!(+ module.state,+ tinybus::module::ModuleState::Rejected { .. }+ | tinybus::module::ModuleState::Unresolved { .. }+ | tinybus::module::ModuleState::Faulted { .. }+ | tinybus::module::ModuleState::Failed { .. }+ | tinybus::module::ModuleState::Stopped+ | tinybus::module::ModuleState::Disabled+ )+ })+}+#[cfg(test)]#[path = "runtime_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/modules/runtime_tests.rs b/crates/openhuman-core/src/modules/runtime_tests.rsindex d6c0b6bcc8..37c20944d2 100644--- a/crates/openhuman-core/src/modules/runtime_tests.rs+++ b/crates/openhuman-core/src/modules/runtime_tests.rs@@ -31,9 +31,13 @@ async fn the_module_bus_is_a_singleton_and_serves_proxies() {#[tokio::test]async fn registry_id_matches_the_live_modules_bus_address_not_package_name() {let config = crate::config::Config::default();- crate::modules::tinyflows::copilot_proxy(&config)+ let proxy = crate::modules::tinyflows::copilot_proxy(&config).await.expect("linked TinyFlows module should be admitted and serving");+ let _: Vec<tinyflows_bus::copilot::ResourceFile> = proxy+ .call("ListResources", ())+ .await+ .expect("the resource call waits for module initialization");let record = crate::modules::registry::find(crate::modules::tinyflows::MODULE_ID).expect("TinyFlows registry record");diff --git a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs b/crates/openhuman-core/src/skills/bundled/flow_authoring.rsindex 89e7c383db..ff945ed710 100644--- a/crates/openhuman-core/src/skills/bundled/flow_authoring.rs+++ b/crates/openhuman-core/src/skills/bundled/flow_authoring.rs@@ -80,8 +80,9 @@ fn schedule_prewarm_operation(}let state = crate::modules::ops::state_of(crate::modules::tinyflows::MODULE_ID);if state == crate::modules::types::ModuleState::Failed- || (state == crate::modules::types::ModuleState::Ready- && !crate::modules::runtime::is_module_serving(crate::modules::tinyflows::MODULE_ID))+ || crate::modules::runtime::is_module_terminally_unavailable(+ crate::modules::tinyflows::MODULE_ID,+ ){return false;}diff --git a/crates/openhuman-core/src/skills/ops_discovery_tests.rs b/crates/openhuman-core/src/skills/ops_discovery_tests.rsindex d861c2ca8d..f6d961e088 100644--- a/crates/openhuman-core/src/skills/ops_discovery_tests.rs+++ b/crates/openhuman-core/src/skills/ops_discovery_tests.rs@@ -352,28 +352,6 @@ async fn flow_authoring_is_hidden_when_tinyflows_component_is_disabled() {crate::modules::tinyflows::copilot_proxy(&enabled_config).await.expect("linked TinyFlows fixture is admitted and serving");- let state = crate::modules::ops::state_of(crate::modules::tinyflows::MODULE_ID);- assert_eq!(state, crate::modules::types::ModuleState::Ready);- let module_runtime = crate::modules::runtime::runtime()- .await- .expect("module runtime should be available after Copilot proxy setup");- let loaded_modules = module_runtime.host().list();- let record = crate::modules::registry::find(crate::modules::tinyflows::MODULE_ID)- .expect("TinyFlows registry record");- let loaded_for_record = loaded_modules.iter().find(|module| {- module.manifest.bus_name.as_str() == record.bus_name- && module.manifest.object_path.as_str() == record.object_path- });- let serving = crate::modules::runtime::is_module_serving(crate::modules::tinyflows::MODULE_ID);- eprintln!(- "flow resource readiness: resolver={state:?}, expected={}:{}, observed={loaded_for_record:#?}, serving={serving}",- record.bus_name,- record.object_path,- );- assert!(- serving,- "TinyFlows registry status should resolve the admitted host snapshot: {loaded_modules:#?}"- );let visible = CoreContext::scope(enabled_ctx, async {let dispatch = crate::core::runtime::DispatchCtx::ambient();let gate = crate::skills::ops_discover::DiscoveryGate::from_config(@@ -391,6 +369,9 @@ async fn flow_authoring_is_hidden_when_tinyflows_component_is_disabled() {Some(enabled_domains),).await;+ assert!(crate::modules::runtime::is_module_serving(+ crate::modules::tinyflows::MODULE_ID+ ));crate::skills::load_workflow_metadata_for(&dispatch, &enabled_config)}).await;