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
test(threads): cover run mode rpc profile isolation
Steven Enamakel451e81200efe
diff --git a/crates/openhuman-core/src/threads/run_mode_tests.rs b/crates/openhuman-core/src/threads/run_mode_tests.rsindex d0586b0d24..54b78b29b6 100644--- a/crates/openhuman-core/src/threads/run_mode_tests.rs+++ b/crates/openhuman-core/src/threads/run_mode_tests.rs@@ -85,3 +85,64 @@ async fn plan_mode_stays_with_the_agent_that_set_it() {RunMode::Build);}++#[tokio::test]+async fn run_mode_rpcs_reject_threads_owned_by_another_profile() {+ use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};+ use crate::threads::store::{CreateConversationThread, blocking::ensure_thread};+ use crate::tools::toolpacks::ToolGroups;++ let scratch = tempfile::tempdir().expect("workspace");+ let dir = scratch.path().to_path_buf();+ let config = crate::config::Config {+ workspace_dir: dir.clone(),+ action_dir: dir.clone(),+ config_path: dir.join("config.toml"),+ ..Default::default()+ };+ let context = |profile: &str| {+ DispatchCtx::new(CoreContext::for_test(DomainSet::full(), Some(dir.clone())).derive_with(+ ContextOverlay::new(config.clone(), DomainSet::full(), ToolGroups::none())+ .profile(profile),+ ))+ };+ let owner = context("run-mode-owner");+ let other = context("run-mode-other");+ let thread_id = "run-mode-private-thread";+ ensure_thread(+ owner.clone(),+ dir,+ CreateConversationThread {+ id: thread_id.into(),+ title: "Private".into(),+ created_at: "2026-10-22T00:00:00Z".into(),+ parent_thread_id: None,+ labels: None,+ personality_id: None,+ working_dir: None,+ },+ )+ .await+ .expect("seed owner's thread");++ set_mode(&owner, thread_id, RunMode::Plan);+ let id_params = serde_json::json!({ "thread_id": thread_id })+ .as_object()+ .unwrap()+ .clone();+ assert!(+ handle_get_run_mode(other.clone(), id_params)+ .await+ .is_err(),+ "get_run_mode must not disclose another profile's thread state"+ );+ let set_params = serde_json::json!({ "thread_id": thread_id, "mode": "build" })+ .as_object()+ .unwrap()+ .clone();+ assert!(+ handle_set_run_mode(other, set_params).await.is_err(),+ "set_run_mode must not mutate another profile's thread"+ );+ assert_eq!(get_mode(&owner, thread_id), RunMode::Plan);+}