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-cli/examples/thread_wire_schema.rs,crates/openhuman-core/src/a
Steven Enamakel5fd61fe67338
diff --git a/crates/openhuman-cli/examples/thread_wire_schema.rs b/crates/openhuman-cli/examples/thread_wire_schema.rsindex c26349cd1e..57c8ca3549 100644--- a/crates/openhuman-cli/examples/thread_wire_schema.rs+++ b/crates/openhuman-cli/examples/thread_wire_schema.rs@@ -1,4 +1,7 @@fn main() -> Result<(), Box<dyn std::error::Error>> {- println!("{}", openhuman_core::threads::wire_schema::thread_wire_schema_json()?);+ println!(+ "{}",+ openhuman_core::threads::wire_schema::thread_wire_schema_json()?+ );Ok(())}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/channel_projection.rs b/crates/openhuman-core/src/threads/channel_projection.rsindex cbc5182546..6b9ca85276 100644--- a/crates/openhuman-core/src/threads/channel_projection.rs+++ b/crates/openhuman-core/src/threads/channel_projection.rs@@ -7,14 +7,14 @@//! guesses from a sender, recent message, or equality between provider and row//! identifiers.-use anyhow::{Context, Result, anyhow};+use anyhow::{anyhow, Context, Result};use serde::{Deserialize, Serialize};-use serde_json::{Value, json};+use serde_json::{json, Value};use sha2::{Digest, Sha256};-use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};use tinychannels_bus::{ChannelRef, ConversationRef};+use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};-use crate::core::runtime::{DispatchCtx, Tenant, tenant::tenant_key};+use crate::core::runtime::{tenant::tenant_key, DispatchCtx, Tenant};use crate::storage::{self, documents::Repo};const DOMAIN: &str = "threads::channel_projection";@@ -94,7 +94,9 @@ fn binding_key(provider_message_id: &str,) -> Result<MessageBindingKey> {if channel.id.is_empty() || conversation.id.is_empty() || provider_message_id.is_empty() {- return Err(anyhow!("channel, conversation, and provider message IDs must be non-empty"));+ return Err(anyhow!(+ "channel, conversation, and provider message IDs must be non-empty"+ ));}Ok(MessageBindingKey {tenant_key,@@ -201,12 +203,7 @@ fn bind_in(repo: &Repo, key: MessageBindingKey, thread_id: &str) -> Result<()> {Ok(())}-fn bind_row_in(- repo: &Repo,- key: MessageBindingKey,- thread_id: &str,- row_id: &str,-) -> Result<()> {+fn bind_row_in(repo: &Repo, key: MessageBindingKey, thread_id: &str, row_id: &str) -> Result<()> {let id = doc_id(&key)?;let (thread_id, row_id) = (thread_id.to_string(), row_id.to_string());repo.run(|docs| async move {@@ -223,7 +220,11 @@ fn bind_row_in("provider message thread binding does not match persisted row",));}- if binding.row_id.as_deref().is_some_and(|existing| existing != row_id) {+ if binding+ .row_id+ .as_deref()+ .is_some_and(|existing| existing != row_id)+ {return Err(tinystoragedrivers::StorageError::conflict("provider message is already bound to another OpenHuman row",));@@ -231,7 +232,8 @@ fn bind_row_in(binding.row_id = Some(row_id);let body: Value = serde_json::to_value(binding).map_err(|e| tinystoragedrivers::StorageError::invalid_input(e.to_string()))?;- docs.put(COLLECTION, &id, json!(body), stored.unchanged()).await?;+ docs.put(COLLECTION, &id, json!(body), stored.unchanged())+ .await?;Ok(())})?;Ok(())@@ -244,8 +246,8 @@ fn resolve_in(repo: &Repo, key: &MessageBindingKey) -> Result<Option<ProjectedMelet Some(stored) = stored else {return Ok(None);};- let binding: MessageBinding = serde_json::from_value(stored.doc)- .context("decode channel message binding")?;+ let binding: MessageBinding =+ serde_json::from_value(stored.doc).context("decode channel message binding")?;if binding.key != expected || binding.thread_id.is_empty() {return Ok(None);}diff --git a/crates/openhuman-core/src/threads/channel_projection_tests.rs b/crates/openhuman-core/src/threads/channel_projection_tests.rsindex a66b3254e3..b70edeecdf 100644--- a/crates/openhuman-core/src/threads/channel_projection_tests.rs+++ b/crates/openhuman-core/src/threads/channel_projection_tests.rs@@ -1,6 +1,6 @@use super::*;-use std::sync::Arc;use crate::storage::{Scope, StorageBackend};+use std::sync::Arc;use tinychannels_bus::ConversationKind;fn repo(backend: &Arc<dyn StorageBackend>) -> Repo {@@ -36,10 +36,20 @@ fn key(fn provider_receipt_maps_to_the_exact_thread_and_row_after_restart() {let backend: Arc<dyn StorageBackend> = Arc::new(crate::storage::MemoryStorage::new());let first = repo(&backend);- let binding = key("tenant-agent-a", Some("account-1"), "conversation-1", Some("topic-1"), "provider-17");+ let binding = key(+ "tenant-agent-a",+ Some("account-1"),+ "conversation-1",+ Some("topic-1"),+ "provider-17",+ );bind_in(&first, binding.clone(), "channel:thread-a").unwrap();- assert_eq!(resolve_in(&first, &binding).unwrap(), None, "a provider receipt is not a persisted UI row");+ assert_eq!(+ resolve_in(&first, &binding).unwrap(),+ None,+ "a provider receipt is not a persisted UI row"+ );bind_row_in(&first, binding.clone(), "channel:thread-a", "user:row-9").unwrap();// A fresh Repository simulates process restart against the same backend.@@ -57,16 +67,52 @@ fn provider_receipt_maps_to_the_exact_thread_and_row_after_restart() {fn provider_receipts_are_scoped_by_tenant_account_and_full_conversation() {let backend: Arc<dyn StorageBackend> = Arc::new(crate::storage::MemoryStorage::new());let repo = repo(&backend);- let original = key("tenant-agent-a", Some("account-1"), "conversation-1", Some("topic-1"), "provider-17");+ let original = key(+ "tenant-agent-a",+ Some("account-1"),+ "conversation-1",+ Some("topic-1"),+ "provider-17",+ );bind_in(&repo, original.clone(), "channel:thread-a").unwrap();bind_row_in(&repo, original.clone(), "channel:thread-a", "row-a").unwrap();for other in [- key("tenant-agent-b", Some("account-1"), "conversation-1", Some("topic-1"), "provider-17"),- key("tenant-agent-a", Some("account-2"), "conversation-1", Some("topic-1"), "provider-17"),- key("tenant-agent-a", Some("account-1"), "conversation-1", Some("topic-2"), "provider-17"),- key("tenant-agent-a", Some("account-1"), "conversation-2", Some("topic-1"), "provider-17"),- key("tenant-agent-a", Some("account-1"), "conversation-1", Some("topic-1"), "provider-18"),+ key(+ "tenant-agent-b",+ Some("account-1"),+ "conversation-1",+ Some("topic-1"),+ "provider-17",+ ),+ key(+ "tenant-agent-a",+ Some("account-2"),+ "conversation-1",+ Some("topic-1"),+ "provider-17",+ ),+ key(+ "tenant-agent-a",+ Some("account-1"),+ "conversation-1",+ Some("topic-2"),+ "provider-17",+ ),+ key(+ "tenant-agent-a",+ Some("account-1"),+ "conversation-2",+ Some("topic-1"),+ "provider-17",+ ),+ key(+ "tenant-agent-a",+ Some("account-1"),+ "conversation-1",+ Some("topic-1"),+ "provider-18",+ ),] {assert_eq!(resolve_in(&repo, &other).unwrap(), None);}@@ -76,14 +122,32 @@ fn provider_receipts_are_scoped_by_tenant_account_and_full_conversation() {fn sender_scoped_threads_can_share_a_conversation_without_overwriting() {let backend: Arc<dyn StorageBackend> = Arc::new(crate::storage::MemoryStorage::new());let repo = repo(&backend);- let alice = key("tenant", Some("account"), "group", Some("topic"), "alice-message");- let bob = key("tenant", Some("account"), "group", Some("topic"), "bob-message");+ let alice = key(+ "tenant",+ Some("account"),+ "group",+ Some("topic"),+ "alice-message",+ );+ let bob = key(+ "tenant",+ Some("account"),+ "group",+ Some("topic"),+ "bob-message",+ );bind_in(&repo, alice.clone(), "channel:alice").unwrap();bind_in(&repo, bob.clone(), "channel:bob").unwrap();bind_row_in(&repo, alice.clone(), "channel:alice", "row-alice").unwrap();bind_row_in(&repo, bob.clone(), "channel:bob", "row-bob").unwrap();- assert_eq!(resolve_in(&repo, &alice).unwrap().unwrap().thread_id, "channel:alice");- assert_eq!(resolve_in(&repo, &bob).unwrap().unwrap().thread_id, "channel:bob");+ assert_eq!(+ resolve_in(&repo, &alice).unwrap().unwrap().thread_id,+ "channel:alice"+ );+ assert_eq!(+ resolve_in(&repo, &bob).unwrap().unwrap().thread_id,+ "channel:bob"+ );assert!(bind_in(&repo, alice, "channel:other").is_err());}diff --git a/crates/openhuman-core/src/threads/mod.rs b/crates/openhuman-core/src/threads/mod.rsindex a31606a7fb..e177f21e98 100644--- a/crates/openhuman-core/src/threads/mod.rs+++ b/crates/openhuman-core/src/threads/mod.rs@@ -14,8 +14,8 @@ pub mod store;#[cfg(test)]mod transcript_host_tests;pub mod turn_state;-pub mod wire_schema;pub mod welcome_migration;+pub mod wire_schema;pub use error::{ThreadsError, THREAD_NOT_FOUND_KIND};pub use rpc_models::*;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/threads/wire_schema_tests.rs b/crates/openhuman-core/src/threads/wire_schema_tests.rsindex 9f4d21d512..a9d58deb60 100644--- a/crates/openhuman-core/src/threads/wire_schema_tests.rs+++ b/crates/openhuman-core/src/threads/wire_schema_tests.rs@@ -22,6 +22,9 @@ fn thread_wire_schema_exports_the_core_and_session_records() {"runEvent","runTelemetry",] {- assert!(properties.contains_key(property), "schema is missing {property}");+ assert!(+ properties.contains_key(property),+ "schema is missing {property}"+ );}}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/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/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/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)diff --git a/crates/openhuman-embed/src/chat_surface.rs b/crates/openhuman-embed/src/chat_surface.rsindex c19b1e76c7..8e21822464 100644--- a/crates/openhuman-embed/src/chat_surface.rs+++ b/crates/openhuman-embed/src/chat_surface.rs@@ -6,8 +6,7 @@//! then reads it with [`subscribe_web_channel_events`].pub use openhuman_core::web_chat::{- ScopedWebEvent, SubagentProgressDetail, WebChannelEvent, WebEventContext,- publish_web_channel_event,- register_approval_surface_subscriber, register_artifact_surface_subscriber,- subscribe_web_channel_events,+ publish_web_channel_event, register_approval_surface_subscriber,+ register_artifact_surface_subscriber, subscribe_web_channel_events, ScopedWebEvent,+ SubagentProgressDetail, WebChannelEvent, WebEventContext,};diff --git a/crates/openhuman-embed/tests/facades.rs b/crates/openhuman-embed/tests/facades.rsindex c12f281ada..ab69389ac0 100644--- a/crates/openhuman-embed/tests/facades.rs+++ b/crates/openhuman-embed/tests/facades.rs@@ -5,12 +5,12 @@use std::time::Duration;use openhuman_embed::artifacts::{- ArtifactKind, ArtifactStatus, FileRoots, create_artifact, finalize_artifact, resolve_ready_file,+ create_artifact, finalize_artifact, resolve_ready_file, ArtifactKind, ArtifactStatus, FileRoots,};use openhuman_embed::chat_surface::{- WebChannelEvent, WebEventContext, publish_web_channel_event, subscribe_web_channel_events,+ publish_web_channel_event, subscribe_web_channel_events, WebChannelEvent, WebEventContext,};-use openhuman_embed::identity::{UserIdentity, peek_credential_user_identity};+use openhuman_embed::identity::{peek_credential_user_identity, UserIdentity};#[tokio::test]async fn an_artifact_resolves_only_once_ready_and_only_under_its_roots() {@@ -106,13 +106,11 @@ async fn web_channel_events_reach_a_subscriber_with_a_timestamp() {fn identity_is_empty_when_nobody_is_signed_in() {assert!(peek_credential_user_identity().is_none());assert!(UserIdentity::default().is_empty());- assert!(- !UserIdentity {- id: Some("u1".into()),- ..UserIdentity::default()- }- .is_empty()- );+ assert!(!UserIdentity {+ id: Some("u1".into()),+ ..UserIdentity::default()+ }+ .is_empty());}#[test]diff --git a/crates/openhuman-embed/tests/profile_host_capabilities.rs b/crates/openhuman-embed/tests/profile_host_capabilities.rsindex ba2b7d0369..682e6933f3 100644--- a/crates/openhuman-embed/tests/profile_host_capabilities.rs+++ b/crates/openhuman-embed/tests/profile_host_capabilities.rs@@ -7,8 +7,8 @@ use std::sync::{Arc, Mutex};use std::time::Duration;use common::{- PointedTransport, chat_completion, chat_requests, runtime_without_master_key,- tool_call_completion, tool_names,+ chat_completion, chat_requests, runtime_without_master_key, tool_call_completion, tool_names,+ PointedTransport,};use openhuman_embed::memory::api::conformance::ReferenceEngine;use openhuman_embed::memory::api::{LearningKind, MemoryEngine, MemoryMeta, StoreItem};@@ -18,7 +18,7 @@ use openhuman_embed::{HostTurnTools, PermissionLevel, ProfileRuntime, RelayMessage, SaasConfig, Tool, ToolResult,ToolScopeSpec,};-use serde_json::{Value, json};+use serde_json::{json, Value};use wiremock::{Mock, Request, Respond, ResponseTemplate};struct TenantTool {@@ -390,12 +390,10 @@ async fn scenario() {.await,ToolHookDecision::Proceed));- assert!(- handles[1]- .scope(alice_hook.before_tool_decision(&hook_context))- .await- .is_deny()- );+ assert!(handles[1]+ .scope(alice_hook.before_tool_decision(&hook_context))+ .await+ .is_deny());for name in ["hidden","shell",@@ -435,12 +433,10 @@ async fn scenario() {}).await;let closed_hook = no_callback.hook(handles[0].id(), alice_profile.lease_fence().clone());- assert!(- handles[0]- .scope(closed_hook.before_tool_decision(&hook_context))- .await- .is_deny()- );+ assert!(handles[0]+ .scope(closed_hook.before_tool_decision(&hook_context))+ .await+ .is_deny());// Closing really releases the old lease; reopening must install the same// immutable belt and engine on a fresh profile context, without pinning it.drop(alice_profile);@@ -461,14 +457,12 @@ async fn scenario() {.await.expect("completed turns leave the profile releasable");let reopened = runtime.open("alice").await.unwrap();- assert!(- reopened- .threads()- .await- .unwrap()- .iter()- .any(|thread| thread.id == "t1")- );+ assert!(reopened+ .threads()+ .await+ .unwrap()+ .iter()+ .any(|thread| thread.id == "t1"));reopened.chat("t1", "alice: call tenant_probe after reopening").await@@ -538,11 +532,9 @@ async fn scenario() {ToolHookDecision::Proceed));let requests = chat_requests(&inference).await;- assert!(- requests- .iter()- .any(|request| !tool_names(request).is_empty())- );+ assert!(requests+ .iter()+ .any(|request| !tool_names(request).is_empty()));for request in requests {let mut names = tool_names(&request);names.sort();@@ -675,11 +667,9 @@ async fn scenario() {.await,"a latched profile must not resolve the shared engine");- assert!(- handles[0]- .scope(alice_hook.before_tool_decision(&hook_context))- .await- .is_deny()- );+ assert!(handles[0]+ .scope(alice_hook.before_tool_decision(&hook_context))+ .await+ .is_deny());runtime.shutdown().await;}diff --git a/crates/openhuman-embed/tests/saas_profiles.rs b/crates/openhuman-embed/tests/saas_profiles.rsindex c6aa8633d7..da7b4cd35d 100644--- a/crates/openhuman-embed/tests/saas_profiles.rs+++ b/crates/openhuman-embed/tests/saas_profiles.rs@@ -11,8 +11,8 @@ mod common;use std::time::Duration;use common::{- PointedTransport, chat_requests, echo_inference, last_user_message,- runtime_without_master_key as runtime,+ chat_requests, echo_inference, last_user_message, runtime_without_master_key as runtime,+ PointedTransport,};use openhuman_embed::profiles::ProfileCredentialKind;use openhuman_embed::{@@ -160,24 +160,20 @@ async fn scenario() {Err(e) => panic!("alice never went idle: {e}"),}}- assert!(- !profiles- .list()- .await- .unwrap()- .iter()- .any(|s| s.open && s.profile_id == alice.profile_id)- );+ assert!(!profiles+ .list()+ .await+ .unwrap()+ .iter()+ .any(|s| s.open && s.profile_id == alice.profile_id));// Reopening picks the same thread back up.let alice_h = profiles.open("alice").await.expect("reopen alice");- assert!(- alice_h- .threads()- .await- .unwrap()- .iter()- .any(|t| t.id == "t1")- );+ assert!(alice_h+ .threads()+ .await+ .unwrap()+ .iter()+ .any(|t| t.id == "t1"));// ── a relayed platform message ──────────────────────────────────────let mut bob_events = bob_h.events();@@ -228,22 +224,18 @@ async fn scenario() {again.duplicate,"a retried delivery runs nothing: {again:?}");- assert!(- bob_h- .threads()- .await- .unwrap()- .iter()- .any(|t| t.id == relayed.thread_id)- );- assert!(- !alice_h- .threads()- .await- .unwrap()- .iter()- .any(|t| t.id == relayed.thread_id)- );+ assert!(bob_h+ .threads()+ .await+ .unwrap()+ .iter()+ .any(|t| t.id == relayed.thread_id));+ assert!(!alice_h+ .threads()+ .await+ .unwrap()+ .iter()+ .any(|t| t.id == relayed.thread_id));// Nothing of bob's relay reached alice's stream.tokio::time::sleep(Duration::from_millis(300)).await;while let Ok(Some(event)) =diff --git a/crates/openhuman-rpc/src/server/http/events_tests.rs b/crates/openhuman-rpc/src/server/http/events_tests.rsindex 7f3c853e54..2ab1661a44 100644--- a/crates/openhuman-rpc/src/server/http/events_tests.rs+++ b/crates/openhuman-rpc/src/server/http/events_tests.rs@@ -1,10 +1,10 @@use axum::body::to_bytes;use axum::extract::Query;-use axum::http::{HeaderMap, StatusCode, header};+use axum::http::{header, HeaderMap, StatusCode};use super::{- EventsQuery, active_workspace_handle, domain_event_payload, domain_event_stream_unavailable,- domain_events_handler, events_handler, webhook_events_handler,+ active_workspace_handle, domain_event_payload, domain_event_stream_unavailable,+ domain_events_handler, events_handler, webhook_events_handler, EventsQuery,};#[test]@@ -98,7 +98,7 @@ async fn events_bind_token_is_client_bound_and_single_use() {#[tokio::test]async fn events_stream_forwards_only_the_bound_client() {- use crate::core_host::web_chat::{WebChannelEvent, publish_web_channel_event};+ use crate::core_host::web_chat::{publish_web_channel_event, WebChannelEvent};use tokio_stream::StreamExt;let token = crate::core_host::core::event_bind_tokens::issue("stream-client", None)diff --git a/crates/openhuman-rpc/src/server/socketio_tests.rs b/crates/openhuman-rpc/src/server/socketio_tests.rsindex 6b6ed2f083..4b877fd1ee 100644--- a/crates/openhuman-rpc/src/server/socketio_tests.rs+++ b/crates/openhuman-rpc/src/server/socketio_tests.rs@@ -6,7 +6,7 @@ use super::{use crate::core_host::web_chat::{WebChannelEvent, WebEventContext};use engineioxide::Packet;-use socketioxide::{SocketIo, extract::SocketRef};+use socketioxide::{extract::SocketRef, SocketIo};#[test]fn companion_state_transport_delivers_payload_to_bridge() {@@ -143,26 +143,18 @@ async fn web_events_reach_client_and_thread_rooms_once_with_compat_aliases() {event_names(&reconnected_packets),["chat_done", "chat:done"]);- assert!(- initiator_packets- .iter()- .all(|(_, payload)| payload["event"] == "chat_done")- );- assert!(- reconnected_packets- .iter()- .all(|(_, payload)| payload["event"] == "chat_done")- );- assert!(- initiator_packets- .iter()- .all(|(_, payload)| payload["full_response"] == "finished")- );- assert!(- reconnected_packets- .iter()- .all(|(_, payload)| payload["thread_id"] == "thread-1")- );+ assert!(initiator_packets+ .iter()+ .all(|(_, payload)| payload["event"] == "chat_done"));+ assert!(reconnected_packets+ .iter()+ .all(|(_, payload)| payload["event"] == "chat_done"));+ assert!(initiator_packets+ .iter()+ .all(|(_, payload)| payload["full_response"] == "finished"));+ assert!(reconnected_packets+ .iter()+ .all(|(_, payload)| payload["thread_id"] == "thread-1"));assert_empty_queue(&mut initiator_rx);assert_empty_queue(&mut reconnected_rx);assert_empty_queue(&mut unrelated_rx);diff --git a/crates/openhuman-tui/src/app.rs b/crates/openhuman-tui/src/app.rsindex f29ea06c22..d0aeea1530 100644--- a/crates/openhuman-tui/src/app.rs+++ b/crates/openhuman-tui/src/app.rs@@ -13,8 +13,8 @@//! subscriber (see `logging::init_for_tui`); nothing is ever `println!`'d.use std::io::Write;-use std::sync::Arc;use std::sync::atomic::{AtomicBool, Ordering};+use std::sync::Arc;use std::time::Duration;use base64::Engine as _;@@ -22,9 +22,9 @@ use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind, KeyModifieruse serde_json::json;use tokio::sync::broadcast;-use openhuman_rpc::embed::CoreRuntime;use openhuman_rpc::embed::chat_surface as web_chat;use openhuman_rpc::embed::chat_surface::ScopedWebEvent;+use openhuman_rpc::embed::CoreRuntime;use super::actions::Action;use super::cockpit::{Overlay, OverlayKind, OverlayRow, PendingApproval, PendingPlanReview};diff --git a/crates/openhuman-tui/src/benchmark.rs b/crates/openhuman-tui/src/benchmark.rsindex cc1890ea80..616b1eca96 100644--- a/crates/openhuman-tui/src/benchmark.rs+++ b/crates/openhuman-tui/src/benchmark.rs@@ -1,8 +1,8 @@//! Deterministic, offline measurements of the real viewport and TestBackend renderer.use super::{render, state::TranscriptState, ui_state::UiState, viewport::ViewportCache};use openhuman_rpc::embed::chat_surface::{WebChannelEvent, WebEventContext};-use ratatui::{Terminal, backend::TestBackend};-use serde_json::{Value, json};+use ratatui::{backend::TestBackend, Terminal};+use serde_json::{json, Value};use std::{hint::black_box, time::Instant};const SAMPLES: usize = 200;diff --git a/scripts/debug/web-scripts/typed-image-attachment-roundtrip.mjs b/scripts/debug/web-scripts/typed-image-attachment-roundtrip.mjsindex b1f5f16b50..925ff40c76 100644--- a/scripts/debug/web-scripts/typed-image-attachment-roundtrip.mjs+++ b/scripts/debug/web-scripts/typed-image-attachment-roundtrip.mjs@@ -117,6 +117,20 @@ export default async function typedImageAttachmentRoundtrip({ page, mock, log, lif (chatRequest.params?.attachments?.length)throw new Error("ordinary attachment was staged twice as a chat part and durable reference");+ const inferenceRequest = mock.requests().find((request) =>+ /(?:^|\/)chat\/completions(?:\?|$)/.test(request.url),+ );+ if (!inferenceRequest)+ throw new Error("mock backend did not receive the model request for the image turn");+ const inferenceBody = JSON.parse(inferenceRequest.body);+ const userMessages = inferenceBody.messages?.filter((message) => message.role === "user") ?? [];+ const userText = JSON.stringify(userMessages);+ if (/\[(?:ATTACHMENT|IMAGE|FILE):/i.test(userText))+ throw new Error("legacy or durable staging markers reached the model's user text");+ if (!userText.includes(IMAGE_BYTES.toString("base64")))+ throw new Error("model request did not receive the uploaded image bytes as typed media");+ log("mock model request contained typed image bytes and clean user text");+await page.reload();await composer.waitFor({ state: "visible", timeout: 30_000 });await page.evaluate((id) => window.__OPENHUMAN_STORE__?.dispatch({