Skip to content

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

Publish the module host policy in the embeddings e2e harness\n\n`embeddings_rpc_e2e` builds only the RPC router, so nothing in it published\na module host policy. That was invisible until the reset/flush paths moved\nonto the contract: `wipe_all` now reaches the bound driver, a module-backed\ndriver refuses to load without a policy naming the workspace to open, and\ntwo of the nine tests failed with\n\n memory wipe failed: wipe_all: the module host policy was never published,\n so module 'tinymemory' cannot be loaded\n\nProduction publishes it at `modules::boot` and `core::runtime::context`,\nand `tests/memory_roundtrip_e2e.rs` does it explicitly for exactly this\nreason. This target was the outlier.\n\nDeliberately not fixed by degrading `wipe_all` when no policy exists. It\nis a destructive call: answering success when the store was never reached\nwould tell a caller their data is gone when it is not, which is a worse\noutcome than the error. The loud failure is the correct behaviour and the\nharness is what was wrong.\n\nOne workspace for the whole binary, behind a `OnceLock`, because\n`set_modules_policy` is a process-global whose first call wins. Publishing\nper test would let whichever test ran first silently own the workspace for\nall of them. The per-test `HOME` tempdirs still isolate config; the module\ncan only ever open one workspace.\n\nAll nine tests in the target pass, including the two that were failing.\n\nDiagnosis from the fleet on the PR thread — the file, the two tests, the\nprecedent and the two production publish sites were all named correctly\nthere, which is most of the work.\n

Shanu900da7079393
diff --git a/tests/embeddings_rpc_e2e.rs b/tests/embeddings_rpc_e2e.rs
index 435a37da50..eb79318c84 100644
--- a/tests/embeddings_rpc_e2e.rs
+++ b/tests/embeddings_rpc_e2e.rs
@@ -237,12 +237,52 @@ fn assert_no_rpc_error<'a>(v: &'a Value, ctx: &str) -> &'a Value {
/// Returns `(rpc_base, tempdir, guards)`. The `guards` tuple keeps all
/// `EnvVarGuard` values alive for the duration of the test.
+/// Publish the module host policy this target's core never publishes itself.
+///
+/// `wipe_all` reaches the bound driver, and a module-backed driver refuses to
+/// load until a policy names the workspace it should open — production does
+/// that at `modules::boot` and `core::runtime::context`, and
+/// `tests/memory_roundtrip_e2e.rs` does it explicitly for the same reason. This
+/// target builds only the RPC router, so nothing here did, and the two
+/// dimension-change tests failed with "the module host policy was never
+/// published".
+///
+/// Deliberately *not* fixed by degrading `wipe_all` when no policy exists. It
+/// is a destructive call: answering success when the store was never reached
+/// would tell a caller their data is gone when it is not, which is a worse
+/// failure than the error. The harness is the outlier, so the harness moves.
+///
+/// One workspace for the whole binary, behind a `OnceLock`, because
+/// `set_modules_policy` is a process-global whose first call wins. Publishing
+/// per test would let whichever test ran first silently own the workspace for
+/// all of them — the per-test `HOME` tempdirs below still isolate config, but
+/// the module can only ever open one.
+fn ensure_modules_policy() {
+ static MODULES_POLICY: OnceLock<tempfile::TempDir> = OnceLock::new();
+ let root = MODULES_POLICY.get_or_init(|| tempdir().expect("modules policy tempdir"));
+ #[cfg(feature = "modules")]
+ {
+ let workspace = root.path().to_path_buf();
+ openhuman_core::openhuman::modules::memory::set_modules_policy(Arc::new(
+ openhuman_core::openhuman::config::Config {
+ workspace_dir: workspace.clone(),
+ action_dir: workspace.clone(),
+ config_path: workspace.join("config.toml"),
+ ..openhuman_core::openhuman::config::Config::default()
+ },
+ ));
+ }
+ let _ = root;
+}
+
async fn setup_embeddings_test() -> (
String,
tempfile::TempDir,
(EnvVarGuard, EnvVarGuard, EnvVarGuard, EnvVarGuard),
tokio::task::JoinHandle<Result<(), std::io::Error>>,
) {
+ ensure_modules_policy();
+
let tmp = tempdir().expect("tempdir");
let home = tmp.path().to_path_buf();
let openhuman_home = home.join(".openhuman");