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
chore(tests): remove obsolete module host policy and agent_experience tests
Steven Enamakel401f7b10d23b
diff --git a/tests/in_process/embeddings_rpc_e2e.rs b/tests/in_process/embeddings_rpc_e2e.rsindex 106ec490e6..b9ef882f2b 100644--- a/tests/in_process/embeddings_rpc_e2e.rs+++ b/tests/in_process/embeddings_rpc_e2e.rs@@ -175,54 +175,12 @@ fn assert_no_rpc_error<'a>(v: &'a Value, ctx: &str) -> &'a Value {// ── Test scaffolding: set up HOME + OPENHUMAN_WORKSPACE then start RPC server ─-/// 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::modules::memory::set_modules_policy(Arc::new(- openhuman_core::config::Config {- workspace_dir: workspace.clone(),- action_dir: workspace.clone(),- config_path: workspace.join("config.toml"),- ..openhuman_core::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");diff --git a/tests/in_process/worker_c_modules_e2e.rs b/tests/in_process/worker_c_modules_e2e.rsindex f152c6cb85..35f0fd5ccd 100644--- a/tests/in_process/worker_c_modules_e2e.rs+++ b/tests/in_process/worker_c_modules_e2e.rs@@ -725,153 +725,19 @@ async fn threads_remaining_controller_paths_round_trip() {}#[tokio::test]-async fn memory_tree_ingest_feeds_memory_sync_status() {- let _lock = env_lock();- let harness = setup().await;- // `memory_tree_ingest` writes through the bound memory driver, which under- // the `modules` gate is the loaded tinymemory artifact and resolves its- // config from the process-wide boot policy that boot publishes and this- // harness never did. Publish it from the config this harness wrote (HOME- // points at the harness tempdir, so this names its workspace and its- // registry file). The policy is first-call-wins and the module captures- // its workspace at load; this is the only case in the binary that reaches- // the driver, so nothing else contends for the slot.- #[cfg(feature = "modules")]- openhuman_core::modules::memory::set_modules_policy(std::sync::Arc::new(- openhuman_core::config::Config::load_or_init()- .await- .expect("load the harness config for the module policy"),- ));-- let ingest = rpc(- &harness.rpc_base,- 30,- "openhuman.memory_tree_ingest",- json!({- "source_kind": "chat",- "source_id": "slack:worker-c",- "owner": "[email protected]",- "tags": ["worker-c", "memory-sync"],- "payload": {- "platform": "slack",- "channel_label": "worker-c",- "messages": [- {- "author": "[email protected]",- "text": "Worker C coverage confirms memory sync status after ingest.",- "timestamp": 1780000000000_i64,- "source_ref": "slack://worker-c/msg-1"- }- ]- }- }),- )- .await;- let ingest_payload = payload(&ingest, "memory_tree_ingest");- assert_eq!(- ingest_payload.get("source_id").and_then(Value::as_str),- Some("slack:worker-c")- );- assert_eq!(- ingest_payload.get("chunks_written").and_then(Value::as_u64),- Some(1)- );-- let statuses = rpc(- &harness.rpc_base,- 31,- "openhuman.memory_sync_status_list",- json!({}),- )- .await;- let rows = payload(&statuses, "memory_sync_status_list")- .get("statuses")- .and_then(Value::as_array)- .expect("statuses array");- let slack = rows- .iter()- .find(|row| row.get("provider").and_then(Value::as_str) == Some("slack"))- .unwrap_or_else(|| panic!("expected slack status row after ingest: {rows:?}"));- assert_eq!(slack.get("chunks_synced").and_then(Value::as_u64), Some(1));- assert_eq!(- slack.get("chunks_pending").and_then(Value::as_u64),- Some(1),- "inert embeddings leave the fresh chunk pending until an embed sidecar exists"- );-}--#[tokio::test]-async fn memory_memory_tree_and_sources_controller_surfaces_are_reachable() {+async fn memory_v2_controller_surface_is_reachable() {let _lock = env_lock();let harness = setup().await;let methods = [- "openhuman.memory_init",- "openhuman.memory_sync_all",- "openhuman.memory_sync_channel",- "openhuman.memory_ingestion_status",- "openhuman.memory_list_files",- "openhuman.memory_read_file",- "openhuman.memory_write_file",- "openhuman.memory_list_namespaces",- "openhuman.memory_query_namespace",- "openhuman.memory_clear_namespace",- "openhuman.memory_recall_memories",- "openhuman.memory_recall_context",- "openhuman.memory_context_query",- "openhuman.memory_context_recall",- "openhuman.memory_doc_put",- "openhuman.memory_doc_ingest",- "openhuman.memory_doc_list",- "openhuman.memory_doc_delete",- "openhuman.memory_list_documents",- "openhuman.memory_delete_document",- "openhuman.memory_namespace_list",- "openhuman.memory_kv_set",- "openhuman.memory_kv_get",- "openhuman.memory_kv_delete",- "openhuman.memory_kv_list_namespace",- "openhuman.memory_graph_upsert",- "openhuman.memory_graph_query",- "openhuman.memory_tool_rule_put",- "openhuman.memory_tool_rule_get",- "openhuman.memory_tool_rule_delete",- "openhuman.memory_tool_rule_list",- "openhuman.memory_tool_rules_for_prompt",- "openhuman.memory_tool_rules_json",- "openhuman.memory_learn_all",- "openhuman.memory_tree_pipeline_status",- "openhuman.memory_tree_ingest",- "openhuman.memory_tree_search",- "openhuman.memory_tree_recall",- "openhuman.memory_tree_list_sources",- "openhuman.memory_tree_list_chunks",- "openhuman.memory_tree_get_chunk",- "openhuman.memory_tree_delete_chunk",- "openhuman.memory_tree_top_entities",- "openhuman.memory_tree_chunks_for_entity",- "openhuman.memory_tree_graph_export",- "openhuman.memory_tree_entity_index_for",- "openhuman.memory_tree_memory_backfill_status",- "openhuman.memory_tree_obsidian_vault_status",- "openhuman.memory_tree_flush_now",- "openhuman.memory_tree_reset_tree",- "openhuman.memory_tree_wipe_all",- "openhuman.memory_tree_set_enabled",- "openhuman.memory_tree_query_source",- "openhuman.memory_tree_search_entities",- "openhuman.memory_tree_drill_down",- "openhuman.memory_tree_fetch_leaves",- "openhuman.memory_tree_chunk_score",+ "openhuman.memory_engines_list",+ "openhuman.memory_engine_get",+ "openhuman.memory_items_list",+ "openhuman.memory_conversations_get","openhuman.memory_sources_list",- "openhuman.memory_sources_add",- "openhuman.memory_sources_get",- "openhuman.memory_sources_update",- "openhuman.memory_sources_remove",- "openhuman.memory_sources_sync",- "openhuman.memory_sources_status_list",- "openhuman.memory_sources_list_items",- "openhuman.memory_sources_read_item",+ "openhuman.memory_context_get",+ "openhuman.memory_import_scan",+ "openhuman.memory_import_status",];for (offset, method) in methods.into_iter().enumerate() {diff --git a/tests/raw_coverage/agent_orchestration_e2e.rs b/tests/raw_coverage/agent_orchestration_e2e.rsindex 9cd710ec04..25355a1232 100644--- a/tests/raw_coverage/agent_orchestration_e2e.rs+++ b/tests/raw_coverage/agent_orchestration_e2e.rs@@ -1,8 +1,7 @@//! JSON-RPC E2E coverage for the agent-orchestration controllers that no e2e//! target reached: durable workflow-run `stop` / `resume`, the command//! center's `agent_work_control`, `agent_team_list` / `agent_team_close`, the-//! detached sub-agent controls (`subagent_cancel` / `subagent_steer`), and the-//! whole `agent_experience` store.+//! detached sub-agent controls (`subagent_cancel` / `subagent_steer`).//!//! Every case boots the real Axum JSON-RPC router over HTTP against an//! isolated `HOME` and asserts on the **content** of the response. Nothing@@ -38,7 +37,6 @@ const TEST_RPC_TOKEN: &str = "agent-orchestration-e2e-token";const BUILTIN_WORKFLOW_ID: &str = "parallel_research_cross_check";static AUTH_INIT: OnceLock<()> = OnceLock::new();-static MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();/// The crate-wide env lock, not a private one. Every aggregated suite in/// `raw_coverage_all` shares one process, so libtest runs them concurrently@@ -66,47 +64,6 @@ fn ensure_rpc_auth() -> &'static str {get_rpc_token().expect("rpc token initialized")}-/// The transport-only JSON-RPC router builds no core runtime context, so-/// neither the memory host seams nor the **module host policy** a-/// driver-backed controller (`agent_experience`) needs are installed by booting-/// it. Without the policy every call fails with "the module host policy was-/// never published, so module 'tinymemory' cannot be loaded".-///-/// Both are installed on a thread with a stack of its own: `Config::default()`-/// is large enough to overflow the 2 MiB libtest stack if materialised inside-/// an async test frame.-///-/// `MODULES_POLICY` is a process-global `OnceLock` and several other aggregated-/// suites publish their own, so **this may lose the race** — `set_modules_policy`-/// silently ignores a later call, and the loaded module keeps whichever-/// workspace won. The experience cases below are therefore written not to-/// depend on owning the store: they use ids unique to this suite and assert on-/// their own records rather than on the store being empty.-fn ensure_memory_seams() {- crate::tinyhumans_boot::boot();- MEMORY_SEAMS_INIT.get_or_init(|| {- std::thread::Builder::new()- .name("agent-orchestration-e2e-memory-seams".to_string())- .stack_size(8 * 1024 * 1024)- .spawn(|| {- let workspace = tempfile::tempdir()- .expect("module workspace tempdir")- .keep()- .join("workspace");- std::fs::create_dir_all(&workspace).expect("create module workspace");- let config = Arc::new(openhuman_core::config::Config {- workspace_dir: workspace,- ..openhuman_core::config::Config::default()- });- #[cfg(feature = "modules")]- openhuman_core::modules::memory::set_modules_policy(config);- })- .expect("spawn agent orchestration e2e seam installer")- .join()- .expect("agent orchestration e2e seam installer panicked");- });-}-async fn serve_rpc() -> (SocketAddr,&'static str,@@ -792,261 +749,3 @@ async fn subagent_steer_honours_and_defaults_the_queue_mode() {h.join.abort();}--// ── agent_experience ────────────────────────────────────────────────────────--fn experience(id: &str, summary: &str, lesson: &str, tools: &[&str], tags: &[&str]) -> Value {- let now = 1_760_000_000_000i64;- json!({- "id": id,- "created_at_ms": now,- "updated_at_ms": now,- "source": "manual",- "agent_id": "planner",- "entrypoint": "chat",- "task_fingerprint": format!("fp-{id}"),- "task_summary": summary,- "tools_used": tools,- "tool_sequence": tools,- "outcome": "success",- "error_class": null,- "lesson": lesson,- "reuse_hint": "reuse when the same tools are available",- "avoid_hint": null,- "confidence": 0.9,- "tags": tags,- "payload_hash": null,- "dismissed": false- })-}--/// The procedural-experience store end to end: capture persists, list reads-/// back, retrieve ranks against a task query, and dismiss takes a record out of-/// retrieval **without** deleting it.-#[tokio::test]-async fn agent_experience_capture_list_retrieve_and_dismiss_round_trip() {- let _lock = env_lock();- ensure_memory_seams();- let h = setup().await;-- let before: Vec<String> = h- .ok(3701, "openhuman.agent_experience_list", json!({}))- .await- .as_array()- .expect("list returns an array")- .iter()- .map(|entry| str_at(entry, "/id").to_string())- .collect();- assert!(- !before.iter().any(|id| id.starts_with("w1exp-")),- "this suite's ids are unique to it, so none may pre-exist: {before:?}"- );-- let stored = h- .ok(- 3702,- "openhuman.agent_experience_capture",- json!({- "experience": experience(- "w1exp-deploy",- "deploy the staging build",- "run the migration before restarting the service",- &["shell_exec", "http_request"],- &["deploy", "staging"],- ),- }),- )- .await;- assert_eq!(- stored.get("id").and_then(Value::as_str),- Some("w1exp-deploy"),- "capture returns the stored record: {stored}"- );- assert_eq!(- stored.get("dismissed").and_then(Value::as_bool),- Some(false)- );-- h.ok(- 3703,- "openhuman.agent_experience_capture",- json!({- "experience": experience(- "w1exp-unrelated",- "reconcile the invoice ledger",- "always reconcile before closing the month",- &["read_file"],- &["finance"],- ),- }),- )- .await;-- let listed = h- .ok(3704, "openhuman.agent_experience_list", json!({}))- .await;- let mine: Vec<&str> = listed- .as_array()- .expect("list returns an array")- .iter()- .map(|entry| str_at(entry, "/id"))- .filter(|id| id.starts_with("w1exp-"))- .collect();- assert_eq!(mine.len(), 2, "both captures are readable: {listed}");- assert!(mine.contains(&"w1exp-deploy") && mine.contains(&"w1exp-unrelated"));-- // Retrieval must RANK, not just return everything: the deploy query has to- // put the deploy experience first.- let hits = h- .ok(- 3705,- "openhuman.agent_experience_retrieve",- json!({- "query": "deploy the staging build",- "tools": ["shell_exec"],- "tags": ["deploy"],- "max_hits": 5,- }),- )- .await;- let hits = hits.as_array().expect("retrieve returns an array").clone();- let rank = |id: &str| {- hits.iter()- .position(|hit| hit.pointer("/experience/id").and_then(Value::as_str) == Some(id))- };- let deploy_rank = rank("w1exp-deploy")- .unwrap_or_else(|| panic!("the captured experience is recalled: {hits:?}"));- if let Some(unrelated_rank) = rank("w1exp-unrelated") {- assert!(- deploy_rank < unrelated_rank,- "retrieval RANKS: the deploy query puts the deploy experience above \- the finance one ({deploy_rank} vs {unrelated_rank}): {hits:?}"- );- }- let hit = &hits[deploy_rank];- assert!(- hit.get("score")- .and_then(Value::as_f64)- .is_some_and(|score| score > 0.0),- "a hit carries a positive score: {hit:?}"- );- assert!(- hit.get("match_reasons")- .and_then(Value::as_array)- .is_some_and(|reasons| !reasons.is_empty()),- "and says why it matched: {hit:?}"- );-- // `max_hits` is a cap, not a hint.- let capped = h- .ok(- 3706,- "openhuman.agent_experience_retrieve",- json!({ "query": "deploy the staging build", "max_hits": 1 }),- )- .await;- assert!(- capped.as_array().map(Vec::len).unwrap_or(0) <= 1,- "retrieve honours max_hits: {capped}"- );-- let dismissed = h- .ok(- 3707,- "openhuman.agent_experience_dismiss",- json!({ "id": "w1exp-deploy" }),- )- .await;- assert_eq!(- dismissed.get("id").and_then(Value::as_str),- Some("w1exp-deploy")- );- assert_eq!(- dismissed.get("dismissed").and_then(Value::as_bool),- Some(true),- "an existing experience is marked dismissed: {dismissed}"- );-- let after = h- .ok(- 3708,- "openhuman.agent_experience_retrieve",- json!({ "query": "deploy the staging build", "max_hits": 5 }),- )- .await;- assert!(- !after- .as_array()- .expect("retrieve array")- .iter()- .any(- |hit| hit.pointer("/experience/id").and_then(Value::as_str) == Some("w1exp-deploy")- ),- "a dismissed experience is out of retrieval: {after}"- );-- // Dismissing something absent is reported, not raised.- let absent = h- .ok(- 3709,- "openhuman.agent_experience_dismiss",- json!({ "id": "w1exp-does-not-exist" }),- )- .await;- assert_eq!(- absent.get("dismissed").and_then(Value::as_bool),- Some(false),- "dismissing an unknown id reports false rather than erroring: {absent}"- );-- h.join.abort();-}--/// Every `agent_experience` controller deserializes its params as a typed-/// struct, so a missing or wrongly shaped field is rejected at the boundary-/// instead of being defaulted into a silently wrong record.-#[tokio::test]-async fn agent_experience_controllers_reject_malformed_params() {- let _lock = env_lock();- ensure_memory_seams();- let h = setup().await;-- let no_experience = h- .err(3801, "openhuman.agent_experience_capture", json!({}))- .await;- assert!(- no_experience.contains("experience"),- "capture names the field it needs: {no_experience}"- );-- // A record missing a required field must not be defaulted into existence.- let incomplete = h- .err(- 3802,- "openhuman.agent_experience_capture",- json!({ "experience": { "id": "w1exp-partial", "task_summary": "half a record" } }),- )- .await;- assert!(- !incomplete.is_empty(),- "an incomplete experience is refused: {incomplete}"- );-- let no_query = h- .err(3803, "openhuman.agent_experience_retrieve", json!({}))- .await;- assert!(- no_query.contains("query"),- "retrieve names its required query: {no_query}"- );-- let no_id = h- .err(3804, "openhuman.agent_experience_dismiss", json!({}))- .await;- assert!(- no_id.contains("id"),- "dismiss names its required id: {no_id}"- );-- h.join.abort();-}diff --git a/tests/raw_coverage/automation_scheduling_e2e.rs b/tests/raw_coverage/automation_scheduling_e2e.rsindex 59fabac2ab..946d9df5c3 100644--- a/tests/raw_coverage/automation_scheduling_e2e.rs+++ b/tests/raw_coverage/automation_scheduling_e2e.rs@@ -104,9 +104,6 @@ embedding_provider = "none"embedding_model = "none"embedding_dimensions = 0-[memory_tree]-embedding_strict = false-spacy_enabled = false"#;/// Prove the disable switches actually bound to the fields harness-init reads,@@ -122,10 +119,6 @@ fn assert_provisioning_is_disabled() -> openhuman_core::config::Config {!parsed.runtime_python.enabled,"[runtime_python] enabled=false must bind — otherwise harness_init downloads CPython");- assert!(- !parsed.memory_tree.spacy_enabled,- "[memory_tree] spacy_enabled=false must bind — otherwise harness_init provisions spaCy"- );parsed}