Skip to content

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

chore(web_chat): apply rustfmt import ordering across web chat and cron modules

Steven Enamakel65c3a1a70340
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index 00d1c306b7..f406884aea 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::{busy, clear_busy_for_thread, TurnBusy};
+use super::busy_guard::{TurnBusy, busy, clear_busy_for_thread};
use super::completion_notice::build_undelivered_notice;
use super::completion_owners;
-use super::delivery_drain::{run_drain, DrainFence, DrainOutcome, RECOVERY_BUSY_POLL};
+use super::delivery_drain::{DrainFence, DrainOutcome, RECOVERY_BUSY_POLL, run_drain};
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 f87c3c6583..7ccc2cf392 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::{publish_web_channel_event, WebChannelEvent};
+use crate::web_chat::{WebChannelEvent, publish_web_channel_event};
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 5c3d41b7a1..fc212faae8 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::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};
use crate::agent::turn_origin::AgentTurnOrigin;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
use std::sync::Mutex;
@@ -211,12 +211,16 @@ 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 9dfbff6bd9..9340a878b5 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::{group_first_time_when_bus_ready, DomainSubscriberPlan};
+use super::{DomainSubscriberPlan, group_first_time_when_bus_ready};
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 2248a68964..29ccae9e4d 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::context::ChatMessage;
use tinychannels_runtime::Channel;
+use tinychannels_runtime::context::ChatMessage;
/// 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 77312ab3dc..560b13ac1f 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::{kind_refusal, Binding};
-use crate::cron::handlers::{kind_handler, JobRunContext};
+use crate::cron::bus_host::{Binding, kind_refusal};
+use crate::cron::handlers::{JobRunContext, kind_handler};
use std::collections::HashMap;
use std::sync::Mutex;
-use tinyflows_bus::schedule::types::{CronJob, JobType, SessionTarget};
use tinyflows_bus::schedule::Attempt;
+use tinyflows_bus::schedule::types::{CronJob, JobType, SessionTarget};
/// 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 480cc7498d..de91419a81 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::{publish_web_channel_event, WebChannelEvent};
-use anyhow::{anyhow, Result};
+use crate::web_chat::{WebChannelEvent, publish_web_channel_event};
+use anyhow::{Result, anyhow};
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::{
- append_background_message_in, BackgroundAppend, BackgroundAppendOutcome, SessionRef,
- TranscriptMessage,
+ BackgroundAppend, BackgroundAppendOutcome, SessionRef, TranscriptMessage,
+ append_background_message_in,
};
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 714a36b771..052be539f7 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,15 +13,17 @@ 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]
@@ -79,15 +81,17 @@ 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()
+ );
}
// ──────────────────────────────────────────────────────────────────────
@@ -648,15 +652,17 @@ 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);
}
@@ -666,15 +672,17 @@ 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 604e53b6a9..076706508f 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::{register, SystemJobContext};
+use crate::cron::system_job_handlers::{SystemJobContext, register};
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::types::Schedule;
use tinyflows_bus::schedule::JobPolicy;
+use tinyflows_bus::schedule::types::Schedule;
/// Stores `policy` on the job.
fn set_policy(config: &Config, job_id: &str, policy: JobPolicy) -> anyhow::Result<()> {
@@ -167,10 +167,12 @@ 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]
@@ -285,10 +287,12 @@ 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 4390b2fe1c..a78f9a998b 100644
--- a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs
@@ -1,24 +1,26 @@
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 b87778bc15..1cfc88d8c2 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,8 +253,7 @@ 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(
@@ -440,11 +439,13 @@ 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 {
@@ -551,15 +552,17 @@ 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]
@@ -616,15 +619,17 @@ 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 f043e64c3d..f332c3b1ba 100644
--- a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs
@@ -109,11 +109,13 @@ 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]
@@ -134,9 +136,11 @@ 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 d21da4a22d..15438c2c4e 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::{build_agent_for_cron_job, run_agent_job, EMPTY_AGENT_OUTPUT};
+use super::agent_run::{EMPTY_AGENT_OUTPUT, build_agent_for_cron_job, run_agent_job};
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 892246abc8..7d673124c7 100644
--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
@@ -5,8 +5,9 @@ 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, FlowStreamTarget,
+ flows_build_with_extra_hidden_tools,
},
},
};
diff --git a/crates/openhuman-core/src/threads/store/bus.rs b/crates/openhuman-core/src/threads/store/bus.rs
index 6be6db72f8..80de886309 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::{
- append_message, ensure_thread, get_messages, ConversationMessage, CreateConversationThread,
+ ConversationMessage, CreateConversationThread, append_message, ensure_thread, get_messages,
};
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 0ba2b1ba9b..089c98ed24 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::{json, Value};
+use serde_json::{Value, json};
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 1bcf7e15b1..51b7e568d4 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::event_context;
use crate::web_chat::WebChannelEvent;
+use crate::web_chat::event_context;
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 00d46c594b..7f1f4c5ced 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::{scope_of, Admission, CancelNote, Shared, WebRunner};
+use super::runner::{Admission, CancelNote, Shared, WebRunner, scope_of};
use crate::agent::queued_turn::QueuedPayload;
use crate::core::events::DomainEvent;
use crate::core::runtime::DispatchCtx;
use crate::security::prompt_injection::{
- enforce_prompt_input, PromptEnforcementAction, PromptEnforcementContext,
+ PromptEnforcementAction, PromptEnforcementContext, enforce_prompt_input,
};
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 7c2a6df536..94631d1408 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::{
- generic_inference_error_user_message, is_action_budget_exhausted,
- is_non_retryable_rate_limit_text, retry_after_hint, ClassifiedError,
+ ClassifiedError, generic_inference_error_user_message, is_action_budget_exhausted,
+ is_non_retryable_rate_limit_text, retry_after_hint,
};
// 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::{
- 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,
+ 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,
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::set_test_forced_run_chat_task_error;
-#[cfg(any(test, debug_assertions))]
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};
+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};
#[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 8da87704e4..ba64958e08 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::{
- classify_budget_correlation, clear_budget_signal, has_fresh_budget_signal,
- record_budget_signal, BudgetCorrelation,
+ BudgetCorrelation, classify_budget_correlation, clear_budget_signal, has_fresh_budget_signal,
+ record_budget_signal,
};
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::{start_chat, StartChatError};
-pub use system_turn::{run_system_turn_on_thread, SESSION_CHECKOUT_FAILURE, SYSTEM_CLIENT_ID};
+pub use start_chat::{StartChatError, start_chat};
+pub use system_turn::{SESSION_CHECKOUT_FAILURE, SYSTEM_CLIENT_ID, run_system_turn_on_thread};
#[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 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};
+pub(super) use test_hooks::{TEST_PARK_AFTER_RUN, run_test_hooks, test_hooks_active};
#[cfg(any(test, debug_assertions))]
-pub use test_hooks::{set_test_park_after_run, set_test_run_chat_task_block, TestRunChatTaskBlock};
+pub use test_hooks::{TestRunChatTaskBlock, set_test_park_after_run, set_test_run_chat_task_block};
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 ac10df4916..4c72d92a67 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::{json, Value};
+use serde_json::{Value, json};
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
-use crate::web_chat::event_context;
+use crate::core::runtime::DispatchCtx;
use crate::web_chat::WebChannelEvent;
+use crate::web_chat::event_context;
use super::super::event_bus::publish_web_channel_event_in;
-use super::super::runner::{runtime, scope_of, CancelNote};
+use super::super::runner::{CancelNote, runtime, scope_of};
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 6144b87c1c..3301857b74 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::{runtime, scope_of, Admission};
+use super::super::runner::{Admission, runtime, scope_of};
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 2a352ccf55..e199f3046f 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::{context::CoreContext, ContextOverlay, DomainSet};
+use crate::core::runtime::{ContextOverlay, DomainSet, context::CoreContext};
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 018c53e7e4..38fc38a3ef 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::{with_origin, AgentTurnOrigin};
+use crate::agent::turn_origin::{AgentTurnOrigin, with_origin};
use super::super::session::{
- checkin_session_agent_if_vacant, checkout_session_agent, CheckedOutSession, CheckoutPolicy,
+ CheckedOutSession, CheckoutPolicy, checkin_session_agent_if_vacant, checkout_session_agent,
};
/// 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 a30d23f863..4ba960a45e 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::{context::CoreContext, ContextOverlay, DomainSet};
+ use crate::core::runtime::{ContextOverlay, DomainSet, context::CoreContext};
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 f59ebc15cf..11adab2f03 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::{publish_web_channel_event_in, WebChannelEvent};
+use crate::web_chat::{WebChannelEvent, publish_web_channel_event_in};
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 5a88a92257..5ad986f0d7 100644
--- a/crates/openhuman-core/src/web_chat/progress_map_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_map_tests.rs
@@ -90,10 +90,12 @@ 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);
@@ -298,9 +300,11 @@ 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 5d48eeacf8..f5886fbfb8 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, run_reply_message_id, ConversationMessage};
+use crate::threads::store::{self as conversations, ConversationMessage, run_reply_message_id};
/// 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 d66468da20..852b353794 100644
--- a/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
+++ b/crates/openhuman-core/src/web_chat/reply_persistence_tests.rs
@@ -111,13 +111,15 @@ 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 4118e24ebe..56186676fc 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::{oneshot, Mutex as AsyncMutex};
+use tokio::sync::{Mutex as AsyncMutex, oneshot};
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 929f6f7486..ae534b453d 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::all::{ControllerFuture, RegisteredController};
use crate::core::Outcome;
+use crate::core::all::{ControllerFuture, RegisteredController};
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 cc38a08422..06ddcabc10 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::{
- checkin_session_agent, checkin_session_agent_if_vacant, checkout_session_agent,
- fingerprint_diff, CheckedOutSession, CheckoutPolicy,
+ CheckedOutSession, CheckoutPolicy, checkin_session_agent, checkin_session_agent_if_vacant,
+ checkout_session_agent, fingerprint_diff,
};
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 379fd13dcc..8addceac04 100644
--- a/crates/openhuman-core/src/web_chat/session_routing_tests.rs
+++ b/crates/openhuman-core/src/web_chat/session_routing_tests.rs
@@ -345,9 +345,11 @@ 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 949d2fd6b8..8e3e5e39ab 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::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
+use std::sync::atomic::{AtomicUsize, Ordering};
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 9f9646f2fb..d9eb18fd01 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::{close_reply, StopCause, StoppedTurn};
+use super::turn_close::{StopCause, StoppedTurn, close_reply};
use super::web_errors::{
- classify_inference_error, is_outer_backstop_timeout, turn_idle_error_message,
- turn_timeout_error_message, ClassifiedError,
+ ClassifiedError, classify_inference_error, is_outer_backstop_timeout, turn_idle_error_message,
+ turn_timeout_error_message,
};
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 22bf33ab71..accf65b142 100644
--- a/crates/openhuman-core/src/web_chat/turn_events_tests.rs
+++ b/crates/openhuman-core/src/web_chat/turn_events_tests.rs
@@ -166,9 +166,10 @@ 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]
@@ -263,10 +264,12 @@ 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 2b538e1b77..ccd66fe7e2 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::{mpsc, watch, Mutex as AsyncMutex};
+use tokio::sync::{Mutex as AsyncMutex, mpsc, watch};
use super::ops::{self, BudgetCorrelation};
-use super::progress::{ProgressProjection, INFERENCE_HEARTBEAT_SECS};
+use super::progress::{INFERENCE_HEARTBEAT_SECS, ProgressProjection};
use super::runner::{Admission, Shared};
use super::session::{
- checkin_session_agent, checkout_session_agent, normalize_model_override, CheckoutPolicy,
+ CheckoutPolicy, checkin_session_agent, checkout_session_agent, normalize_model_override,
};
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::{with_origin, AgentTurnOrigin};
+use crate::agent::turn_origin::{AgentTurnOrigin, with_origin};
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_tests.rs b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
index f394e3dd83..eb9453807f 100644
--- a/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
+++ b/crates/openhuman-core/src/web_chat/voice_notes_tests.rs
@@ -62,16 +62,8 @@ 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 },
]
));
@@ -100,13 +92,7 @@ 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 65cb39d2d2..91bee727ee 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::{classify_inference_error, ClassifiedError};
+pub(crate) use classify::{ClassifiedError, classify_inference_error};
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 2503cc3753..23127d1367 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::{
- body_flags_malformed, extract_backend_error_code, is_managed_backend_envelope,
- BackendErrorCode,
+ BackendErrorCode, body_flags_malformed, extract_backend_error_code,
+ is_managed_backend_envelope,
};
// 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::{failure_copy, FailureClass as C};
+ use crate::inference::failure_copy::{FailureClass as C, failure_copy};
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 8bab4a48d0..23271e16e1 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::{failure_copy, FailureClass};
-use tinyinference_providers::{is_budget_message, BudgetMatch};
+use crate::inference::failure_copy::{FailureClass, failure_copy};
+use tinyinference_providers::{BudgetMatch, is_budget_message};
/// 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 c666459f06..16a99f248a 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::{failure_copy, FailureClass};
+use crate::inference::failure_copy::{FailureClass, failure_copy};
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 af2d17807b..0e59a1e49b 100644
--- a/crates/openhuman-core/src/web_chat/web_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests.rs
@@ -1,4 +1,5 @@
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,
@@ -7,14 +8,13 @@ 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, ChatRequestMetadata, ClassifiedError, StartChatError,
- TestRunChatTaskBlock, WebChatParams,
+ subscribe_web_channel_events,
};
use crate::core::TypeSchema;
-use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
+use std::sync::atomic::{AtomicBool, Ordering};
use tinyagents_harness::run_queue::QueueLane;
-use tokio::time::{timeout, Duration};
+use tokio::time::{Duration, timeout};
// 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 3b9cd1161e..309e1d9783 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,14 +465,16 @@ 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 88d760b201..087660f585 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::{classify_error, ArmError};
+use crate::agent::triage::evaluator::{ArmError, classify_error};
use regex::Regex;
/// `(case, input, error_type, source, retryable, retry_after_ms, provider,
@@ -652,8 +652,9 @@ 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::{
- recoverable_identical_halt_summary, recoverable_no_progress_halt_summary,
- terminal_inference_halt_summary, user_actionable_escalation, TerminalInferenceFailure,
+ TerminalInferenceFailure, recoverable_identical_halt_summary,
+ recoverable_no_progress_halt_summary, terminal_inference_halt_summary,
+ user_actionable_escalation,
};
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 8350175e26..e17f01b11d 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,9 +169,11 @@ 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;
}
@@ -233,27 +235,33 @@ 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;
}
@@ -314,10 +322,12 @@ 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)