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: reformat long call sites to satisfy line width
Steven Enamakel4dbd919f2211
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rsindex f43e692a9a..c0f3573c5f 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs@@ -430,8 +430,12 @@ fn attach_workflow_proposal_persists_thread_message_and_extends_summary() {// Proposal is durably persisted in the parent thread with rehydratable// metadata (this is what survives reload / a dropped socket event).- let messages =- conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf(), "thread-parent").expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ "thread-parent",+ )+ .expect("messages");let proposal_msg = messages.iter().find(|m| m.id == "workflow-proposal:sub-task-1")diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rsindex f95d3ccca1..d65127cecf 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tests.rs@@ -105,7 +105,11 @@ fn persist_worker_thread_creates_thread_with_tasks_label_and_messages() {assert!(thread_id.starts_with("worker-"));- let threads = conversations::list_threads(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf()).expect("list threads");+ let threads = conversations::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ )+ .expect("list threads");let worker = threads.iter().find(|t| t.id == thread_id)@@ -113,8 +117,12 @@ fn persist_worker_thread_creates_thread_with_tasks_label_and_messages() {assert!(worker.labels.contains(&"tasks".to_string()));assert!(worker.title.starts_with("draft a long research plan"));- let messages =- conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf(), &thread_id).expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ &thread_id,+ )+ .expect("messages");assert_eq!(messages.len(), 2);assert_eq!(messages[0].sender, "user");assert_eq!(messages[0].content, "draft a long research plan");diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rsindex ec31ecedaa..d4d4a186f5 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs@@ -465,16 +465,23 @@ async fn spawn_worker_thread_tool_persists_worker_thread_e2e() {assert!(result.output().contains("\"status\":\"completed\""));assert!(provider.saw(WORKER_THREAD_CANARY));- let threads =- conversations::list_threads(&crate::core::runtime::DispatchCtx::ambient(), workspace.path().to_path_buf()).expect("worker threads");+ let threads = conversations::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ workspace.path().to_path_buf(),+ )+ .expect("worker threads");let worker = threads.iter().find(|thread| thread.labels.contains(&"tasks".to_string())).expect("worker thread was persisted");assert_eq!(worker.title, "Long delegated task");- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), workspace.path().to_path_buf(), &worker.id)- .expect("worker messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ workspace.path().to_path_buf(),+ &worker.id,+ )+ .expect("worker messages");assert_eq!(messages.len(), 2);assert_eq!(messages[0].sender, "user");assert!(messages[0].content.contains(WORKER_THREAD_CANARY));diff --git a/crates/openhuman-core/src/agent/orchestration/tools/worker_thread_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/worker_thread_tests.rsindex f74e49b3a3..da19cde5cd 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/worker_thread_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/worker_thread_tests.rs@@ -16,7 +16,9 @@ fn creates_child_thread_linked_to_parent_and_seeds_prompt() {// The new thread is labelled `tasks` and linked to the parent so it// stays grouped with delegated task work in the chat sidebar.- let threads = conversations::list_threads(&crate::core::runtime::DispatchCtx::ambient(), dir.clone()).unwrap();+ let threads =+ conversations::list_threads(&crate::core::runtime::DispatchCtx::ambient(), dir.clone())+ .unwrap();let thread = threads.iter().find(|t| t.id == id)@@ -26,7 +28,12 @@ fn creates_child_thread_linked_to_parent_and_seeds_prompt() {// It opens with the delegation prompt as the user message, so the// drawer can render the parent↔subagent chat from memory on reopen.- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), dir.clone(), &id).unwrap();+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ &id,+ )+ .unwrap();assert_eq!(messages.len(), 1);assert_eq!(messages[0].sender, "user");assert_eq!(messages[0].content, "Find Q3");@@ -49,7 +56,12 @@ fn appends_follow_up_prompt_to_existing_worker_thread() {append_worker_user_message(dir.clone(), &id, "researcher", "sub-2", "Follow-up prompt").unwrap();- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), dir.clone(), &id).unwrap();+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ &id,+ )+ .unwrap();assert_eq!(messages.len(), 2);assert_eq!(messages[1].sender, "user");assert_eq!(messages[1].content, "Follow-up prompt");diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rsindex 7a3eb08439..5403e77bed 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rs@@ -213,7 +213,7 @@ fn mirrored_tool_results_are_hidden_from_the_worker_thread_chat() {let now = chrono::Utc::now().to_rfc3339();for id in ["worker-typed", "worker-recovered"] {store::ensure_thread(- &crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),dir.clone(),CreateConversationThread {id: id.to_string(),@@ -274,7 +274,12 @@ fn mirrored_tool_results_are_hidden_from_the_worker_thread_chat() {// failure names every path that is still painting a tool result as chat.let mut painted_as_user_chat: Vec<String> = Vec::new();for thread_id in ["worker-typed", "worker-recovered"] {- let rows = store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), dir.clone(), thread_id).unwrap();+ let rows = store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ thread_id,+ )+ .unwrap();assert!(rows.iter().any(|r| r.content == RAW),"{thread_id}: the mirror wrote no tool-result row to assert on"diff --git a/crates/openhuman-core/src/channels/host/adapters.rs b/crates/openhuman-core/src/channels/host/adapters.rsindex b37e936882..9fcb28610e 100644--- a/crates/openhuman-core/src/channels/host/adapters.rs+++ b/crates/openhuman-core/src/channels/host/adapters.rs@@ -209,8 +209,12 @@ impl ConversationStore for ConversationHistoryStore {session_key: &str,limit: usize,) -> anyhow::Result<Vec<ConversationMessage>> {- let messages = crate::threads::store::get_messages(&DispatchCtx::ambient(), self.workspace_dir.clone(), session_key)- .map_err(|e| anyhow::anyhow!(e))?;+ let messages = crate::threads::store::get_messages(+ &DispatchCtx::ambient(),+ self.workspace_dir.clone(),+ session_key,+ )+ .map_err(|e| anyhow::anyhow!(e))?;let start = messages.len().saturating_sub(limit);Ok(messages[start..].iter()@@ -226,7 +230,7 @@ impl ConversationStore for ConversationHistoryStore {let now = chrono::Utc::now().to_rfc3339();// `append_message` requires the thread to exist; create-or-noop first.crate::threads::store::ensure_thread(- &DispatchCtx::ambient(),+ &DispatchCtx::ambient(),self.workspace_dir.clone(),crate::threads::store::CreateConversationThread {id: session_key.to_string(),@@ -247,8 +251,13 @@ impl ConversationStore for ConversationHistoryStore {sender: message.role,created_at: now,};- crate::threads::store::append_message(&DispatchCtx::ambient(), self.workspace_dir.clone(), session_key, stored)- .map_err(|e| anyhow::anyhow!(e))?;+ crate::threads::store::append_message(+ &DispatchCtx::ambient(),+ self.workspace_dir.clone(),+ session_key,+ stored,+ )+ .map_err(|e| anyhow::anyhow!(e))?;Ok(())}}diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex 7ee04ad896..12f661cf69 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -46,7 +46,8 @@ pub async fn channel_relay_inbound(let thread_id = identity.thread_id;let workspace_dir = config.workspace_dir.clone();- if store::record_inbound(ctx, &workspace_dir, ¶ms, &thread_id).await? == Recorded::Duplicate {+ if store::record_inbound(ctx, &workspace_dir, ¶ms, &thread_id).await? == Recorded::Duplicate+ {tracing::info!(channel = %params.channel,thread_id = %thread_id,@@ -134,7 +135,14 @@ pub(crate) async fn run_relay_turn(&crate::channels::SendMessage::new(reply, ¶ms.chat_id),).await;- record(&dispatch_ctx, &workspace_dir, ¶ms, &thread_id, &channel.sent()).await;+ record(+ &dispatch_ctx,+ &workspace_dir,+ ¶ms,+ &thread_id,+ &channel.sent(),+ )+ .await;return channel.sent();}};@@ -159,7 +167,14 @@ pub(crate) async fn run_relay_turn(&crate::channels::SendMessage::new(reply, ¶ms.chat_id),).await;- record(&dispatch_ctx, &workspace_dir, ¶ms, &thread_id, &channel.sent()).await;+ record(+ &dispatch_ctx,+ &workspace_dir,+ ¶ms,+ &thread_id,+ &channel.sent(),+ )+ .await;return channel.sent();}};diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rsindex ef0b80b780..94b723eeca 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs@@ -127,10 +127,23 @@ async fn a_relayed_turn_runs_as_an_external_channel_and_keeps_its_thread() {let p = params(id, text);let thread = p.thread_id();assert_eq!(- store::record_inbound(&crate::core::runtime::DispatchCtx::ambient(), &workspace, &p, &thread).await,+ store::record_inbound(+ &crate::core::runtime::DispatchCtx::ambient(),+ &workspace,+ &p,+ &thread+ )+ .await,Ok(Recorded::New));- let replies = run_relay_turn(crate::core::runtime::DispatchCtx::ambient(), config.clone(), p, thread, format!("req-{id}")).await;+ let replies = run_relay_turn(+ crate::core::runtime::DispatchCtx::ambient(),+ config.clone(),+ p,+ thread,+ format!("req-{id}"),+ )+ .await;assert_eq!(replies.len(), 1, "{replies:?}");}@@ -173,7 +186,12 @@ async fn a_relayed_turn_runs_as_an_external_channel_and_keeps_its_thread() {);let thread = params("m1", "x").thread_id();- let messages = crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), workspace.clone(), &thread).unwrap();+ let messages = crate::threads::store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ workspace.clone(),+ &thread,+ )+ .unwrap();let ids: Vec<&str> = messages.iter().map(|m| m.id.as_str()).collect();assert_eq!(ids,@@ -207,14 +225,21 @@ async fn invalid_or_repeated_messages_start_no_turn() {CoreContext::scope(ctx, async {let mut bad = params("m1", "hello");bad.chat_id = "a/b".into();- let err = channel_relay_inbound(&crate::core::runtime::DispatchCtx::ambient(), bad).await.expect_err("invalid");+ let err = channel_relay_inbound(&crate::core::runtime::DispatchCtx::ambient(), bad)+ .await+ .expect_err("invalid");assert!(err.contains("chat_id"), "{err}");let p = params("m1", "hello");let thread = p.thread_id();- store::record_inbound(&crate::core::runtime::DispatchCtx::ambient(), &workspace, &p, &thread)- .await- .unwrap();+ store::record_inbound(+ &crate::core::runtime::DispatchCtx::ambient(),+ &workspace,+ &p,+ &thread,+ )+ .await+ .unwrap();let outcome = channel_relay_inbound(&crate::core::runtime::DispatchCtx::ambient(), p).await.expect("duplicate is not an error");diff --git a/crates/openhuman-core/src/channels/providers/relay/store_tests.rs b/crates/openhuman-core/src/channels/providers/relay/store_tests.rsindex 9c444d84f2..3d4aecc352 100644--- a/crates/openhuman-core/src/channels/providers/relay/store_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/store_tests.rs@@ -18,20 +18,41 @@ async fn an_inbound_message_is_recorded_once() {let p = params("m1", "hello");let thread = p.thread_id();assert_eq!(- record_inbound(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &p, &thread).await,+ record_inbound(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &p,+ &thread+ )+ .await,Ok(Recorded::New));assert_eq!(- record_inbound(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &p, &thread).await,+ record_inbound(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &p,+ &thread+ )+ .await,Ok(Recorded::Duplicate),"a gateway retry is not recorded twice");- let threads = crate::threads::store::list_threads(&crate::core::runtime::DispatchCtx::ambient(), tmp.path().to_path_buf()).unwrap();+ let threads = crate::threads::store::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path().to_path_buf(),+ )+ .unwrap();assert_eq!(threads.len(), 1);assert_eq!(threads[0].id, thread);assert_eq!(threads[0].title, "telegram · 42 · -100");- let messages = crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), tmp.path().to_path_buf(), &thread).unwrap();+ let messages = crate::threads::store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path().to_path_buf(),+ &thread,+ )+ .unwrap();assert_eq!(messages.len(), 1);assert_eq!(messages[0].id, "user:m1");assert_eq!(messages[0].sender, "user");@@ -43,17 +64,51 @@ async fn replies_are_recorded_and_seed_the_next_turn() {let tmp = tempfile::tempdir().unwrap();let first = params("m1", "hello");let thread = first.thread_id();- record_inbound(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &first, &thread).await.unwrap();- record_reply(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &first, &thread, &[])- .await- .expect("nothing sent, nothing recorded");- record_reply(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &first, &thread, &["hi".into(), "there".into()])- .await- .unwrap();+ record_inbound(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &first,+ &thread,+ )+ .await+ .unwrap();+ record_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &first,+ &thread,+ &[],+ )+ .await+ .expect("nothing sent, nothing recorded");+ record_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &first,+ &thread,+ &["hi".into(), "there".into()],+ )+ .await+ .unwrap();let second = params("m2", "again");- record_inbound(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &second, &thread).await.unwrap();+ record_inbound(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &second,+ &thread,+ )+ .await+ .unwrap();- let prior = prior_turns(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &thread, "m2", 10).await.unwrap();+ let prior = prior_turns(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &thread,+ "m2",+ 10,+ )+ .await+ .unwrap();let rows: Vec<(String, String)> = prior.iter().map(|m| (m.role.clone(), m.content.clone()))@@ -66,7 +121,15 @@ async fn replies_are_recorded_and_seed_the_next_turn() {],"earlier turns only, not the message being answered");- let limited = prior_turns(&crate::core::runtime::DispatchCtx::ambient(), tmp.path(), &thread, "m2", 1).await.unwrap();+ let limited = prior_turns(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path(),+ &thread,+ "m2",+ 1,+ )+ .await+ .unwrap();assert_eq!(limited.len(), 1);assert_eq!(limited[0].content, "hi\n\nthere", "the most recent rows");}@@ -81,7 +144,13 @@ async fn concurrent_retries_of_one_message_record_it_once() {let dir = tmp.path().to_path_buf();let (p, thread) = (p.clone(), thread.clone());tasks.push(tokio::spawn(async move {- record_inbound(&crate::core::runtime::DispatchCtx::ambient(), &dir, &p, &thread).await+ record_inbound(+ &crate::core::runtime::DispatchCtx::ambient(),+ &dir,+ &p,+ &thread,+ )+ .await}));}let mut new = 0;@@ -91,6 +160,11 @@ async fn concurrent_retries_of_one_message_record_it_once() {}}assert_eq!(new, 1, "exactly one concurrent retry is the new message");- let messages = crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), tmp.path().to_path_buf(), &thread).unwrap();+ let messages = crate::threads::store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ tmp.path().to_path_buf(),+ &thread,+ )+ .unwrap();assert_eq!(messages.len(), 1);}diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rsindex b140635ce8..534d17b0d4 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs@@ -11,9 +11,9 @@//! - Channel origin: the reply is sent to the origin's reply target, then//! appended to that chat's history so its next turn sees it.-use crate::core::runtime::DispatchCtx;use super::delivery::strip_openhuman_link_markup;use crate::config::Config;+use crate::core::runtime::DispatchCtx;use crate::web_chat::{publish_web_channel_event, WebChannelEvent};use anyhow::{anyhow, Result};use std::path::Path;diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rsindex 913709c490..bc2502f2da 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs@@ -94,11 +94,13 @@ async fn no_reply_is_suppressed_without_writing_anything() {.await.unwrap();assert_eq!(status, DeliveryStatus::Suppressed);- assert!(- conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), cfg.workspace_dir.clone(), "t-1")- .unwrap()- .is_empty()- );+ assert!(conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ cfg.workspace_dir.clone(),+ "t-1"+ )+ .unwrap()+ .is_empty());}#[tokio::test]@@ -114,7 +116,12 @@ async fn web_delivery_stores_one_row_under_the_run_reply_id_and_is_idempotent().unwrap();assert_eq!(status, DeliveryStatus::Delivered);}- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), cfg.workspace_dir.clone(), "t-1").unwrap();+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ cfg.workspace_dir.clone(),+ "t-1",+ )+ .unwrap();assert_eq!(messages.len(), 1, "same run collapses onto one row");assert_eq!(messages[0].id,@@ -127,9 +134,13 @@ async fn web_delivery_stores_one_row_under_the_run_reply_id_and_is_idempotent().await.unwrap();assert_eq!(- conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), cfg.workspace_dir.clone(), "t-1")- .unwrap()- .len(),+ conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ cfg.workspace_dir.clone(),+ "t-1"+ )+ .unwrap()+ .len(),2);}diff --git a/crates/openhuman-core/src/memory/backfill_tests.rs b/crates/openhuman-core/src/memory/backfill_tests.rsindex fc198ad8b0..0cda546244 100644--- a/crates/openhuman-core/src/memory/backfill_tests.rs+++ b/crates/openhuman-core/src/memory/backfill_tests.rs@@ -37,7 +37,7 @@ async fn seed_thread(workspace: &Path, thread_id: &str, messages: &[(&str, &str).unwrap();for (index, (sender, content)) in messages.iter().enumerate() {threads::append_message(- crate::core::runtime::DispatchCtx::ambient(),+ crate::core::runtime::DispatchCtx::ambient(),workspace.to_path_buf(),thread_id.to_string(),message(diff --git a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rsindex 350df0f6c0..fd608e7e8f 100644--- a/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs+++ b/crates/openhuman-core/src/threads/ops/crud_message_append_tests.rs@@ -29,7 +29,14 @@ async fn append_with_test_config(config: &crate::config::Config,origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,) -> Result<Outcome<ApiEnvelope<ConversationMessageRecord>>, ThreadsError> {- message_append_with_config(&crate::core::runtime::DispatchCtx::ambient(), request, config, origin, &config.workspace_dir).await+ message_append_with_config(+ &crate::core::runtime::DispatchCtx::ambient(),+ request,+ config,+ origin,+ &config.workspace_dir,+ )+ .await}fn request(id: &str, content: &str, sender: &str) -> AppendConversationMessageRequest {@@ -101,10 +108,13 @@ async fn user_append_stages_original_strips_upload_bytes_and_reuses_returned_con.await.unwrap();assert_eq!(staged, first.content);- let persisted =- conversations::blocking::get_messages(crate::core::runtime::DispatchCtx::ambient(), config.workspace_dir.clone(), "uploads".into())- .await- .unwrap();+ let persisted = conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir.clone(),+ "uploads".into(),+ )+ .await+ .unwrap();assert_eq!(persisted.len(), 2);assert!(!serde_json::to_string(&persisted).unwrap()@@ -139,12 +149,14 @@ async fn rejected_upload_never_appends_a_message() {.await.is_err());- assert!(- conversations::blocking::get_messages(crate::core::runtime::DispatchCtx::ambient(), config.workspace_dir.clone(), "uploads".into())- .await- .unwrap()- .is_empty()- );+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir.clone(),+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]@@ -172,12 +184,14 @@ async fn external_origin_cannot_reuse_an_existing_attachment_marker() {.await.is_err());- assert!(- conversations::blocking::get_messages(crate::core::runtime::DispatchCtx::ambient(), config.workspace_dir, "uploads".into())- .await- .unwrap()- .is_empty()- );+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir,+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]@@ -238,16 +252,22 @@ async fn append_uses_host_persistence_workspace_separate_from_rpc_config() {.await.unwrap();- let persisted = conversations::blocking::get_messages(crate::core::runtime::DispatchCtx::ambient(), persistence_dir, "uploads".into())- .await- .unwrap();+ let persisted = conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ persistence_dir,+ "uploads".into(),+ )+ .await+ .unwrap();assert_eq!(persisted.len(), 1);- assert!(- conversations::blocking::get_messages(crate::core::runtime::DispatchCtx::ambient(), config.workspace_dir, "uploads".into())- .await- .unwrap()- .is_empty()- );+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir,+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]@@ -261,12 +281,14 @@ async fn poster_only_user_metadata_is_rejected_before_persistence() {assert!(append_with_test_config(upload, &config, None).await.is_err());- assert!(- conversations::blocking::get_messages(crate::core::runtime::DispatchCtx::ambient(), config.workspace_dir.clone(), "uploads".into())- .await- .unwrap()- .is_empty()- );+ assert!(conversations::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ config.workspace_dir.clone(),+ "uploads".into()+ )+ .await+ .unwrap()+ .is_empty());}#[tokio::test]diff --git a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rsindex 8802da6ce8..64eb56a87e 100644--- a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs+++ b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs@@ -155,9 +155,14 @@ async fn next_reply_request_id_after_finds_the_correlated_turn() {let thread_id = "thread-reply-lookup";seed_message_log(dir.path(), thread_id).await;- let found = next_reply_request_id_after(&crate::core::runtime::DispatchCtx::ambient(), dir.path(), thread_id, "user-1")- .await- .expect("lookup");+ let found = next_reply_request_id_after(+ &crate::core::runtime::DispatchCtx::ambient(),+ dir.path(),+ thread_id,+ "user-1",+ )+ .await+ .expect("lookup");assert_eq!(found, Some("turn-1".to_string()));}@@ -168,9 +173,14 @@ async fn next_reply_request_id_after_none_when_message_is_the_log_tail() {seed_message_log(dir.path(), thread_id).await;let last_reply_id = run_reply_message_id("turn-2");- let found = next_reply_request_id_after(&crate::core::runtime::DispatchCtx::ambient(), dir.path(), thread_id, &last_reply_id)- .await- .expect("lookup");+ let found = next_reply_request_id_after(+ &crate::core::runtime::DispatchCtx::ambient(),+ dir.path(),+ thread_id,+ &last_reply_id,+ )+ .await+ .expect("lookup");assert_eq!(found, None,"the last message in the log has no reply after it"@@ -183,8 +193,13 @@ async fn next_reply_request_id_after_none_when_message_id_unknown() {let thread_id = "thread-reply-lookup-unknown";seed_message_log(dir.path(), thread_id).await;- let found = next_reply_request_id_after(&crate::core::runtime::DispatchCtx::ambient(), dir.path(), thread_id, "does-not-exist")- .await- .expect("lookup");+ let found = next_reply_request_id_after(+ &crate::core::runtime::DispatchCtx::ambient(),+ dir.path(),+ thread_id,+ "does-not-exist",+ )+ .await+ .expect("lookup");assert_eq!(found, None);}diff --git a/crates/openhuman-core/src/threads/ops/search_tests.rs b/crates/openhuman-core/src/threads/ops/search_tests.rsindex 1ec0f95ad8..70820643d4 100644--- a/crates/openhuman-core/src/threads/ops/search_tests.rs+++ b/crates/openhuman-core/src/threads/ops/search_tests.rs@@ -47,10 +47,13 @@ fn request_limit_is_optional() {#[tokio::test]async fn blank_query_answers_no_hits() {- let out = thread_search(&crate::core::runtime::DispatchCtx::ambient(), ThreadSearchRequest {- query: " ".into(),- limit: None,- })+ let out = thread_search(+ &crate::core::runtime::DispatchCtx::ambient(),+ ThreadSearchRequest {+ query: " ".into(),+ limit: None,+ },+ ).await.unwrap();let json = out.into_cli_compatible_json().unwrap();diff --git a/crates/openhuman-core/src/threads/ops_conversion_tests.rs b/crates/openhuman-core/src/threads/ops_conversion_tests.rsindex 7c510948eb..c22943978e 100644--- a/crates/openhuman-core/src/threads/ops_conversion_tests.rs+++ b/crates/openhuman-core/src/threads/ops_conversion_tests.rs@@ -219,10 +219,13 @@ async fn generate_title_returns_typed_not_found_for_stale_thread() {let _workspace_guard = EnvVarGuard::set("OPENHUMAN_WORKSPACE", workspace.path());let thread_id = "thread-missing";- let err = thread_generate_title(&crate::core::runtime::DispatchCtx::ambient(), GenerateConversationThreadTitleRequest {- thread_id: thread_id.to_string(),- assistant_message: None,- })+ let err = thread_generate_title(+ &crate::core::runtime::DispatchCtx::ambient(),+ GenerateConversationThreadTitleRequest {+ thread_id: thread_id.to_string(),+ assistant_message: None,+ },+ ).await.expect_err("missing thread must return a typed not-found error");@@ -261,10 +264,13 @@ async fn generate_title_leaves_custom_title_unchanged() {).unwrap();- let outcome = thread_generate_title(&crate::core::runtime::DispatchCtx::ambient(), GenerateConversationThreadTitleRequest {- thread_id: thread_id.to_string(),- assistant_message: None,- })+ let outcome = thread_generate_title(+ &crate::core::runtime::DispatchCtx::ambient(),+ GenerateConversationThreadTitleRequest {+ thread_id: thread_id.to_string(),+ assistant_message: None,+ },+ ).await.expect("generate title");@@ -283,10 +289,13 @@ async fn generate_title_returns_existing_title_when_no_user_message_exists() {let thread_id = "thread-no-user";create_thread_with_title(&workspace, thread_id, "Chat Jan 1 1:00 AM").await;- let outcome = thread_generate_title(&crate::core::runtime::DispatchCtx::ambient(), GenerateConversationThreadTitleRequest {- thread_id: thread_id.to_string(),- assistant_message: Some("assistant reply".into()),- })+ let outcome = thread_generate_title(+ &crate::core::runtime::DispatchCtx::ambient(),+ GenerateConversationThreadTitleRequest {+ thread_id: thread_id.to_string(),+ assistant_message: Some("assistant reply".into()),+ },+ ).await.expect("generate title");@@ -323,10 +332,13 @@ async fn generate_title_falls_back_to_first_user_message_when_assistant_missing().unwrap();- let outcome = thread_generate_title(&crate::core::runtime::DispatchCtx::ambient(), GenerateConversationThreadTitleRequest {- thread_id: thread_id.to_string(),- assistant_message: None,- })+ let outcome = thread_generate_title(+ &crate::core::runtime::DispatchCtx::ambient(),+ GenerateConversationThreadTitleRequest {+ thread_id: thread_id.to_string(),+ assistant_message: None,+ },+ ).await.expect("generate title");@@ -437,9 +449,12 @@ async fn threads_purge_removes_every_turn_state_snapshot() {).await;- threads_purge(&crate::core::runtime::DispatchCtx::ambient(), EmptyRequest {})- .await- .expect("purge threads should also clear snapshots");+ threads_purge(+ &crate::core::runtime::DispatchCtx::ambient(),+ EmptyRequest {},+ )+ .await+ .expect("purge threads should also clear snapshots");assert!(bg::pending_for(&dir, "thread-a").is_empty());assert!(bg::pending_for(&dir, "thread-b").is_empty());@@ -474,10 +489,13 @@ async fn thread_update_title_rejects_empty_and_whitespace_only_titles() {let _workspace_guard = EnvVarGuard::set("OPENHUMAN_WORKSPACE", workspace.path());for title in ["", " "] {- let err = thread_update_title(&crate::core::runtime::DispatchCtx::ambient(), crate::threads::UpdateConversationThreadTitleRequest {- thread_id: "t-1".to_string(),- title: title.to_string(),- })+ let err = thread_update_title(+ &crate::core::runtime::DispatchCtx::ambient(),+ crate::threads::UpdateConversationThreadTitleRequest {+ thread_id: "t-1".to_string(),+ title: title.to_string(),+ },+ ).await.expect_err("blank title must be rejected");diff --git a/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rs b/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rsindex 0bfc7fc571..761c18c8b8 100644--- a/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rs+++ b/crates/openhuman-core/src/threads/ops_title_and_cancellation_tests.rs@@ -9,10 +9,13 @@ async fn thread_update_title_persists_new_title() {let thread_id = "t-title";create_thread_with_title(&workspace, thread_id, "Original title").await;- let outcome = thread_update_title(&crate::core::runtime::DispatchCtx::ambient(), crate::threads::UpdateConversationThreadTitleRequest {- thread_id: thread_id.to_string(),- title: " Invoice follow-up ".to_string(),- })+ let outcome = thread_update_title(+ &crate::core::runtime::DispatchCtx::ambient(),+ crate::threads::UpdateConversationThreadTitleRequest {+ thread_id: thread_id.to_string(),+ title: " Invoice follow-up ".to_string(),+ },+ ).await.expect("thread_update_title");@@ -30,10 +33,13 @@ async fn thread_update_title_returns_error_for_missing_thread() {let workspace = tempfile::tempdir().expect("workspace");let _workspace_guard = EnvVarGuard::set("OPENHUMAN_WORKSPACE", workspace.path());- let err = thread_update_title(&crate::core::runtime::DispatchCtx::ambient(), crate::threads::UpdateConversationThreadTitleRequest {- thread_id: "nonexistent-thread".to_string(),- title: "New title".to_string(),- })+ let err = thread_update_title(+ &crate::core::runtime::DispatchCtx::ambient(),+ crate::threads::UpdateConversationThreadTitleRequest {+ thread_id: "nonexistent-thread".to_string(),+ title: "New title".to_string(),+ },+ ).await.expect_err("missing thread must return an error");diff --git a/crates/openhuman-core/src/threads/store/blocking_tests.rs b/crates/openhuman-core/src/threads/store/blocking_tests.rsindex 7cbe2355cb..11e5a1e088 100644--- a/crates/openhuman-core/src/threads/store/blocking_tests.rs+++ b/crates/openhuman-core/src/threads/store/blocking_tests.rs@@ -40,22 +40,37 @@ async fn create_append_read_round_trips_through_the_blocking_pool() {let tmp = TempDir::new().unwrap();let dir = tmp.path().to_path_buf();- let thread = ensure_thread(crate::core::runtime::DispatchCtx::ambient(), dir.clone(), create("thread-a"))- .await- .expect("ensure_thread");+ let thread = ensure_thread(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ create("thread-a"),+ )+ .await+ .expect("ensure_thread");assert_eq!(thread.id, "thread-a");- append_message(crate::core::runtime::DispatchCtx::ambient(), dir.clone(), "thread-a".to_string(), message("m1", "hello"))- .await- .expect("append_message");+ append_message(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ "thread-a".to_string(),+ message("m1", "hello"),+ )+ .await+ .expect("append_message");- let messages = get_messages(crate::core::runtime::DispatchCtx::ambient(), dir.clone(), "thread-a".to_string())- .await- .expect("get_messages");+ let messages = get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ "thread-a".to_string(),+ )+ .await+ .expect("get_messages");assert_eq!(messages.len(), 1);assert_eq!(messages[0].content, "hello");- let threads = list_threads(crate::core::runtime::DispatchCtx::ambient(), dir.clone()).await.expect("list_threads");+ let threads = list_threads(crate::core::runtime::DispatchCtx::ambient(), dir.clone())+ .await+ .expect("list_threads");assert_eq!(threads.len(), 1);assert_eq!(threads[0].message_count, 1);}@@ -68,9 +83,14 @@ async fn store_errors_surface_unchanged() {// Appending to a thread that was never created is the store's own error,// not a join failure — the wrapper must pass it through verbatim so the// RPC layer's thread-scoped error mapping still recognises it.- let error = append_message(crate::core::runtime::DispatchCtx::ambient(), dir, "missing".to_string(), message("m1", "hello"))- .await- .expect_err("append to a missing thread must fail");+ let error = append_message(+ crate::core::runtime::DispatchCtx::ambient(),+ dir,+ "missing".to_string(),+ message("m1", "hello"),+ )+ .await+ .expect_err("append to a missing thread must fail");assert!(error.contains("not found"),"expected the store's own error, got: {error}"@@ -167,11 +187,15 @@ async fn concurrent_operations_complete_without_stalling_the_single_async_workerfor idx in 0..8 {let dir = dir.clone();handles.push(tokio::spawn(async move {- let thread = ensure_thread(crate::core::runtime::DispatchCtx::ambient(), dir.clone(), create(&format!("thread-{idx}")))- .await- .expect("ensure_thread");+ let thread = ensure_thread(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ create(&format!("thread-{idx}")),+ )+ .await+ .expect("ensure_thread");append_message(- crate::core::runtime::DispatchCtx::ambient(),+ crate::core::runtime::DispatchCtx::ambient(),dir,thread.id.clone(),message(&format!("m{idx}"), "concurrent"),@@ -212,7 +236,9 @@ async fn concurrent_operations_complete_without_stalling_the_single_async_worker"every concurrent create must land its own thread");- let threads = list_threads(crate::core::runtime::DispatchCtx::ambient(), dir).await.expect("list_threads");+ let threads = list_threads(crate::core::runtime::DispatchCtx::ambient(), dir)+ .await+ .expect("list_threads");assert_eq!(threads.len(), 8);assert!(threads.iter().all(|thread| thread.message_count == 1));}@@ -221,9 +247,13 @@ async fn concurrent_operations_complete_without_stalling_the_single_async_workerasync fn title_labels_delete_and_purge_round_trip() {let tmp = TempDir::new().unwrap();let dir = tmp.path().to_path_buf();- ensure_thread(crate::core::runtime::DispatchCtx::ambient(), dir.clone(), create("thread-a"))- .await- .expect("ensure_thread");+ ensure_thread(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ create("thread-a"),+ )+ .await+ .expect("ensure_thread");let retitled = update_thread_title(crate::core::runtime::DispatchCtx::ambient(),@@ -250,7 +280,7 @@ async fn title_labels_delete_and_purge_round_trip() {assert!(delete_thread(- crate::core::runtime::DispatchCtx::ambient(),+ crate::core::runtime::DispatchCtx::ambient(),dir.clone(),"thread-a".to_string(),"2026-07-30T00:03:00Z".to_string()@@ -259,22 +289,42 @@ async fn title_labels_delete_and_purge_round_trip() {.expect("delete_thread"),"deleting a live thread reports true");- assert!(list_threads(crate::core::runtime::DispatchCtx::ambient(), dir.clone()).await.unwrap().is_empty());+ assert!(+ list_threads(crate::core::runtime::DispatchCtx::ambient(), dir.clone())+ .await+ .unwrap()+ .is_empty()+ );- ensure_thread(crate::core::runtime::DispatchCtx::ambient(), dir.clone(), create("thread-b"))+ ensure_thread(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ create("thread-b"),+ )+ .await+ .expect("ensure_thread");+ purge_threads(crate::core::runtime::DispatchCtx::ambient(), dir.clone()).await- .expect("ensure_thread");- purge_threads(crate::core::runtime::DispatchCtx::ambient(), dir.clone()).await.expect("purge_threads");- assert!(list_threads(crate::core::runtime::DispatchCtx::ambient(), dir).await.unwrap().is_empty());+ .expect("purge_threads");+ assert!(+ list_threads(crate::core::runtime::DispatchCtx::ambient(), dir)+ .await+ .unwrap()+ .is_empty()+ );}#[tokio::test]async fn update_message_patches_metadata_and_search_finds_content() {let tmp = TempDir::new().unwrap();let dir = tmp.path().to_path_buf();- ensure_thread(crate::core::runtime::DispatchCtx::ambient(), dir.clone(), create("thread-a"))- .await- .expect("ensure_thread");+ ensure_thread(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.clone(),+ create("thread-a"),+ )+ .await+ .expect("ensure_thread");append_message(crate::core::runtime::DispatchCtx::ambient(),dir.clone(),@@ -297,9 +347,15 @@ async fn update_message_patches_metadata_and_search_finds_content() {.expect("update_message");assert_eq!(patched.extra_metadata, json!({"pinned": true}));- let hits = search_cross_thread_messages(crate::core::runtime::DispatchCtx::ambient(), dir, "roadmap".to_string(), 10, None)- .await- .expect("search_cross_thread_messages");+ let hits = search_cross_thread_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ dir,+ "roadmap".to_string(),+ 10,+ None,+ )+ .await+ .expect("search_cross_thread_messages");assert!(hits.iter().any(|hit| hit.thread_id == "thread-a"),"cross-thread search must find the appended message, got: {hits:?}"diff --git a/crates/openhuman-core/src/threads/store/bus_tests.rs b/crates/openhuman-core/src/threads/store/bus_tests.rsindex abc84f27ee..49f3542930 100644--- a/crates/openhuman-core/src/threads/store/bus_tests.rs+++ b/crates/openhuman-core/src/threads/store/bus_tests.rs@@ -62,12 +62,20 @@ async fn persists_inbound_and_processed_turns_into_workspace_thread() {}).await;- let threads = crate::threads::store::list_threads(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf()).expect("threads");+ let threads = crate::threads::store::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ )+ .expect("threads");assert_eq!(threads.len(), 1);assert_eq!(threads[0].id, "channel:slack_alice_general_thread:thread-1");- let messages = crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf(), &threads[0].id)- .expect("messages");+ let messages = crate::threads::store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ &threads[0].id,+ )+ .expect("messages");assert_eq!(messages.len(), 2);assert_eq!(messages[0].id, "user:m1");assert_eq!(messages[0].sender, "user");@@ -113,7 +121,11 @@ async fn telegram_thread_ts_does_not_split_persisted_thread() {}).await;- let threads = crate::threads::store::list_threads(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf()).expect("threads");+ let threads = crate::threads::store::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ )+ .expect("threads");assert_eq!(threads.len(), 1);assert_eq!(threads[0].id, "channel:telegram_alice_chat-1");}@@ -195,9 +207,12 @@ async fn received_matching_workspace_is_persisted() {}).await;- let messages =- crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf(), "channel:slack_bob_dev")- .expect("messages");+ let messages = crate::threads::store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ "channel:slack_bob_dev",+ )+ .expect("messages");assert_eq!(messages.len(), 1);assert_eq!(messages[0].id, "user:m1");}@@ -224,7 +239,11 @@ async fn received_stale_workspace_is_dropped() {.await;// No thread should have been created in temp (the subscriber's workspace).- let threads = crate::threads::store::list_threads(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf()).expect("threads");+ let threads = crate::threads::store::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ )+ .expect("threads");assert!(threads.is_empty(),"stale-workspace event must not create a thread"@@ -434,7 +453,11 @@ async fn multiple_stale_workspaces_all_dropped() {.await;}- let threads = crate::threads::store::list_threads(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf()).expect("threads");+ let threads = crate::threads::store::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ )+ .expect("threads");assert!(threads.is_empty(),"no events from wrong workspaces should create a thread"@@ -529,7 +552,11 @@ async fn claimed_channel_turns_are_left_to_their_caller() {subscriber.handle(&event).await;}- let threads = crate::threads::store::list_threads(&crate::core::runtime::DispatchCtx::ambient(), temp.path().to_path_buf()).expect("threads");+ let threads = crate::threads::store::list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ temp.path().to_path_buf(),+ )+ .expect("threads");assert!(threads.is_empty(),"a claimed turn is not mirrored: {threads:?}"diff --git a/crates/openhuman-core/src/threads/store/legacy_import_tests.rs b/crates/openhuman-core/src/threads/store/legacy_import_tests.rsindex e9fe56fd8e..2917965f4b 100644--- a/crates/openhuman-core/src/threads/store/legacy_import_tests.rs+++ b/crates/openhuman-core/src/threads/store/legacy_import_tests.rs@@ -66,7 +66,10 @@ fn legacy_jsonl_conversations_are_imported_and_the_files_stay_byte_identical() {write_legacy(&root, &log_refs, &[("t1", &[m1.as_str(), m2.as_str()])]);let before = snapshot(&root);- let store = ConversationStore::new(crate::core::runtime::DispatchCtx::ambient(), dir.path().to_path_buf());+ let store = ConversationStore::new(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.path().to_path_buf(),+ );let threads = store.list_threads().unwrap();assert_eq!(threads.len(), 1, "the deleted thread is not imported");assert_eq!(threads[0].id, "t1");@@ -86,7 +89,10 @@ fn legacy_import_runs_once_even_when_the_files_change_afterwards() {let m1 = message("m1", "hello", "2026-01-01T00:00:01Z");write_legacy(&root, &[&upsert("t1", "First")], &[("t1", &[m1.as_str()])]);- let store = ConversationStore::new(crate::core::runtime::DispatchCtx::ambient(), dir.path().to_path_buf());+ let store = ConversationStore::new(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.path().to_path_buf(),+ );assert_eq!(store.list_threads().unwrap().len(), 1);// A new process on the same workspace: the marker, not the process cache,@@ -97,7 +103,10 @@ fn legacy_import_runs_once_even_when_the_files_change_afterwards() {&[&upsert("t1", "First"), &upsert("t9", "Late")],&[("t1", &[m1.as_str()])],);- let after = ConversationStore::new(crate::core::runtime::DispatchCtx::ambient(), dir.path().to_path_buf());+ let after = ConversationStore::new(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.path().to_path_buf(),+ );let threads = after.list_threads().unwrap();assert_eq!(threads.len(), 1);assert_eq!(after.get_messages("t1").unwrap().len(), 1);@@ -106,7 +115,10 @@ fn legacy_import_runs_once_even_when_the_files_change_afterwards() {#[test]fn a_workspace_without_legacy_files_starts_empty() {let dir = tempfile::tempdir().unwrap();- let store = ConversationStore::new(crate::core::runtime::DispatchCtx::ambient(), dir.path().to_path_buf());+ let store = ConversationStore::new(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.path().to_path_buf(),+ );assert!(store.list_threads().unwrap().is_empty());assert!(store.get_messages("nope").unwrap().is_empty());assert!(!backend::legacy_root(dir.path()).exists());@@ -115,7 +127,10 @@ fn a_workspace_without_legacy_files_starts_empty() {#[test]fn threads_round_trip_through_the_backend_store() {let dir = tempfile::tempdir().unwrap();- let store = ConversationStore::new(crate::core::runtime::DispatchCtx::ambient(), dir.path().to_path_buf());+ let store = ConversationStore::new(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.path().to_path_buf(),+ );store.ensure_thread(CreateConversationThread {id: "t".into(),@@ -169,7 +184,11 @@ fn an_unreadable_legacy_log_is_an_error_not_an_empty_store() {std::fs::set_permissions(&root, std::fs::Permissions::from_mode(0o000)).unwrap();// Root bypasses permission bits; only assert when the stat truly fails.let blocked = std::fs::metadata(root.join("threads.jsonl")).is_err();- let result = ConversationStore::new(crate::core::runtime::DispatchCtx::ambient(), dir.path().to_path_buf()).list_threads();+ let result = ConversationStore::new(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.path().to_path_buf(),+ )+ .list_threads();std::fs::set_permissions(&root, std::fs::Permissions::from_mode(0o755)).unwrap();if blocked {assert!(diff --git a/crates/openhuman-core/src/threads/welcome_migration_tests.rs b/crates/openhuman-core/src/threads/welcome_migration_tests.rsindex bc6a5ecf00..9951a0a9de 100644--- a/crates/openhuman-core/src/threads/welcome_migration_tests.rs+++ b/crates/openhuman-core/src/threads/welcome_migration_tests.rs@@ -50,7 +50,11 @@ fn migration_updates_thread_labels_and_transcripts() {assert_eq!(result.transcript_files_renamed, 1);assert_eq!(result.markdown_files_renamed, 1);- let threads = list_threads(&crate::core::runtime::DispatchCtx::ambient(), workspace.to_path_buf()).unwrap();+ let threads = list_threads(+ &crate::core::runtime::DispatchCtx::ambient(),+ workspace.to_path_buf(),+ )+ .unwrap();let thread = threads.iter().find(|thread| thread.id == "welcome-thread")diff --git a/crates/openhuman-core/src/voice/live/persist.rs b/crates/openhuman-core/src/voice/live/persist.rsindex 1f9d22a8b2..65b814207c 100644--- a/crates/openhuman-core/src/voice/live/persist.rs+++ b/crates/openhuman-core/src/voice/live/persist.rs@@ -76,7 +76,7 @@ impl TranscriptPersister {};let id = message.id.clone();match crate::threads::store::blocking::append_message(- DispatchCtx::ambient(),+ DispatchCtx::ambient(),self.workspace_dir.clone(),self.thread_id.clone(),message,diff --git a/crates/openhuman-core/src/voice/live/persist_tests.rs b/crates/openhuman-core/src/voice/live/persist_tests.rsindex 96409d2306..c94f275567 100644--- a/crates/openhuman-core/src/voice/live/persist_tests.rs+++ b/crates/openhuman-core/src/voice/live/persist_tests.rs@@ -44,10 +44,13 @@ async fn saves_into_the_thread_store() {p.save(TranscriptRole::User, "hello").await;p.save(TranscriptRole::Agent, "hi there").await;p.save(TranscriptRole::Agent, "").await;- let messages =- crate::threads::store::blocking::get_messages(crate::core::runtime::DispatchCtx::ambient(), dir.path().to_path_buf(), "t1".into())- .await- .unwrap();+ let messages = crate::threads::store::blocking::get_messages(+ crate::core::runtime::DispatchCtx::ambient(),+ dir.path().to_path_buf(),+ "t1".into(),+ )+ .await+ .unwrap();let texts: Vec<_> = messages.iter().map(|m| (m.sender.as_str(), m.content.as_str()))diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rsindex a5ad74a5b5..32abbae5d7 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs@@ -194,12 +194,9 @@ async fn start_chat_inner(// Save originals before scanning, history, memory, or queue persistence.// A missing config/root cannot safely accept an upload.let mut message = if message.contains("[FILE:") || message.contains("[IMAGE:") {- let config = ctx- .load_config()- .await- .map_err(|error| {- StartChatError::Other(format!("upload configuration unavailable: {error}"))- })?;+ let config = ctx.load_config().await.map_err(|error| {+ StartChatError::Other(format!("upload configuration unavailable: {error}"))+ })?;// Stage where the turn will read: the thread's working folder when// one is bound (`run_task` applies the same folder), else action_dir.let workspace = crate::agent::attachments::thread_action_dir(diff --git a/crates/openhuman-core/src/web_chat/presentation_tests.rs b/crates/openhuman-core/src/web_chat/presentation_tests.rsindex 20fac41995..b3caadc7ac 100644--- a/crates/openhuman-core/src/web_chat/presentation_tests.rs+++ b/crates/openhuman-core/src/web_chat/presentation_tests.rs@@ -171,7 +171,12 @@ async fn delivery_stores_the_reply_before_announcing_it() {// a row present here proves the write happened no later than the announce.// A client that never receives that event, or fails to append it, no longer// decides whether the reply exists.- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "t-deliver").expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-deliver",+ )+ .expect("messages");assert_eq!(messages.len(), 1, "delivery must leave exactly one row");assert_eq!(messages[0].id, "agent:req-deliver");assert_eq!(messages[0].content, "Here is the summary you asked for.");@@ -207,8 +212,12 @@ async fn delivery_still_announces_when_the_reply_cannot_be_stored() {// `get_messages` answers `Ok(vec![])` for a thread it has never seen — only// `append_message` refuses one — so absence is what proves the write was// rejected and swallowed rather than silently creating a thread.- let messages = crate::threads::store::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "absent-thread")- .expect("reading an unknown thread is not an error");+ let messages = crate::threads::store::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "absent-thread",+ )+ .expect("reading an unknown thread is not an error");assert!(messages.is_empty(),"the thread was never created, so nothing should have been written"diff --git a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rsindex 2caf0fed6e..16d1599271 100644--- a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs+++ b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs@@ -32,11 +32,23 @@ fn persists_the_reply_under_the_id_the_client_will_reuse() {let ws = temp_ws();seed_thread(&ws, "t-1");- let stored = persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "t-1", "req-1", "Done, the draft is updated.", &[])- .expect("append succeeds");+ let stored = persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "t-1",+ "req-1",+ "Done, the draft is updated.",+ &[],+ )+ .expect("append succeeds");assert!(stored, "a non-empty reply must report that it was stored");- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "t-1").expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-1",+ )+ .expect("messages");assert_eq!(messages.len(), 1);// The id is what makes the client's own append collapse onto this row// instead of adding a duplicate bubble (#5933 / #6034).@@ -52,14 +64,35 @@ fn a_second_write_of_the_same_turn_does_not_add_a_row() {let ws = temp_ws();seed_thread(&ws, "t-2");- persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "t-2", "req-2", "First", &[]).expect("first append");+ persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "t-2",+ "req-2",+ "First",+ &[],+ )+ .expect("first append");// The client persists the same reply from the `chat_done` it received. The// store's idempotency for deterministic ids is what keeps the thread at one// row; assert the second write here so a change to the id shape (which// would silently opt out of that lookup) fails loudly.- persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "t-2", "req-2", "First", &[]).expect("second append");+ persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "t-2",+ "req-2",+ "First",+ &[],+ )+ .expect("second append");- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "t-2").expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-2",+ )+ .expect("messages");assert_eq!(messages.len(), 1, "one turn must never leave two rows");}@@ -68,11 +101,23 @@ fn an_empty_reply_is_not_stored() {let ws = temp_ws();seed_thread(&ws, "t-3");- let stored = persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "t-3", "req-3", " \n ", &[]).expect("no error");+ let stored = persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "t-3",+ "req-3",+ " \n ",+ &[],+ )+ .expect("no error");assert!(!stored, "an empty reply reports that nothing was stored");- assert!(conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "t-3")- .expect("messages")- .is_empty());+ assert!(conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-3"+ )+ .expect("messages")+ .is_empty());}#[test]@@ -80,9 +125,22 @@ fn content_is_trimmed_the_way_the_autonomous_path_trims_it() {let ws = temp_ws();seed_thread(&ws, "t-4");- persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "t-4", "req-4", " padded reply\n", &[]).expect("append");+ persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "t-4",+ "req-4",+ " padded reply\n",+ &[],+ )+ .expect("append");- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "t-4").expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-4",+ )+ .expect("messages");assert_eq!(messages[0].content, "padded reply");}@@ -90,8 +148,15 @@ fn content_is_trimmed_the_way_the_autonomous_path_trims_it() {fn a_missing_thread_is_reported_rather_than_silently_dropped() {let ws = temp_ws();- let err = persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "nope", "req-5", "text", &[])- .expect_err("a missing thread must not look like a successful store");+ let err = persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "nope",+ "req-5",+ "text",+ &[],+ )+ .expect_err("a missing thread must not look like a successful store");assert!(err.contains("nope"), "error names the thread: {err}");}@@ -108,13 +173,25 @@ fn citations_ride_on_the_authoritative_row() {timestamp: "2026-09-04T00:00:00Z".to_string(),snippet: "The draft lives in Notion.".to_string(),};- persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "t-6", "req-6", "Updated the draft.", &[citation])- .expect("append");+ persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "t-6",+ "req-6",+ "Updated the draft.",+ &[citation],+ )+ .expect("append");// The client's append is deduped onto this row, so whatever is missing here// is missing from the rendered message — citation chips included. Losing// them was a real regression caught in review of #6034.- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "t-6").expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-6",+ )+ .expect("messages");let cites = messages[0].extra_metadata["citations"].as_array().expect("citations are stored as an array");@@ -127,9 +204,22 @@ fn a_reply_without_citations_stores_no_citations_key() {let ws = temp_ws();seed_thread(&ws, "t-7");- persist_delivered_reply(&crate::core::runtime::DispatchCtx::ambient(), &ws, "t-7", "req-7", "No sources for this one.", &[]).expect("append");+ persist_delivered_reply(+ &crate::core::runtime::DispatchCtx::ambient(),+ &ws,+ "t-7",+ "req-7",+ "No sources for this one.",+ &[],+ )+ .expect("append");- let messages = conversations::get_messages(&crate::core::runtime::DispatchCtx::ambient(), ws.clone(), "t-7").expect("messages");+ let messages = conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ ws.clone(),+ "t-7",+ )+ .expect("messages");assert!(messages[0].extra_metadata.get("citations").is_none(),"an empty citation list must not add an empty array the client never wrote"