Skip to content

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

chore: apply rustfmt formatting across core crate

Steven Enamakel8581c3be4e7b
diff --git a/crates/openhuman-core/src/agent/queued_turn.rs b/crates/openhuman-core/src/agent/queued_turn.rs
index d42a829427..9df5af34da 100644
--- a/crates/openhuman-core/src/agent/queued_turn.rs
+++ b/crates/openhuman-core/src/agent/queued_turn.rs
@@ -4,9 +4,7 @@
//! selects how this payload is consumed. OpenHuman retains the web and
//! orchestration metadata needed to dispatch a deferred follow-up turn.
-use tinyagents_harness::turn_runner::{
- QueueDisposition, RequeuePayload, ScopeKey, TurnRequest,
-};
+use tinyagents_harness::turn_runner::{QueueDisposition, RequeuePayload, ScopeKey, TurnRequest};
/// The host metadata one OpenHuman turn carries through TinyAgents' turn
/// runner and its run queue: which client asked, the per-message model and
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index 7349e792b6..eb9bf57820 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -12,8 +12,8 @@ use std::{
sync::{Arc, Mutex},
};
-use async_trait::async_trait;
use crate::agent::subagent_host::SubagentUsageExt as _;
+use async_trait::async_trait;
use fs2::FileExt;
use sha2::{Digest, Sha256};
use tinyagents_harness::context::{RunConfig, RunContext};
diff --git a/crates/openhuman-core/src/agent/tinyagents/steering_forwarder_tests.rs b/crates/openhuman-core/src/agent/tinyagents/steering_forwarder_tests.rs
index de97ba43bd..461752391e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/steering_forwarder_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/steering_forwarder_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use tinyagents_harness::run_queue::QueuedMessage;
use tinyagents_harness::run_queue::QueueLane;
+use tinyagents_harness::run_queue::QueuedMessage;
#[test]
fn recovered_steer_becomes_a_queued_turn_on_the_forwarders_thread() {
diff --git a/crates/openhuman-core/src/channels/context_tests.rs b/crates/openhuman-core/src/channels/context_tests.rs
index fdd9de075a..edbfeeab97 100644
--- a/crates/openhuman-core/src/channels/context_tests.rs
+++ b/crates/openhuman-core/src/channels/context_tests.rs
@@ -94,7 +94,9 @@ fn clear_and_compact_sender_history_update_cached_messages() {
let mut history = Vec::new();
history.push(tinychannels_runtime::context::ChatMessage::user("short"));
history.extend(
- (0..20).map(|idx| tinychannels_runtime::context::ChatMessage::assistant("x".repeat(700 + idx))),
+ (0..20).map(|idx| {
+ tinychannels_runtime::context::ChatMessage::assistant("x".repeat(700 + idx))
+ }),
);
ctx.conversation_histories
.lock()
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 6faad77f51..c0a3e9aa4a 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -12,8 +12,8 @@ use std::sync::{Arc, Mutex};
use std::task::{Context, Poll, Waker};
use tinybus::EventHandler;
use tinychannels::routes::resolve_provider_alias;
-use tinychannels_runtime::context::ChatMessage;
use tinychannels_bus::ChannelMessage;
+use tinychannels_runtime::context::ChatMessage;
use tinytools::{Tool, ToolResult};
struct DummyTool;
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
index afdf76ef20..21e55f839d 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
@@ -11,7 +11,10 @@ pub(super) use tinychannels::runtime::select_acknowledgment_reaction;
pub(super) fn log_worker_join_result(result: Result<(), tokio::task::JoinError>) {
if let Err(error) = result {
- tracing::warn!("{}", tinychannels_runtime::context::worker_crash_message(&error));
+ tracing::warn!(
+ "{}",
+ tinychannels_runtime::context::worker_crash_message(&error)
+ );
}
}
diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
index f58095305b..39044977ba 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
@@ -14,9 +14,9 @@ use tinychannels_bus::module_runtime::{
ChannelIngressKind, ChannelMessagePreparation, ConfiguredChannelInfo,
};
use tinychannels_bus::module_supervision::ChannelSupervisionPolicy;
+use tinychannels_bus::{ChannelInteraction, ChannelInteractionResult};
use tinychannels_bus::{ChannelMessage, SendMessage};
use tinychannels_runtime::Channel;
-use tinychannels_bus::{ChannelInteraction, ChannelInteractionResult};
use tokio::sync::mpsc;
/// Channel objects sharing one captured config, callback object and module lease.
diff --git a/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs
index 35914a40e5..a0d6379cd5 100644
--- a/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup_email_secret_tests_tests.rs
@@ -1,8 +1,8 @@
use super::*;
-use tinychannels::providers::email_channel::EmailConfig;
use crate::security::credentials::AuthService;
use std::collections::HashMap;
use tempfile::tempdir;
+use tinychannels::providers::email_channel::EmailConfig;
use crate::channels::credentials::resolve_email_password;
fn isolated_config() -> (tempfile::TempDir, Config) {
diff --git a/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs
index 36bf78af5c..eb646e999a 100644
--- a/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup_yuanbao_secret_tests_tests.rs
@@ -1,8 +1,8 @@
use super::*;
-use tinychannels::providers::yuanbao::YuanbaoConfig;
use crate::security::credentials::AuthService;
use std::collections::HashMap;
use tempfile::tempdir;
+use tinychannels::providers::yuanbao::YuanbaoConfig;
fn isolated_config() -> (tempfile::TempDir, Config) {
let tmp = tempdir().expect("tempdir");
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index dc96145f3c..b4aa5f727a 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -21,8 +21,8 @@ use std::path::PathBuf;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;
-use tinychannels_runtime::context::ChatMessage;
use tinychannels_bus::{ChannelMessage, SendMessage};
+use tinychannels_runtime::context::ChatMessage;
use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};
use tinytools::{Tool, ToolResult};
diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rs
index c6c46d8116..2204c4ca3d 100644
--- a/crates/openhuman-core/src/config/mod.rs
+++ b/crates/openhuman-core/src/config/mod.rs
@@ -49,22 +49,21 @@ pub use schema::{
DictationActivationMode, DictationConfig, DiscordConfig, DockerRuntimeConfig, EmailConfig,
EmbeddingRouteConfig, GitbooksConfig, HttpHeader, HttpRequestConfig, IMessageConfig,
IntegrationToggle, IntegrationsConfig, LarkConfig, LegacySearchInputs, LinqConfig,
- LocalAiConfig, LocalJailConfig, McpAuthConfig, McpClientConfig,
- McpClientIdentityConfig, McpServerConfig, McpToolExposure, MemoryConfig, MemoryLayoutMode,
- ModelRouteConfig, MultimodalConfig, MultimodalFileConfig, ObservabilityConfig,
- OrchestratorModelConfig, PresentationMode, PrivacyConfig, PrivacyMode, ProviderRoute,
- ProxyConfig, ProxyScope, ReliabilityConfig, ResourceLimitsConfig, RuntimeConfig,
- SandboxBackend, SandboxConfig, SchedulerConfig, SchedulerGateConfig, SchedulerGateMode,
- SearchConfig, SearchEngineCredentials, SearchHostCredential, SearchProviderSettings,
- SearxngConfig, SecretsConfig, SecurityConfig, ShellConfig, SlackConfig, StreamMode, SttEngine,
- TeamModelConfig, TelegramConfig, TokenjuiceConfig, UnknownKeyedSearchProvider, UpdateConfig,
- UpdateRestartStrategy, VoiceActivationMode, VoiceServerConfig, WebSearchConfig,
- YuanbaoConfig, DEFAULT_MODEL, LEGACY_TIER_MODELS, MANAGED_MULTIMODAL_MODELS,
- MANAGED_SEARCH_PROVIDERS, MODEL_IMAGE_GENERATION_AGENT, MODEL_MANAGED_DEFAULT,
- MODEL_MEDIA_UNDERSTANDING, MODEL_VIDEO_GENERATION_AGENT, SEARCH_ENGINE_BRAVE,
- SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,
- SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER,
- SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
+ LocalAiConfig, LocalJailConfig, McpAuthConfig, McpClientConfig, McpClientIdentityConfig,
+ McpServerConfig, McpToolExposure, MemoryConfig, MemoryLayoutMode, ModelRouteConfig,
+ MultimodalConfig, MultimodalFileConfig, ObservabilityConfig, OrchestratorModelConfig,
+ PresentationMode, PrivacyConfig, PrivacyMode, ProviderRoute, ProxyConfig, ProxyScope,
+ ReliabilityConfig, ResourceLimitsConfig, RuntimeConfig, SandboxBackend, SandboxConfig,
+ SchedulerConfig, SchedulerGateConfig, SchedulerGateMode, SearchConfig, SearchEngineCredentials,
+ SearchHostCredential, SearchProviderSettings, SearxngConfig, SecretsConfig, SecurityConfig,
+ ShellConfig, SlackConfig, StreamMode, SttEngine, TeamModelConfig, TelegramConfig,
+ TokenjuiceConfig, UnknownKeyedSearchProvider, UpdateConfig, UpdateRestartStrategy,
+ VoiceActivationMode, VoiceServerConfig, WebSearchConfig, YuanbaoConfig, DEFAULT_MODEL,
+ LEGACY_TIER_MODELS, MANAGED_MULTIMODAL_MODELS, MANAGED_SEARCH_PROVIDERS,
+ MODEL_IMAGE_GENERATION_AGENT, MODEL_MANAGED_DEFAULT, MODEL_MEDIA_UNDERSTANDING,
+ MODEL_VIDEO_GENERATION_AGENT, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA,
+ SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY,
+ SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
};
// Kept as a separate re-export (issue #4117) so the large alphabetized group
// above stays byte-identical and rustfmt-stable.
diff --git a/crates/openhuman-core/src/config/schema/channels.rs b/crates/openhuman-core/src/config/schema/channels.rs
index ec28c4d13a..5329f5dcb4 100644
--- a/crates/openhuman-core/src/config/schema/channels.rs
+++ b/crates/openhuman-core/src/config/schema/channels.rs
@@ -6,9 +6,8 @@ use serde::{Deserialize, Serialize};
pub use tinychannels_bus::config::{
ChannelsConfig, DingTalkConfig, DiscordConfig, EmailConfig, IMessageConfig, IrcConfig,
- LarkConfig, LarkReceiveMode, LinqConfig, MattermostConfig, QQConfig,
- SignalConfig, SlackConfig, StreamMode, TelegramConfig, WhatsAppConfig,
- YuanbaoConfig,
+ LarkConfig, LarkReceiveMode, LinqConfig, MattermostConfig, QQConfig, SignalConfig, SlackConfig,
+ StreamMode, TelegramConfig, WhatsAppConfig, YuanbaoConfig,
};
#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
diff --git a/crates/openhuman-core/src/cron/channel_bridge.rs b/crates/openhuman-core/src/cron/channel_bridge.rs
index 315428b21d..2f602162f8 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_runtime::context::ChatMessage;
use tinychannels_bus::SendMessage;
+use tinychannels_runtime::context::ChatMessage;
use tinychannels_runtime::Channel;
/// Same shape as `channels::context::ConversationHistoryMap`, spelled out so
diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rs
index e36a863384..023a8102e4 100644
--- a/crates/openhuman-core/src/cron/mod.rs
+++ b/crates/openhuman-core/src/cron/mod.rs
@@ -12,10 +12,16 @@
// Host-condition policy (battery / AC / CPU) that throttles background LLM
// work such as memory digests. The cron poll loop itself does not consult it.
-#[allow(deprecated, reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content")]
+#[allow(
+ deprecated,
+ reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content"
+)]
pub mod bus;
pub(crate) mod bus_host;
-#[allow(deprecated, reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content")]
+#[allow(
+ deprecated,
+ reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content"
+)]
pub mod channel_bridge;
pub(crate) mod client;
pub mod completion_owner;
diff --git a/crates/openhuman-core/src/lib.rs b/crates/openhuman-core/src/lib.rs
index 65b73a1b72..ac62386a00 100644
--- a/crates/openhuman-core/src/lib.rs
+++ b/crates/openhuman-core/src/lib.rs
@@ -54,7 +54,10 @@
pub mod agent;
pub mod backend;
-#[allow(deprecated, reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content")]
+#[allow(
+ deprecated,
+ reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content"
+)]
pub mod channels;
pub mod commands;
pub mod config;
diff --git a/crates/openhuman-core/src/threads/store/mod.rs b/crates/openhuman-core/src/threads/store/mod.rs
index 2f1978e58a..1e11501c1f 100644
--- a/crates/openhuman-core/src/threads/store/mod.rs
+++ b/crates/openhuman-core/src/threads/store/mod.rs
@@ -31,7 +31,10 @@
pub mod backend;
pub mod blocking;
-#[allow(deprecated, reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content")]
+#[allow(
+ deprecated,
+ reason = "v21 ChannelMessage/SendMessage shims stay until the native channel path moves to canonical v22 content"
+)]
mod bus;
mod legacy_import;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/web_chat/channel_event_tests.rs b/crates/openhuman-core/src/web_chat/channel_event_tests.rs
index e69de29bb2..8b13789179 100644
--- a/crates/openhuman-core/src/web_chat/channel_event_tests.rs
+++ b/crates/openhuman-core/src/web_chat/channel_event_tests.rs
@@ -0,0 +1 @@
+
diff --git a/crates/openhuman-core/src/web_chat/ingress.rs b/crates/openhuman-core/src/web_chat/ingress.rs
index 77f190bf28..050f1a3a9c 100644
--- a/crates/openhuman-core/src/web_chat/ingress.rs
+++ b/crates/openhuman-core/src/web_chat/ingress.rs
@@ -14,7 +14,7 @@ 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;
@@ -43,7 +43,11 @@ impl WebIngress {
let _ = self.runner.set(Arc::downgrade(runner));
}
- fn refuse(&self, request: &TurnRequest<QueuedPayload>, error: StartChatError) -> IngressDecision {
+ fn refuse(
+ &self,
+ request: &TurnRequest<QueuedPayload>,
+ error: StartChatError,
+ ) -> IngressDecision {
let reason = error.to_string();
self.shared
.admit(&request.request_id, Admission::Rejected(error));
@@ -61,9 +65,10 @@ impl WebIngress {
return IngressDecision::Continue;
}
let staged = async {
- let config = ctx.load_config().await.map_err(|error| {
- format!("upload configuration unavailable: {error}")
- })?;
+ let config = ctx
+ .load_config()
+ .await
+ .map_err(|error| format!("upload configuration unavailable: {error}"))?;
// Stage where the turn will read: the thread's working folder when
// one is bound (the turn applies the same folder), else action_dir.
let workspace = crate::agent::attachments::thread_action_dir(
diff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rs
index 51677d1351..a9513d4333 100644
--- a/crates/openhuman-core/src/web_chat/mod.rs
+++ b/crates/openhuman-core/src/web_chat/mod.rs
@@ -97,14 +97,14 @@ pub use schemas::{
};
// Helpers re-exported for tests
-#[cfg(any(test, debug_assertions))]
-#[allow(unused_imports)]
-pub(crate) use turn_events::sentry_suppression_reason;
pub(crate) use ops::{event_session_id_for, key_for};
#[cfg(test)]
pub(crate) use ops::{key_in, unscope_in};
#[cfg(feature = "flows")]
pub(crate) use progress::spawn_progress_bridge;
+#[cfg(any(test, debug_assertions))]
+#[allow(unused_imports)]
+pub(crate) use turn_events::sentry_suppression_reason;
// Schema field helpers + session/error helpers re-exported for the `web_tests`
// integration module (they moved into submodules during the module split but
diff --git a/crates/openhuman-core/src/web_chat/ops.rs b/crates/openhuman-core/src/web_chat/ops.rs
index 5c26cc46bb..8da87704e4 100644
--- a/crates/openhuman-core/src/web_chat/ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops.rs
@@ -34,19 +34,19 @@ pub(crate) use state::lock_thread_sessions_for_test;
pub use state::parallel_in_flight_entries_for_test;
#[cfg(test)]
pub(crate) use state::scoped_key;
-pub(super) use state::{tenant_of, thread_sessions};
pub use state::{cancel_should_target, in_flight_entries_for_test, invalidate_thread_sessions};
pub(crate) use state::{event_session_id_for, key_for};
#[cfg(test)]
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::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 use test_hooks::{set_test_park_after_run, set_test_run_chat_task_block, TestRunChatTaskBlock};
-#[cfg(any(test, debug_assertions))]
pub(super) use test_hooks::{run_test_hooks, test_hooks_active, TEST_PARK_AFTER_RUN};
-#[cfg(test)]
-pub(crate) use test_hooks::track_parallel_turn_for_test;
+#[cfg(any(test, debug_assertions))]
+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 9cf0990dff..b013877a8d 100644
--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
@@ -320,7 +320,12 @@ pub async fn channel_web_queue_remove(
}
let rt = runtime(ctx);
let scope = scope_of(ctx);
- if rt.runner.in_flight_request_id(&scope, thread_id).await.is_none() {
+ if rt
+ .runner
+ .in_flight_request_id(&scope, thread_id)
+ .await
+ .is_none()
+ {
return Ok(Outcome::single_log(
json!({
"thread_id": thread_id,
@@ -365,7 +370,12 @@ pub async fn channel_web_queue_clear(
) -> Result<Outcome<Value>, String> {
let rt = runtime(ctx);
let scope = scope_of(ctx);
- if rt.runner.in_flight_request_id(&scope, thread_id).await.is_none() {
+ if rt
+ .runner
+ .in_flight_request_id(&scope, thread_id)
+ .await
+ .is_none()
+ {
return Ok(Outcome::single_log(
json!({
"thread_id": thread_id.trim(),
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 ecd5dfcae2..835a1462c1 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -10,9 +10,7 @@
use std::time::Duration;
use serde_json::json;
-use tinyagents_harness::turn_runner::{
- QueueDisposition, TurnRequest, TurnRunnerError,
-};
+use tinyagents_harness::turn_runner::{QueueDisposition, TurnRequest, TurnRunnerError};
use tinychannels_bus::web::{ChatRequestMetadata, QueueMode};
use uuid::Uuid;
@@ -300,13 +298,19 @@ async fn start_chat_inner(
shared.mark_queued(&id);
}
Err(TurnRunnerError::Rejected(reason) | TurnRunnerError::Failed(reason)) => {
- shared.admit(&id, Admission::Rejected(StartChatError::Other(reason.clone())));
+ shared.admit(
+ &id,
+ Admission::Rejected(StartChatError::Other(reason.clone())),
+ );
}
Err(TurnRunnerError::Consumed | TurnRunnerError::Cancelled) | Ok(_) => {
shared.admit(&id, Admission::Started);
}
}
- log::debug!("[web-channel] turn finished request_id={id} ok={}", outcome.is_ok());
+ log::debug!(
+ "[web-channel] turn finished request_id={id} ok={}",
+ outcome.is_ok()
+ );
},
));
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 0827b6f0b9..d7238292f5 100644
--- a/crates/openhuman-core/src/web_chat/ops/state_tests.rs
+++ b/crates/openhuman-core/src/web_chat/ops/state_tests.rs
@@ -1,8 +1,8 @@
use super::*;
-use crate::web_chat::runner::runtime;
-use crate::web_chat::track_parallel_turn_for_test;
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;
fn agent(parent: &Arc<CoreContext>, id: &str) -> Arc<CoreContext> {
parent.derive_with(
@@ -100,7 +100,9 @@ async fn a_user_cancel_under_the_fence_placeholder_id_keeps_the_callers_client()
let seen = tokio::time::timeout(std::time::Duration::from_secs(10), async {
loop {
match events.recv().await {
- Ok(event) if event.event == "chat_cancelled" && event.thread_id == "fence-thread" => {
+ Ok(event)
+ if event.event == "chat_cancelled" && event.thread_id == "fence-thread" =>
+ {
return event.client_id;
}
Ok(_) | Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => continue,
diff --git a/crates/openhuman-core/src/web_chat/ops/test_hooks.rs b/crates/openhuman-core/src/web_chat/ops/test_hooks.rs
index 6a6be8b0c5..4139183b00 100644
--- a/crates/openhuman-core/src/web_chat/ops/test_hooks.rs
+++ b/crates/openhuman-core/src/web_chat/ops/test_hooks.rs
@@ -86,7 +86,9 @@ pub(crate) async fn test_hooks_active() -> bool {
/// `Some(outcome)` is the whole turn.
pub(crate) async fn run_test_hooks(
shared: &super::super::runner::Shared,
- request: &tinyagents_harness::turn_runner::TurnRequest<crate::agent::queued_turn::QueuedPayload>,
+ request: &tinyagents_harness::turn_runner::TurnRequest<
+ crate::agent::queued_turn::QueuedPayload,
+ >,
) -> Option<Result<tinyagents_harness::turn_runner::TurnResult, String>> {
use tinyagents_harness::turn_runner::TurnResult;
let (thread_id, request_id) = (&request.thread_id, &request.request_id);
@@ -109,7 +111,9 @@ pub(crate) async fn run_test_hooks(
}
}
let _guard = DropGuard(block.dropped.clone());
- log::debug!("[web-channel][test] parking the turn thread_id={thread_id} request_id={request_id}");
+ log::debug!(
+ "[web-channel][test] parking the turn thread_id={thread_id} request_id={request_id}"
+ );
// The turn future is live and parked: a test may cancel now.
block
.started
diff --git a/crates/openhuman-core/src/web_chat/presentation.rs b/crates/openhuman-core/src/web_chat/presentation.rs
index 18c018dd04..21f9f9718d 100644
--- a/crates/openhuman-core/src/web_chat/presentation.rs
+++ b/crates/openhuman-core/src/web_chat/presentation.rs
@@ -1,8 +1,8 @@
//! Presentation layer for web-channel chat responses: store a finished reply,
//! then announce it to the client as one unmodified `chat_done` message.
-use tinychannels_bus::web as bus_web;
use crate::agent::subagent_host::SubagentUsageExt as _;
+use tinychannels_bus::web as bus_web;
use crate::agent::tinyagents::host::LastTurnUsage;
use crate::web_chat::{SubagentUsagePayload, TurnUsagePayload, WebChannelEvent};
diff --git a/crates/openhuman-core/src/web_chat/progress.rs b/crates/openhuman-core/src/web_chat/progress.rs
index 0253829e2a..fc4cabfb97 100644
--- a/crates/openhuman-core/src/web_chat/progress.rs
+++ b/crates/openhuman-core/src/web_chat/progress.rs
@@ -13,10 +13,12 @@ use std::collections::HashMap;
use std::time::Instant;
use serde_json::json;
-use tinychannels_bus::module_progressive::ChannelOutputEvent;
-use tinychannels_bus::web::{ChatRequestMetadata, TurnCostThrottle, TurnTimingSnapshot, TurnTimingState};
use tinyagents_session::port::TurnStates;
use tinyagents_session::turn_state::TurnStateMirror;
+use tinychannels_bus::module_progressive::ChannelOutputEvent;
+use tinychannels_bus::web::{
+ ChatRequestMetadata, TurnCostThrottle, TurnTimingSnapshot, TurnTimingState,
+};
use super::progress_ledger::{ChildDone, Ledger};
use super::progress_map as map;
@@ -322,8 +324,13 @@ impl ProgressProjection {
cached_input_tokens,
total_usd,
} => {
- self.ledger()
- .cost(&model, input_tokens, output_tokens, cached_input_tokens, total_usd);
+ self.ledger().cost(
+ &model,
+ input_tokens,
+ output_tokens,
+ cached_input_tokens,
+ total_usd,
+ );
log::debug!(
"[web_channel] turn cost update model={model} iter={iteration} in={input_tokens} out={output_tokens} cached_in={cached_input_tokens} total_usd={total_usd:.4} thread_id={}",
self.ids.thread_id
@@ -479,10 +486,7 @@ impl ProgressProjection {
dirty_status,
..
} => {
- let parent_call_id = self
- .subagent_parent_call_ids
- .remove(&task_id)
- .flatten();
+ let parent_call_id = self.subagent_parent_call_ids.remove(&task_id).flatten();
self.ledger().child_completed(&ChildDone {
agent_id: &agent_id,
task_id: &task_id,
@@ -522,10 +526,7 @@ impl ProgressProjection {
self.ids.thread_id,
self.ids.request_id
);
- let parent_call_id = self
- .subagent_parent_call_ids
- .remove(&task_id)
- .flatten();
+ let parent_call_id = self.subagent_parent_call_ids.remove(&task_id).flatten();
self.ledger().child_failed(
&agent_id,
&task_id,
@@ -534,7 +535,13 @@ impl ProgressProjection {
self.child_tool_counts.get(&task_id).copied(),
);
self.surface
- .output(map::sub_failed(&agent_id, &task_id, round, error, parent_call_id))
+ .output(map::sub_failed(
+ &agent_id,
+ &task_id,
+ round,
+ error,
+ parent_call_id,
+ ))
.await;
}
AgentProgress::SubagentAwaitingUser {
diff --git a/crates/openhuman-core/src/web_chat/progress_map.rs b/crates/openhuman-core/src/web_chat/progress_map.rs
index a1bbb5d056..4db2b630ee 100644
--- a/crates/openhuman-core/src/web_chat/progress_map.rs
+++ b/crates/openhuman-core/src/web_chat/progress_map.rs
@@ -5,9 +5,9 @@
//! file builds no `WebChannelEvent`. Payload caps are applied here, before the
//! projection, so a multi-megabyte tool result never reaches the socket.
+use crate::agent::subagent_host::SubagentUsageExt as _;
use serde::Serialize;
use serde_json::Value;
-use crate::agent::subagent_host::SubagentUsageExt as _;
use tinychannels_bus::module_progressive::{
ChannelOutputEvent, SubagentOutput, SubagentUsage, ToolFailureSummary,
};
@@ -72,7 +72,12 @@ fn subagent(agent_id: &str, task_id: &str, state: &str) -> SubagentOutput {
}
}
-fn lifecycle(stage: &str, message: Option<String>, iteration: Option<u32>, max: Option<u32>) -> ChannelOutputEvent {
+fn lifecycle(
+ stage: &str,
+ message: Option<String>,
+ iteration: Option<u32>,
+ max: Option<u32>,
+) -> ChannelOutputEvent {
ChannelOutputEvent::Lifecycle {
stage: stage.to_owned(),
message,
@@ -215,7 +220,9 @@ pub(super) fn sub_completed(
parent_call_id: Option<String>,
) -> ChannelOutputEvent {
let mut out = subagent(agent_id, task_id, "completed");
- out.message = Some(format!("Sub-agent '{agent_id}' completed in {elapsed_ms}ms"));
+ out.message = Some(format!(
+ "Sub-agent '{agent_id}' completed in {elapsed_ms}ms"
+ ));
out.tool_name = Some(agent_id.to_owned());
out.success = Some(true);
out.iteration = Some(iterations);
@@ -356,7 +363,15 @@ pub(super) fn sub_delta(
delta: String,
iteration: u32,
) -> ChannelOutputEvent {
- let mut out = subagent(agent_id, task_id, if thinking { "thinking_delta" } else { "text_delta" });
+ let mut out = subagent(
+ agent_id,
+ task_id,
+ if thinking {
+ "thinking_delta"
+ } else {
+ "text_delta"
+ },
+ );
out.message = Some(delta);
out.iteration = Some(iteration);
ChannelOutputEvent::Subagent(Box::new(out))
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 e69de29bb2..8b13789179 100644
--- a/crates/openhuman-core/src/web_chat/progress_map_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_map_tests.rs
@@ -0,0 +1 @@
+
diff --git a/crates/openhuman-core/src/web_chat/progress_tests.rs b/crates/openhuman-core/src/web_chat/progress_tests.rs
index 5c1c0d7ee6..1775c9ccd9 100644
--- a/crates/openhuman-core/src/web_chat/progress_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_tests.rs
@@ -1,7 +1,7 @@
use super::*;
-use crate::web_chat::WebChannelEvent;
use crate::agent::progress::AgentProgress;
use crate::config::Config;
+use crate::web_chat::WebChannelEvent;
use std::time::Duration;
use tokio::sync::broadcast::error::TryRecvError;
@@ -28,7 +28,6 @@ fn interim_narration_surfaces_and_trims_substantial_text() {
);
}
-
/// Attribution for a turn whose stored user payload carries no identity.
mod attribution {
use super::super::trace::session_profile_user_attribution;
diff --git a/crates/openhuman-core/src/web_chat/runner.rs b/crates/openhuman-core/src/web_chat/runner.rs
index 9f41a96581..4118e24ebe 100644
--- a/crates/openhuman-core/src/web_chat/runner.rs
+++ b/crates/openhuman-core/src/web_chat/runner.rs
@@ -30,8 +30,15 @@ use super::types::WebChatTaskResult;
use crate::agent::queued_turn::QueuedPayload;
use crate::core::runtime::DispatchCtx;
-pub(super) type WebRunner =
- TurnRunner<WebHost, WebIngress, WebReplies, WebEvents, WebFailures, WebSummarizer, QueuedPayload>;
+pub(super) type WebRunner = TurnRunner<
+ WebHost,
+ WebIngress,
+ WebReplies,
+ WebEvents,
+ WebFailures,
+ WebSummarizer,
+ QueuedPayload,
+>;
/// How long a stopped turn may keep running so the session runtime can persist
/// the rounds it completed. Just above the runtime's own 2 s driver grace; the
@@ -90,13 +97,17 @@ pub(super) struct Shared {
}
fn locked<T>(mutex: &Mutex<T>) -> MutexGuard<'_, T> {
- mutex.lock().unwrap_or_else(|poisoned| poisoned.into_inner())
+ mutex
+ .lock()
+ .unwrap_or_else(|poisoned| poisoned.into_inner())
}
impl Shared {
/// Run `f` on the slot of `request_id`, creating it on first use.
pub(super) fn with<R>(&self, request_id: &str, f: impl FnOnce(&mut TurnSlot) -> R) -> R {
- f(locked(&self.turns).entry(request_id.to_owned()).or_default())
+ f(locked(&self.turns)
+ .entry(request_id.to_owned())
+ .or_default())
}
/// Drop the slot of a finished request and hand back what it held.
diff --git a/crates/openhuman-core/src/web_chat/surface_tests.rs b/crates/openhuman-core/src/web_chat/surface_tests.rs
index e69de29bb2..8b13789179 100644
--- a/crates/openhuman-core/src/web_chat/surface_tests.rs
+++ b/crates/openhuman-core/src/web_chat/surface_tests.rs
@@ -0,0 +1 @@
+
diff --git a/crates/openhuman-core/src/web_chat/turn_activity_tests.rs b/crates/openhuman-core/src/web_chat/turn_activity_tests.rs
index c975c4960e..290b4e1097 100644
--- a/crates/openhuman-core/src/web_chat/turn_activity_tests.rs
+++ b/crates/openhuman-core/src/web_chat/turn_activity_tests.rs
@@ -200,4 +200,3 @@ fn the_turn_context_is_what_the_turn_recorded() {
assert!(Arc::ptr_eq(&seen.expect("config recorded"), &config));
assert_eq!(locale.as_deref(), Some("de"));
}
-
diff --git a/crates/openhuman-core/src/web_chat/turn_events.rs b/crates/openhuman-core/src/web_chat/turn_events.rs
index 3de371770b..ecbf93f78d 100644
--- a/crates/openhuman-core/src/web_chat/turn_events.rs
+++ b/crates/openhuman-core/src/web_chat/turn_events.rs
@@ -11,11 +11,11 @@ use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
-use tinychannels_bus::web as bus_web;
use tinyagents_harness::progress::AgentProgress;
use tinyagents_harness::turn_runner::{
EventSink, FailureClassifier, ReplyStore, Summarizer, TerminalEvent, TurnRequest, TurnResult,
};
+use tinychannels_bus::web as bus_web;
use super::runner::{CancelNote, Shared};
use super::surface::{Surface, TurnIds};
@@ -279,13 +279,9 @@ impl WebEvents {
}
}
- async fn failed(
- &self,
- request: &TurnRequest<QueuedPayload>,
- surface: &Surface,
- error: &str,
- ) {
- let parallel = request.disposition == tinyagents_harness::turn_runner::QueueDisposition::Parallel;
+ async fn failed(&self, request: &TurnRequest<QueuedPayload>, surface: &Surface, error: &str) {
+ let parallel =
+ request.disposition == tinyagents_harness::turn_runner::QueueDisposition::Parallel;
let raw = host_error(error, Some(request));
let (client_id, thread_id, request_id) = (
&request.payload.client_id,
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 e69de29bb2..8b13789179 100644
--- a/crates/openhuman-core/src/web_chat/turn_events_tests.rs
+++ b/crates/openhuman-core/src/web_chat/turn_events_tests.rs
@@ -0,0 +1 @@
+
diff --git a/crates/openhuman-core/src/web_chat/turn_host.rs b/crates/openhuman-core/src/web_chat/turn_host.rs
index 0d3e01919f..df221c2d13 100644
--- a/crates/openhuman-core/src/web_chat/turn_host.rs
+++ b/crates/openhuman-core/src/web_chat/turn_host.rs
@@ -285,8 +285,14 @@ impl WebHost {
})
}
Err(err) => {
- self.budget_outcome(&ctx, request, &fingerprint.provider_binding, &config, err.to_string())
- .await
+ self.budget_outcome(
+ &ctx,
+ request,
+ &fingerprint.provider_binding,
+ &config,
+ err.to_string(),
+ )
+ .await
}
};
#[cfg(feature = "tinymemes")]
@@ -440,7 +446,10 @@ async fn speak_and_publish(
);
if speak_reply && !task_result.full_response.trim().is_empty() {
let opts = crate::voice::reply_speech::ReplySpeechOptions {
- voice_id: config.channel_voice.resolve_voice("web").map(str::to_string),
+ voice_id: config
+ .channel_voice
+ .resolve_voice("web")
+ .map(str::to_string),
..Default::default()
};
match crate::voice::reply_speech::synthesize_reply(config, &task_result.full_response, &opts)
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 af7f6e45e9..a949e8380e 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
@@ -79,7 +79,10 @@ async fn web_queue_retains_typed_queued_turn_metadata() {
assert_eq!(queued.payload.client_id, "queue-test-client");
assert_eq!(queued.thread_id, thread_id);
assert!(queued.payload.queued_at_ms > 0);
- assert_eq!(queued.payload.model_override.as_deref(), Some("model-override"));
+ assert_eq!(
+ queued.payload.model_override.as_deref(),
+ Some("model-override")
+ );
assert_eq!(queued.payload.temperature, Some(0.7));
assert_eq!(queued.payload.locale.as_deref(), Some("ar"));
diff --git a/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs
index 25662899e2..63b1fe92b8 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_start_chat_ingress_tests.rs
@@ -638,7 +638,9 @@ fn timeout_bound_tag_separates_the_two_harness_ceilings() {
"per_model_call"
);
assert_eq!(
- super::super::turn_events::timeout_bound_tag("openrouter API error (500 Internal Server Error)"),
+ super::super::turn_events::timeout_bound_tag(
+ "openrouter API error (500 Internal Server Error)"
+ ),
"none",
"a non-timeout error must not carry a timeout bound"
);
@@ -663,7 +665,10 @@ fn hosted_timeout_bound_reaches_the_sentry_tag_and_keeps_the_user_class() {
};
let err = crate::agent::tinyagents::hosted_error::run_error_from_hosted(hosted);
let flattened = format!("run_chat_task failed error=tinyagents harness run failed: {err}");
- assert_eq!(super::super::turn_events::timeout_bound_tag(&flattened), tag);
+ assert_eq!(
+ super::super::turn_events::timeout_bound_tag(&flattened),
+ tag
+ );
assert_eq!(
super::super::web_errors::classify_inference_error(&flattened).error_type,
"turn_timeout"