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): reformat saas isolation tests and add memory_explore facet
Steven Enamakel711cb0b04a33
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rsindex 7e876b402b..17d46e50a5 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs@@ -399,7 +399,10 @@ fn detach_progress_releases_every_sender_of_the_turns_channel() {assert!(context.progress.is_none());assert!(context.parent.as_ref().unwrap().on_progress.is_none());assert!(- matches!(rx.try_recv(), Err(tokio::sync::mpsc::error::TryRecvError::Disconnected)),+ matches!(+ rx.try_recv(),+ Err(tokio::sync::mpsc::error::TryRecvError::Disconnected)+ ),"no sender of the turn's channel survives in the kept context");}diff --git a/crates/openhuman-core/src/profiles/ops.rs b/crates/openhuman-core/src/profiles/ops.rsindex 560ea73f62..1af8cbaf78 100644--- a/crates/openhuman-core/src/profiles/ops.rs+++ b/crates/openhuman-core/src/profiles/ops.rs@@ -25,7 +25,9 @@ pub(crate) async fn provision_on() -> Result<Outcome<ProvisionResult>, String> {let profile_id = ProfileId::for_user(user_id, host.saas().profile_ids)?;if names_operator_state(&profile_id, &host.saas().operator_dir()) {- log::warn!("[profiles] refusing to provision a profile named like the operator's state dir");+ log::warn!(+ "[profiles] refusing to provision a profile named like the operator's state dir"+ );return Err(format!("profile id {profile_id} is reserved on this deployment: it is the name of the \operator's state directory"diff --git a/tests/saas_isolation/generators.rs b/tests/saas_isolation/generators.rsindex 8bca74ea65..c452910d74 100644--- a/tests/saas_isolation/generators.rs+++ b/tests/saas_isolation/generators.rs@@ -22,9 +22,10 @@ pub const GENERATORS: &[(&str, Generator)] = &[}params}),- ("openhuman.threads_delete", |w, a| {- json!({ "thread_id": w.thread_for(a, true), "deleted_at": NOW })- }),+ (+ "openhuman.threads_delete",+ |w, a| json!({ "thread_id": w.thread_for(a, true), "deleted_at": NOW }),+ ),("openhuman.threads_purge", |_, _| json!({})),("openhuman.threads_create_new", |w, a| {match w.rng.below(6) {@@ -34,9 +35,10 @@ pub const GENERATORS: &[(&str, Generator)] = &[_ => json!({ "labels": [w.canary(a)] }),}}),- ("openhuman.threads_messages_list", |w, a| {- json!({ "thread_id": w.thread_for(a, false) })- }),+ (+ "openhuman.threads_messages_list",+ |w, a| json!({ "thread_id": w.thread_for(a, false) }),+ ),("openhuman.threads_message_append", |w, a| {let id = if w.rng.chance(40) {w.message_for(a)@@ -62,41 +64,51 @@ pub const GENERATORS: &[(&str, Generator)] = &["extra_metadata": { "note": w.canary(a) },})}),- ("openhuman.threads_update_labels", |w, a| {- json!({ "thread_id": w.thread_for(a, true), "labels": [w.canary(a)] })- }),- ("openhuman.threads_update_title", |w, a| {- json!({ "thread_id": w.thread_for(a, true), "title": w.canary(a) })- }),- ("openhuman.threads_turn_state_get", |w, a| {- json!({ "thread_id": w.thread_for(a, false) })- }),+ (+ "openhuman.threads_update_labels",+ |w, a| json!({ "thread_id": w.thread_for(a, true), "labels": [w.canary(a)] }),+ ),+ (+ "openhuman.threads_update_title",+ |w, a| json!({ "thread_id": w.thread_for(a, true), "title": w.canary(a) }),+ ),+ (+ "openhuman.threads_turn_state_get",+ |w, a| json!({ "thread_id": w.thread_for(a, false) }),+ ),("openhuman.threads_turn_state_list", |_, _| json!({})),- ("openhuman.threads_turn_state_history", |w, a| {- json!({ "thread_id": w.thread_for(a, false) })- }),+ (+ "openhuman.threads_turn_state_history",+ |w, a| json!({ "thread_id": w.thread_for(a, false) }),+ ),("openhuman.threads_turn_state_get_turn", |w, a| {let (request, thread) = w.request_on_thread(a);json!({ "thread_id": thread, "request_id": request })}),- ("openhuman.threads_turn_state_clear", |w, a| {- json!({ "thread_id": w.thread_for(a, true) })- }),- ("openhuman.threads_token_usage", |w, a| {- json!({ "thread_id": w.thread_for(a, false) })- }),- ("openhuman.threads_transcript_get", |w, a| {- json!({ "thread_id": w.thread_for(a, false), "limit": 50 })- }),- ("openhuman.threads_goal_get", |w, a| {- json!({ "thread_id": w.thread_for(a, false) })- }),- ("openhuman.threads_todos_get", |w, a| {- json!({ "thread_id": w.thread_for(a, false) })- }),- ("openhuman.threads_generate_title", |w, a| {- json!({ "thread_id": w.thread_for(a, true), "assistant_message": w.canary(a) })- }),+ (+ "openhuman.threads_turn_state_clear",+ |w, a| json!({ "thread_id": w.thread_for(a, true) }),+ ),+ (+ "openhuman.threads_token_usage",+ |w, a| json!({ "thread_id": w.thread_for(a, false) }),+ ),+ (+ "openhuman.threads_transcript_get",+ |w, a| json!({ "thread_id": w.thread_for(a, false), "limit": 50 }),+ ),+ (+ "openhuman.threads_goal_get",+ |w, a| json!({ "thread_id": w.thread_for(a, false) }),+ ),+ (+ "openhuman.threads_todos_get",+ |w, a| json!({ "thread_id": w.thread_for(a, false) }),+ ),+ (+ "openhuman.threads_generate_title",+ |w, a| json!({ "thread_id": w.thread_for(a, true), "assistant_message": w.canary(a) }),+ ),("openhuman.threads_edit_message", |w, a| {json!({"thread_id": w.thread_for(a, true),@@ -120,7 +132,8 @@ pub const GENERATORS: &[(&str, Generator)] = &[if a != VICTIM && w.rng.chance(4) {message.push_str(&format!(" {}", mock_llm::HANG));}- let mut params = json!({ "client_id": w.client_for(a), "thread_id": thread, "message": message });+ let mut params =+ json!({ "client_id": w.client_for(a), "thread_id": thread, "message": message });let mode = ["interrupt", "steer", "followup", "collect"][w.rng.below(4)];if w.rng.chance(60) {params["queue_mode"] = json!(mode);@@ -135,12 +148,14 @@ pub const GENERATORS: &[(&str, Generator)] = &[json!({ "client_id": w.client_for(a), "thread_id": w.thread_for(a, true) })}}),- ("openhuman.channel_web_queue_status", |w, a| {- json!({ "thread_id": w.thread_for(a, false) })- }),- ("openhuman.channel_web_queue_clear", |w, a| {- json!({ "thread_id": w.thread_for(a, true) })- }),+ (+ "openhuman.channel_web_queue_status",+ |w, a| json!({ "thread_id": w.thread_for(a, false) }),+ ),+ (+ "openhuman.channel_web_queue_clear",+ |w, a| json!({ "thread_id": w.thread_for(a, true) }),+ ),("openhuman.channel_web_queue_remove", |w, a| {json!({"client_id": w.client_for(a),@@ -179,12 +194,27 @@ pub const GENERATORS: &[(&str, Generator)] = &[}params}),- ("openhuman.memory_recall", |w, a| json!({ "question": w.canary(a) })),- ("openhuman.memory_fetch", |w, a| json!({ "query": w.canary(a), "limit": 5 })),- ("openhuman.memory_learn", |w, a| json!({ "text": w.canary(a) })),- ("openhuman.memory_forget", |w, a| json!({ "ids": [w.memory_id_for(a)] })),+ (+ "openhuman.memory_recall",+ |w, a| json!({ "question": w.canary(a) }),+ ),+ (+ "openhuman.memory_fetch",+ |w, a| json!({ "query": w.canary(a), "limit": 5 }),+ ),+ (+ "openhuman.memory_learn",+ |w, a| json!({ "text": w.canary(a) }),+ ),+ (+ "openhuman.memory_forget",+ |w, a| json!({ "ids": [w.memory_id_for(a)] }),+ ),("openhuman.memory_items_list", |_, _| json!({ "limit": 20 })),- ("openhuman.memory_explore", |_, _| json!({})),+ (+ "openhuman.memory_explore",+ |w, _| json!({ "facet": ["kind", "source", "workspace", "folder"][w.rng.below(4)] }),+ ),];impl World {diff --git a/tests/saas_isolation/probes.rs b/tests/saas_isolation/probes.rsindex 47aec1afc6..63a4ddb047 100644--- a/tests/saas_isolation/probes.rs+++ b/tests/saas_isolation/probes.rs@@ -32,10 +32,17 @@ fn probe(node: &Node, tag: &str, tool: &str, args: Value) -> Outcome {assert!(body.get("result").is_some(), "probe {tag}: {body}");let deadline = Instant::now() + Duration::from_secs(60);loop {- let (_, _, body) = call(node, USERS[0], "openhuman.threads_turn_state_get",- json!({ "thread_id": thread }));+ let (_, _, body) = call(+ node,+ USERS[0],+ "openhuman.threads_turn_state_get",+ json!({ "thread_id": thread }),+ );let state = find_key(&body, "turnState").cloned().unwrap_or(Value::Null);- let done = !matches!(state["lifecycle"].as_str(), None | Some("started" | "streaming"));+ let done = !matches!(+ state["lifecycle"].as_str(),+ None | Some("started" | "streaming")+ );let call = state["toolTimeline"].as_array().and_then(|t| t.iter().find(|c| c["id"] == "call_probe"))@@ -43,11 +50,19 @@ fn probe(node: &Node, tag: &str, tool: &str, args: Value) -> Outcome {if let (true, Some(call)) = (done, call) {return Outcome {status: call["status"].as_str().unwrap_or_default().to_string(),- class: call.pointer("/failure/class").and_then(Value::as_str).unwrap_or_default().to_string(),+ class: call+ .pointer("/failure/class")+ .and_then(Value::as_str)+ .unwrap_or_default()+ .to_string(),output: call["output"].as_str().unwrap_or_default().to_string(),};}- assert!(Instant::now() < deadline, "probe {tag} never finished: {body}\n{}", node.log_tail());+ assert!(+ Instant::now() < deadline,+ "probe {tag} never finished: {body}\n{}",+ node.log_tail()+ );std::thread::sleep(Duration::from_millis(200));}}@@ -57,7 +72,13 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {let started = Instant::now();let d = deployment(true);let llm = mock_llm();- let node = start_node(&d, "1", None, "tool_allowlist = [\"host_files\"]\n", Some(llm.port));+ let node = start_node(+ &d,+ "1",+ None,+ "tool_allowlist = [\"host_files\"]\n",+ Some(llm.port),+ );for (user, name) in USERS.iter().enumerate().take(2) {provision(&client(), &node.base, name);let body = operator(@@ -69,18 +90,30 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {}// Keyring secrets are namespaced by their store's directory name: a user// named like this node's operator directory would share its slots.- let (_, body) = rpc_with(&client(), &node.base, Some(BEARER), "openhuman.profiles_provision",- json!({ "user_id": "operator-1" }));+ let (_, body) = rpc_with(+ &client(),+ &node.base,+ Some(BEARER),+ "openhuman.profiles_provision",+ json!({ "user_id": "operator-1" }),+ );assert!(body.get("error").is_some() && !d.root.join("users/operator-1").exists(),"a profile named like the operator dir is refused: {body}");// Bob's data, the operator's and the host's: everything alice must not read.- let (_, _, body) = call(&node, USERS[1], "openhuman.threads_upsert", json!({- "id": "bob-private", "title": canary(1, "title"), "created_at": "2026-10-10T00:00:00Z"- }));+ let (_, _, body) = call(+ &node,+ USERS[1],+ "openhuman.threads_upsert",+ json!({+ "id": "bob-private", "title": canary(1, "title"), "created_at": "2026-10-10T00:00:00Z"+ }),+ );assert!(body.get("result").is_some(), "{body}");- let bob_threads = d.root.join("users/bob/workspace/memory/conversations/threads.jsonl");+ let bob_threads = d+ .root+ .join("users/bob/workspace/memory/conversations/threads.jsonl");assert!(std::fs::read_to_string(&bob_threads).is_ok_and(|t| t.contains("CANARY-bob-")),"bob's thread index at {}",@@ -94,8 +127,12 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {let config_before = std::fs::read(&alice_config).ok();// Positive control: inside her sandbox the file tools work.- let wrote = probe(&node, "own-write", "file_write",- json!({ "path": "note.txt", "content": canary(0, "note") }));+ let wrote = probe(+ &node,+ "own-write",+ "file_write",+ json!({ "path": "note.txt", "content": canary(0, "note") }),+ );let offered: Vec<String> = llm.recorded().iter()@@ -107,16 +144,33 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {!offered.iter().any(|t| t == "shell"),"`host_shell` is not allowlisted, so `shell` is never offered: {offered:?}");- for denied in ["install_tool", "git_operations", "delegate", "curl", "node_exec"] {- assert!(!offered.iter().any(|t| t == denied), "{denied} is hard-denied: {offered:?}");+ for denied in [+ "install_tool",+ "git_operations",+ "delegate",+ "curl",+ "node_exec",+ ] {+ assert!(+ !offered.iter().any(|t| t == denied),+ "{denied} is hard-denied: {offered:?}"+ );}let note = d.root.join("users/alice/sandbox/note.txt");assert!(std::fs::read_to_string(¬e).is_ok_and(|t| t.contains("CANARY-alice-note")),"file_write lands in alice's sandbox: {wrote:?}");- let read = probe(&node, "own-read", "file_read", json!({ "path": "note.txt" }));- assert!(read.output.contains("CANARY-alice-note"), "file_read reads her sandbox: {read:?}");+ let read = probe(+ &node,+ "own-read",+ "file_read",+ json!({ "path": "note.txt" }),+ );+ assert!(+ read.output.contains("CANARY-alice-note"),+ "file_read reads her sandbox: {read:?}"+ );// Hostile probes, in parallel: each on its own thread.let pwned_host = d.tmp.path().join("pwned-host.txt");@@ -125,31 +179,74 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {// A link in alice's sandbox to bob's tree: the path policy must judge// where a path lands, not how it is spelled.#[cfg(unix)]- std::os::unix::fs::symlink(d.root.join("users/bob"), d.root.join("users/alice/sandbox/link-to-bob"))- .unwrap();+ std::os::unix::fs::symlink(+ d.root.join("users/bob"),+ d.root.join("users/alice/sandbox/link-to-bob"),+ )+ .unwrap();let probes: Vec<(&str, &str, Value)> = vec![("host-read", "file_read", json!({ "path": host_secret })),- ("operator-read", "file_read", json!({ "path": operator_secret })),+ (+ "operator-read",+ "file_read",+ json!({ "path": operator_secret }),+ ),("bob-abs-read", "file_read", json!({ "path": bob_threads })),- ("bob-rel-read", "file_read",- json!({ "path": "../../bob/workspace/memory/conversations/threads.jsonl" })),- ("own-ws-read", "file_read", json!({ "path": "../workspace/memory/conversations/threads.jsonl" })),- ("bob-grep", "grep", json!({ "pattern": "CANARY", "path": d.root.join("users/bob") })),+ (+ "bob-rel-read",+ "file_read",+ json!({ "path": "../../bob/workspace/memory/conversations/threads.jsonl" }),+ ),+ (+ "own-ws-read",+ "file_read",+ json!({ "path": "../workspace/memory/conversations/threads.jsonl" }),+ ),+ (+ "bob-grep",+ "grep",+ json!({ "pattern": "CANARY", "path": d.root.join("users/bob") }),+ ),("root-list", "list", json!({ "path": d.root.join("users") })),- ("host-write", "file_write", json!({ "path": pwned_host, "content": canary(0, "pwn") })),- ("bob-write", "file_write",- json!({ "path": "../../bob/sandbox/pwned.txt", "content": canary(0, "pwn") })),- ("config-write", "file_write",- json!({ "path": "../config.toml", "content": "[autonomy]\nenabled = false\n" })),- ("bob-patch", "apply_patch", json!({ "edits": [{+ (+ "host-write",+ "file_write",+ json!({ "path": pwned_host, "content": canary(0, "pwn") }),+ ),+ (+ "bob-write",+ "file_write",+ json!({ "path": "../../bob/sandbox/pwned.txt", "content": canary(0, "pwn") }),+ ),+ (+ "config-write",+ "file_write",+ json!({ "path": "../config.toml", "content": "[autonomy]\nenabled = false\n" }),+ ),+ (+ "bob-patch",+ "apply_patch",+ json!({ "edits": [{"path": "../../bob/sandbox/patched.txt", "old_string": "", "new_string": canary(0, "pwn")- }] })),- ("host-patch", "apply_patch", json!({ "edits": [{+ }] }),+ ),+ (+ "host-patch",+ "apply_patch",+ json!({ "edits": [{"path": pwned_patch, "old_string": "", "new_string": canary(0, "pwn")- }] })),- ("symlink-read", "file_read",- json!({ "path": "link-to-bob/workspace/memory/conversations/threads.jsonl" })),- ("shell", "shell", json!({ "command": format!("touch {}", shell_marker.display()) })),+ }] }),+ ),+ (+ "symlink-read",+ "file_read",+ json!({ "path": "link-to-bob/workspace/memory/conversations/threads.jsonl" }),+ ),+ (+ "shell",+ "shell",+ json!({ "command": format!("touch {}", shell_marker.display()) }),+ ),];let results: Vec<(&str, &str, Outcome)> = std::thread::scope(|s| {let handles: Vec<_> = probes@@ -170,10 +267,18 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {outcome.output.chars().take(110).collect::<String>()));for secret in ["HOST-SECRET", "OPERATOR-SECRET", "CANARY-bob-"] {- assert!(!outcome.output.contains(secret), "probe {tag} read {secret}: {outcome:?}");+ assert!(+ !outcome.output.contains(secret),+ "probe {tag} read {secret}: {outcome:?}"+ );}- assert_eq!(outcome.status, "error", "probe {tag} was not refused: {outcome:?}");- if offered.iter().any(|t| t == tool) || ["file_read", "file_write", "apply_patch"].contains(tool) {+ assert_eq!(+ outcome.status, "error",+ "probe {tag} was not refused: {outcome:?}"+ );+ if offered.iter().any(|t| t == tool)+ || ["file_read", "file_write", "apply_patch"].contains(tool)+ {// A tool the user has: refused by the profile's path policy.// (`apply_patch` reports the same path check per edit.)assert!(@@ -182,16 +287,25 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {);} else {// A tool the user does not have: it does not exist for them.- assert!(outcome.output.contains("unknown tool"), "probe {tag}: {outcome:?}");+ assert!(+ outcome.output.contains("unknown tool"),+ "probe {tag}: {outcome:?}"+ );}}eprintln!("[isolation] offered to alice: {offered:?}");eprintln!("[isolation] probe outcomes:\n{}", report.join("\n"));assert!(!pwned_host.exists(), "a user wrote a host file");- assert!(!d.root.join("users/bob/sandbox/pwned.txt").exists(), "alice wrote into bob's sandbox");+ assert!(+ !d.root.join("users/bob/sandbox/pwned.txt").exists(),+ "alice wrote into bob's sandbox"+ );assert!(!shell_marker.exists(), "a user ran a host shell command");assert!(!pwned_patch.exists(), "a user patched a host file");- assert!(!d.root.join("users/bob/sandbox/patched.txt").exists(), "alice patched bob's sandbox");+ assert!(+ !d.root.join("users/bob/sandbox/patched.txt").exists(),+ "alice patched bob's sandbox"+ );assert_eq!(std::fs::read(&alice_config).ok(),config_before,@@ -199,5 +313,8 @@ fn host_tool_probes_are_refused_under_the_profile_policy() {);let (violations, _) = scan::audit_backend(&llm.recorded());assert!(violations.is_empty(), "{}", violations.join("\n"));- eprintln!("[isolation] probes took {:.1}s", started.elapsed().as_secs_f64());+ eprintln!(+ "[isolation] probes took {:.1}s",+ started.elapsed().as_secs_f64()+ );}diff --git a/tests/saas_isolation/storm.rs b/tests/saas_isolation/storm.rsindex cf81823e51..34aeffe751 100644--- a/tests/saas_isolation/storm.rs+++ b/tests/saas_isolation/storm.rs@@ -12,9 +12,16 @@ use super::*;const ROUNDS: usize = 12;fn queue(node: &Node, user: &str, thread: &str) -> Value {- let (status, _, body) = call(node, user, "openhuman.channel_web_queue_status",- json!({ "thread_id": thread }));- assert_eq!(status, 200, "{user}'s queue status during the storm: {body}");+ let (status, _, body) = call(+ node,+ user,+ "openhuman.channel_web_queue_status",+ json!({ "thread_id": thread }),+ );+ assert_eq!(+ status, 200,+ "{user}'s queue status during the storm: {body}"+ );body}@@ -33,17 +40,25 @@ fn an_eviction_storm_keeps_live_turns_controllable() {);for (user, name) in USERS.iter().enumerate() {provision(&client(), &node.base, name);- let body = operator(&node, "openhuman.profiles_set_credential",- json!({ "profile_id": name, "kind": "session", "token": credential(user) }));+ let body = operator(+ &node,+ "openhuman.profiles_set_credential",+ json!({ "profile_id": name, "kind": "session", "token": credential(user) }),+ );assert!(body.get("result").is_some(), "{body}");}let (alice, bob, carol) = (USERS[0], USERS[1], USERS[2]);// Alice's turn goes live, and a follow-up queues behind it.- let (_, _, live) = call(&node, alice, "openhuman.channel_web_chat", json!({- "client_id": "c-live", "thread_id": "live",- "message": format!("{} {HANG}", canary(0, "live")),- }));+ let (_, _, live) = call(+ &node,+ alice,+ "openhuman.channel_web_chat",+ json!({+ "client_id": "c-live", "thread_id": "live",+ "message": format!("{} {HANG}", canary(0, "live")),+ }),+ );let request = find_key(&live, "request_id").and_then(Value::as_str).unwrap_or_else(|| panic!("{live}"))@@ -51,14 +66,22 @@ fn an_eviction_storm_keeps_live_turns_controllable() {wait_until("alice's live turn", &node, Duration::from_secs(60), || {active(&node, alice, "live")});- let (_, _, body) = call(&node, alice, "openhuman.channel_web_chat", json!({- "client_id": "c-live", "thread_id": "live",- "message": canary(0, "followup"), "queue_mode": "followup",- }));+ let (_, _, body) = call(+ &node,+ alice,+ "openhuman.channel_web_chat",+ json!({+ "client_id": "c-live", "thread_id": "live",+ "message": canary(0, "followup"), "queue_mode": "followup",+ }),+ );assert!(body.get("result").is_some(), "{body}");let queued = queue(&node, alice, "live");- assert!(queued.to_string().contains("CANARY-alice-followup") || queued.to_string().contains("\"id\""),- "the follow-up is queued: {queued}");+ assert!(+ queued.to_string().contains("CANARY-alice-followup")+ || queued.to_string().contains("\"id\""),+ "the follow-up is queued: {queued}"+ );// The storm: bob and carol share the one free slot.let (mut opened, mut refused) = (0, 0);@@ -70,9 +93,14 @@ fn an_eviction_storm_keeps_live_turns_controllable() {// that stays busy past the deadline is pinned (leak d).let deadline = Instant::now() + Duration::from_secs(20);let body = loop {- let (status, _, body) = call(&node, user, "openhuman.threads_upsert", json!({- "id": thread, "title": canary(i + 1, &thread), "created_at": "2026-10-10T00:00:00Z"- }));+ let (status, _, body) = call(+ &node,+ user,+ "openhuman.threads_upsert",+ json!({+ "id": thread, "title": canary(i + 1, &thread), "created_at": "2026-10-10T00:00:00Z"+ }),+ );match status {200 => break body,503 if Instant::now() < deadline => {@@ -91,17 +119,32 @@ fn an_eviction_storm_keeps_live_turns_controllable() {if round % 3 == 0 {// A short turn of their own, which pins the profile while it// runs and must stop pinning it once it is over.- call(&node, user, "openhuman.channel_web_chat", json!({- "client_id": "c1", "thread_id": thread, "message": canary(i + 1, "storm")- }));- wait_until("a churning user's short turn", &node, Duration::from_secs(30), || {- !active(&node, user, &thread)- });+ call(+ &node,+ user,+ "openhuman.channel_web_chat",+ json!({+ "client_id": "c1", "thread_id": thread, "message": canary(i + 1, "storm")+ }),+ );+ wait_until(+ "a churning user's short turn",+ &node,+ Duration::from_secs(30),+ || !active(&node, user, &thread),+ );}// Aimed at alice's turn: a no-op in their own profile.- let (_, _, body) = call(&node, user, "openhuman.channel_web_cancel",- json!({ "client_id": "c-live", "thread_id": "live", "request_id": request }));- assert!(!body.to_string().contains("\"cancelled\":true"), "{user} cancelled alice: {body}");+ let (_, _, body) = call(+ &node,+ user,+ "openhuman.channel_web_cancel",+ json!({ "client_id": "c-live", "thread_id": "live", "request_id": request }),+ );+ assert!(+ !body.to_string().contains("\"cancelled\":true"),+ "{user} cancelled alice: {body}"+ );let status = queue(&node, alice, "live");assert!(status.to_string().contains("\"active\":true"),@@ -119,31 +162,57 @@ fn an_eviction_storm_keeps_live_turns_controllable() {"the storm evicted profiles ({evictions})\n{}",node.log_tail());- assert!(!log.contains("evicted least recently used profile=alice")- && !log.contains("evicted idle profile=alice"), "alice was evicted mid-turn");+ assert!(+ !log.contains("evicted least recently used profile=alice")+ && !log.contains("evicted idle profile=alice"),+ "alice was evicted mid-turn"+ );// Alice still controls her queue and her turn.let status = queue(&node, alice, "live");if let Some(item) = find_key(&status, "id").and_then(Value::as_str) {- let (_, _, body) = call(&node, alice, "openhuman.channel_web_queue_remove",- json!({ "client_id": "c-live", "thread_id": "live", "item_id": item }));- assert!(body.get("result").is_some(), "alice removes her queued follow-up: {body}");+ let (_, _, body) = call(+ &node,+ alice,+ "openhuman.channel_web_queue_remove",+ json!({ "client_id": "c-live", "thread_id": "live", "item_id": item }),+ );+ assert!(+ body.get("result").is_some(),+ "alice removes her queued follow-up: {body}"+ );}- let (_, _, body) = call(&node, alice, "openhuman.channel_web_cancel",- json!({ "client_id": "c-live", "thread_id": "live", "request_id": request }));- assert!(body.to_string().contains("\"cancelled\":true"), "alice cancels her turn: {body}");- wait_until("alice's turn to stop", &node, Duration::from_secs(30), || {- !active(&node, alice, "live")- });+ let (_, _, body) = call(+ &node,+ alice,+ "openhuman.channel_web_cancel",+ json!({ "client_id": "c-live", "thread_id": "live", "request_id": request }),+ );+ assert!(+ body.to_string().contains("\"cancelled\":true"),+ "alice cancels her turn: {body}"+ );+ wait_until(+ "alice's turn to stop",+ &node,+ Duration::from_secs(30),+ || !active(&node, alice, "live"),+ );// Bob's and carol's writes survived every evict-and-reopen.for (i, user) in [bob, carol].into_iter().enumerate() {let (_, _, body) = call(&node, user, "openhuman.threads_list", json!({}));let text = body.to_string();for thread in &written[i] {- assert!(text.contains(&format!("\"{thread}\"")), "{user} lost {thread}: {text}");+ assert!(+ text.contains(&format!("\"{thread}\"")),+ "{user} lost {thread}: {text}"+ );}assert!(world::foreign_in(&text, i + 1).is_empty(), "{text}");}- eprintln!("[isolation] storm took {:.1}s", started.elapsed().as_secs_f64());+ eprintln!(+ "[isolation] storm took {:.1}s",+ started.elapsed().as_secs_f64()+ );}diff --git a/tests/saas_isolation/world.rs b/tests/saas_isolation/world.rsindex 7fcb6102bf..525388c2da 100644--- a/tests/saas_isolation/world.rs+++ b/tests/saas_isolation/world.rs@@ -309,7 +309,12 @@ impl World {}let sent: HashSet<String> = params.as_object()- .map(|m| m.values().filter_map(Value::as_str).map(str::to_owned).collect())+ .map(|m| {+ m.values()+ .filter_map(Value::as_str)+ .map(str::to_owned)+ .collect()+ }).unwrap_or_default();let mut stack = vec![(body.clone(), thread)];while let Some((value, thread)) = stack.pop() {@@ -332,11 +337,15 @@ impl World {let t = here.as_deref();let pools = &mut self.pools;match key.as_str() {- "thread_id" | "threadId" => Pools::push(&mut pools.threads, actor, s, None),+ "thread_id" | "threadId" => {+ Pools::push(&mut pools.threads, actor, s, None)+ }"request_id" | "requestId" => {Pools::push_unless(&mut pools.requests, actor, s, t, &sent)}- "client_id" | "clientId" => Pools::push(&mut pools.clients, actor, s, None),+ "client_id" | "clientId" => {+ Pools::push(&mut pools.clients, actor, s, None)+ }"item_id" | "itemId" => {Pools::push_unless(&mut pools.queue_items, actor, s, t, &sent)}@@ -350,7 +359,9 @@ impl World {{Pools::push(&mut pools.threads, actor, s, None)}- m if m.contains("messages_list") || m.contains("message_append") => {+ m if m.contains("messages_list")+ || m.contains("message_append") =>+ {Pools::push(&mut pools.messages, actor, s, t)}m if m.contains("memory_") => {diff --git a/tests/saas_mode/cluster.rs b/tests/saas_mode/cluster.rsindex 93edca5b89..098bb974b2 100644--- a/tests/saas_mode/cluster.rs+++ b/tests/saas_mode/cluster.rs@@ -238,4 +238,3 @@ fn two_users_with_the_same_thread_id_stay_apart() {"alice's turn on the same thread id is untouched");}-diff --git a/tests/saas_mode/mock_llm.rs b/tests/saas_mode/mock_llm.rsindex f178b6fef3..72dacfd500 100644--- a/tests/saas_mode/mock_llm.rs+++ b/tests/saas_mode/mock_llm.rs@@ -160,8 +160,8 @@ fn read_chunked(reader: &mut BufReader<TcpStream>) -> Vec<u8> {if reader.read_line(&mut size).unwrap_or(0) == 0 {break;}- let size = usize::from_str_radix(size.trim().split(';').next().unwrap_or("0"), 16)- .unwrap_or(0);+ let size =+ usize::from_str_radix(size.trim().split(';').next().unwrap_or("0"), 16).unwrap_or(0);if size == 0 {let mut trailer = String::new();let _ = reader.read_line(&mut trailer);@@ -279,7 +279,11 @@ fn sse_response(reply: &Reply, model: &str) -> String {);let finish = match reply {Reply::Text(text) => {- out.push_str(&chunk(json!({ "role": "assistant", "content": text }), None, None));+ out.push_str(&chunk(+ json!({ "role": "assistant", "content": text }),+ None,+ None,+ ));"stop"}Reply::Tool { name, arguments } => {diff --git a/tests/saas_profile_isolation_e2e.rs b/tests/saas_profile_isolation_e2e.rsindex f684bd762d..8665774ae0 100644--- a/tests/saas_profile_isolation_e2e.rs+++ b/tests/saas_profile_isolation_e2e.rs@@ -39,7 +39,7 @@ mod storm;mod world;use generators::{assert_covers_user_surface, GENERATORS};-use world::{canary, credential, foreign_in, steps_from_env, seed_from_env, World, USERS, VICTIM};+use world::{canary, credential, foreign_in, seed_from_env, steps_from_env, World, USERS, VICTIM};const LIVE_THREAD: &str = "live-alice";const LIVE_CLIENT: &str = "c-live";@@ -88,7 +88,10 @@ fn act(w: &mut World, actor: usize, method: &str, params: Value) -> Value {_ => stat.2 += 1,}if status != 200 {- w.fail(&format!("{method} as {} answered HTTP {status}: {body}", USERS[actor]));+ w.fail(&format!(+ "{method} as {} answered HTTP {status}: {body}",+ USERS[actor]+ ));}let leaked = foreign_in(&text, actor);if !leaked.is_empty() {@@ -107,8 +110,16 @@ fn check_response(w: &mut World, actor: usize, method: &str, params: &Value, bodlet text = body.to_string();if method == "openhuman.channel_web_cancel" {if let Some(request) = params["request_id"].as_str() {- let theirs = w.pools.requests.iter().any(|o| o.owner != actor && o.value == request);- let ours = w.pools.requests.iter().any(|o| o.owner == actor && o.value == request);+ let theirs = w+ .pools+ .requests+ .iter()+ .any(|o| o.owner != actor && o.value == request);+ let ours = w+ .pools+ .requests+ .iter()+ .any(|o| o.owner == actor && o.value == request);if theirs && !ours && text.contains("\"cancelled\":true") {w.fail(&format!("{} cancelled another user's request {request}: {text}",@@ -140,14 +151,23 @@ fn check_response(w: &mut World, actor: usize, method: &str, params: &Value, bodfn seed_keep(w: &mut World, user: usize) {let thread = keep_thread(user);w.protected[user].insert(thread.clone());- act(w, user, "openhuman.threads_upsert",- json!({ "id": thread, "title": canary(user, "keep-title"), "created_at": "2026-10-10T00:00:00Z" }));- act(w, user, "openhuman.threads_message_append", json!({- "thread_id": thread,- "message": { "id": format!("keep-msg-{}", USERS[user]), "content": canary(user, "keep"),- "type": "text", "extraMetadata": {}, "sender": "user",- "createdAt": "2026-10-10T00:00:00Z" }- }));+ act(+ w,+ user,+ "openhuman.threads_upsert",+ json!({ "id": thread, "title": canary(user, "keep-title"), "created_at": "2026-10-10T00:00:00Z" }),+ );+ act(+ w,+ user,+ "openhuman.threads_message_append",+ json!({+ "thread_id": thread,+ "message": { "id": format!("keep-msg-{}", USERS[user]), "content": canary(user, "keep"),+ "type": "text", "extraMetadata": {}, "sender": "user",+ "createdAt": "2026-10-10T00:00:00Z" }+ }),+ );}/// Every kind of state the user surface writes, once per user, plus the@@ -161,17 +181,31 @@ fn seed_state(w: &mut World) {for user in 0..USERS.len() {seed_keep(w, user);let message = canary(user, "hello");- act(w, user, "openhuman.channel_web_chat",- json!({ "client_id": "c1", "thread_id": format!("chat-{}", USERS[user]), "message": message }));+ act(+ w,+ user,+ "openhuman.channel_web_chat",+ json!({ "client_id": "c1", "thread_id": format!("chat-{}", USERS[user]), "message": message }),+ );let params = json!({ "channel": "telegram", "chat_id": "777", "sender_id": "555","message_id": "tg-1", "text": canary(user, "relayed") });act(w, user, "openhuman.channel_relay_inbound", params);- act(w, user, "openhuman.memory_learn", json!({ "text": canary(user, "memory") }));+ act(+ w,+ user,+ "openhuman.memory_learn",+ json!({ "text": canary(user, "memory") }),+ );}- let body = act(w, VICTIM, "openhuman.channel_web_chat", json!({- "client_id": LIVE_CLIENT, "thread_id": LIVE_THREAD,- "message": format!("{} {}", canary(VICTIM, "live"), mock_llm::HANG),- }));+ let body = act(+ w,+ VICTIM,+ "openhuman.channel_web_chat",+ json!({+ "client_id": LIVE_CLIENT, "thread_id": LIVE_THREAD,+ "message": format!("{} {}", canary(VICTIM, "live"), mock_llm::HANG),+ }),+ );let request = find_key(&body, "request_id").and_then(Value::as_str).unwrap_or_else(|| panic!("no request_id for the live turn: {body}"))@@ -179,9 +213,12 @@ fn seed_state(w: &mut World) {w.protected[VICTIM].insert(LIVE_THREAD.to_string());w.protected_requests[VICTIM].insert(request);let node = &w.node;- wait_until("the victim's live turn", node, Duration::from_secs(60), || {- active(node, USERS[VICTIM], LIVE_THREAD)- });+ wait_until(+ "the victim's live turn",+ node,+ Duration::from_secs(60),+ || active(node, USERS[VICTIM], LIVE_THREAD),+ );}fn drive(w: &mut World, steps: usize) {@@ -229,26 +266,47 @@ fn settle(llm: &mock_llm::MockLlm, quiet: Duration, max: Duration) {fn verify_victims(w: &mut World) {for user in 0..USERS.len() {- let body = act(w, user, "openhuman.threads_messages_list",- json!({ "thread_id": keep_thread(user) }));+ let body = act(+ w,+ user,+ "openhuman.threads_messages_list",+ json!({ "thread_id": keep_thread(user) }),+ );if !body.to_string().contains(&canary(user, "keep")) {- w.fail(&format!("{}'s sentinel thread lost its message: {body}", USERS[user]));+ w.fail(&format!(+ "{}'s sentinel thread lost its message: {body}",+ USERS[user]+ ));}}- let status = act(w, VICTIM, "openhuman.channel_web_queue_status",- json!({ "thread_id": LIVE_THREAD }));+ let status = act(+ w,+ VICTIM,+ "openhuman.channel_web_queue_status",+ json!({ "thread_id": LIVE_THREAD }),+ );if !status.to_string().contains("\"active\":true") {- let state = act(w, VICTIM, "openhuman.threads_turn_state_get",- json!({ "thread_id": LIVE_THREAD }));+ let state = act(+ w,+ VICTIM,+ "openhuman.threads_turn_state_get",+ json!({ "thread_id": LIVE_THREAD }),+ );w.fail(&format!("the victim's live turn ended during the run: {status}\nturn state: {state}"));}let request = w.protected_requests[VICTIM].iter().next().cloned().unwrap();- let body = act(w, VICTIM, "openhuman.channel_web_cancel",- json!({ "client_id": LIVE_CLIENT, "thread_id": LIVE_THREAD, "request_id": request }));+ let body = act(+ w,+ VICTIM,+ "openhuman.channel_web_cancel",+ json!({ "client_id": LIVE_CLIENT, "thread_id": LIVE_THREAD, "request_id": request }),+ );if !body.to_string().contains("\"cancelled\":true") {- w.fail(&format!("the victim cannot cancel their own live turn: {body}"));+ w.fail(&format!(+ "the victim cannot cancel their own live turn: {body}"+ ));}}@@ -267,8 +325,14 @@ fn verify_frames(w: &World) {own[*user] += 1;}}- eprintln!("[isolation] /events frames: {} total, own-canary frames per user {own:?}", frames.len());- assert!(own.iter().all(|&n| n > 0), "every user's stream saw their own turns: {own:?}");+ eprintln!(+ "[isolation] /events frames: {} total, own-canary frames per user {own:?}",+ frames.len()+ );+ assert!(+ own.iter().all(|&n| n > 0),+ "every user's stream saw their own turns: {own:?}"+ );}#[test]@@ -279,7 +343,13 @@ fn random_cross_profile_calls_never_leak() {eprintln!("[isolation] seed {seed} steps {steps} (OH_FUZZ_SEED / OH_FUZZ_STEPS)");let d = deployment(true);let llm = mock_llm::mock_llm();- let node = start_node(&d, "1", None, "max_profiles_open = 3\nidle_evict_secs = 2\n", Some(llm.port));+ let node = start_node(+ &d,+ "1",+ None,+ "max_profiles_open = 3\nidle_evict_secs = 2\n",+ Some(llm.port),+ );provision_users(&node);let mut w = World::new(node, seed);seed_state(&mut w);@@ -292,16 +362,30 @@ fn random_cross_profile_calls_never_leak() {let (violations, per_user) = scan::audit_backend(&llm.recorded());if !violations.is_empty() {- w.fail(&format!("backend requests crossed profiles:\n{}", violations.join("\n")));+ w.fail(&format!(+ "backend requests crossed profiles:\n{}",+ violations.join("\n")+ ));}- assert!(per_user.iter().all(|&n| n > 0), "every user reached inference: {per_user:?}");+ assert!(+ per_user.iter().all(|&n| n > 0),+ "every user reached inference: {per_user:?}"+ );let (violations, own) = scan::scan_files(&d.root, d.tmp.path());if !violations.is_empty() {- w.fail(&format!("files hold other profiles' canaries:\n{}", violations.join("\n")));+ w.fail(&format!(+ "files hold other profiles' canaries:\n{}",+ violations.join("\n")+ ));}- assert!(own.iter().all(|&n| n > 0), "every user's tree holds their own data: {own:?}");+ assert!(+ own.iter().all(|&n| n > 0),+ "every user's tree holds their own data: {own:?}"+ );- let summary: Vec<String> = w.stats.iter()+ let summary: Vec<String> = w+ .stats+ .iter().map(|(m, (ok, err, other))| {let first = w.first_error.get(m).map(String::as_str).unwrap_or("");format!(" {m}: ok {ok} err {err} other {other} {first}")