Skip to content

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

style: apply rustfmt formatting across core crates

Steven Enamakel044a0e9ca7ef
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
index f9d15c2677..d27a13ff02 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs
@@ -312,7 +312,9 @@ impl SessionHostBuilder {
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
)
})
- .ok_or_else(|| anyhow::anyhow!("model_name or configured provider default is required"))?;
+ .ok_or_else(|| {
+ anyhow::anyhow!("model_name or configured provider default is required")
+ })?;
let context_config = self.context_config.unwrap_or_default();
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
index 9442c9ed36..1cc0b64f7e 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
@@ -491,8 +491,7 @@ fn resolve_subagent_source_hint_with_config_routes_via_factory() {
0.0,
);
assert_eq!(
- resolved_model,
- "openrouter/deepseek/deepseek-v4-flash",
+ resolved_model, "openrouter/deepseek/deepseek-v4-flash",
"Hint must resolve to the managed default model, not a retired tier \
slug from default_model or the parent's model"
);
diff --git a/crates/openhuman-core/src/agent/tinyagents/config.rs b/crates/openhuman-core/src/agent/tinyagents/config.rs
index b3f3daae70..7853e784d9 100644
--- a/crates/openhuman-core/src/agent/tinyagents/config.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/config.rs
@@ -19,9 +19,7 @@ use tinyagents_harness::config::{
RequiredOutput, SessionConfig, ToolConfig, ToolDispatcher, TurnConfig,
};
-use crate::config::{
- AgentConfig, Config, DelegateAgentConfig, RequiredOutputContract,
-};
+use crate::config::{AgentConfig, Config, DelegateAgentConfig, RequiredOutputContract};
/// Translates OpenHuman's free-form `agent.tool_dispatcher` string into the
/// crate enum.
diff --git a/crates/openhuman-core/src/agent/tinyagents/config_tests.rs b/crates/openhuman-core/src/agent/tinyagents/config_tests.rs
index 589e94e0d1..a1a7078e04 100644
--- a/crates/openhuman-core/src/agent/tinyagents/config_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/config_tests.rs
@@ -91,7 +91,8 @@ fn required_output_contract_is_carried_across() {
required_keys: vec!["next_action".into()],
});
- let r = session_config_from(&c).unwrap()
+ let r = session_config_from(&c)
+ .unwrap()
.turn
.required_output
.expect("contract is mapped");
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
index b5ef3f964c..814edb9a9d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/budget_gate.rs
@@ -238,7 +238,9 @@ impl OpenHumanBudgetGate {
Some(est.model.clone())
};
let Some(model) = model else {
- log::debug!("[tinyagents][budget] no model available for estimate; skipping budget check");
+ log::debug!(
+ "[tinyagents][budget] no model available for estimate; skipping budget check"
+ );
return None;
};
let call = cost::budget::CallUnderCheck {
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 33de402cbc..b37470343e 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -18,8 +18,7 @@ fn provider_descriptors(config: &crate::config::Config) -> Vec<ProviderDescripto
|| crate::config::schema::cloud_providers::is_hosted_cloud_provider(
&provider.slug,
provider.auth_style,
- )
- {
+ ) {
vec!["backend".to_string(), "openhuman-backend".to_string()]
} else {
Vec::new()
diff --git a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs
index 1dbffd0723..ae36f40941 100644
--- a/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs
+++ b/crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs
@@ -86,7 +86,10 @@ fn seed_legacy_custom_provider(config: &mut Config, stats: &mut MigrationStats)
if !trimmed.is_empty()
&& !looks_like_managed_backend(&hosts, trimmed)
&& !config.cloud_providers.iter().any(|entry| {
- entry.endpoint.trim().trim_end_matches('/')
+ entry
+ .endpoint
+ .trim()
+ .trim_end_matches('/')
.eq_ignore_ascii_case(trimmed.trim_end_matches('/'))
})
{
@@ -133,11 +136,12 @@ fn set_primary_cloud(config: &mut Config, stats: &mut MigrationStats) {
.and_then(|url| {
let normalized = url.trim_end_matches('/').to_ascii_lowercase();
config.cloud_providers.iter().find(|entry| {
- entry.endpoint
- .trim()
- .trim_end_matches('/')
- .to_ascii_lowercase()
- == normalized
+ entry
+ .endpoint
+ .trim()
+ .trim_end_matches('/')
+ .to_ascii_lowercase()
+ == normalized
})
});
if let Some(entry) = legacy_custom {
@@ -149,7 +153,6 @@ fn set_primary_cloud(config: &mut Config, stats: &mut MigrationStats) {
);
return;
}
-
}
/// Derive each per-workload `*_provider` field from the legacy flags.
diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rs
index e35e89de3f..940356a361 100644
--- a/crates/openhuman-core/src/config/mod.rs
+++ b/crates/openhuman-core/src/config/mod.rs
@@ -31,9 +31,9 @@ pub use ops::*;
pub use schema::{
action_dir_env_override, active_user_marker_path, active_workspace_dir,
active_workspace_dir_cached, active_workspace_snapshot, clear_active_user, default_action_dir,
- default_files_dir, default_projects_dir, default_root_openhuman_dir,
- pre_login_user_dir, read_active_user_id, resolve_action_dir,
- resolve_files_dir, user_openhuman_dir, write_active_user_id, PRE_LOGIN_USER_ID, WORKLOAD_ROLES,
+ default_files_dir, default_projects_dir, default_root_openhuman_dir, pre_login_user_dir,
+ read_active_user_id, resolve_action_dir, resolve_files_dir, user_openhuman_dir,
+ write_active_user_id, PRE_LOGIN_USER_ID, WORKLOAD_ROLES,
};
pub use workspace_handle::workspace_handle;
// Crate-internal: workspace→config-dir resolver reused by the cloud embedder.
diff --git a/crates/openhuman-core/src/config/ops/primary_cloud.rs b/crates/openhuman-core/src/config/ops/primary_cloud.rs
index a6e902f6f2..ff280a1128 100644
--- a/crates/openhuman-core/src/config/ops/primary_cloud.rs
+++ b/crates/openhuman-core/src/config/ops/primary_cloud.rs
@@ -145,10 +145,7 @@ fn cloud_entry_provider_string(entry: &CloudProviderCreds, config: &Config) -> S
}
fn is_openhuman_cloud_entry(config: &Config, entry: &CloudProviderCreds) -> bool {
- crate::config::schema::cloud_providers::is_hosted_cloud_provider(
- &entry.slug,
- entry.auth_style,
- )
+ crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, entry.auth_style)
|| looks_like_openhuman_backend(config, &entry.endpoint)
}
diff --git a/crates/openhuman-core/src/config/schema/cloud_providers.rs b/crates/openhuman-core/src/config/schema/cloud_providers.rs
index b15fd9403c..c92280909a 100644
--- a/crates/openhuman-core/src/config/schema/cloud_providers.rs
+++ b/crates/openhuman-core/src/config/schema/cloud_providers.rs
@@ -13,10 +13,10 @@ use serde::{Deserialize, Serialize};
use std::sync::Arc;
+use crate::core::slots::HookSlot;
use tinyinference_providers::builtin::{
BuiltinAuthStyle, BUILTIN_CLOUD_PROVIDERS as UPSTREAM_BUILTINS,
};
-use crate::core::slots::HookSlot;
static HOSTED_PRESETS: HookSlot<BuiltinCloudProvider> =
HookSlot::new("config::hosted_cloud_presets");
diff --git a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
index 96dc88c8ca..c7961d5b3c 100644
--- a/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
+++ b/crates/openhuman-core/src/config/schema/cloud_providers_tests.rs
@@ -1,9 +1,9 @@
//! Tests for the surrounding module.
use super::{
- builtin_cloud_supports_responses_api, endpoint_host, endpoint_host_is_chat_completions_only,
- host_is_builtin_cloud_provider, is_builtin_cloud_slug, is_slug_reserved, AuthStyle,
- builtin_cloud_providers,
+ builtin_cloud_providers, builtin_cloud_supports_responses_api, endpoint_host,
+ endpoint_host_is_chat_completions_only, host_is_builtin_cloud_provider, is_builtin_cloud_slug,
+ is_slug_reserved, AuthStyle,
};
#[test]
@@ -154,11 +154,20 @@ fn hosted_presets_and_classification_are_context_scoped() {
assert!(super::builtin_cloud_provider("tenant-hosted").is_none());
crate::core::runtime::CoreContext::sync_scope(context, || {
assert!(super::builtin_cloud_provider("tenant-hosted").is_some());
- assert!(super::is_hosted_cloud_provider("tenant-hosted", AuthStyle::Bearer));
- assert!(!super::is_hosted_cloud_provider("openai", AuthStyle::Bearer));
+ assert!(super::is_hosted_cloud_provider(
+ "tenant-hosted",
+ AuthStyle::Bearer
+ ));
+ assert!(!super::is_hosted_cloud_provider(
+ "openai",
+ AuthStyle::Bearer
+ ));
});
assert!(super::builtin_cloud_provider("tenant-hosted").is_none());
- assert!(!super::is_hosted_cloud_provider("tenant-hosted", AuthStyle::Bearer));
+ assert!(!super::is_hosted_cloud_provider(
+ "tenant-hosted",
+ AuthStyle::Bearer
+ ));
}
/// Drift guard (TAURI-RUST-5EN): couple the capability helper to the
diff --git a/crates/openhuman-core/src/config/schema/identity_cost.rs b/crates/openhuman-core/src/config/schema/identity_cost.rs
index b46f020888..31997344eb 100644
--- a/crates/openhuman-core/src/config/schema/identity_cost.rs
+++ b/crates/openhuman-core/src/config/schema/identity_cost.rs
@@ -216,9 +216,7 @@ impl Default for CostConfig {
let prices = crate::inference::registry::provider_default_pricing(
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
)
- .map(|(model, input, output)| {
- HashMap::from([(model, ModelPricing { input, output })])
- })
+ .map(|(model, input, output)| HashMap::from([(model, ModelPricing { input, output })]))
.unwrap_or_default();
Self {
enabled: default_cost_enabled(),
diff --git a/crates/openhuman-core/src/config/schema/identity_cost_tests.rs b/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
index 8d5ccdade5..2f32568f84 100644
--- a/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
+++ b/crates/openhuman-core/src/config/schema/identity_cost_tests.rs
@@ -37,7 +37,10 @@ fn cost_dashboard_config_serde_roundtrip() {
#[test]
fn cost_config_default_pricing_has_known_models() {
let c = CostConfig::default();
- assert!(c.prices.is_empty(), "bare core has no provider-owned price catalog");
+ assert!(
+ c.prices.is_empty(),
+ "bare core has no provider-owned price catalog"
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs
index 7fa07d6292..f3b72ce6ee 100644
--- a/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load_managed_provider_tests.rs
@@ -13,6 +13,9 @@ async fn bare_core_advances_schema_without_inventing_hosted_defaults() {
config.schema_version = 7;
config.default_model = Some("reasoning-v1".to_string());
crate::config::migrations::run_pending(&mut config).await;
- assert_eq!(config.schema_version, crate::config::migrations::CURRENT_SCHEMA_VERSION);
+ assert_eq!(
+ config.schema_version,
+ crate::config::migrations::CURRENT_SCHEMA_VERSION
+ );
assert_eq!(config.default_model.as_deref(), Some("reasoning-v1"));
}
diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rs
index d156582f94..4eafaa359f 100644
--- a/crates/openhuman-core/src/core/observability.rs
+++ b/crates/openhuman-core/src/core/observability.rs
@@ -2611,9 +2611,7 @@ pub fn is_backend_error_code_event(event: &sentry::protocol::Event<'_>) -> bool
.flatten()
.any(|message| {
crate::inference::registry::classify_backend_error(None, message).is_some_and(
- |classification| {
- classification.backend_owned && !classification.reportable
- },
+ |classification| classification.backend_owned && !classification.reportable,
)
})
}
diff --git a/crates/openhuman-core/src/core/observability_tests.rs b/crates/openhuman-core/src/core/observability_tests.rs
index 3e2842f9e2..5049c2ddc4 100644
--- a/crates/openhuman-core/src/core/observability_tests.rs
+++ b/crates/openhuman-core/src/core/observability_tests.rs
@@ -57,10 +57,7 @@ fn managed_body(status: &str, code: &str) -> String {
/// Installs exact-message metadata for core tests of the generic classifier
/// hook. The tests supply ownership and reportability directly; this fixture
/// deliberately contains no hosted token parser or vocabulary.
-fn register_backend_classifier_fixture(
- message: &str,
- classification: BackendErrorClassification,
-) {
+fn register_backend_classifier_fixture(message: &str, classification: BackendErrorClassification) {
static FIXTURES: OnceLock<Arc<Mutex<HashMap<String, BackendErrorClassification>>>> =
OnceLock::new();
let fixtures = Arc::clone(FIXTURES.get_or_init(|| {
@@ -89,7 +86,10 @@ fn register_backend_classifier_fixture(
.insert(message.to_string(), classification);
}
-fn reportable_fixture(kind: BackendErrorKind, malformed_bad_request: bool) -> BackendErrorClassification {
+fn reportable_fixture(
+ kind: BackendErrorKind,
+ malformed_bad_request: bool,
+) -> BackendErrorClassification {
BackendErrorClassification {
provider_owned: true,
backend_owned: true,
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/llm.rs b/crates/openhuman-core/src/flows/tinyflows/caps/llm.rs
index a24991afcf..b4e5d74b2b 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/llm.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/llm.rs
@@ -14,9 +14,7 @@ use tinyflows::error::{EngineError, Result};
use super::*;
use crate::config::Config;
-use crate::inference::provider::{
- create_chat_model_with_model_id_in, is_raw_passthrough_model,
-};
+use crate::inference::provider::{create_chat_model_with_model_id_in, is_raw_passthrough_model};
use tinyflows::nodes::integration::agent_prompt;
use tinyinference_llm::model::ModelRequest;
diff --git a/crates/openhuman-core/src/inference/mod.rs b/crates/openhuman-core/src/inference/mod.rs
index 2dcf68e933..754d5662ea 100644
--- a/crates/openhuman-core/src/inference/mod.rs
+++ b/crates/openhuman-core/src/inference/mod.rs
@@ -120,7 +120,6 @@ impl tinyinference_local::models::LocalModelConfig for crate::config::Config {
}
}
-
// Test helpers (re-exported for sibling test files that use inference_test_guard)
#[cfg(test)]
pub(crate) fn inference_test_guard() -> tokio::sync::MutexGuard<'static, ()> {
diff --git a/crates/openhuman-core/src/inference/model_context.rs b/crates/openhuman-core/src/inference/model_context.rs
index 1ee36ba468..5862b19b0c 100644
--- a/crates/openhuman-core/src/inference/model_context.rs
+++ b/crates/openhuman-core/src/inference/model_context.rs
@@ -104,8 +104,7 @@ pub fn model_supports_vision(model: &str, config: &crate::config::Config) -> boo
crate::inference::registry::provider_model_supports_vision(
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
model,
- )
- || model_vision_enabled(model, config)
+ ) || model_vision_enabled(model, config)
}
#[cfg(test)]
diff --git a/crates/openhuman-core/src/inference/model_context_tests.rs b/crates/openhuman-core/src/inference/model_context_tests.rs
index 7ebb56334c..8339c825cc 100644
--- a/crates/openhuman-core/src/inference/model_context_tests.rs
+++ b/crates/openhuman-core/src/inference/model_context_tests.rs
@@ -113,7 +113,10 @@ fn o1_o3_segment_match_does_not_overmatch() {
fn managed_vision_capability_is_absent_without_provider_policy() {
let config = crate::config::Config::default();
assert!(!model_supports_vision("hint:reasoning", &config));
- assert!(!model_supports_vision("openrouter/qwen/qwen3.5-flash-02-23", &config));
+ assert!(!model_supports_vision(
+ "openrouter/qwen/qwen3.5-flash-02-23",
+ &config
+ ));
}
#[test]
diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rs
index 93c69ca420..5bb2f5bc85 100644
--- a/crates/openhuman-core/src/inference/provider/factory.rs
+++ b/crates/openhuman-core/src/inference/provider/factory.rs
@@ -82,10 +82,10 @@ use local_runtime::{
try_create_local_runtime_chat_model, try_create_local_runtime_chat_model_from_string,
OptionalChatModelResult,
};
+use managed_backend::managed_chat_model;
pub(crate) use managed_backend::{
make_openhuman_backend_model_for_options, make_openhuman_backend_model_for_thread,
};
-use managed_backend::managed_chat_model;
use subprocess_providers::{
prepare_claude_agent_sdk_chat_model, try_create_claude_agent_sdk_chat_model,
try_create_claude_agent_sdk_chat_model_from_string, try_create_claude_code_chat_model,
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
index 2b7482ed2b..a572bf657c 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -86,13 +86,13 @@ pub(super) fn resolve_cloud_slug<'a>(
);
}
- if !hosted && crate::inference::provider_model::is_abstract_model(PROVIDER_OPENHUMAN, &effective_model) {
- if let Some(default_model) = entry
- .default_model
- .as_deref()
- .map(str::trim)
- .filter(|m| !m.is_empty() && !crate::inference::provider_model::is_abstract_model(PROVIDER_OPENHUMAN, m))
- {
+ if !hosted
+ && crate::inference::provider_model::is_abstract_model(PROVIDER_OPENHUMAN, &effective_model)
+ {
+ if let Some(default_model) = entry.default_model.as_deref().map(str::trim).filter(|m| {
+ !m.is_empty()
+ && !crate::inference::provider_model::is_abstract_model(PROVIDER_OPENHUMAN, m)
+ }) {
log::info!(
"[providers][chat-factory] role={} slug={} remapping abstract model {} -> {}",
role,
@@ -336,7 +336,12 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(
);
}
AuthStyle::Anthropic | AuthStyle::None => {}
- style if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, style) => {
+ style
+ if crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &entry.slug,
+ style,
+ ) =>
+ {
#[cfg(not(test))]
if let Err(error) = verify_backend_session_active(config) {
return Some(Err(error));
diff --git a/crates/openhuman-core/src/inference/provider/factory/discovery.rs b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
index 1cfef09edb..eaefb2d449 100644
--- a/crates/openhuman-core/src/inference/provider/factory/discovery.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/discovery.rs
@@ -39,7 +39,10 @@ pub(crate) fn model_limits_request(
let (slug, raw) = p.split_once(':')?;
let slug = slug.trim();
let entry = config.cloud_providers.iter().find(|e| e.slug == slug)?;
- if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, entry.auth_style) {
+ if crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &entry.slug,
+ entry.auth_style,
+ ) {
let (raw_model, _) = split_model_and_temperature(raw);
let model = if raw_model.trim().is_empty() {
model
diff --git a/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs b/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs
index 5b1bd43599..f32c941684 100644
--- a/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs
@@ -1,6 +1,5 @@
use super::*;
-
use crate::inference::provider::factory::access_gates::local_only_violation;
/// When the provider string includes a model id the factory should build
/// successfully and return that model id unchanged.
@@ -252,11 +251,22 @@ fn local_provider_string_detection() {
fn resolve_model_for_hint_extracts_model_from_byok_provider() {
let mut config = Config::default();
config.reasoning_provider = Some("openai:gpt-4o".to_string());
- assert_eq!(crate::inference::provider_model::resolve_provider_model_hint(crate::inference::provider::factory::PROVIDER_OPENHUMAN, "hint:reasoning", &config), "gpt-4o");
+ assert_eq!(
+ crate::inference::provider_model::resolve_provider_model_hint(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ "hint:reasoning",
+ &config
+ ),
+ "gpt-4o"
+ );
config.chat_provider = Some("anthropic:claude-sonnet-4-20250514".to_string());
assert_eq!(
- crate::inference::provider_model::resolve_provider_model_hint(crate::inference::provider::factory::PROVIDER_OPENHUMAN, "hint:chat", &config),
+ crate::inference::provider_model::resolve_provider_model_hint(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ "hint:chat",
+ &config
+ ),
"claude-sonnet-4-20250514"
);
}
@@ -266,19 +276,31 @@ fn unresolved_managed_route_keeps_the_abstract_hint() {
let mut config = Config::default();
config.reasoning_provider = Some("openhuman".to_string());
assert_eq!(
- crate::inference::provider_model::resolve_provider_model_hint(crate::inference::provider::factory::PROVIDER_OPENHUMAN, "hint:reasoning", &config),
+ crate::inference::provider_model::resolve_provider_model_hint(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ "hint:reasoning",
+ &config
+ ),
"hint:reasoning"
);
config.reasoning_provider = Some("cloud".to_string());
assert_eq!(
- crate::inference::provider_model::resolve_provider_model_hint(crate::inference::provider::factory::PROVIDER_OPENHUMAN, "hint:reasoning", &config),
+ crate::inference::provider_model::resolve_provider_model_hint(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ "hint:reasoning",
+ &config
+ ),
"hint:reasoning"
);
config.reasoning_provider = Some("".to_string());
assert_eq!(
- crate::inference::provider_model::resolve_provider_model_hint(crate::inference::provider::factory::PROVIDER_OPENHUMAN, "hint:reasoning", &config),
+ crate::inference::provider_model::resolve_provider_model_hint(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ "hint:reasoning",
+ &config
+ ),
"hint:reasoning"
);
}
@@ -286,7 +308,11 @@ fn unresolved_managed_route_keeps_the_abstract_hint() {
#[test]
fn resolve_model_for_hint_handles_unknown_hint_passthrough() {
let config = Config::default();
- let result = crate::inference::provider_model::resolve_provider_model_hint(crate::inference::provider::factory::PROVIDER_OPENHUMAN, "hint:unknown_tier", &config);
+ let result = crate::inference::provider_model::resolve_provider_model_hint(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ "hint:unknown_tier",
+ &config,
+ );
assert_eq!(result, "hint:unknown_tier");
}
diff --git a/crates/openhuman-core/src/inference/provider/http_error.rs b/crates/openhuman-core/src/inference/provider/http_error.rs
index 1892723896..73802a97f1 100644
--- a/crates/openhuman-core/src/inference/provider/http_error.rs
+++ b/crates/openhuman-core/src/inference/provider/http_error.rs
@@ -148,8 +148,8 @@ impl ErrorReporter for HostErrorReporter<'_> {
status,
facts,
} = failure;
- let is_backend = classify_backend_error(Some(provider), "")
- .is_some_and(|result| result.provider_owned);
+ let is_backend =
+ classify_backend_error(Some(provider), "").is_some_and(|result| result.provider_owned);
let status_code =
reqwest::StatusCode::from_u16(status).unwrap_or(reqwest::StatusCode::BAD_GATEWAY);
let demote = |kind: &str, reason: &str, warn: bool| {
diff --git a/crates/openhuman-core/src/inference/provider/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/http_error_tests.rs
index c5eadc38f3..dc9ad694e7 100644
--- a/crates/openhuman-core/src/inference/provider/http_error_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/http_error_tests.rs
@@ -85,11 +85,7 @@ async fn backend_401_publishes_session_expired_through_reporter() {
crate::core::bus::init().await.expect("bus init");
let mut rx = crate::core::bus::BUS.get().expect("bus").receiver();
let marker = "REPORTER_MARKER_SESSION";
- let _ = api_error(
- "OpenHuman",
- response(StatusCode::UNAUTHORIZED, marker),
- )
- .await;
+ let _ = api_error("OpenHuman", response(StatusCode::UNAUTHORIZED, marker)).await;
let seen = drain_until(&mut rx, |e| match e {
DomainEvent::SessionExpired { reason, .. } if reason.contains(marker) => Some(()),
_ => None,
@@ -136,11 +132,7 @@ async fn backend_provider_does_not_get_byo_key_rejection() {
)
.await;
let rejected = drain_until(&mut rx, |e| match e {
- DomainEvent::ProviderApiKeyRejected { provider, .. }
- if provider == "OpenHuman" =>
- {
- Some(())
- }
+ DomainEvent::ProviderApiKeyRejected { provider, .. } if provider == "OpenHuman" => Some(()),
_ => None,
});
assert!(
diff --git a/crates/openhuman-core/src/inference/provider/mod.rs b/crates/openhuman-core/src/inference/provider/mod.rs
index 9f90abf3ee..e8d2ed9c26 100644
--- a/crates/openhuman-core/src/inference/provider/mod.rs
+++ b/crates/openhuman-core/src/inference/provider/mod.rs
@@ -17,7 +17,6 @@ pub mod types;
#[allow(unused_imports)]
pub use types::{BilledUsage, ChatResponse, ProviderDelta, AGENT_TURN_MAX_OUTPUT_TOKENS};
-
#[cfg(feature = "flows")]
pub(crate) use factory::is_raw_passthrough_model;
pub use factory::{
diff --git a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
index 67e7465f5f..52cc817497 100644
--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
@@ -142,7 +142,10 @@ pub async fn list_configured_models_from_config(
// An entry that authenticates with the managed session is the managed
// catalog: the registered provider lists it, and with none registered
// there is nothing to list.
- if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, entry.auth_style) {
+ if crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &entry.slug,
+ entry.auth_style,
+ ) {
return match crate::inference::registry::catalog(
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
) {
@@ -248,7 +251,14 @@ pub async fn list_configured_models_from_config(
r
}
// Handled above: the managed catalog is served by the registered provider.
- style if crate::config::schema::cloud_providers::is_hosted_cloud_provider(&entry.slug, style) => request,
+ style
+ if crate::config::schema::cloud_providers::is_hosted_cloud_provider(
+ &entry.slug,
+ style,
+ ) =>
+ {
+ request
+ }
AuthStyle::None => request,
};
diff --git a/crates/openhuman-core/src/inference/provider_model_tests.rs b/crates/openhuman-core/src/inference/provider_model_tests.rs
index a1d8a14651..81130d175b 100644
--- a/crates/openhuman-core/src/inference/provider_model_tests.rs
+++ b/crates/openhuman-core/src/inference/provider_model_tests.rs
@@ -18,16 +18,20 @@ fn abstract_hint_markers_do_not_become_raw_model_ids() {
assert!(is_abstract_model("missing-provider", "hint:unknown"));
assert!(!is_raw_model("missing-provider", "hint:unknown"));
assert!(is_raw_model("missing-provider", "vendor/model-id"));
- assert_eq!(role_for_provider_model("missing-provider", "hint:coding"), "coding");
- assert_eq!(role_for_provider_model("missing-provider", "hint:unknown"), "chat");
+ assert_eq!(
+ role_for_provider_model("missing-provider", "hint:coding"),
+ "coding"
+ );
+ assert_eq!(
+ role_for_provider_model("missing-provider", "hint:unknown"),
+ "chat"
+ );
}
#[test]
fn registered_model_defaults_and_aliases_are_context_scoped() {
use crate::core::slots::Extensions;
- use crate::inference::registry::{
- register_chat_model_in, ChatModelEntry, ProviderModelHooks,
- };
+ use crate::inference::registry::{register_chat_model_in, ChatModelEntry, ProviderModelHooks};
use std::sync::Arc;
let extensions = Extensions::new();
diff --git a/crates/openhuman-core/src/inference/registry.rs b/crates/openhuman-core/src/inference/registry.rs
index ae97abdceb..b49c20b832 100644
--- a/crates/openhuman-core/src/inference/registry.rs
+++ b/crates/openhuman-core/src/inference/registry.rs
@@ -99,7 +99,11 @@ pub struct ProviderModelHooks {
/// Provider default pricing as (model id, input USD/1M, output USD/1M).
pub default_pricing: Arc<dyn Fn() -> Option<(String, f64, f64)> + Send + Sync>,
/// Applies a provider-specific request hint without exposing its wire key.
- pub without_reasoning: Arc<dyn Fn(tinyinference_llm::model::ModelRequest) -> tinyinference_llm::model::ModelRequest + Send + Sync>,
+ pub without_reasoning: Arc<
+ dyn Fn(tinyinference_llm::model::ModelRequest) -> tinyinference_llm::model::ModelRequest
+ + Send
+ + Sync,
+ >,
}
/// A provider-neutral semantic category for a backend error.
@@ -221,8 +225,7 @@ pub fn provider_model_role(provider_id: &str, model: &str) -> Option<String> {
/// Whether the provider recognizes `model` as an abstract alias.
pub fn provider_model_is_alias(provider_id: &str, model: &str) -> bool {
- provider_model_hooks(provider_id)
- .is_some_and(|hooks| (hooks.is_alias)(model))
+ provider_model_hooks(provider_id).is_some_and(|hooks| (hooks.is_alias)(model))
}
/// Whether the provider regards `model` as a concrete id for pass-through.
@@ -230,14 +233,12 @@ pub fn provider_model_is_raw(provider_id: &str, model: &str) -> bool {
let model = model.trim();
!model.is_empty()
&& !model.starts_with("hint:")
- && provider_model_hooks(provider_id)
- .map_or(true, |hooks| (hooks.is_raw_model)(model))
+ && provider_model_hooks(provider_id).map_or(true, |hooks| (hooks.is_raw_model)(model))
}
/// Whether the provider says `model` supports image input.
pub fn provider_model_supports_vision(provider_id: &str, model: &str) -> bool {
- provider_model_hooks(provider_id)
- .is_some_and(|hooks| (hooks.supports_vision)(model))
+ provider_model_hooks(provider_id).is_some_and(|hooks| (hooks.supports_vision)(model))
}
/// Provider-specific resolution of a role alias, configured default, or pin.
@@ -294,7 +295,9 @@ pub(crate) fn normalize_config(config: &mut Config) -> bool {
CONFIG_NORMALIZERS
.entries_context_first()
.into_iter()
- .fold(false, |changed, (_, normalize)| normalize(config) || changed)
+ .fold(false, |changed, (_, normalize)| {
+ normalize(config) || changed
+ })
}
// ---------------------------------------------------------------------------
diff --git a/crates/openhuman-core/src/inference/registry_tests.rs b/crates/openhuman-core/src/inference/registry_tests.rs
index 6c870ec6c1..0cd22f3e70 100644
--- a/crates/openhuman-core/src/inference/registry_tests.rs
+++ b/crates/openhuman-core/src/inference/registry_tests.rs
@@ -79,11 +79,7 @@ async fn a_registered_chat_model_serves_the_managed_provider_for_a_thread() {
let seen = seen.lock().unwrap();
assert_eq!(
seen[0],
- (
- "chat".to_string(),
- None,
- Some("thread-1".to_string())
- )
+ ("chat".to_string(), None, Some("thread-1".to_string()))
);
assert_eq!(
seen.len(),
diff --git a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs b/crates/openhuman-core/src/inference/schemas/settings_handlers.rs
index 8700bdc001..ad3477f1b5 100644
--- a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs
+++ b/crates/openhuman-core/src/inference/schemas/settings_handlers.rs
@@ -69,12 +69,11 @@ pub(super) fn handle_inference_resolve_model(
Box::pin(async move {
let p = deserialize_params::<InferenceResolveModelParams>(params)?;
let config = ctx.load_config().await?;
- let resolved =
- crate::inference::provider_model::resolve_provider_model_hint(
- crate::inference::provider::factory::PROVIDER_OPENHUMAN,
- &p.hint,
- &config,
- );
+ let resolved = crate::inference::provider_model::resolve_provider_model_hint(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ &p.hint,
+ &config,
+ );
// Whether the resolved model accepts image input — drives the chat UI's
// image-attachment affordance. Managed OpenHuman tiers consult the
// core-owned per-tier map, which returns `true` for the reasoning and
diff --git a/crates/openhuman-core/src/inference/turn_models.rs b/crates/openhuman-core/src/inference/turn_models.rs
index d1aba40bac..3f98367863 100644
--- a/crates/openhuman-core/src/inference/turn_models.rs
+++ b/crates/openhuman-core/src/inference/turn_models.rs
@@ -147,7 +147,12 @@ fn build_turn_models_crate(
.unwrap_or_else(|| factory::resolves_to_managed_backend(role, config));
if managed {
let (backend, _) = factory::make_openhuman_backend_model_for_thread(
- role, config, Some(m), true, thread_id, &egress,
+ role,
+ config,
+ Some(m),
+ true,
+ thread_id,
+ &egress,
)?;
return Ok(Arc::new(RouteRecordingModel::new(
crate::attachments::provider::wrap(
@@ -227,7 +232,12 @@ fn build_turn_models_crate(
}
let route = if factory::resolves_to_managed_backend(tier_role, config) {
factory::make_openhuman_backend_model_for_thread(
- tier_role, config, Some(tier), true, thread_id, &egress,
+ tier_role,
+ config,
+ Some(tier),
+ true,
+ thread_id,
+ &egress,
)
.map(|(backend, _)| (backend, "openhuman".to_string(), tier.to_string()))
} else {
diff --git a/crates/openhuman-core/src/platform/cost/route_tests.rs b/crates/openhuman-core/src/platform/cost/route_tests.rs
index a3c865063c..a3d281c2fe 100644
--- a/crates/openhuman-core/src/platform/cost/route_tests.rs
+++ b/crates/openhuman-core/src/platform/cost/route_tests.rs
@@ -37,12 +37,23 @@ fn decorations_do_not_promote_a_byok_model_to_managed() {
/// managed like every other catalog model the backend serves.
#[test]
fn managed_default_model_is_managed() {
- assert_eq!(route_for_model("openrouter/deepseek/deepseek-v4-flash"), CostRoute::Managed);
+ assert_eq!(
+ route_for_model("openrouter/deepseek/deepseek-v4-flash"),
+ CostRoute::Managed
+ );
}
#[test]
fn retired_provider_aliases_need_a_registered_provider_policy() {
- for tier in ["chat-v1", "reasoning-v1", "agentic-v1", "burst-v1", "coding-v1", "vision-v1", "summarization-v1"] {
+ for tier in [
+ "chat-v1",
+ "reasoning-v1",
+ "agentic-v1",
+ "burst-v1",
+ "coding-v1",
+ "vision-v1",
+ "summarization-v1",
+ ] {
assert_eq!(route_for_model(tier), CostRoute::Byok);
}
}