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 memory integration tests
Steven Enamakeld83c1fc2b78a
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rsindex 118cd6b4ea..af857f866d 100644--- a/tests/json_rpc_e2e.rs+++ b/tests/json_rpc_e2e.rs@@ -3,8 +3,6 @@//! Isolates config under a temp `HOME` so auth profiles and the OpenHuman provider resolve//! the same state directory. Run with: `cargo test --test json_rpc_e2e`-#[path = "support/memory_module.rs"]-mod memory_module;#[path = "support/tinyhumans_boot.rs"]mod tinyhumans_boot;@@ -32,7 +30,6 @@ use tinyinference_llm::message::Message;use tinyinference_llm::model::ModelRequest;use openhuman_core::core::auth::{init_rpc_token, CORE_TOKEN_ENV_VAR};-use openhuman_core::memory::tree::all_memory_tree_registered_controllers;use openhuman_core::platform::connectivity::rpc::pick_listen_port;use openhuman_rpc::server::build_core_http_router;@@ -44,7 +41,6 @@ static JSON_RPC_AUTH_INIT: OnceLock<()> = OnceLock::new();/// inherited `VITE_BACKEND_URL`.static JSON_RPC_E2E_ENV_LOCK: OnceLock<Mutex<()>> = OnceLock::new();static JSON_RPC_E2E_KEYRING_INIT: OnceLock<()> = OnceLock::new();-static JSON_RPC_E2E_MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();static CHAT_COMPLETION_MODELS: OnceLock<Mutex<Vec<String>>> = OnceLock::new();static CHAT_COMPLETION_REQUESTS: OnceLock<Mutex<Vec<Value>>> = OnceLock::new();@@ -60,54 +56,6 @@ fn json_rpc_e2e_env_lock() -> std::sync::MutexGuard<'static, ()> {}}-/// The one memory workspace every case in this binary shares.-///-/// The module host captures a workspace **once per process** — `set_modules_policy`-/// ignores later calls, and the loaded artifact takes its `workspace_dir` at load-/// time — while each case below gets its own `HOME`. Production never has that-/// mismatch: boot publishes the runtime config, so the module and the RPC-/// handlers name one object. This reproduces that arrangement by pointing both-/// at a single path — the policy below is built from it, and the cases that mix-/// contract-routed writes with direct-SQLite reads export it as-/// `OPENHUMAN_WORKSPACE`, which `config::schema::load::env_overlay` honours.-///-/// The path ends in `workspace` on purpose: `resolve_config_dir_for_workspace`-/// treats such a path as the workspace dir itself rather than appending another-/// `workspace` segment, so the env var and this constant agree exactly.-fn json_rpc_e2e_shared_workspace() -> &'static Path {- static SHARED: OnceLock<PathBuf> = OnceLock::new();- SHARED.get_or_init(|| {- let tmp = tempdir().expect("shared memory workspace tempdir");- let path = tmp.path().join("workspace");- std::fs::create_dir_all(&path).expect("shared memory workspace dir");- // Outlives every case in the binary; the OS reaps it with the tmpdir.- std::mem::forget(tmp);- path- })-}--/// The transport-only JSON-RPC router deliberately does not construct a core-/// runtime context. Install its memory seams once for this integration-test-/// binary before any router can dispatch a memory-backed method.-fn ensure_json_rpc_e2e_memory_seams() {- JSON_RPC_E2E_MEMORY_SEAMS_INIT.get_or_init(|| {- std::thread::Builder::new()- .name("json-rpc-e2e-memory-seams".to_string())- .stack_size(8 * 1024 * 1024)- .spawn(|| {- let config = Arc::new(openhuman_core::config::Config {- workspace_dir: json_rpc_e2e_shared_workspace().to_path_buf(),- ..openhuman_core::config::Config::default()- });- #[cfg(feature = "modules")]- openhuman_core::modules::memory::set_modules_policy(config);- })- .expect("spawn json_rpc e2e memory seam installer")- .join()- .expect("json_rpc e2e memory seam installer panicked");- });-}-fn run_json_rpc_e2e_on_agent_stack<F, Fut>(name: &str, future_factory: F)whereF: FnOnce() -> Fut + Send + 'static,@@ -1227,58 +1175,6 @@ fn ensure_test_rpc_auth() {});}-#[tokio::test]-async fn json_rpc_discovers_codex_and_claude_sessions_for_memory_ingestion() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard =- EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", json_rpc_e2e_shared_workspace());- let _memory_driver_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_DRIVER", "tinymemory");- let _backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- memory_module::settle().await;- let claude_home = tmp.path().join("claude");- let codex_home = tmp.path().join("codex");- let claude_root = claude_home.join("projects/repo");- let codex_root = codex_home.join("sessions/2026/07/14");- std::fs::create_dir_all(&claude_root).expect("claude fixture root");- std::fs::create_dir_all(&codex_root).expect("codex fixture root");- std::fs::write(- claude_root.join("session.jsonl"),- "{\"type\":\"user\",\"timestamp\":\"2026-07-14T00:00:00Z\",\"message\":{\"content\":\"Prefer focused tests\"}}\n",- )- .expect("claude fixture");- std::fs::write(- codex_root.join("rollout-session.jsonl"),- "{\"type\":\"response_item\",\"timestamp\":\"2026-07-14T00:00:00Z\",\"payload\":{\"type\":\"message\",\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"Prefer small modules\"}]}}\n",- )- .expect("codex fixture");-- let _claude_guard = EnvVarGuard::set_to_path("CLAUDE_CONFIG_DIR", &claude_home);- let _codex_guard = EnvVarGuard::set_to_path("CODEX_HOME", &codex_home);- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{rpc_addr}");-- let response = post_json_rpc(- &rpc_base,- 4_914_001,- "openhuman.memory_sources_coding_session_status",- json!({}),- )- .await;- let result = peel_logs_envelope(assert_no_jsonrpc_error(- &response,- "memory_sources_coding_session_status",- ));- let sources = result["sources"].as_array().expect("sources array");- assert_eq!(sources.len(), 2);- assert!(sources.iter().all(|source| source["session_files"] == 1));- assert!(sources.iter().all(|source| source["evidence_units"] == 1));-- rpc_join.abort();-}-#[tokio::test]async fn json_rpc_config_update_browser_settings_persists_backend() {let _env_lock = json_rpc_e2e_env_lock();@@ -3927,526 +3823,6 @@ async fn json_rpc_agent_team_coordination_roundtrip() {rpc_join.abort();}-#[tokio::test]-async fn json_rpc_memory_sync_and_learn() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- // Share the module's workspace: this case ingests through the memory- // contract and reads back through direct SQLite, so the two must name- // one store. See `json_rpc_e2e_shared_workspace`.- let _workspace_guard =- EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", json_rpc_e2e_shared_workspace());- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- let _embed_strict_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_STRICT", "false");- let _embed_endpoint_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_ENDPOINT", "");- let _embed_model_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_MODEL", "");-- let (mock_addr, mock_join) = serve_on_ephemeral(mock_upstream_router()).await;- let mock_origin = format!("http://{}", mock_addr);- write_min_config(&openhuman_home, &mock_origin);-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{rpc_addr}");-- tokio::time::sleep(Duration::from_millis(100)).await;-- // ── memory_sync_all: returns requested:true ──────────────────────────────- let sync_all = post_json_rpc(&rpc_base, 7001, "openhuman.memory_sync_all", json!({})).await;- let sync_all_result = assert_no_jsonrpc_error(&sync_all, "memory_sync_all");- assert_eq!(- sync_all_result.get("requested"),- Some(&json!(true)),- "memory_sync_all must return requested:true"- );-- // ── memory_sync_channel: echoes channel_id and returns requested:true ─────- let sync_ch = post_json_rpc(- &rpc_base,- 7002,- "openhuman.memory_sync_channel",- json!({ "channel_id": "test-channel-abc" }),- )- .await;- let sync_ch_result = assert_no_jsonrpc_error(&sync_ch, "memory_sync_channel");- assert_eq!(- sync_ch_result.get("requested"),- Some(&json!(true)),- "memory_sync_channel must return requested:true"- );- assert_eq!(- sync_ch_result.get("channel_id").and_then(Value::as_str),- Some("test-channel-abc"),- "memory_sync_channel must echo channel_id"- );-- // ── memory_sync_channel: missing channel_id returns a JSON-RPC error ────- let sync_bad = post_json_rpc(&rpc_base, 7003, "openhuman.memory_sync_channel", json!({})).await;- assert!(- sync_bad.get("error").is_some(),- "missing channel_id must return an error, got: {sync_bad}"- );-- // ── memory.init: explicit one-shot bootstrap (no auto-init fallback) ────- let init_resp = post_json_rpc(&rpc_base, 7003, "openhuman.memory_init", json!({})).await;- assert_no_jsonrpc_error(&init_resp, "memory_init");-- // The assertions below are about an EMPTY store, and the workspace is now- // shared with the other memory cases in this binary (see- // `json_rpc_e2e_shared_workspace`), so whatever ran earlier is still in it.- // Re-scoping cannot express these: `namespaces_processed`, `queue_depth`- // and "ingestion is idle" are properties of the whole store, not of one- // source. So clear it first.- //- // This is safe only because the coverage lane runs this target serially —- // `scripts/ci/rust-coverage.sh`, in `run_integration_target()`:- // llvm_cov ... --test "${target}" -- --test-threads=1- // If that ever stops being true, a concurrent case would have its store- // wiped underneath it and this is the line that made that possible.- let wiped = post_json_rpc(&rpc_base, 7099, "openhuman.memory_tree_wipe_all", json!({})).await;- assert_no_jsonrpc_error(&wiped, "memory_tree_wipe_all before fresh-store checks");-- // ── ...and the wipe is not enough on its own ────────────────────────────- //- // `memory_tree_wipe_all` reaches the driver through- // `binding::for_config(config)` — *this* case's workspace. The namespace- // assertions below read through `active_memory_guard()`. Those are the same- // binding here, but they are not the same **store**: the memory module is a- // native module loaded once per process, and it captures the first workspace- // it is given. Every later binding in this binary — one per case, each with- // its own tempdir — is a different `MemoryBinding` over that one captured- // store.- //- // So a namespace another case wrote is visible to `list_namespaces` here and- // is not reachable by a `purge_all` scoped to this workspace: after the wipe- // above reports its rows deleted, a second wipe reports `rows_deleted: 0`- // while `namespace_list` still answers with the other case's namespace. That- // asymmetry is the one-workspace-per-process property, not a defect in- // `wipe_all`; a `purge_all` that reached across workspaces would be the real- // bug the day a host binds two.- //- // openhuman#5779 is what made it bite. Before it, a session agent's memory- // came from `create_session_memory_with_local_ai` — an engine-built store- // over that case's own workspace files, invisible here. #5779 routed session- // memory onto `DriverMemory::for_subtree` (correctly: that is the point of- // #5560), and the driver is the shared module — so an agent turn in an- // earlier case now files `conversation_raw` where this case can see it.- //- // Draining through `memory_clear_namespace` is what makes this deterministic:- // it takes `active_memory_guard()` + `as_documents()`, the exact path- // `list_namespaces` reads through, so "cleared" and "listed" cannot disagree- // by construction. Do not replace this with a bigger wipe — no wipe scoped to- // a workspace can empty a store shared by every workspace in the process.- async fn list_namespaces(rpc_base: &str, id: i64) -> Vec<Value> {- let listed =- post_json_rpc(rpc_base, id, "openhuman.memory_namespace_list", json!({})).await;- assert_no_jsonrpc_error(&listed, "memory_namespace_list");- listed["result"]["result"]- .as_array()- .unwrap_or_else(|| panic!("namespace_list must answer an array, got: {listed}"))- .clone()- }-- let leftover = list_namespaces(&rpc_base, 7100).await;- for namespace in &leftover {- let cleared = post_json_rpc(- &rpc_base,- 7101,- "openhuman.memory_clear_namespace",- json!({ "namespace": namespace }),- )- .await;- assert_no_jsonrpc_error(- &cleared,- "memory_clear_namespace draining a shared namespace",- );- }- let remaining = list_namespaces(&rpc_base, 7102).await;- assert!(- remaining.is_empty(),- "draining through the same family the assertions read through must empty the \- listing; started with {leftover:?}, still holding {remaining:?}"- );-- // ── memory_learn_all: no namespaces → zero processed (empty store) ──────- let learn_all = post_json_rpc(&rpc_base, 7004, "openhuman.memory_learn_all", json!({})).await;- let learn_result = assert_no_jsonrpc_error(&learn_all, "memory_learn_all");- let processed = learn_result- .get("namespaces_processed")- .and_then(Value::as_u64)- .expect("namespaces_processed must be present");- assert_eq!(processed, 0, "no namespaces in a fresh store");- let results_arr = learn_result- .get("results")- .and_then(Value::as_array)- .expect("results array must be present");- assert!(- results_arr.is_empty(),- "results must be empty when no namespaces"- );-- // ── memory_learn_all: constrained to non-existent namespace → also zero ──- let learn_constrained = post_json_rpc(- &rpc_base,- 7005,- "openhuman.memory_learn_all",- json!({ "namespaces": ["does-not-exist"] }),- )- .await;- let learn_c_result =- assert_no_jsonrpc_error(&learn_constrained, "memory_learn_all constrained");- assert_eq!(- learn_c_result- .get("namespaces_processed")- .and_then(Value::as_u64),- Some(0),- "non-existent namespace must be filtered out"- );-- // ── memory_ingestion_status: idle after direct learning ─────────────────- // The module's worker may still be settling an item that was already in- // flight when the shared store was wiped. Poll the read-only status until- // the worker releases it instead of racing its last queue-stat update.- let ing_result = tokio::time::timeout(Duration::from_secs(10), async {- loop {- let ing_status = post_json_rpc(- &rpc_base,- 7006,- "openhuman.memory_ingestion_status",- json!({}),- )- .await;- let result = assert_no_jsonrpc_error(&ing_status, "memory_ingestion_status");- if result.get("running") == Some(&json!(false)) {- break result.clone();- }- tokio::time::sleep(Duration::from_millis(100)).await;- }- })- .await- .expect("memory ingestion did not settle after clearing the fresh store");- assert_eq!(- ing_result.get("running"),- Some(&json!(false)),- "ingestion must be idle on a fresh store, got: {ing_result}"- );- assert!(- ing_result- .get("queue_depth")- .and_then(Value::as_u64)- .is_some_and(|depth| depth <= 1),- "direct learning may leave one bounded pending item, got: {ing_result}"- );-- mock_join.abort();- rpc_join.abort();-}--#[tokio::test]-async fn json_rpc_memory_tree_end_to_end() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- // Phase 4 (#710): disable strict embedding so ingest falls back to the- // Inert (zero-vector) embedder when no Ollama endpoint is reachable.- // CI has no local Ollama; without this the `memory_tree_ingest` call- // would fail with `embed chunk_id=<id> during ingest` before writing- // any chunks.- let _embed_strict_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_STRICT", "false");- let _embed_endpoint_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_ENDPOINT", "");- let _embed_model_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_MODEL", "");-- let (mock_addr, mock_join) = serve_on_ephemeral(mock_upstream_router()).await;- let mock_origin = format!("http://{}", mock_addr);- write_min_config(&openhuman_home, &mock_origin);-- let controllers = all_memory_tree_registered_controllers();- // Sampled methods this test exercises end-to-end. Don't pin- // controllers.len() — the registry has grown organically- // (list_sources, search, recall, entity_index_for, top_entities,- // chunk_score, delete_chunk, get_llm, set_llm, chunks_for_entity, …)- // and adding a new RPC shouldn't break this smoke test. We just- // assert the four sampled methods exercised below are registered.- let expected_methods = vec![- "openhuman.memory_tree_ingest".to_string(),- "openhuman.memory_tree_list_chunks".to_string(),- "openhuman.memory_tree_get_chunk".to_string(),- ];- assert!(- controllers.len() >= expected_methods.len(),- "expected at least {} memory_tree controllers, found {}",- expected_methods.len(),- controllers.len()- );- for method in &expected_methods {- assert!(- controllers- .iter()- .any(|controller| controller.rpc_method_name() == *method),- "expected memory_tree controller registration for {method}"- );- }-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{}", rpc_addr);-- tokio::time::sleep(Duration::from_millis(100)).await;-- let ingest = post_json_rpc(- &rpc_base,- 200,- &expected_methods[0],- json!({- "source_kind": "document",- "source_id": "notion:launch-plan",- "owner": "[email protected]",- "tags": ["planning", "launch"],- "payload": {- "provider": "notion",- "title": "Launch Plan",- "body": "We decided to ship Phoenix on Friday after reviewing [email protected] and the migration plan carefully. @bob will coordinate rollout, track #launch-q2 details, and update the Notion launch checklist with staging validation notes.",- "modified_at": 1700000000000_i64,- "source_ref": " notion://page/launch-plan "- }- }),- )- .await;- let ingest_outer = assert_no_jsonrpc_error(&ingest, "memory_tree_ingest");- let ingest_result = ingest_outer.get("result").unwrap_or(ingest_outer);- assert_eq!(- ingest_result.get("source_id"),- Some(&json!("notion:launch-plan"))- );- assert_eq!(ingest_result.get("chunks_written"), Some(&json!(1)));- assert_eq!(ingest_result.get("chunks_dropped"), Some(&json!(0)));- let chunk_ids = ingest_result- .get("chunk_ids")- .and_then(Value::as_array)- .expect("chunk_ids array");- assert_eq!(chunk_ids.len(), 1);-- let list = post_json_rpc(- &rpc_base,- 201,- &expected_methods[1],- json!({- "source_kinds": ["document"],- "source_ids": ["notion:launch-plan"],- "limit": 0- }),- )- .await;- let list_outer = assert_no_jsonrpc_error(&list, "memory_tree_list_chunks");- let list_result = list_outer.get("result").unwrap_or(list_outer);- let chunks = list_result- .get("chunks")- .and_then(Value::as_array)- .expect("chunks array");- assert_eq!(chunks.len(), 1);- // `list_chunks` returns the flat `ChunkRow` projection (id, source_kind,- // source_id, source_ref as a flat string, owner, timestamp_ms, …), not- // the full `Chunk { metadata: Metadata { source_ref: Option<SourceRef>,- // … }, seq_in_source, … }` that `get_chunk` returns. Assert against- // the row shape here.- let chunk = &chunks[0];- assert_eq!(chunk.get("source_kind"), Some(&json!("document")));- assert_eq!(chunk.get("source_id"), Some(&json!("notion:launch-plan")));- assert_eq!(- chunk.get("source_ref"),- Some(&json!("notion://page/launch-plan"))- );-- let get_chunk = post_json_rpc(- &rpc_base,- 202,- &expected_methods[2],- json!({- "id": chunk_ids[0].clone()- }),- )- .await;- let get_outer = assert_no_jsonrpc_error(&get_chunk, "memory_tree_get_chunk");- let get_result = get_outer.get("result").unwrap_or(get_outer);- assert_eq!(get_result.pointer("/chunk/id"), Some(&chunk_ids[0]));- // Full-Chunk-shape assertions live here because `get_chunk` returns the- // canonical `Chunk` (with nested `metadata` + `seq_in_source`), unlike- // `list_chunks`'s `ChunkRow` projection above.- assert_eq!(get_result.pointer("/chunk/seq_in_source"), Some(&json!(0)));- assert_eq!(- get_result.pointer("/chunk/metadata/source_ref/value"),- Some(&json!("notion://page/launch-plan"))- );-- let invalid_ingest = post_json_rpc(- &rpc_base,- 203,- &expected_methods[0],- json!({- "source_kind": "document",- "source_id": "notion:bad",- "owner": "[email protected]",- "payload": {- "provider": "notion",- "title": "Bad payload"- }- }),- )- .await;- assert!(- invalid_ingest.get("error").is_some(),- "expected invalid payload JSON-RPC error: {invalid_ingest}"- );-- let invalid_list = post_json_rpc(- &rpc_base,- 204,- &expected_methods[1],- json!({- "source_kind": "not-a-kind"- }),- )- .await;- assert!(- invalid_list.get("error").is_some(),- "expected invalid source_kind JSON-RPC error: {invalid_list}"- );-- rpc_join.abort();- let _ = rpc_join.await;- mock_join.abort();- let _ = mock_join.await;-}--/// `openhuman.memory_tree_cover_window` over RPC: ingest a chunk, then assert-/// the windowed minimum-cover returns it raw inside the window and nothing-/// outside it. One ingested chunk doesn't reach the seal fanout, so this also-/// exercises the not-yet-sealed (no Tree row) raw-leaf fallback end to end.-#[tokio::test]-async fn json_rpc_memory_tree_cover_window_end_to_end() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- // Fall back to the Inert (zero-vector) embedder — no Ollama in CI.- let _embed_strict_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_STRICT", "false");- let _embed_endpoint_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_ENDPOINT", "");- let _embed_model_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_MODEL", "");-- let (mock_addr, mock_join) = serve_on_ephemeral(mock_upstream_router()).await;- let mock_origin = format!("http://{}", mock_addr);- write_min_config(&openhuman_home, &mock_origin);-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{}", rpc_addr);- tokio::time::sleep(Duration::from_millis(100)).await;-- // Ingest a single document chunk.- let ingest = post_json_rpc(- &rpc_base,- 300,- "openhuman.memory_tree_ingest",- json!({- "source_kind": "document",- "source_id": "notion:daily-note",- "owner": "[email protected]",- "payload": {- "provider": "notion",- "title": "Daily Note",- "body": "Stand-up at 9, shipped the cover_window tool, reviewed the migration plan.",- "modified_at": 1_700_000_000_000_i64- }- }),- )- .await;- let ingest_outer = assert_no_jsonrpc_error(&ingest, "memory_tree_ingest");- let ingest_result = ingest_outer.get("result").unwrap_or(ingest_outer);- let chunk_ids = ingest_result- .get("chunk_ids")- .and_then(Value::as_array)- .expect("chunk_ids array");- assert_eq!(chunk_ids.len(), 1, "expected one ingested chunk");- let chunk_id = chunk_ids[0].as_str().expect("chunk id string").to_string();-- // Covering window → the chunk comes back as a raw leaf.- let inside = post_json_rpc(- &rpc_base,- 301,- "openhuman.memory_tree_cover_window",- json!({ "since_ms": 0_i64, "until_ms": 4_000_000_000_000_i64 }),- )- .await;- let inside_outer = assert_no_jsonrpc_error(&inside, "cover_window inside");- let inside_result = inside_outer.get("result").unwrap_or(inside_outer);- let hits = inside_result- .get("hits")- .and_then(Value::as_array)- .expect("hits array");- assert!(- hits.iter().any(|h| {- h.get("node_id").and_then(Value::as_str) == Some(chunk_id.as_str())- && h.get("node_kind").and_then(Value::as_str) == Some("leaf")- }),- "covering window must return the ingested chunk as a raw leaf: {inside_result}"- );-- // Far-future window (after the chunk) → empty cover.- let outside = post_json_rpc(- &rpc_base,- 302,- "openhuman.memory_tree_cover_window",- json!({ "since_ms": 3_500_000_000_000_i64, "until_ms": 4_000_000_000_000_i64 }),- )- .await;- let outside_outer = assert_no_jsonrpc_error(&outside, "cover_window outside");- let outside_result = outside_outer.get("result").unwrap_or(outside_outer);- assert_eq!(- outside_result- .get("hits")- .and_then(Value::as_array)- .map(|h| h.len()),- Some(0),- "a window after the chunk must be empty: {outside_result}"- );-- // Inverted window is rejected as a JSON-RPC error.- let inverted = post_json_rpc(- &rpc_base,- 303,- "openhuman.memory_tree_cover_window",- json!({ "since_ms": 100_i64, "until_ms": 50_i64 }),- )- .await;- let inverted_err = assert_jsonrpc_error(&inverted, "cover_window inverted");- let inverted_msg = inverted_err- .get("message")- .and_then(Value::as_str)- .unwrap_or_default();- assert!(- inverted_msg.contains("until_ms") && inverted_msg.contains("since_ms"),- "expected the inverted-window guard to fire (until_ms < since_ms), got: {inverted_err}"- );-- rpc_join.abort();- let _ = rpc_join.await;- mock_join.abort();- let _ = mock_join.await;-}-#[test]fn json_rpc_web_chat_routing_cases_use_expected_backend_models() {run_json_rpc_e2e_on_agent_stack(@@ -8633,109 +8009,6 @@ async fn channels_status_reflects_managed_dm_credential_e2e() {rpc_join.abort();}-#[tokio::test]-async fn whatsapp_memory_doc_ingest_e2e() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- // Disable strict embedding so ingest falls back to the Inert- // (zero-vector) embedder when no Ollama endpoint is reachable. CI- // has no local Ollama; without this the memory_doc_ingest call- // would fail at the chunk-embedding step.- let _embed_strict_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_STRICT", "false");- let _embed_endpoint_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_ENDPOINT", "");- let _embed_model_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_MODEL", "");-- let (mock_addr, mock_join) = serve_on_ephemeral(mock_upstream_router()).await;- let mock_origin = format!("http://{}", mock_addr);- write_min_config(&openhuman_home, &mock_origin);-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{}", rpc_addr);- tokio::time::sleep(Duration::from_millis(100)).await;-- // ── 1. Ingest a WhatsApp-shaped memory document ───────────────────────────- let ingest = post_json_rpc(- &rpc_base,- 9101,- "openhuman.memory_doc_ingest",- json!({- "namespace": "whatsapp-web:[email protected]",- "key": "[email protected]:2026-05-07",- "title": "WhatsApp: Alice (2026-05-07)",- "content": "[10:00] Alice: Hey!\n[10:01] me: Hi there!\n[10:02] Alice: How are you?",- "source_type": "whatsapp-web",- "tags": ["whatsapp", "chat"],- "metadata": {- "chat_id": "[email protected]",- "account_id": "[email protected]"- }- }),- )- .await;- assert_no_jsonrpc_error(&ingest, "memory_doc_ingest");-- // ── 2. List documents scoped to the WhatsApp namespace ───────────────────- let doc_list = post_json_rpc(- &rpc_base,- 9102,- "openhuman.memory_doc_list",- json!({ "namespace": "whatsapp-web:[email protected]" }),- )- .await;- let doc_list_result = assert_no_jsonrpc_error(&doc_list, "memory_doc_list");-- // The result may be wrapped in a logs envelope {result: ..., logs: [...]}- // or returned bare depending on whether logs are present.- let doc_list_inner = doc_list_result.get("result").unwrap_or(doc_list_result);-- // The doc_list response can be:- // - an array directly- // - { documents: [...], count: N }- // - { result: [...] }- let docs_arr = doc_list_inner- .as_array()- .or_else(|| doc_list_inner.get("documents").and_then(Value::as_array))- .or_else(|| doc_list_inner.get("items").and_then(Value::as_array))- .unwrap_or_else(|| {- panic!("memory_doc_list: expected documents array in result: {doc_list_result}")- });-- assert!(- !docs_arr.is_empty(),- "memory_doc_list should return at least 1 document after ingest: {doc_list_result}"- );-- // ── 3. Verify the ingested document has the correct key and namespace ─────- let found = docs_arr.iter().find(|doc| {- let key_match = doc- .get("key")- .and_then(Value::as_str)- .map(|k| k == "[email protected]:2026-05-07")- .unwrap_or(false);- let ns_match = doc- .get("namespace")- .and_then(Value::as_str)- .map(|n| n == "whatsapp-web:[email protected]")- .unwrap_or(false);- key_match || ns_match- });- assert!(- found.is_some(),- "ingested document with key '[email protected]:2026-05-07' not found in doc_list; \- docs: {docs_arr:?}"- );-- mock_join.abort();- rpc_join.abort();-}-/// Regression guard for issue #1289: `openhuman.voice_cloud_transcribe`/// must stay registered in the controller registry and reachable via/// JSON-RPC dispatch.@@ -11892,414 +11165,6 @@ async fn json_rpc_voice_server_settings_roundtrip_always_on_and_wake_word() {rpc_join.abort();}-/// Memory-sync schedule (#3302): get defaults → set a 4h cadence → confirm it-/// persists → switch to Manual only → confirm the flag flips.-#[tokio::test]-async fn json_rpc_memory_sync_settings_roundtrip_interval_and_manual() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- // The global override would mask the persisted value; keep it unset here.- let _interval_guard = EnvVarGuard::unset("OPENHUMAN_MEMORY_SYNC_INTERVAL_SECS");-- write_min_config(&openhuman_home, "http://127.0.0.1:9");-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{}", rpc_addr);- tokio::time::sleep(Duration::from_millis(100)).await;-- // GET defaults — unset stored value, but a resolved 24h selected cadence.- let initial = post_json_rpc(- &rpc_base,- 7501,- "openhuman.config_get_memory_sync_settings",- json!({}),- )- .await;- let initial_outer = assert_no_jsonrpc_error(&initial, "get_memory_sync_settings initial");- let initial_result = initial_outer.get("result").unwrap_or(initial_outer);- assert!(- initial_result.get("sync_interval_secs").map(Value::is_null) == Some(true),- "default stored value should be null, envelope: {initial_outer}"- );- assert_eq!(- initial_result.get("is_default").and_then(Value::as_bool),- Some(true),- "fresh config should report is_default=true, envelope: {initial_outer}"- );- assert_eq!(- initial_result.get("selected_secs").and_then(Value::as_u64),- Some(86_400),- "selected cadence should resolve to the 24h default, envelope: {initial_outer}"- );-- // UPDATE — pick the 4h preset.- let update = post_json_rpc(- &rpc_base,- 7502,- "openhuman.config_update_memory_sync_settings",- json!({ "sync_interval_secs": 14400 }),- )- .await;- let update_outer = assert_no_jsonrpc_error(&update, "update_memory_sync_settings 4h");- let update_result = update_outer.get("result").unwrap_or(update_outer);- assert_eq!(- update_result- .get("sync_interval_secs")- .and_then(Value::as_u64),- Some(14_400),- "4h cadence should be stored, envelope: {update_outer}"- );- assert_eq!(- update_result.get("is_manual").and_then(Value::as_bool),- Some(false)- );-- // GET again — the 4h cadence persists across the round-trip.- let after = post_json_rpc(- &rpc_base,- 7503,- "openhuman.config_get_memory_sync_settings",- json!({}),- )- .await;- let after_outer = assert_no_jsonrpc_error(&after, "get_memory_sync_settings after 4h");- let after_result = after_outer.get("result").unwrap_or(after_outer);- assert_eq!(- after_result- .get("sync_interval_secs")- .and_then(Value::as_u64),- Some(14_400),- "4h cadence should persist, envelope: {after_outer}"- );-- // UPDATE — switch to Manual only (0).- let manual = post_json_rpc(- &rpc_base,- 7504,- "openhuman.config_update_memory_sync_settings",- json!({ "sync_interval_secs": 0 }),- )- .await;- let manual_outer = assert_no_jsonrpc_error(&manual, "update_memory_sync_settings manual");- let manual_result = manual_outer.get("result").unwrap_or(manual_outer);- assert_eq!(- manual_result.get("is_manual").and_then(Value::as_bool),- Some(true),- "0 should flip is_manual, envelope: {manual_outer}"- );-- // GET once more — manual mode persisted (stored value 0, is_manual true).- let manual_get = post_json_rpc(- &rpc_base,- 7505,- "openhuman.config_get_memory_sync_settings",- json!({}),- )- .await;- let manual_get_outer = assert_no_jsonrpc_error(&manual_get, "get_memory_sync_settings manual");- let manual_get_result = manual_get_outer.get("result").unwrap_or(manual_get_outer);- assert_eq!(- manual_get_result.get("is_manual").and_then(Value::as_bool),- Some(true),- "manual mode should persist across a GET, envelope: {manual_get_outer}"- );- assert_eq!(- manual_get_result- .get("sync_interval_secs")- .and_then(Value::as_u64),- Some(0),- "manual stored value should be 0, envelope: {manual_get_outer}"- );-- rpc_join.abort();-}--/// Ops / headless path (#3302): a fleet operator sets-/// `OPENHUMAN_MEMORY_SYNC_INTERVAL_SECS` in the environment, and the running-/// core surfaces that cadence through `config_get_memory_sync_settings` with no-/// UI interaction. Verifies the env override flows all the way through the RPC.-/// (The `0` = "Manual only" sentinel on the env path is covered at the parse-/// layer by `env_overlay_memory_sync_interval_parses_and_honours_zero`.)-#[tokio::test]-async fn json_rpc_memory_sync_settings_env_override_is_reflected() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- // Operator sets an 8h cadence via the environment (not a UI write).- let _interval_guard = EnvVarGuard::set("OPENHUMAN_MEMORY_SYNC_INTERVAL_SECS", "28800");-- write_min_config(&openhuman_home, "http://127.0.0.1:9");-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{}", rpc_addr);- tokio::time::sleep(Duration::from_millis(100)).await;-- // GET reflects the env-provided cadence even though config.toml never set it.- let resp = post_json_rpc(- &rpc_base,- 7601,- "openhuman.config_get_memory_sync_settings",- json!({}),- )- .await;- let outer = assert_no_jsonrpc_error(&resp, "get_memory_sync_settings env-override");- let result = outer.get("result").unwrap_or(outer);- assert_eq!(- result.get("sync_interval_secs").and_then(Value::as_u64),- Some(28_800),- "env override should surface via RPC, envelope: {outer}"- );- assert_eq!(- result.get("selected_secs").and_then(Value::as_u64),- Some(28_800),- "selected cadence should match the env override, envelope: {outer}"- );- assert_eq!(- result.get("is_default").and_then(Value::as_bool),- Some(false),- "an env-provided value is not the default, envelope: {outer}"- );-- rpc_join.abort();-}--#[tokio::test]-async fn json_rpc_memory_sources_conversation_crud() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _ws_guard = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", home);- let _action_guard = EnvVarGuard::set_to_path("OPENHUMAN_ACTION_DIR", home);- let _backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{rpc_addr}");-- // 1. Add a conversation source- let add_resp = post_json_rpc(- &rpc_base,- 9501,- "openhuman.memory_sources_add",- json!({- "kind": "conversation",- "label": "Agent Conversations",- "enabled": true- }),- )- .await;- let add_result = assert_no_jsonrpc_error(&add_resp, "memory_sources_add conversation");- let source = add_result- .get("source")- .expect("add should return source object");- let source_id = source- .get("id")- .and_then(Value::as_str)- .expect("source must have id");- assert_eq!(- source.get("kind").and_then(Value::as_str),- Some("conversation")- );- assert_eq!(- source.get("label").and_then(Value::as_str),- Some("Agent Conversations")- );- assert_eq!(source.get("enabled").and_then(Value::as_bool), Some(true));-- // 2. List sources — should contain our conversation source- let list_resp =- post_json_rpc(&rpc_base, 9502, "openhuman.memory_sources_list", json!({})).await;- let list_result = assert_no_jsonrpc_error(&list_resp, "memory_sources_list");- let sources = list_result- .get("sources")- .and_then(Value::as_array)- .expect("list should return sources array");- let conversation_sources: Vec<&Value> = sources- .iter()- .filter(|s| s.get("kind").and_then(Value::as_str) == Some("conversation"))- .collect();- assert_eq!(- conversation_sources.len(),- 1,- "exactly one conversation source after add"- );-- // 3. Get the source by id- let get_resp = post_json_rpc(- &rpc_base,- 9503,- "openhuman.memory_sources_get",- json!({ "id": source_id }),- )- .await;- let get_result = assert_no_jsonrpc_error(&get_resp, "memory_sources_get");- assert_eq!(- get_result- .get("source")- .and_then(|s| s.get("kind"))- .and_then(Value::as_str),- Some("conversation")- );-- // 4. Update — disable the source- let update_resp = post_json_rpc(- &rpc_base,- 9504,- "openhuman.memory_sources_update",- json!({ "id": source_id, "enabled": false }),- )- .await;- let update_result = assert_no_jsonrpc_error(&update_resp, "memory_sources_update");- assert_eq!(- update_result- .get("source")- .and_then(|s| s.get("enabled"))- .and_then(Value::as_bool),- Some(false),- "source should be disabled after update"- );-- // 5. Remove the source- let remove_resp = post_json_rpc(- &rpc_base,- 9505,- "openhuman.memory_sources_remove",- json!({ "id": source_id }),- )- .await;- let remove_result = assert_no_jsonrpc_error(&remove_resp, "memory_sources_remove");- assert_eq!(- remove_result.get("removed").and_then(Value::as_bool),- Some(true)- );-- // 6. List again — empty- let list2_resp =- post_json_rpc(&rpc_base, 9506, "openhuman.memory_sources_list", json!({})).await;- let list2_result = assert_no_jsonrpc_error(&list2_resp, "memory_sources_list after remove");- let sources2 = list2_result- .get("sources")- .and_then(Value::as_array)- .expect("list should return sources array");- let conv_remaining: Vec<&Value> = sources2- .iter()- .filter(|s| s.get("kind").and_then(Value::as_str) == Some("conversation"))- .collect();- assert!(- conv_remaining.is_empty(),- "no conversation sources after remove"- );-- rpc_join.abort();-}--/// Raw-archive coverage reconcile over JSON-RPC: a GitHub source whose raw-/// archive holds files that no tree summary covers must be reported as-/// pending by `openhuman.memory_sources_reconcile` (report-only mode).-/// Regression for the silent divergence where thousands of raw files sat-/// unsummarised with no way to see or repair it.-#[tokio::test]-async fn json_rpc_memory_sources_reconcile_reports_pending_raw_files() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- // `reconcile_rpc` resolves the bound driver (`as_source_sync`), so it reads- // the module's store while the raw files below are planted on disk. Both- // must name one workspace — see `json_rpc_e2e_shared_workspace`.- let _ws_guard =- EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", json_rpc_e2e_shared_workspace());- let _action_guard = EnvVarGuard::set_to_path("OPENHUMAN_ACTION_DIR", home);- let _backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");- // reconcile reads the module's store; wait out the module's load first.- memory_module::settle().await;-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{rpc_addr}");-- // 1. Register a GitHub repo source (no sync — we plant the archive).- let add_resp = post_json_rpc(- &rpc_base,- 9601,- "openhuman.memory_sources_add",- json!({- "kind": "github_repo",- "label": "Repo",- "enabled": true,- "url": "https://github.com/owner/repo"- }),- )- .await;- let add_result = assert_no_jsonrpc_error(&add_resp, "memory_sources_add github_repo");- let source_id = add_result- .get("source")- .and_then(|s| s.get("id"))- .and_then(Value::as_str)- .expect("source must have id")- .to_string();-- // 2. Plant two uncovered raw archive files where a fetch would write- // them: <workspace>/memory_tree/content/raw/github-com-owner-repo/.- // `OPENHUMAN_WORKSPACE` is the shared workspace above, and its basename- // is `workspace`, so `resolve_config_dir_for_workspace` returns it- // unchanged rather than appending a second segment.- let commits_dir = json_rpc_e2e_shared_workspace()- .join("memory_tree")- .join("content")- .join("raw")- .join("github-com-owner-repo")- .join("commits");- std::fs::create_dir_all(&commits_dir).expect("create raw commits dir");- std::fs::write(commits_dir.join("1000_aaa.md"), "commit one").expect("write raw");- std::fs::write(commits_dir.join("2000_bbb.md"), "commit two").expect("write raw");-- // 3. Report-only reconcile must surface both files as pending.- let reconcile_resp = post_json_rpc(- &rpc_base,- 9602,- "openhuman.memory_sources_reconcile",- json!({ "source_id": source_id }),- )- .await;- let reconcile_result = assert_no_jsonrpc_error(&reconcile_resp, "memory_sources_reconcile");- let scopes = reconcile_result- .get("scopes")- .and_then(Value::as_array)- .expect("reconcile should return scopes array");- assert_eq!(scopes.len(), 1, "one scope for one github source");- let scope = &scopes[0];- assert_eq!(- scope.get("tree_scope").and_then(Value::as_str),- Some("github:owner/repo")- );- assert_eq!(- scope.get("total_raw_files").and_then(Value::as_u64),- Some(2)- );- assert_eq!(scope.get("covered").and_then(Value::as_u64), Some(0));- assert_eq!(scope.get("pending").and_then(Value::as_u64), Some(2));- assert_eq!(- scope.get("started").and_then(Value::as_bool),- Some(false),- "report-only call must not start a reconcile"- );-- rpc_join.abort();-}-// ── Memory sources: active-connection filtering over JSON-RPC ────────────────/// Mock Composio v3 `/connected_accounts`. Returns a single ACTIVE Gmail@@ -12354,206 +11219,6 @@ api_key = "ck_e2e_test"toml::from_str(&cfg).expect("config toml must match Config schema");}-async fn add_composio_memory_source(- rpc_base: &str,- id: i64,- label: &str,- toolkit: &str,- connection_id: &str,-) {- let add = post_json_rpc(- rpc_base,- id,- "openhuman.memory_sources_add",- json!({- "kind": "composio",- "label": label,- "toolkit": toolkit,- "connection_id": connection_id- }),- )- .await;- assert_no_jsonrpc_error(&add, "memory_sources_add (composio)");-}--async fn add_folder_memory_source(rpc_base: &str, id: i64, label: &str, path: &str) {- let add = post_json_rpc(- rpc_base,- id,- "openhuman.memory_sources_add",- json!({ "kind": "folder", "label": label, "path": path }),- )- .await;- assert_no_jsonrpc_error(&add, "memory_sources_add (folder)");-}--/// Extract the `sources` array from a `memory_sources_list` result, tolerating-/// both the bare value and the `{ result, logs }` envelope shape.-fn memory_sources_from_list(result: &Value) -> &Vec<Value> {- result- .get("result")- .unwrap_or(result)- .get("sources")- .and_then(Value::as_array)- .unwrap_or_else(|| panic!("memory_sources_list missing sources array: {result}"))-}--/// End-to-end: `memory_sources_list` hides Composio rows whose connection is no-/// longer active and collapses identical same-`connection_id` duplicates, while-/// always showing non-Composio sources — driven by a real active scan against a-/// mock Composio `/connected_accounts` endpoint.-#[tokio::test]-async fn json_rpc_memory_sources_list_filters_to_active_connections() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");-- // Mock Composio direct endpoint — only conn_active_gmail is ACTIVE.- let (composio_addr, composio_join) =- serve_on_ephemeral(mock_composio_connected_accounts_router()).await;- let composio_base = format!("http://{composio_addr}");- let _v2_guard = EnvVarGuard::set("OPENHUMAN_COMPOSIO_DIRECT_BASE_V2", &composio_base);- let _v3_guard = EnvVarGuard::set("OPENHUMAN_COMPOSIO_DIRECT_BASE_V3", &composio_base);-- write_composio_direct_config(&openhuman_home, "http://127.0.0.1:1");-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{rpc_addr}");-- // Seed the registry: an active row, an identical duplicate of it (RC-B), a- // stale row whose connection is no longer active (RC-A), and a folder.- // memory_sources_add keys only on the generated src_ id, so the duplicate- // and stale composio rows both persist into config.memory_sources.- add_composio_memory_source(- &rpc_base,- 8801,- "Gmail · active",- "gmail",- "conn_active_gmail",- )- .await;- add_composio_memory_source(- &rpc_base,- 8802,- "Gmail · active dup",- "gmail",- "conn_active_gmail",- )- .await;- add_composio_memory_source(- &rpc_base,- 8803,- "Gmail · stale",- "gmail",- "conn_stale_gmail",- )- .await;- add_folder_memory_source(&rpc_base, 8804, "My notes", "/tmp/notes").await;-- // Probe the exact chain the filter depends on FIRST, so a broken scan- // fails here with its real error instead of downstream as a silently- // fail-open (unfiltered) listing.- let probe = post_json_rpc(- &rpc_base,- 8899,- "openhuman.composio_list_connections",- json!({}),- )- .await;- let probe_result = assert_no_jsonrpc_error(&probe, "composio_list_connections probe").clone();- let probe_text = probe_result.to_string();- assert!(- probe_text.contains("conn_active_gmail"),- "the connections probe must see the mock's active set; got {probe_text}"- );-- let list = post_json_rpc(&rpc_base, 8805, "openhuman.memory_sources_list", json!({})).await;- let result = assert_no_jsonrpc_error(&list, "memory_sources_list").clone();- let sources = memory_sources_from_list(&result);-- // Only the active connection shows, exactly once (stale hidden, dupe collapsed).- let composio_conn_ids: Vec<&str> = sources- .iter()- .filter(|s| s.get("kind").and_then(Value::as_str) == Some("composio"))- .filter_map(|s| s.get("connection_id").and_then(Value::as_str))- .collect();- assert_eq!(- composio_conn_ids,- vec!["conn_active_gmail"],- "only the active connection should list, exactly once; got sources={sources:?}"- );-- // Non-Composio sources are always shown regardless of the active set.- assert!(- sources- .iter()- .any(|s| s.get("kind").and_then(Value::as_str) == Some("folder")),- "folder source must always be listed; got sources={sources:?}"- );-- rpc_join.abort();- composio_join.abort();-}--/// Safety: when the live Composio scan is unavailable (here the direct endpoint-/// is unreachable), `memory_sources_list` must show **all** sources rather than-/// hiding every Composio row — a transient outage must never read as "all-/// inactive".-#[tokio::test]-async fn json_rpc_memory_sources_list_shows_all_when_scan_unavailable() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");-- // Point the direct Composio base at a loopback port nothing listens on so- // the scan errors out → active set is None → no filtering applied.- let dead_base = "http://127.0.0.1:1";- let _v2_guard = EnvVarGuard::set("OPENHUMAN_COMPOSIO_DIRECT_BASE_V2", dead_base);- let _v3_guard = EnvVarGuard::set("OPENHUMAN_COMPOSIO_DIRECT_BASE_V3", dead_base);-- write_composio_direct_config(&openhuman_home, "http://127.0.0.1:1");-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{rpc_addr}");-- add_composio_memory_source(&rpc_base, 8901, "Gmail · A", "gmail", "conn_A").await;- add_composio_memory_source(&rpc_base, 8902, "Gmail · B", "gmail", "conn_B").await;- add_folder_memory_source(&rpc_base, 8903, "My notes", "/tmp/notes").await;-- let list = post_json_rpc(&rpc_base, 8904, "openhuman.memory_sources_list", json!({})).await;- let result = assert_no_jsonrpc_error(&list, "memory_sources_list").clone();- let sources = memory_sources_from_list(&result);-- // Failed scan ⇒ show everything: both composio rows + the folder remain.- assert_eq!(- sources.len(),- 3,- "failed scan must show all sources (hide none); got sources={sources:?}"- );- let composio_count = sources- .iter()- .filter(|s| s.get("kind").and_then(Value::as_str) == Some("composio"))- .count();- assert_eq!(- composio_count, 2,- "both composio rows must remain visible on scan failure; got sources={sources:?}"- );-- rpc_join.abort();-}-/// Mock Composio v3 `/connected_accounts` returning **two** distinct ACTIVE/// Gmail connections — exercises multiple-account-per-toolkit support (#3443).fn mock_composio_two_gmail_accounts_router() -> Router {@@ -12568,86 +11233,6 @@ fn mock_composio_two_gmail_accounts_router() -> Router {Router::new().route("/connected_accounts", get(connected_accounts))}-/// Regression for #3443 (multiple account connections per toolkit): two-/// *distinct* active connections of the same toolkit (two Gmail accounts) must-/// **both** be listed. Our filter keys on `connection_id`, never on toolkit, so-/// it must not collapse them — while a third, stale Gmail connection (absent-/// from the active scan) is still hidden.-#[tokio::test]-async fn json_rpc_memory_sources_list_keeps_multiple_active_connections_per_toolkit() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");-- // Scan reports two active Gmail accounts (distinct connection_ids).- let (composio_addr, composio_join) =- serve_on_ephemeral(mock_composio_two_gmail_accounts_router()).await;- let composio_base = format!("http://{composio_addr}");- let _v2_guard = EnvVarGuard::set("OPENHUMAN_COMPOSIO_DIRECT_BASE_V2", &composio_base);- let _v3_guard = EnvVarGuard::set("OPENHUMAN_COMPOSIO_DIRECT_BASE_V3", &composio_base);-- write_composio_direct_config(&openhuman_home, "http://127.0.0.1:1");-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{rpc_addr}");-- // Two active Gmail accounts + one stale Gmail connection (not in the scan).- add_composio_memory_source(&rpc_base, 8951, "Gmail · one", "gmail", "conn_gmail_one").await;- add_composio_memory_source(&rpc_base, 8952, "Gmail · two", "gmail", "conn_gmail_two").await;- add_composio_memory_source(- &rpc_base,- 8953,- "Gmail · stale",- "gmail",- "conn_gmail_stale",- )- .await;-- // Probe the exact chain the filter depends on FIRST, so a broken scan- // fails here with its real error instead of downstream as a silently- // fail-open (unfiltered) listing.- let probe = post_json_rpc(- &rpc_base,- 8999,- "openhuman.composio_list_connections",- json!({}),- )- .await;- let probe_result = assert_no_jsonrpc_error(&probe, "composio_list_connections probe").clone();- let probe_text = probe_result.to_string();- assert!(- probe_text.contains("conn_gmail_one"),- "the connections probe must see the mock's active set; got {probe_text}"- );-- let list = post_json_rpc(&rpc_base, 8954, "openhuman.memory_sources_list", json!({})).await;- let result = assert_no_jsonrpc_error(&list, "memory_sources_list").clone();- let sources = memory_sources_from_list(&result);-- let mut gmail_conn_ids: Vec<&str> = sources- .iter()- .filter(|s| s.get("kind").and_then(Value::as_str) == Some("composio"))- .filter_map(|s| s.get("connection_id").and_then(Value::as_str))- .collect();- gmail_conn_ids.sort_unstable();-- // Both active accounts kept (not collapsed by toolkit); stale one hidden.- assert_eq!(- gmail_conn_ids,- vec!["conn_gmail_one", "conn_gmail_two"],- "both active connections of the same toolkit must list; stale hidden; got sources={sources:?}"- );-- rpc_join.abort();- composio_join.abort();-}-// ─────────────────────────────────────────────────────────────────────────────// Workflow run execution engine (#3375 PR2)//@@ -13508,53 +12093,6 @@ async fn json_rpc_threads_transcript_get_projects_and_paginates() {rpc_join.abort();}-/// #5172 — `memory_flavour` is a read-only agent tool exposing the compiled-/// persona flavour profiles (communication/coding_style/stack/workflow/-/// environment/directives/anti_preferences) that persona ingestion builds-/// but nothing previously surfaced to the agent loop.-///-/// Verifies:-/// 1. The tool is reachable under its registered name (`memory_flavour`).-/// 2. On a fresh workspace (no persona ingestion has run, so no flavoured-/// tree exists yet), a valid flavour slug returns a clear non-error-/// "no profile built yet" message rather than an error or a fabricated-/// profile.-/// 3. An unknown flavour slug is rejected.-#[tokio::test]-async fn memory_flavour_agent_tool_e2e_5172() {- use openhuman_core::config::Config;- use openhuman_core::tools::MemoryFlavourTool;- use tinytools::Tool;-- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let mut cfg = Config::default();- cfg.workspace_dir = tmp.path().to_path_buf();- let tool = MemoryFlavourTool::new(std::sync::Arc::new(cfg));-- assert_eq!(tool.name(), "memory_flavour");-- let result = tool- .execute(json!({ "flavour": "coding_style" }))- .await- .expect("valid flavour on a fresh workspace should not error");- assert!(- !result.is_error,- "an unbuilt profile must not be reported as a tool error: {result:?}"- );- assert!(- result.output().contains("No profile built yet"),- "expected the no-profile-yet message, got: {}",- result.output()- );-- let unknown = tool- .execute(json!({ "flavour": "astrology" }))- .await- .expect_err("an unrecognized flavour slug must be rejected");- assert!(unknown.to_string().contains("Unknown flavour"));-}-/// The `memory_diff` RPC surface is gone, and the `memory` domain is not (#5839).////// #5839 deleted the `memory-git` feature, `crates/openhuman-core/src/memory/diff/`, the@@ -14123,144 +12661,6 @@ async fn json_rpc_flows_strict_create_still_refuses_prose_prompt_without_message// Migration import guard: refusing the null memory driver (#5799)// ----------------------------------------------------------------------------/// An apply-mode migration into a null memory driver must REFUSE, and the-/// refusal must not name the wrong product.-///-/// The guard exists because every write into a null driver is discarded, so an-/// import that reports "migrated N entries" having written none is silent data-/// loss of the worst kind: the user may delete the source workspace on the-/// strength of that report and have nothing left to re-run against.-///-/// #5799 rewrote the refusal. The half reachable in a modules-on build — which-/// is every build this lane runs — is the headline: it used to read "refusing to-/// import **OpenClaw** memory into the null driver" and was raised verbatim by-/// `migrate_hermes` too, telling a Hermes user about a product they were not-/// migrating. That is what this drives: the Hermes RPC, asserting the refusal-/// does not say "OpenClaw".-///-/// Not covered here, and deliberately: the third arm #5799 added, which names a-/// modules-off *build* rather than the user's config. `binding::module_provider`-/// only substitutes the null provider under `#[cfg(not(feature = "modules"))]`-/// (`memory/binding.rs:406-415`); with modules on it always answers-/// `DriverClass::Module`, so that arm is unreachable from this binary. It is-/// asserted by the gates-off unit test-/// `migration_helpers::ops_tests::apply_refuses_and_names_the_build_when_no_memory_module_is_compiled_in`.-#[tokio::test]-async fn json_rpc_migrate_hermes_refuses_null_driver_without_naming_openclaw() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- // `Config::workspace_dir` is `#[serde(skip)]` (`config/schema/types_part_01.rs:78`),- // so it cannot be set from config.toml — the workspace comes from the- // `OPENHUMAN_WORKSPACE` env overlay, which is what this sets. A `workspace_dir`- // key in the TOML would be silently inert, and the migration's- // self-migration guard compares against whatever the overlay resolved.- let workspace = home.join("workspace");- std::fs::create_dir_all(&workspace).expect("mkdir workspace");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", &workspace);- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");-- let (mock_addr, mock_join) = serve_on_ephemeral(mock_upstream_router()).await;- let mock_origin = format!("http://{}", mock_addr);-- // `driver = "null"` is the one route to a null-classed binding that a- // modules-on build can take: `admit` returns the configured id, and the id- // *is* the null driver, so the binding reports class Null with no fallback.- let cfg = format!(- r#"api_url = "{mock_origin}"-default_model = "e2e-mock-model"-default_temperature = 0.7-chat_onboarding_completed = true--[secrets]-encrypt = false--[subsystems.memory]-driver = "null"-"#- );- std::fs::create_dir_all(&openhuman_home).expect("mkdir openhuman");- std::fs::write(openhuman_home.join("config.toml"), &cfg).expect("write config");- std::fs::create_dir_all(openhuman_home.join("users").join("local")).expect("mkdir users/local");- std::fs::write(- openhuman_home- .join("users")- .join("local")- .join("config.toml"),- &cfg,- )- .expect("write user config");- let _: openhuman_core::config::Config =- toml::from_str(&cfg).expect("config toml must match Config schema");-- // A Hermes source with something real to lose. `MEMORY.md` is the first of- // `hermes_file_mappings()`, so the import has an entry to write and the- // refusal has to come from the guard rather than from an empty plan.- let source = home.join("hermes-src");- std::fs::create_dir_all(&source).expect("mkdir hermes source");- let source_memory = source.join("MEMORY.md");- std::fs::write(&source_memory, "# Note\nwould be lost").expect("write hermes MEMORY.md");-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{}", rpc_addr);- tokio::time::sleep(Duration::from_millis(100)).await;-- let response = post_json_rpc(- &rpc_base,- 7310,- "openhuman.migrate_hermes",- json!({- "source_workspace": source.to_string_lossy(),- "dry_run": false,- }),- )- .await;-- // The refusal may surface as a JSON-RPC error or as an error payload- // depending on how the controller maps it; take whichever carries text so- // the assertions below are about the message, not the envelope.- let message = response- .get("error")- .and_then(|e| e.get("message"))- .and_then(Value::as_str)- .map(str::to_string)- .unwrap_or_else(|| response.to_string());-- assert!(- message.contains("null driver"),- "apply into a null memory driver must be refused by the guard; got: {message}"- );- assert!(- !message.contains("OpenClaw"),- "the Hermes migration must not blame OpenClaw — #5799 dropped the \- hard-coded product name from a message both migrations raise; got: {message}"- );- assert!(- message.contains("the source workspace is untouched"),- "the refusal must still promise the source survived; got: {message}"- );-- // The promise in that sentence, checked rather than taken on trust.- assert!(- source_memory.exists(),- "the refusal promised the source workspace was untouched, but {} is gone",- source_memory.display()- );- assert_eq!(- std::fs::read_to_string(&source_memory).expect("read source memory"),- "# Note\nwould be lost",- "the source workspace must be byte-identical after a refused import"- );-- mock_join.abort();- rpc_join.abort();-}-#[tokio::test]async fn json_rpc_agent_run_mode_set_and_get_round_trip() {// `agent.set_run_mode` / `agent.get_run_mode` flip and read back a