Skip to content

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

test(openhuman-embed): link tinyflows via env override in test harness

Steven Enamakel5da6b66a91c8
diff --git a/crates/openhuman-embed/tests/common/mod.rs b/crates/openhuman-embed/tests/common/mod.rs
index 356d9b286b..4de8be12e3 100644
--- a/crates/openhuman-embed/tests/common/mod.rs
+++ b/crates/openhuman-embed/tests/common/mod.rs
@@ -54,26 +54,21 @@ pub fn offline_config() -> Config {
config.agent.session_dual_write = false;
config.agent.session_shadow_reads = false;
config.default_temperature = 0.0;
- link_tinyflows(&mut config);
config
}
/// Serve the tinyflows module (scheduler runtime, job store, schedule maths)
-/// from the test binary instead of a downloaded release: the factory is
-/// registered with the core's `register_linked` seam and this config asks for
-/// it by a per-module override, so no other module changes source.
-pub fn link_tinyflows(config: &mut Config) {
- use openhuman_core::config::schema::{ModuleOverride, ModuleSourceMode};
- openhuman_embed::modules::register_linked("tinyflows", tinyflows_module::linked_module);
- config.modules.allow_download = false;
- config
- .modules
- .overrides
- .retain(|existing| existing.id != "tinyflows");
- config
- .modules
- .overrides
- .push(ModuleOverride::with_source("tinyflows", ModuleSourceMode::Linked));
+/// from the test binary instead of a downloaded release. The factory goes in
+/// through the core's `register_linked` seam, and a per-module environment
+/// override (read when the module first resolves, whichever config asks) selects
+/// it, so no other module changes source. Idempotent; every runtime these tests
+/// build calls it first.
+pub fn link_tinyflows() {
+ static ONCE: std::sync::Once = std::sync::Once::new();
+ ONCE.call_once(|| {
+ openhuman_embed::modules::register_linked("tinyflows", tinyflows_module::linked_module);
+ std::env::set_var("OPENHUMAN_MODULE_SOURCE_TINYFLOWS", "linked");
+ });
}
/// The tuned runtime the harness documents as the caller's responsibility.
@@ -87,6 +82,7 @@ pub fn runtime() -> tokio::runtime::Runtime {
/// A tuned async runtime for profile hosts which initialize keys after choosing their root.
pub fn runtime_without_master_key() -> tokio::runtime::Runtime {
+ link_tinyflows();
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.thread_stack_size(AGENT_WORKER_STACK_BYTES)