Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(web_chat): reorder imports to match rustfmt conventions

Steven Enamakel4a8fe1713aa2
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 4c72d92a67..ac10df4916 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;
diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
index 3301857b74..6144b87c1c 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, TurnRunnerE
use 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;
diff --git a/crates/openhuman-core/src/web_chat/ops/state_tests.rs b/crates/openhuman-core/src/web_chat/ops/state_tests.rs
index 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.rs
index 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 never
diff --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.rs
index 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.rs
index 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.rs
index 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.rs
index 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/reply_persistence_tests.rs b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
index 852b353794..d66468da20 100644
--- a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
+++ b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
@@ -111,15 +111,13 @@ fn an_empty_reply_is_not_stored() {
)
.expect("no error");
assert!(!stored, "an empty reply reports that nothing was stored");
- assert!(
- conversations::get_messages(
- &crate::core::runtime::DispatchCtx::ambient(),
- ws.clone(),
- "t-3"
- )
- .expect("messages")
- .is_empty()
- );
+ assert!(conversations::get_messages(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ ws.clone(),
+ "t-3"
+ )
+ .expect("messages")
+ .is_empty());
}
#[test]
diff --git a/crates/openhuman-core/src/web_chat/runner.rs b/crates/openhuman-core/src/web_chat/runner.rs
index 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.rs
index ae534b453d..929f6f7486 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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.rs
index 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/turn_host.rs b/crates/openhuman-core/src/web_chat/turn_host.rs
index ccd66fe7e2..2b538e1b77 100644
--- a/crates/openhuman-core/src/web_chat/turn_host.rs
+++ b/crates/openhuman-core/src/web_chat/turn_host.rs
@@ -16,19 +16,19 @@ use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
-use tinyagents_harness::CancellationToken;
use tinyagents_harness::run_queue::RunQueue;
use tinyagents_harness::turn_runner::{
QueueDisposition, TurnHost, TurnRequest, TurnResult, TurnSession, TurnSignal, WorkTracker,
};
+use tinyagents_harness::CancellationToken;
use tinyinference_llm::failure::is_empty_provider_response_text;
-use tokio::sync::{Mutex as AsyncMutex, mpsc, watch};
+use tokio::sync::{mpsc, watch, Mutex as AsyncMutex};
use super::ops::{self, BudgetCorrelation};
-use super::progress::{INFERENCE_HEARTBEAT_SECS, ProgressProjection};
+use super::progress::{ProgressProjection, INFERENCE_HEARTBEAT_SECS};
use super::runner::{Admission, Shared};
use super::session::{
- CheckoutPolicy, checkin_session_agent, checkout_session_agent, normalize_model_override,
+ checkin_session_agent, checkout_session_agent, normalize_model_override, CheckoutPolicy,
};
use super::surface::TurnIds;
use super::turn_activity::TurnActivity;
@@ -37,7 +37,7 @@ use super::web_errors::{
inference_budget_exceeded_user_message, is_inference_budget_exceeded_error,
};
use crate::agent::queued_turn::QueuedPayload;
-use crate::agent::turn_origin::{AgentTurnOrigin, with_origin};
+use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};
use crate::core::events::DomainEvent;
use crate::core::runtime::DispatchCtx;
use tinyagents_harness::progress::AgentProgress;
diff --git a/crates/openhuman-core/src/web_chat/voice_notes.rs b/crates/openhuman-core/src/web_chat/voice_notes.rs
index b6e8b4ec0a..af1985f3a5 100644
--- a/crates/openhuman-core/src/web_chat/voice_notes.rs
+++ b/crates/openhuman-core/src/web_chat/voice_notes.rs
@@ -12,7 +12,7 @@
use std::path::{Path, PathBuf};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
const LOG_PREFIX: &str = "[web_channel][voice_note]";
/// `source` the composer stamps on a turn that began as a voice note.
@@ -215,7 +215,7 @@ pub(crate) fn store_synthesized_reply(
request_id: &str,
audio_base64: &str,
audio_mime: &str,
- visemes: &[tinyinference_voice::VisemeFrame],
+ visemes: &[impl serde::Serialize],
) -> bool {
use base64::Engine as _;
if audio_base64.is_empty() {
@@ -235,9 +235,13 @@ pub(crate) fn store_synthesized_reply(
let path = dir(workspace).join(format!("{id}.visemes.json"));
if let Err(err) = serde_json::to_vec(visemes)
.map_err(|err| err.to_string())
- .and_then(|encoded| std::fs::write(path, encoded).map_err(|err| err.to_string()))
+ .and_then(|encoded| {
+ std::fs::write(path, encoded).map_err(|err| err.to_string())
+ })
{
- log::warn!("{LOG_PREFIX} could not store reply visemes request_id={request_id}: {err}");
+ log::warn!(
+ "{LOG_PREFIX} could not store reply visemes request_id={request_id}: {err}"
+ );
}
}
true
diff --git a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
index eb9453807f..f394e3dd83 100644
--- a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
+++ b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
@@ -62,8 +62,16 @@ fn synthesized_reply_metadata_preserves_its_viseme_timeline() {
"YWJj",
"audio/mpeg",
&[
- tinyinference_voice::VisemeFrame { viseme: "aa".into(), start_ms: 0, end_ms: 120 },
- tinyinference_voice::VisemeFrame { viseme: "PP".into(), start_ms: 120, end_ms: 220 },
+ tinyinference_voice::VisemeFrame {
+ viseme: "aa".into(),
+ start_ms: 0,
+ end_ms: 120
+ },
+ tinyinference_voice::VisemeFrame {
+ viseme: "PP".into(),
+ start_ms: 120,
+ end_ms: 220
+ },
]
));
@@ -92,7 +100,13 @@ fn rpc_round_trip_and_bad_base64() {
#[test]
fn synthesized_reply_is_stored_only_with_decodable_audio() {
let tmp = tempfile::tempdir().unwrap();
- assert!(!store_synthesized_reply(tmp.path(), "r1", "", "audio/mpeg", &[]));
+ assert!(!store_synthesized_reply(
+ tmp.path(),
+ "r1",
+ "",
+ "audio/mpeg",
+ &[]
+ ));
assert!(!store_synthesized_reply(
tmp.path(),
"r1",
diff --git a/crates/openhuman-core/src/web_chat/web_errors.rs b/crates/openhuman-core/src/web_chat/web_errors.rs
index 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.rs
index 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.rs
index 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-credits
diff --git a/crates/openhuman-core/src/web_chat/web_errors/classify.rs b/crates/openhuman-core/src/web_chat/web_errors/classify.rs
index 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.rs
index 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 the
diff --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.rs
index 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.rs
index 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.rs
index 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)