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: files changed crates/openhuman-core/src/agent/orchestration/background_delivery.rs,crates/ope
Steven Enamakel37753630105d
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rsindex f406884aea..00d1c306b7 100644--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs@@ -50,10 +50,10 @@ use persistence::{persist_delivery_reply, persist_then_announce};use super::background_completions;use super::busy_guard::is_busy;#[cfg(test)]-use super::busy_guard::{TurnBusy, busy, clear_busy_for_thread};+use super::busy_guard::{busy, clear_busy_for_thread, TurnBusy};use super::completion_notice::build_undelivered_notice;use super::completion_owners;-use super::delivery_drain::{DrainFence, DrainOutcome, RECOVERY_BUSY_POLL, run_drain};+use super::delivery_drain::{run_drain, DrainFence, DrainOutcome, RECOVERY_BUSY_POLL};use crate::core::runtime::CoreContext;/// Coalesce completions landing within this window into one delivery turn.diff --git a/crates/openhuman-core/src/channels/providers/relay/channel.rs b/crates/openhuman-core/src/channels/providers/relay/channel.rsindex 7ccc2cf392..f87c3c6583 100644--- a/crates/openhuman-core/src/channels/providers/relay/channel.rs+++ b/crates/openhuman-core/src/channels/providers/relay/channel.rs@@ -10,7 +10,7 @@ use std::sync::Mutex;use async_trait::async_trait;use serde_json::json;-use crate::web_chat::{WebChannelEvent, publish_web_channel_event};+use crate::web_chat::{publish_web_channel_event, WebChannelEvent};use tinychannels_bus::{ChannelMessage, SendMessage};use tinychannels_runtime::Channel;diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rsindex fc212faae8..5c3d41b7a1 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs@@ -1,6 +1,6 @@use super::super::channel::CHANNEL_OUTBOUND_EVENT;use super::*;-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};+use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};use crate::agent::turn_origin::AgentTurnOrigin;use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};use std::sync::Mutex;@@ -211,16 +211,12 @@ async fn a_relayed_turn_runs_as_an_external_channel_and_keeps_its_thread() {}}assert_eq!(outbound.len(), 2, "one channel_outbound per reply");- assert!(- outbound- .iter()- .all(|event| event.event_name() == CHANNEL_OUTBOUND_EVENT)- );- assert!(- outbound- .iter()- .all(|event| event.context().thread_id == thread)- );+ assert!(outbound+ .iter()+ .all(|event| event.event_name() == CHANNEL_OUTBOUND_EVENT));+ assert!(outbound+ .iter()+ .all(|event| event.context().thread_id == thread));assert_eq!(outbound[0].context().request_id, "req-m1");assert!(matches!(outbound[0].wire_event(),diff --git a/crates/openhuman-core/src/core/runtime/subscribers_tests.rs b/crates/openhuman-core/src/core/runtime/subscribers_tests.rsindex 9340a878b5..9dfbff6bd9 100644--- a/crates/openhuman-core/src/core/runtime/subscribers_tests.rs+++ b/crates/openhuman-core/src/core/runtime/subscribers_tests.rs@@ -1,4 +1,4 @@-use super::{DomainSubscriberPlan, group_first_time_when_bus_ready};+use super::{group_first_time_when_bus_ready, DomainSubscriberPlan};use crate::config::test_env::EnvVarGuard;// ---- domain-subscriber gating (#4796 DoD item 3) ----------------------------diff --git a/crates/openhuman-core/src/cron/channel_bridge.rs b/crates/openhuman-core/src/cron/channel_bridge.rsindex 29ccae9e4d..2248a68964 100644--- a/crates/openhuman-core/src/cron/channel_bridge.rs+++ b/crates/openhuman-core/src/cron/channel_bridge.rs@@ -10,8 +10,8 @@use std::collections::HashMap;use std::sync::{Arc, Mutex, RwLock};use tinychannels_bus::SendMessage;-use tinychannels_runtime::Channel;use tinychannels_runtime::context::ChatMessage;+use tinychannels_runtime::Channel;/// Same shape as `channels::context::ConversationHistoryMap`, spelled out so/// cron does not depend on the feature-gated `channels` module.diff --git a/crates/openhuman-core/src/cron/scheduler/executor.rs b/crates/openhuman-core/src/cron/scheduler/executor.rsindex 560b13ac1f..77312ab3dc 100644--- a/crates/openhuman-core/src/cron/scheduler/executor.rs+++ b/crates/openhuman-core/src/cron/scheduler/executor.rs@@ -16,12 +16,12 @@ use super::failure_classification::{};use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::cron::bus_host::{Binding, kind_refusal};-use crate::cron::handlers::{JobRunContext, kind_handler};+use crate::cron::bus_host::{kind_refusal, Binding};+use crate::cron::handlers::{kind_handler, JobRunContext};use std::collections::HashMap;use std::sync::Mutex;-use tinyflows_bus::schedule::Attempt;use tinyflows_bus::schedule::types::{CronJob, JobType, SessionTarget};+use tinyflows_bus::schedule::Attempt;/// Run states kept before the map is cleared outright (a run whose task was/// aborted never reaches `failed`).diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rsindex de91419a81..480cc7498d 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs@@ -14,8 +14,8 @@use super::delivery::strip_openhuman_link_markup;use crate::config::Config;use crate::core::runtime::DispatchCtx;-use crate::web_chat::{WebChannelEvent, publish_web_channel_event};-use anyhow::{Result, anyhow};+use crate::web_chat::{publish_web_channel_event, WebChannelEvent};+use anyhow::{anyhow, Result};use std::path::Path;use {crate::cron::channel_bridge, tinyflows_bus::schedule::types::CronJob,@@ -72,8 +72,8 @@ pub(crate) async fn append_to_origin_transcript(append: &TranscriptAppend<'_>,) -> Result<(), String> {use tinyagents_session::transcript::{- BackgroundAppend, BackgroundAppendOutcome, SessionRef, TranscriptMessage,- append_background_message_in,+ append_background_message_in, BackgroundAppend, BackgroundAppendOutcome, SessionRef,+ TranscriptMessage,};let session = SessionRef::scoped(append.thread_id.to_string(), append.agent_id.to_string());let options = BackgroundAppend::new(diff --git a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rsindex 052be539f7..714a36b771 100644--- a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs@@ -13,17 +13,15 @@ async fn deliver_if_configured_skips_empty_mode() {let config = test_config(&tmp).await;let mut job = test_job("echo ok");job.delivery.mode = "".into();- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "output",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "output",+ true+ )+ .await+ .is_ok());}#[tokio::test]@@ -81,17 +79,15 @@ async fn deliver_if_configured_proactive_mode_succeeds() {to: None,best_effort: true,};- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "hello",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "hello",+ true+ )+ .await+ .is_ok());}// ──────────────────────────────────────────────────────────────────────@@ -652,17 +648,15 @@ async fn deliver_if_configured_failure_skips_chat_but_alerts() {let config = test_config(&tmp).await;let job = proactive_job();// Failed run (non-empty canned error): no chat injection, but still alerts.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "Something went wrong.",- false- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "Something went wrong.",+ false+ )+ .await+ .is_ok());assert_eq!(cron_alerts(&config).await, 1);}@@ -672,17 +666,15 @@ async fn deliver_if_configured_empty_failure_alerts_with_fallback_body() {let config = test_config(&tmp).await;let job = proactive_job();// Empty failed run: still surfaces in /notifications with a fallback body.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "",- false- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "",+ false+ )+ .await+ .is_ok());let items =crate::desktop::notifications::store::list(&config, 10, 0, Some("cron"), None).unwrap();assert_eq!(items.len(), 1);diff --git a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rsindex 076706508f..604e53b6a9 100644--- a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs@@ -3,13 +3,13 @@//! are honoured and a system job's handler result is what gets recorded.use super::*;-use crate::cron::system_job_handlers::{SystemJobContext, register};+use crate::cron::system_job_handlers::{register, SystemJobContext};use crate::cron::system_jobs::ensure_system_job;use std::sync::atomic::{AtomicUsize, Ordering};use std::time::Duration;use tempfile::TempDir;-use tinyflows_bus::schedule::JobPolicy;use tinyflows_bus::schedule::types::Schedule;+use tinyflows_bus::schedule::JobPolicy;/// Stores `policy` on the job.fn set_policy(config: &Config, job_id: &str, policy: JobPolicy) -> anyhow::Result<()> {@@ -167,12 +167,10 @@ async fn a_system_job_handler_error_is_recorded_as_the_run_result() {dispatcher.drain().await;let stored = cron::get_job(&config, &job.id).unwrap();assert_eq!(stored.last_status.as_deref(), Some("error"));- assert!(- stored- .last_output- .unwrap_or_default()- .contains("handler failed")- );+ assert!(stored+ .last_output+ .unwrap_or_default()+ .contains("handler failed"));}#[tokio::test]@@ -287,12 +285,10 @@ async fn a_flow_schedule_job_fires_through_the_trigger_sink() {let stored = cron::get_job(&config, &job.id).unwrap();assert_eq!(stored.last_status.as_deref(), Some("ok"));- assert!(- stored- .last_output- .unwrap_or_default()- .contains("flow schedule tick emitted for flow flow-missing-for-sink")- );+ assert!(stored+ .last_output+ .unwrap_or_default()+ .contains("flow schedule tick emitted for flow flow-missing-for-sink"));assert!(stored.next_run > Utc::now(), "the recurrence moved on");}diff --git a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rsindex a78f9a998b..4390b2fe1c 100644--- a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs@@ -1,26 +1,24 @@use super::*;-use tinyflows_bus::schedule::MIN_AGENT_JOB_INTERVAL;-use tinyflows_bus::schedule::TooFrequent;use tinyflows_bus::schedule::types::JobType;use tinyflows_bus::schedule::types::Schedule;+use tinyflows_bus::schedule::TooFrequent;+use tinyflows_bus::schedule::MIN_AGENT_JOB_INTERVAL;#[tokio::test]async fn deliver_if_configured_empty_success_skips_chat_and_alert() {let tmp = TempDir::new().unwrap();let config = test_config(&tmp).await;let job = proactive_job();// Successful but empty: nothing delivered anywhere.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "",+ true+ )+ .await+ .is_ok());assert_eq!(cron_alerts(&config).await, 0);}diff --git a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rsindex 1cfc88d8c2..b87778bc15 100644--- a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs@@ -253,7 +253,8 @@ fn is_local_provider_unreachable_failure_matches_raw_no_models_loaded_body() {#[test]fn is_local_provider_unreachable_failure_checks_output_when_raw_is_generic() {- let output = "Your local inference server (e.g. LM Studio) is running but has no model loaded. \+ let output =+ "Your local inference server (e.g. LM Studio) is running but has no model loaded. \Load a model, then try again.";assert!(is_local_provider_unreachable_failure(@@ -439,13 +440,11 @@ async fn scheduler_flow_runs_active_hours_job_and_reschedules_inside_window() {let stored = cron::get_job(&config, &job.id).unwrap();assert_eq!(stored.last_status.as_deref(), Some("ok"));- assert!(- stored- .last_output- .as_deref()- .unwrap_or_default()- .contains("active-hours-fired")- );+ assert!(stored+ .last_output+ .as_deref()+ .unwrap_or_default()+ .contains("active-hours-fired"));assert_eq!(stored.schedule,Schedule::Cron {@@ -552,17 +551,15 @@ async fn deliver_if_configured_skips_non_announce_mode() {let job = test_job("echo ok");// Default delivery mode is not "announce", so nothing is published.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "x",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "x",+ true+ )+ .await+ .is_ok());}#[tokio::test]@@ -619,17 +616,15 @@ async fn deliver_if_configured_publishes_event_for_announce_mode() {assert_eq!(received.load(Ordering::SeqCst), 1);// Also verify the function itself succeeds.- assert!(- deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "hello",- true- )- .await- .is_ok()- );+ assert!(deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "hello",+ true+ )+ .await+ .is_ok());}#[test]diff --git a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rsindex f332c3b1ba..f043e64c3d 100644--- a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs@@ -109,13 +109,11 @@ fn a_cron_job_for_a_host_agent_builds_with_its_host_tools_and_context() {belt_builds.load(Ordering::SeqCst) > 0,"the host belt was built");- assert!(- built- .agent- .visible_tool_specs_arc()- .iter()- .any(|spec| spec.name == "cron_host_marker")- );+ assert!(built+ .agent+ .visible_tool_specs_arc()+ .iter()+ .any(|spec| spec.name == "cron_host_marker"));}#[test]@@ -136,11 +134,9 @@ fn an_id_the_host_does_not_know_falls_back_to_the_registries() {host_agents::clear_if(&installed);let built = built.expect("the orchestrator builds from the registries");assert!(built.context.is_none());- assert!(- !built- .agent- .visible_tool_specs_arc()- .iter()- .any(|spec| spec.name == "cron_host_marker")- );+ assert!(!built+ .agent+ .visible_tool_specs_arc()+ .iter()+ .any(|spec| spec.name == "cron_host_marker"));}diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rsindex 15438c2c4e..d21da4a22d 100644--- a/crates/openhuman-core/src/cron/scheduler_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs@@ -1,4 +1,4 @@-use super::agent_run::{EMPTY_AGENT_OUTPUT, build_agent_for_cron_job, run_agent_job};+use super::agent_run::{build_agent_for_cron_job, run_agent_job, EMPTY_AGENT_OUTPUT};use super::*;use crate::config::Config;use crate::security::SecurityPolicy;diff --git a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rsindex 7d673124c7..892246abc8 100644--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs@@ -5,9 +5,8 @@ use crate::{flows::{agents::workflow_builder::builder_prompt::{BuildMode, BuilderRequest},ops::{- FlowStreamTarget,builder::{backend_repair_message, is_backend_or_infrastructure_failure},- flows_build_with_extra_hidden_tools,+ flows_build_with_extra_hidden_tools, FlowStreamTarget,},},};diff --git a/crates/openhuman-core/src/threads/ops/transcript.rs b/crates/openhuman-core/src/threads/ops/transcript.rsindex f098ddcf96..6e9532556e 100644--- a/crates/openhuman-core/src/threads/ops/transcript.rs+++ b/crates/openhuman-core/src/threads/ops/transcript.rs@@ -79,12 +79,9 @@ async fn attach_voice_note_metadata(.await.map_err(|error| format!("load config for voice-note projection: {error}"))?.workspace_dir;- let rows = conversations::blocking::get_messages(- ctx.clone(),- workspace_dir,- thread_id.to_string(),- )- .await?;+ let rows =+ conversations::blocking::get_messages(ctx.clone(), workspace_dir, thread_id.to_string())+ .await?;for item in items {let (content, sender, request_id, projected_metadata) = match item {@@ -93,13 +90,23 @@ async fn attach_voice_note_metadata(request_id,extra_metadata,..- } => (content.as_str(), "user", request_id.as_deref(), extra_metadata),+ } => (+ content.as_str(),+ "user",+ request_id.as_deref(),+ extra_metadata,+ ),DisplayItem::AssistantMessage {content,request_id,extra_metadata,..- } => (content.as_str(), "agent", request_id.as_deref(), extra_metadata),+ } => (+ content.as_str(),+ "agent",+ request_id.as_deref(),+ extra_metadata,+ ),_ => continue,};@@ -113,11 +120,11 @@ async fn attach_voice_note_metadata(.and_then(serde_json::Value::as_str);match (request_id, row_request_id) {(Some(projected), Some(stored)) => projected == stored,- (Some(_), None) if sender == "agent" => false,- // User rows are durably written before the core returns its- // request id. Exact text is safe only when unique in this- // thread; repeated messages are left unlabelled.- _ => true,+ (None, None) => true,+ // A modern transcript item cannot fall back to a different+ // or missing row request id. Legacy rows match only legacy+ // items, and the unique-content check below stays strict.+ _ => false,}}).collect::<Vec<_>>();diff --git a/crates/openhuman-core/src/threads/ops/transcript_tests.rs b/crates/openhuman-core/src/threads/ops/transcript_tests.rsindex 2fc7498585..3d7bd99c41 100644--- a/crates/openhuman-core/src/threads/ops/transcript_tests.rs+++ b/crates/openhuman-core/src/threads/ops/transcript_tests.rs@@ -145,8 +145,20 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_row.await.unwrap();for (id, content, sender, note_id, request_id) in [- ("user-voice", "hello", "user", Some("recording-1"), Some("req-1")),- ("assistant-voice", "hi there", "agent", Some("reply-1"), Some("req-1")),+ (+ "user-voice",+ "hello",+ "user",+ Some("recording-1"),+ Some("req-1"),+ ),+ (+ "assistant-voice",+ "hi there",+ "agent",+ Some("reply-1"),+ Some("req-1"),+ ),("user-plain", "hello", "user", None, Some("req-2")),("assistant-plain", "hi again", "agent", None, Some("req-2")),] {@@ -192,7 +204,10 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_rowTranscriptMessage::assistant("hi again"),];locator- .open_session(&SessionRef::scoped(THREAD, "orchestrator"), root_meta.clone())+ .open_session(+ &SessionRef::scoped(THREAD, "orchestrator"),+ root_meta.clone(),+ ).unwrap().append_turn(TranscriptTurn {prev: &prior,@@ -217,41 +232,45 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_row.value.data.unwrap();- let voice_user = page- .items- .iter()- .find_map(|item| match item {- tinyagents_session::transcript::view::DisplayItem::UserMessage {- content,- request_id,- extra_metadata,- ..- } if content == "hello" && request_id.as_deref() == Some("req-1") => extra_metadata.as_ref(),- _ => None,- });+ let voice_user = page.items.iter().find_map(|item| match item {+ tinyagents_session::transcript::view::DisplayItem::UserMessage {+ content,+ request_id,+ extra_metadata,+ ..+ } if content == "hello" && request_id.as_deref() == Some("req-1") => {+ extra_metadata.as_ref()+ }+ _ => None,+ });let plain_duplicate_user = page.items.iter().find_map(|item| match item {tinyagents_session::transcript::view::DisplayItem::UserMessage {content,request_id,extra_metadata,..- } if content == "hello" && request_id.as_deref() == Some("req-2") => extra_metadata.as_ref(),+ } if content == "hello" && request_id.as_deref() == Some("req-2") => {+ extra_metadata.as_ref()+ }_ => None,});- let assistant = page- .items- .iter()- .find_map(|item| match item {- tinyagents_session::transcript::view::DisplayItem::AssistantMessage {- content,- extra_metadata,- ..- } if content == "hi there" => extra_metadata.as_ref(),- _ => None,- });- assert_eq!(voice_user.and_then(|value| value.pointer("/voiceNote/noteId")), Some(&json!("recording-1")));+ let assistant = page.items.iter().find_map(|item| match item {+ tinyagents_session::transcript::view::DisplayItem::AssistantMessage {+ content,+ extra_metadata,+ ..+ } if content == "hi there" => extra_metadata.as_ref(),+ _ => None,+ });+ assert_eq!(+ voice_user.and_then(|value| value.pointer("/voiceNote/noteId")),+ Some(&json!("recording-1"))+ );assert!(plain_duplicate_user.is_none_or(|value| value.get("voiceNote").is_none()));- assert_eq!(assistant.and_then(|value| value.pointer("/voiceNote/noteId")), Some(&json!("reply-1")));+ assert_eq!(+ assistant.and_then(|value| value.pointer("/voiceNote/noteId")),+ Some(&json!("reply-1"))+ );let mut cursor = None;let mut voice_reply_on_its_page = false;loop {@@ -268,22 +287,27 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_row.value.data.unwrap();- voice_reply_on_its_page |= page.items.iter().any(|item| matches!(- item,- tinyagents_session::transcript::view::DisplayItem::AssistantMessage {- content,- request_id,- extra_metadata: Some(metadata),- ..- } if content == "hi there" && request_id.as_deref() == Some("req-1")- && metadata.pointer("/voiceNote/noteId") == Some(&json!("reply-1"))- ));+ voice_reply_on_its_page |= page.items.iter().any(|item| {+ matches!(+ item,+ tinyagents_session::transcript::view::DisplayItem::AssistantMessage {+ content,+ request_id,+ extra_metadata: Some(metadata),+ ..+ } if content == "hi there" && request_id.as_deref() == Some("req-1")+ && metadata.pointer("/voiceNote/noteId") == Some(&json!("reply-1"))+ )+ });cursor = page.next_cursor;if cursor.is_none() {break;}}- assert!(voice_reply_on_its_page, "voice metadata survives paging to its assistant row");+ assert!(+ voice_reply_on_its_page,+ "voice metadata survives paging to its assistant row"+ );}#[tokio::test]diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rsindex 80de886309..6be6db72f8 100644--- a/crates/openhuman-core/src/threads/store/bus.rs+++ b/crates/openhuman-core/src/threads/store/bus.rs@@ -36,7 +36,7 @@ use tinychannels_bus::ChannelMessage;use tinychannels_runtime::context::conversation_history_key;use super::{- ConversationMessage, CreateConversationThread, append_message, ensure_thread, get_messages,+ append_message, ensure_thread, get_messages, ConversationMessage, CreateConversationThread,};static CONVERSATION_PERSISTENCE_HANDLE: OnceLock<SubscriptionHandle> = OnceLock::new();diff --git a/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs b/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rsindex 089c98ed24..0ba2b1ba9b 100644--- a/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs+++ b/crates/openhuman-core/src/voice/realtime_harness/chat_delivery.rs@@ -3,7 +3,7 @@//! relay.use log::{info, warn};-use serde_json::{Value, json};+use serde_json::{json, Value};use crate::platform::socket::manager::global_socket_manager;diff --git a/crates/openhuman-core/src/web_chat/egress_surface.rs b/crates/openhuman-core/src/web_chat/egress_surface.rsindex 51b7e568d4..1bcf7e15b1 100644--- a/crates/openhuman-core/src/web_chat/egress_surface.rs+++ b/crates/openhuman-core/src/web_chat/egress_surface.rs@@ -10,8 +10,8 @@ use async_trait::async_trait;use tinybus::{EventHandler, SubscriptionHandle};use crate::core::events::DomainEvent;-use crate::web_chat::WebChannelEvent;use crate::web_chat::event_context;+use crate::web_chat::WebChannelEvent;use super::event_bus::publish_web_channel_event;diff --git a/crates/openhuman-core/src/web_chat/ingress.rs b/crates/openhuman-core/src/web_chat/ingress.rsindex 7f1f4c5ced..00d46c594b 100644--- a/crates/openhuman-core/src/web_chat/ingress.rs+++ b/crates/openhuman-core/src/web_chat/ingress.rs@@ -14,12 +14,12 @@ use tinyagents_harness::turn_runner::{};use super::ops::StartChatError;-use super::runner::{Admission, CancelNote, Shared, WebRunner, scope_of};+use super::runner::{scope_of, Admission, CancelNote, Shared, WebRunner};use crate::agent::queued_turn::QueuedPayload;use crate::core::events::DomainEvent;use crate::core::runtime::DispatchCtx;use crate::security::prompt_injection::{- PromptEnforcementAction, PromptEnforcementContext, enforce_prompt_input,+ enforce_prompt_input, PromptEnforcementAction, PromptEnforcementContext,};const LOG: &str = "[web-channel]";diff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rsindex 94631d1408..7c2a6df536 100644--- a/crates/openhuman-core/src/web_chat/mod.rs+++ b/crates/openhuman-core/src/web_chat/mod.rs@@ -51,8 +51,8 @@ pub(crate) use web_errors::classify_inference_error;#[cfg(any(test, debug_assertions))]#[allow(unused_imports)]pub(crate) use web_errors::{- ClassifiedError, generic_inference_error_user_message, is_action_budget_exhausted,- is_non_retryable_rate_limit_text, retry_after_hint,+ generic_inference_error_user_message, is_action_budget_exhausted,+ is_non_retryable_rate_limit_text, retry_after_hint, ClassifiedError,};// Public API — event bus@@ -86,10 +86,10 @@ pub use ops::parallel_in_flight_entries_for_test;#[cfg(test)]pub(crate) use ops::track_parallel_turn_for_test;pub use ops::{- SESSION_CHECKOUT_FAILURE, SYSTEM_CLIENT_ID, StartChatError, cancel_all_turns,- cancel_chat_scoped, cancel_should_target, channel_web_cancel, channel_web_chat,- channel_web_queue_clear, channel_web_queue_remove, channel_web_queue_status,+ cancel_all_turns, cancel_chat_scoped, cancel_should_target, channel_web_cancel,+ channel_web_chat, channel_web_queue_clear, channel_web_queue_remove, channel_web_queue_status,in_flight_entries_for_test, invalidate_thread_sessions, run_system_turn_on_thread, start_chat,+ StartChatError, SESSION_CHECKOUT_FAILURE, SYSTEM_CLIENT_ID,};pub use types::ChatRequestMetadata;@@ -134,11 +134,11 @@ pub(crate) use web_errors::{// Test helpers (debug/test builds only)#[cfg(any(test, debug_assertions))]-pub use ops::RUN_CHAT_TASK_TEST_LOCK;-#[cfg(any(test, debug_assertions))]pub use ops::set_test_forced_run_chat_task_error;#[cfg(any(test, debug_assertions))]-pub use ops::{TestRunChatTaskBlock, set_test_park_after_run, set_test_run_chat_task_block};+pub use ops::RUN_CHAT_TASK_TEST_LOCK;+#[cfg(any(test, debug_assertions))]+pub use ops::{set_test_park_after_run, set_test_run_chat_task_block, TestRunChatTaskBlock};#[cfg(any(test, debug_assertions))]#[path = "mod_test_support_tests.rs"]diff --git a/crates/openhuman-core/src/web_chat/ops.rs b/crates/openhuman-core/src/web_chat/ops.rsindex ba64958e08..8da87704e4 100644--- a/crates/openhuman-core/src/web_chat/ops.rs+++ b/crates/openhuman-core/src/web_chat/ops.rs@@ -13,8 +13,8 @@ mod system_turn;mod test_hooks;pub(super) use budget_correlation::{- BudgetCorrelation, classify_budget_correlation, clear_budget_signal, has_fresh_budget_signal,- record_budget_signal,+ classify_budget_correlation, clear_budget_signal, has_fresh_budget_signal,+ record_budget_signal, BudgetCorrelation,};pub use channel_ops::{@@ -22,8 +22,8 @@ pub use channel_ops::{channel_web_queue_clear, channel_web_queue_remove, channel_web_queue_status,};-pub use start_chat::{StartChatError, start_chat};-pub use system_turn::{SESSION_CHECKOUT_FAILURE, SYSTEM_CLIENT_ID, run_system_turn_on_thread};+pub use start_chat::{start_chat, StartChatError};+pub use system_turn::{run_system_turn_on_thread, SESSION_CHECKOUT_FAILURE, SYSTEM_CLIENT_ID};#[cfg(test)]pub use state::drain_queued_turns_for_test;@@ -40,13 +40,13 @@ pub(crate) use state::{event_session_id_for, key_for};pub(crate) use state::{key_in, unscope_in};pub(super) use state::{tenant_of, thread_sessions};-#[cfg(any(test, debug_assertions))]-pub use test_hooks::RUN_CHAT_TASK_TEST_LOCK;#[cfg(any(test, debug_assertions))]pub use test_hooks::set_test_forced_run_chat_task_error;#[cfg(test)]pub(crate) use test_hooks::track_parallel_turn_for_test;#[cfg(any(test, debug_assertions))]-pub(super) use test_hooks::{TEST_PARK_AFTER_RUN, run_test_hooks, test_hooks_active};+pub use test_hooks::RUN_CHAT_TASK_TEST_LOCK;+#[cfg(any(test, debug_assertions))]+pub(super) use test_hooks::{run_test_hooks, test_hooks_active, TEST_PARK_AFTER_RUN};#[cfg(any(test, debug_assertions))]-pub use test_hooks::{TestRunChatTaskBlock, set_test_park_after_run, set_test_run_chat_task_block};+pub use test_hooks::{set_test_park_after_run, set_test_run_chat_task_block, TestRunChatTaskBlock};diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rsindex a0eb5512b8..9ddf9e35a3 100644--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs@@ -3,15 +3,15 @@//! inspecting/clearing a thread's run queue. The turns and their queues live//! in the context's turn runner; these are the thin entry points over it.-use serde_json::{Value, json};+use serde_json::{json, Value};-use crate::core::Outcome;use crate::core::runtime::DispatchCtx;-use crate::web_chat::WebChannelEvent;+use crate::core::Outcome;use crate::web_chat::event_context;+use crate::web_chat::WebChannelEvent;use super::super::event_bus::publish_web_channel_event_in;-use super::super::runner::{CancelNote, runtime, scope_of};+use super::super::runner::{runtime, scope_of, CancelNote};use super::super::types::ChatRequestMetadata;use super::start_chat::start_chat_with_voice_note;diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rsindex 322d168858..15a4e58fa1 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs@@ -14,7 +14,7 @@ use tinyagents_harness::turn_runner::{QueueDisposition, TurnRequest, TurnRunnerEuse tinychannels_bus::web::{ChatRequestMetadata, QueueMode};use uuid::Uuid;-use super::super::runner::{Admission, runtime, scope_of};+use super::super::runner::{runtime, scope_of, Admission};use super::super::turn_activity::configured_idle_window;use crate::agent::queued_turn::QueuedPayload;use crate::core::events::DomainEvent;@@ -388,7 +388,7 @@ async fn bind_voice_note_request_id(note_id: &str,request_id: &str,) -> Result<(), StartChatError> {- use crate::threads::store::{ConversationMessagePatch, blocking};+ use crate::threads::store::{blocking, ConversationMessagePatch};let workspace_dir = ctx.load_config()@@ -415,8 +415,21 @@ async fn bind_voice_note_request_id(};let mut extra_metadata = row.extra_metadata.clone();let Some(metadata) = extra_metadata.as_object_mut() else {- return Err(StartChatError::Other("voice note row metadata is invalid".into()));+ return Err(StartChatError::Other(+ "voice note row metadata is invalid".into(),+ ));};+ if let Some(existing) = metadata+ .get("requestId")+ .and_then(serde_json::Value::as_str)+ {+ if existing == request_id {+ return Ok(());+ }+ return Err(StartChatError::Other(format!(+ "voice note {note_id} is already bound to request {existing}"+ )));+ }metadata.insert("requestId".into(), serde_json::json!(request_id));blocking::update_message(ctx.clone(),diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rs b/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rsindex 3662e488c4..008c1a5e7f 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rs@@ -79,7 +79,7 @@ fn plain_string_conversions_build_other_variant() {#[tokio::test]async fn voice_note_turn_id_is_bound_to_its_exact_user_row_before_admission() {use crate::core::runtime::{ContextOverlay, CoreContext, DispatchCtx, DomainSet};- use crate::threads::store::{ConversationMessage, CreateConversationThread, blocking};+ use crate::threads::store::{blocking, ConversationMessage, CreateConversationThread};use crate::tools::toolpacks::ToolGroups;use serde_json::json;@@ -89,10 +89,9 @@ async fn voice_note_turn_id_is_bound_to_its_exact_user_row_before_admission() {workspace_dir: workspace.clone(),..crate::config::Config::default()};- let ctx = DispatchCtx::new(- CoreContext::for_test(DomainSet::full(), None)- .derive_with(ContextOverlay::new(config, DomainSet::kernel(), ToolGroups::none())),- );+ let ctx = DispatchCtx::new(CoreContext::for_test(DomainSet::full(), None).derive_with(+ ContextOverlay::new(config, DomainSet::kernel(), ToolGroups::none()),+ ));blocking::ensure_thread(ctx.clone(),workspace.clone(),@@ -135,9 +134,23 @@ async fn voice_note_turn_id_is_bound_to_its_exact_user_row_before_admission() {).await.unwrap();+ let conflicting = bind_voice_note_request_id(+ &ctx,+ "voice-thread",+ "same transcription",+ "note-1",+ "request-2",+ )+ .await;+ assert!(+ conflicting.is_err(),+ "a replay cannot overwrite the row's turn identity"+ );let rows = blocking::get_messages(ctx, workspace, "voice-thread".into()).await.unwrap();- assert_eq!(rows[0].extra_metadata["requestId"], "request-1");- assert!(rows[1].extra_metadata.get("requestId").is_none());+ let voice_row = rows.iter().find(|row| row.id == "voice-row").unwrap();+ let plain_row = rows.iter().find(|row| row.id == "plain-row").unwrap();+ assert_eq!(voice_row.extra_metadata["requestId"], "request-1");+ assert!(plain_row.extra_metadata.get("requestId").is_none());}diff --git a/crates/openhuman-core/src/web_chat/ops/state_tests.rs b/crates/openhuman-core/src/web_chat/ops/state_tests.rsindex e199f3046f..2a352ccf55 100644--- a/crates/openhuman-core/src/web_chat/ops/state_tests.rs+++ b/crates/openhuman-core/src/web_chat/ops/state_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::core::runtime::{ContextOverlay, DomainSet, context::CoreContext};+use crate::core::runtime::{context::CoreContext, ContextOverlay, DomainSet};use crate::tools::toolpacks::ToolGroups;use crate::web_chat::runner::runtime;use crate::web_chat::track_parallel_turn_for_test;diff --git a/crates/openhuman-core/src/web_chat/ops/system_turn.rs b/crates/openhuman-core/src/web_chat/ops/system_turn.rsindex 38fc38a3ef..018c53e7e4 100644--- a/crates/openhuman-core/src/web_chat/ops/system_turn.rs+++ b/crates/openhuman-core/src/web_chat/ops/system_turn.rs@@ -17,10 +17,10 @@use std::sync::Arc;use tinyagents_harness::run_queue::RunQueue;-use crate::agent::turn_origin::{AgentTurnOrigin, with_origin};+use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};use super::super::session::{- CheckedOutSession, CheckoutPolicy, checkin_session_agent_if_vacant, checkout_session_agent,+ checkin_session_agent_if_vacant, checkout_session_agent, CheckedOutSession, CheckoutPolicy,};/// Client id stamped on host-authored turns. Never a real socket, so it neverdiff --git a/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs b/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rsindex 4ba960a45e..a30d23f863 100644--- a/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs+++ b/crates/openhuman-core/src/web_chat/ops_budget_correlation_tests_tests.rs@@ -126,7 +126,7 @@ async fn record_prunes_other_threads_stale_entries() {#[tokio::test]async fn budget_signals_stay_with_the_agent_that_recorded_them() {- use crate::core::runtime::{ContextOverlay, DomainSet, context::CoreContext};+ use crate::core::runtime::{context::CoreContext, ContextOverlay, DomainSet};let root = CoreContext::for_test(DomainSet::full(), None);let agent = |id: &str| {root.derive_with(diff --git a/crates/openhuman-core/src/web_chat/proactive.rs b/crates/openhuman-core/src/web_chat/proactive.rsindex 11adab2f03..f59ebc15cf 100644--- a/crates/openhuman-core/src/web_chat/proactive.rs+++ b/crates/openhuman-core/src/web_chat/proactive.rs@@ -7,7 +7,7 @@use crate::core::events::DomainEvent;use crate::core::runtime::DispatchCtx;use crate::web_chat::event_context;-use crate::web_chat::{WebChannelEvent, publish_web_channel_event_in};+use crate::web_chat::{publish_web_channel_event_in, WebChannelEvent};use async_trait::async_trait;use std::sync::Arc;use tinybus::EventHandler;diff --git a/crates/openhuman-core/src/web_chat/progress_map_tests.rs b/crates/openhuman-core/src/web_chat/progress_map_tests.rsindex 5ad986f0d7..5a88a92257 100644--- a/crates/openhuman-core/src/web_chat/progress_map_tests.rs+++ b/crates/openhuman-core/src/web_chat/progress_map_tests.rs@@ -90,12 +90,10 @@ fn a_finished_tool_call_caps_output_and_arguments_and_names_its_failure() {panic!("tool result")};assert!(output.len() <= MAX_WEB_TOOL_PAYLOAD_BYTES && output.contains("truncated"));- assert!(- arguments- .expect("arguments")- .as_str()- .is_some_and(|marker| marker.contains("truncated"))- );+ assert!(arguments+ .expect("arguments")+ .as_str()+ .is_some_and(|marker| marker.contains("truncated")));let summary = summary.expect("failure summary");assert_eq!(summary.cause_plain, failure.cause_plain);assert_eq!(summary.recoverable, failure.recoverable);@@ -300,11 +298,9 @@ fn subagent_tool_calls_carry_their_arguments_and_capped_results() {.expect("a completed sub-agent call"),);assert_eq!(completed.state, "tool_result");- assert!(- completed- .output- .is_some_and(|out| out.contains("truncated"))- );+ assert!(completed+ .output+ .is_some_and(|out| out.contains("truncated")));assert_eq!(completed.structured, Some(json!({ "kind": "web_search" })));assert!(sub_tool_completed(AgentProgress::TurnStarted).is_none());}diff --git a/crates/openhuman-core/src/web_chat/reply_persistence.rs b/crates/openhuman-core/src/web_chat/reply_persistence.rsindex f5886fbfb8..5d48eeacf8 100644--- a/crates/openhuman-core/src/web_chat/reply_persistence.rs+++ b/crates/openhuman-core/src/web_chat/reply_persistence.rs@@ -24,7 +24,7 @@ use std::path::Path;use serde_json::json;use crate::memory::types::TurnCitation;-use crate::threads::store::{self as conversations, ConversationMessage, run_reply_message_id};+use crate::threads::store::{self as conversations, run_reply_message_id, ConversationMessage};/// Metadata scope stamped on a reply persisted by the web-channel delivery path.///diff --git a/crates/openhuman-core/src/web_chat/runner.rs b/crates/openhuman-core/src/web_chat/runner.rsindex 56186676fc..4118e24ebe 100644--- a/crates/openhuman-core/src/web_chat/runner.rs+++ b/crates/openhuman-core/src/web_chat/runner.rs@@ -17,7 +17,7 @@ use std::sync::{Arc, Mutex, MutexGuard};use std::time::Duration;use tinyagents_harness::turn_runner::{ScopeKey, TurnRunner, TurnRunnerConfig};-use tokio::sync::{Mutex as AsyncMutex, oneshot};+use tokio::sync::{oneshot, Mutex as AsyncMutex};use super::ingress::WebIngress;use super::ops::StartChatError;diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rsindex 587c1e4bfc..76120f8014 100644--- a/crates/openhuman-core/src/web_chat/schemas.rs+++ b/crates/openhuman-core/src/web_chat/schemas.rs@@ -5,8 +5,8 @@use crate::core::runtime::DispatchCtx;use serde_json::{Map, Value};-use crate::core::Outcome;use crate::core::all::{ControllerFuture, RegisteredController};+use crate::core::Outcome;use crate::core::{ControllerSchema, FieldSchema, TypeSchema};use super::ops::{diff --git a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_tests.rsindex 06ddcabc10..cc38a08422 100644--- a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs+++ b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs@@ -11,8 +11,8 @@ use std::path::Path;use tinyagents_session::transcript::TranscriptMeta;use super::{- CheckedOutSession, CheckoutPolicy, checkin_session_agent, checkin_session_agent_if_vacant,- checkout_session_agent, fingerprint_diff,+ checkin_session_agent, checkin_session_agent_if_vacant, checkout_session_agent,+ fingerprint_diff, CheckedOutSession, CheckoutPolicy,};use crate::agent::OpenHumanSessionHost;use crate::config::Config;diff --git a/crates/openhuman-core/src/web_chat/session_routing_tests.rs b/crates/openhuman-core/src/web_chat/session_routing_tests.rsindex 8addceac04..379fd13dcc 100644--- a/crates/openhuman-core/src/web_chat/session_routing_tests.rs+++ b/crates/openhuman-core/src/web_chat/session_routing_tests.rs@@ -345,11 +345,9 @@ fn persisted_managed_model_changes_invalidate_the_session_fingerprint() {first, second,"the old cached agent must not survive a saved model change");- assert!(- super::fingerprint_diff(&first, &second)- .iter()- .any(|field| field.starts_with("effective_model:"))- );+ assert!(super::fingerprint_diff(&first, &second)+ .iter()+ .any(|field| field.starts_with("effective_model:")));config.default_model = None;assert_ne!(second,diff --git a/crates/openhuman-core/src/web_chat/suggestions_tests.rs b/crates/openhuman-core/src/web_chat/suggestions_tests.rsindex 8e3e5e39ab..949d2fd6b8 100644--- a/crates/openhuman-core/src/web_chat/suggestions_tests.rs+++ b/crates/openhuman-core/src/web_chat/suggestions_tests.rs@@ -1,5 +1,5 @@-use std::sync::Arc;use std::sync::atomic::{AtomicUsize, Ordering};+use std::sync::Arc;use async_trait::async_trait;use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};diff --git a/crates/openhuman-core/src/web_chat/turn_events.rs b/crates/openhuman-core/src/web_chat/turn_events.rsindex d9eb18fd01..9f9646f2fb 100644--- a/crates/openhuman-core/src/web_chat/turn_events.rs+++ b/crates/openhuman-core/src/web_chat/turn_events.rs@@ -19,10 +19,10 @@ use tinychannels_bus::web as bus_web;use super::runner::{CancelNote, Shared};use super::surface::{Surface, TurnIds};-use super::turn_close::{StopCause, StoppedTurn, close_reply};+use super::turn_close::{close_reply, StopCause, StoppedTurn};use super::web_errors::{- ClassifiedError, classify_inference_error, is_outer_backstop_timeout, turn_idle_error_message,- turn_timeout_error_message,+ classify_inference_error, is_outer_backstop_timeout, turn_idle_error_message,+ turn_timeout_error_message, ClassifiedError,};use crate::agent::queued_turn::QueuedPayload;diff --git a/crates/openhuman-core/src/web_chat/turn_events_tests.rs b/crates/openhuman-core/src/web_chat/turn_events_tests.rsindex accf65b142..22bf33ab71 100644--- a/crates/openhuman-core/src/web_chat/turn_events_tests.rs+++ b/crates/openhuman-core/src/web_chat/turn_events_tests.rs@@ -166,10 +166,9 @@ async fn a_stopped_turn_announces_cancelled_to_the_client_that_stopped_it() {cancel_reason: Some(reason), ..} if reason == "user_stop"));- assert!(- seen.iter()- .all(|event| event.context().client_id == "stopper")- );+ assert!(seen+ .iter()+ .all(|event| event.context().client_id == "stopper"));}#[tokio::test]@@ -264,12 +263,10 @@ async fn a_turn_stopped_before_its_config_resolved_cannot_be_closed() {let shared = Arc::new(Shared::default());let summarizer = WebSummarizer::new(shared.clone());let req = request("close-none", QueueDisposition::Interrupt);- assert!(- summarizer- .grounded_close(&req, RUNNER_DEADLINE)- .await- .is_none()- );+ assert!(summarizer+ .grounded_close(&req, RUNNER_DEADLINE)+ .await+ .is_none());assert!(summarizer.grounded_close(&req, RUNNER_IDLE).await.is_none());}diff --git a/crates/openhuman-core/src/web_chat/voice_notes.rs b/crates/openhuman-core/src/web_chat/voice_notes.rsindex 049baaedf1..52ffe8a5da 100644--- a/crates/openhuman-core/src/web_chat/voice_notes.rs+++ b/crates/openhuman-core/src/web_chat/voice_notes.rs@@ -151,9 +151,13 @@ pub(crate) fn validate_typed_media(let (_, stored_mime) = read_note(workspace, note_id)?.ok_or_else(|| "typed voice note has no stored audio".to_string())?;if media.content_type.as_deref().is_some_and(|content_type| {- content_type.split(';').next().unwrap_or(content_type).trim() != stored_mime- })- {+ content_type+ .split(';')+ .next()+ .unwrap_or(content_type)+ .trim()+ != stored_mime+ }) {return Err("typed voice note mime does not match the stored audio".into());}Ok(())diff --git a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs b/crates/openhuman-core/src/web_chat/voice_notes_tests.rsindex b3935607d2..d747c1b5ff 100644--- a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs+++ b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs@@ -108,9 +108,15 @@ fn typed_voice_media_must_match_its_durable_note_reference() {..Default::default()};- assert!(validate_typed_media(tmp.path(), "note-typed", &media("note-typed", "audio/wav")).is_ok());- assert!(validate_typed_media(tmp.path(), "note-typed", &media("other-note", "audio/wav")).is_err());- assert!(validate_typed_media(tmp.path(), "note-typed", &media("note-typed", "audio/mpeg")).is_err());+ assert!(+ validate_typed_media(tmp.path(), "note-typed", &media("note-typed", "audio/wav")).is_ok()+ );+ assert!(+ validate_typed_media(tmp.path(), "note-typed", &media("other-note", "audio/wav")).is_err()+ );+ assert!(+ validate_typed_media(tmp.path(), "note-typed", &media("note-typed", "audio/mpeg")).is_err()+ );assert!(validate_typed_media(tmp.path(), "missing", &media("missing", "audio/wav")).is_err());}diff --git a/crates/openhuman-core/src/web_chat/web_errors.rs b/crates/openhuman-core/src/web_chat/web_errors.rsindex 91bee727ee..65cb39d2d2 100644--- a/crates/openhuman-core/src/web_chat/web_errors.rs+++ b/crates/openhuman-core/src/web_chat/web_errors.rs@@ -13,7 +13,7 @@ pub(crate) use budget::{generic_inference_error_user_message, inference_budget_exceeded_user_message,is_action_budget_exhausted, is_inference_budget_exceeded_error,};-pub(crate) use classify::{ClassifiedError, classify_inference_error};+pub(crate) use classify::{classify_inference_error, ClassifiedError};pub(crate) use retry::{is_non_retryable_rate_limit_text, retry_after_hint};pub(crate) use timeout::{is_outer_backstop_timeout, is_turn_timeout_error, turn_idle_error_message,diff --git a/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rs b/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rsindex 23127d1367..2503cc3753 100644--- a/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rs+++ b/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rs@@ -25,8 +25,8 @@ pub(super) fn classify_by_backend_error_code(fallback_available: Option<bool>,) -> Option<ClassifiedError> {use crate::inference::provider::{- BackendErrorCode, body_flags_malformed, extract_backend_error_code,- is_managed_backend_envelope,+ body_flags_malformed, extract_backend_error_code, is_managed_backend_envelope,+ BackendErrorCode,};// Managed-vs-BYO gate: an `errorCode` is only trustworthy on a@@ -49,7 +49,7 @@ pub(super) fn classify_by_backend_error_code();use super::classify::{classified, classified_plain, copy_params};- use crate::inference::failure_copy::{FailureClass as C, failure_copy};+ use crate::inference::failure_copy::{failure_copy, FailureClass as C};let classified = match code {BackendErrorCode::RateLimited => {diff --git a/crates/openhuman-core/src/web_chat/web_errors/budget.rs b/crates/openhuman-core/src/web_chat/web_errors/budget.rsindex 23271e16e1..8bab4a48d0 100644--- a/crates/openhuman-core/src/web_chat/web_errors/budget.rs+++ b/crates/openhuman-core/src/web_chat/web_errors/budget.rs@@ -3,8 +3,8 @@//! copy lives in the host copy table; the phrase matching in//! `tinyinference_providers::billing`.-use crate::inference::failure_copy::{FailureClass, failure_copy};-use tinyinference_providers::{BudgetMatch, is_budget_message};+use crate::inference::failure_copy::{failure_copy, FailureClass};+use tinyinference_providers::{is_budget_message, BudgetMatch};/// Whether an error string signals an exhausted inference budget, read with the/// chat surface's [`BudgetMatch::Managed`] strictness: the managed no-creditsdiff --git a/crates/openhuman-core/src/web_chat/web_errors/classify.rs b/crates/openhuman-core/src/web_chat/web_errors/classify.rsindex 16a99f248a..c666459f06 100644--- a/crates/openhuman-core/src/web_chat/web_errors/classify.rs+++ b/crates/openhuman-core/src/web_chat/web_errors/classify.rs@@ -6,7 +6,7 @@ use super::backend_error_code::classify_by_backend_error_code;use super::budget::{is_action_budget_exhausted, is_inference_budget_exceeded_error};use super::retry::{is_non_retryable_rate_limit_text, retry_after_hint};use super::timeout::is_turn_timeout_error;-use crate::inference::failure_copy::{FailureClass, failure_copy};+use crate::inference::failure_copy::{failure_copy, FailureClass};use tinyinference_llm::failure::{extract_provider_error_detail, extract_provider_name, is_auth_error_text,is_codex_token_expired_text, is_connection_dropped_text, is_context_length_text,diff --git a/crates/openhuman-core/src/web_chat/web_tests.rs b/crates/openhuman-core/src/web_chat/web_tests.rsindex 0e59a1e49b..af2d17807b 100644--- a/crates/openhuman-core/src/web_chat/web_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests.rs@@ -1,5 +1,4 @@use super::{- ChatRequestMetadata, ClassifiedError, StartChatError, TestRunChatTaskBlock, WebChatParams,all_web_channel_controller_schemas, all_web_channel_registered_controllers, cancel_chat_scoped,channel_web_cancel, channel_web_queue_clear, channel_web_queue_remove,channel_web_queue_status, classify_inference_error, drain_queued_turns_for_test,@@ -8,13 +7,14 @@ use super::{locale_reply_directive, normalize_model_override, parallel_in_flight_entries_for_test,provider_role_for_model_override, schemas, sentry_suppression_reason,set_test_forced_run_chat_task_error, set_test_run_chat_task_block, start_chat,- subscribe_web_channel_events,+ subscribe_web_channel_events, ChatRequestMetadata, ClassifiedError, StartChatError,+ TestRunChatTaskBlock, WebChatParams,};use crate::core::TypeSchema;-use std::sync::Arc;use std::sync::atomic::{AtomicBool, Ordering};+use std::sync::Arc;use tinyagents_harness::run_queue::QueueLane;-use tokio::time::{Duration, timeout};+use tokio::time::{timeout, Duration};// Serializes every test that drives `start_chat` with the process-global// `run_chat_task` test hooks (forced error / forced block) or thediff --git a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rsindex 309e1d9783..3b9cd1161e 100644--- a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs@@ -465,16 +465,14 @@ fn chat_schema_requires_client_thread_message() {assert!(required.contains(&"thread_id"));assert!(required.contains(&"message"));// model_override and temperature must be optional.- assert!(- s.inputs- .iter()- .any(|f| f.name == "model_override" && !f.required)- );- assert!(- s.inputs- .iter()- .any(|f| f.name == "temperature" && !f.required)- );+ assert!(s+ .inputs+ .iter()+ .any(|f| f.name == "model_override" && !f.required));+ assert!(s+ .inputs+ .iter()+ .any(|f| f.name == "temperature" && !f.required));}#[test]diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rsindex 087660f585..88d760b201 100644--- a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs@@ -8,7 +8,7 @@//! (web_chat regex list, triage whole-word list, loop-guard billing list).use super::*;-use crate::agent::triage::evaluator::{ArmError, classify_error};+use crate::agent::triage::evaluator::{classify_error, ArmError};use regex::Regex;/// `(case, input, error_type, source, retryable, retry_after_ms, provider,@@ -652,9 +652,8 @@ fn shared_budget_matcher_reproduces_each_legacy_matcher_on_the_corpus() {#[test]fn loop_guard_halt_summaries_are_byte_identical() {use crate::inference::failure_copy::{- TerminalInferenceFailure, recoverable_identical_halt_summary,- recoverable_no_progress_halt_summary, terminal_inference_halt_summary,- user_actionable_escalation,+ recoverable_identical_halt_summary, recoverable_no_progress_halt_summary,+ terminal_inference_halt_summary, user_actionable_escalation, TerminalInferenceFailure,};assert_eq!(terminal_inference_halt_summary(diff --git a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rsindex e17f01b11d..8350175e26 100644--- a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs+++ b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs@@ -169,11 +169,9 @@ async fn terminal_turn_dispatches_followup_as_a_fresh_host_turn() {.any(|(key, request_id)| key == thread_id && request_id != &primary_request_id)}).await;- assert!(- entries- .iter()- .any(|(key, request_id)| key == thread_id && request_id != &primary_request_id)- );+ assert!(entries+ .iter()+ .any(|(key, request_id)| key == thread_id && request_id != &primary_request_id));cancel_parked_turn(thread_id, &block).await;}@@ -235,33 +233,27 @@ async fn cancellation_discards_pending_lanes_before_a_replacement_turn() {.await.expect("replacement queue status should be available");assert_eq!(replacement.value["total"], 0);- assert!(- drain_queued_turns_for_test(- &crate::core::runtime::DispatchCtx::ambient(),- thread_id,- QueueLane::Followup- )- .await- .is_empty()- );- assert!(- drain_queued_turns_for_test(- &crate::core::runtime::DispatchCtx::ambient(),- thread_id,- QueueLane::Steer- )- .await- .is_empty()- );- assert!(- drain_queued_turns_for_test(- &crate::core::runtime::DispatchCtx::ambient(),- thread_id,- QueueLane::Collect- )- .await- .is_empty()- );+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Followup+ )+ .await+ .is_empty());+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Steer+ )+ .await+ .is_empty());+ assert!(drain_queued_turns_for_test(+ &crate::core::runtime::DispatchCtx::ambient(),+ thread_id,+ QueueLane::Collect+ )+ .await+ .is_empty());cancel_parked_turn(thread_id, &replacement_block).await;}@@ -322,12 +314,10 @@ async fn web_queue_status_wire_shape_and_clear_cleanup_remain_stable() {assert_eq!(lanes, ["collect", "followup", "steer"]);for item in items {assert!(!item["id"].as_str().expect("id").is_empty());- assert!(- item["text_preview"]- .as_str()- .expect("text_preview")- .ends_with("payload")- );+ assert!(item["text_preview"]+ .as_str()+ .expect("text_preview")+ .ends_with("payload"));}let cleared = channel_web_queue_clear(&DispatchCtx::ambient(), thread_id)