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(orchestration): cover completion isolation across profiles in one workspace
Steven Enamakel0ff6deddb871
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rsindex 9ba51b2f58..8d9aeb356b 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs@@ -566,6 +566,7 @@ pub(crate) async fn release_all() -> usize {/// Undelivered completions for `thread_id`, oldest first (read-only; includes/// records an in-flight delivery currently holds).+#[cfg(test)]pub(crate) fn pending_for(workspace_dir: &Path, thread_id: &str) -> Vec<CompletionRecord> {router_for_workspace(workspace_dir).pending_for(thread_id)}@@ -582,11 +583,13 @@ pub(crate) fn pending_for_ctx(/// background completion is not independently delivered as a second, duplicate/// answer. The router withdraws an already-recorded completion and drops one/// that arrives later. Returns whether a pending completion was withdrawn.+#[cfg(test)]pub(crate) fn mark_collected(workspace_dir: &Path, task_id: &str) -> bool {let entry = entry_for(workspace_dir);mark_collected_in_entry(entry, task_id)}+#[cfg(test)]fn mark_collected_in_entry(entry: Arc<Entry>, task_id: &str) -> bool {let router = &entry.router;let completion = router.tombstone(task_id);diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_tenant_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_tenant_tests.rsindex b6f6986a4e..eaf114947a 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tenant_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tenant_tests.rs@@ -174,3 +174,36 @@ async fn the_explicit_context_keys_completions_without_any_ambient_scope() {resume_stopped_thread(&alice, "t-x");discard_for_thread(&bob, ws_b.path(), "t-x");}++#[tokio::test]+async fn explicit_profiles_share_a_workspace_without_sharing_completion_routers() {+ let _guard = crate::config::TEST_ENV_LOCK.lock().await;+ let ws = TestWorkspace::new();+ let alice = DispatchCtx::new(profile("same-ws-alice", ws.path()));+ let bob = DispatchCtx::new(profile("same-ws-bob", ws.path()));++ for (ctx, task) in [(&alice, "alice-task"), (&bob, "bob-task")] {+ record_completion(+ ctx,+ ws.path(),+ "same-session",+ task,+ "researcher",+ "done",+ Some("same-thread".into()),+ )+ .await;+ }++ let alice_tasks: Vec<_> = pending_for_ctx(&alice, ws.path(), "same-thread")+ .into_iter()+ .map(|record| record.task_id)+ .collect();+ let bob_tasks: Vec<_> = pending_for_ctx(&bob, ws.path(), "same-thread")+ .into_iter()+ .map(|record| record.task_id)+ .collect();++ assert_eq!(alice_tasks, ["alice-task"]);+ assert_eq!(bob_tasks, ["bob-task"]);+}