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 to config save call sites

Steven Enamakel9fff9f640a64
diff --git a/crates/openhuman-core/src/agent_registry/ops.rs b/crates/openhuman-core/src/agent_registry/ops.rs
index 79141b6b0c..2e093826b3 100644
--- a/crates/openhuman-core/src/agent_registry/ops.rs
+++ b/crates/openhuman-core/src/agent_registry/ops.rs
@@ -55,14 +55,9 @@ pub async fn upsert_custom_agent(
Some(existing) => *existing = entry.clone(),
None => config.agent_registry.entries.push(entry.clone()),
}
- config
- .save()
- .await
- .map_err(|error| crate::config::ops::config_save_error_with_context(
- error,
- "failed to save config",
- true,
- ))?;
+ config.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(error, "failed to save config", true)
+ })?;
Ok(entry)
}
@@ -104,14 +99,9 @@ pub async fn update_agent(
entry.validate()?;
ensure_orchestrator_enabled(entry)?;
let updated = entry.clone();
- config
- .save()
- .await
- .map_err(|error| crate::config::ops::config_save_error_with_context(
- error,
- "failed to save config",
- true,
- ))?;
+ config.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(error, "failed to save config", true)
+ })?;
Ok(updated)
}
@@ -142,14 +132,9 @@ pub async fn remove_agent(ctx: &DispatchCtx, id: &str) -> Result<bool, String> {
config.agent_registry.entries.retain(|agent| agent.id != id);
let removed = config.agent_registry.entries.len() < before;
if removed {
- config
- .save()
- .await
- .map_err(|error| crate::config::ops::config_save_error_with_context(
- error,
- "failed to save config",
- true,
- ))?;
+ config.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(error, "failed to save config", true)
+ })?;
}
Ok(removed)
}
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs
index 14dcd3afa2..4e2b68d5be 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/connect_channel.rs
@@ -113,16 +113,13 @@ pub(crate) async fn persist_prepared_connection(
persisted.channels_config.yuanbao = Some(*value);
}
}
- persisted
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- &format!("failed to persist {channel_id} config.toml"),
- false,
- )
- })?;
+ persisted.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ &format!("failed to persist {channel_id} config.toml"),
+ false,
+ )
+ })?;
}
}
let log = if local_only {
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rs
index d8396cacac..47d3b6f859 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/disconnect.rs
@@ -33,16 +33,13 @@ pub async fn disconnect_channel(
if channel_id == "telegram" && auth_mode == ChannelAuthMode::BotToken {
let mut persisted = config.clone();
if persisted.channels_config.telegram.take().is_some() {
- persisted
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "failed to clear telegram config.toml",
- false,
- )
- })?;
+ persisted.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "failed to clear telegram config.toml",
+ false,
+ )
+ })?;
tracing::info!(
target: "openhuman::channels",
"[telegram] disconnect_channel: cleared channels_config.telegram"
@@ -51,16 +48,13 @@ pub async fn disconnect_channel(
} else if channel_id == "discord" && auth_mode == ChannelAuthMode::BotToken {
let mut persisted = config.clone();
if persisted.channels_config.discord.take().is_some() {
- persisted
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "failed to clear discord config.toml",
- false,
- )
- })?;
+ persisted.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "failed to clear discord config.toml",
+ false,
+ )
+ })?;
tracing::info!(
target: "openhuman::channels",
"[discord] disconnect_channel: cleared channels_config.discord"
@@ -69,16 +63,13 @@ pub async fn disconnect_channel(
} else if channel_id == "imessage" && auth_mode == ChannelAuthMode::ManagedDm {
let mut persisted = config.clone();
if persisted.channels_config.imessage.take().is_some() {
- persisted
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "failed to clear imessage config.toml",
- false,
- )
- })?;
+ persisted.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "failed to clear imessage config.toml",
+ false,
+ )
+ })?;
tracing::info!(
target: "openhuman::channels",
"[imessage] disconnect_channel: cleared channels_config.imessage"
@@ -87,16 +78,13 @@ pub async fn disconnect_channel(
} else if channel_id == "yuanbao" && auth_mode == ChannelAuthMode::ApiKey {
let mut persisted = config.clone();
if persisted.channels_config.yuanbao.take().is_some() {
- persisted
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "failed to clear yuanbao config.toml",
- false,
- )
- })?;
+ persisted.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "failed to clear yuanbao config.toml",
+ false,
+ )
+ })?;
tracing::info!(
target: "openhuman::channels",
"[yuanbao] disconnect_channel: cleared channels_config.yuanbao"
@@ -105,16 +93,13 @@ pub async fn disconnect_channel(
} else if channel_id == "email" && auth_mode == ChannelAuthMode::ApiKey {
let mut persisted = config.clone();
if persisted.channels_config.email.take().is_some() {
- persisted
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "failed to clear email config.toml",
- false,
- )
- })?;
+ persisted.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "failed to clear email config.toml",
+ false,
+ )
+ })?;
tracing::info!(
target: "openhuman::channels",
"[email] disconnect_channel: cleared channels_config.email"
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs
index e81fff9599..6f6b0743c2 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/email.rs
@@ -28,16 +28,13 @@ pub(crate) async fn persist_email_config(
let mut persisted = config.clone();
persisted.channels_config.email = Some(email_cfg);
- persisted
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "failed to persist email config.toml",
- false,
- )
- })?;
+ persisted.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "failed to persist email config.toml",
+ false,
+ )
+ })?;
tracing::info!(
target: "openhuman::channels",
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs
index b445047f12..dc64e6e3eb 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/status.rs
@@ -90,16 +90,13 @@ pub async fn set_default_channel(
}
config.channels_config.active_channel = Some(canonical.clone());
- config
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "failed to persist default channel",
- true,
- )
- })?;
+ config.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "failed to persist default channel",
+ true,
+ )
+ })?;
// Apply live so proactive routing follows the new default immediately.
crate::channels::proactive::set_runtime_active_channel(Some(canonical.clone()));
diff --git a/crates/openhuman-core/src/config/ops/mod.rs b/crates/openhuman-core/src/config/ops/mod.rs
index 3d5415483f..ee0d7f5941 100644
--- a/crates/openhuman-core/src/config/ops/mod.rs
+++ b/crates/openhuman-core/src/config/ops/mod.rs
@@ -14,10 +14,7 @@ pub(crate) fn config_save_error(error: anyhow::Error) -> String {
config_save_error_with_retryability(error, true)
}
-pub(crate) fn config_save_error_with_retryability(
- error: anyhow::Error,
- retryable: bool,
-) -> String {
+pub(crate) fn config_save_error_with_retryability(error: anyhow::Error, retryable: bool) -> String {
if let Some(conflict) = config_save_conflict(&error, retryable) {
return conflict.encode();
}
diff --git a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
index 1cbc6da39c..52bc6ae3d4 100644
--- a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
@@ -96,10 +96,7 @@ async fn document_source_write_uses_its_last_read_revision() {
first.write("default_model = \"seed\"\n").await.unwrap();
first.read().await.unwrap();
stale.read().await.unwrap();
- first
- .write("default_model = \"winner\"\n")
- .await
- .unwrap();
+ first.write("default_model = \"winner\"\n").await.unwrap();
let error = stale
.write("output_language = \"fr\"\n")
diff --git a/crates/openhuman-core/src/inference/tokenjuice/schemas.rs b/crates/openhuman-core/src/inference/tokenjuice/schemas.rs
index f98567f48b..187579a915 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/schemas.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/schemas.rs
@@ -395,12 +395,9 @@ fn handle_settings_update(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
.await
.map_err(|e| format!("load config: {e}"))?;
patch.apply(&mut config.tokenjuice);
- config
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(error, "save config", true)
- })?;
+ config.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(error, "save config", true)
+ })?;
// Re-install so router flags / CCR limits / threshold take effect live.
crate::inference::tokenjuice::install_from_config(&config).await?;
diff --git a/crates/openhuman-core/src/integrations/composio/ops/direct_mode.rs b/crates/openhuman-core/src/integrations/composio/ops/direct_mode.rs
index 2ab21caddf..c0a160c4e8 100644
--- a/crates/openhuman-core/src/integrations/composio/ops/direct_mode.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops/direct_mode.rs
@@ -99,16 +99,13 @@ pub async fn composio_set_api_key(
.await
.map_err(|e| format!("[composio-direct] reload config failed: {e}"))?;
cfg_mut.composio.mode = crate::config::schema::COMPOSIO_MODE_DIRECT.into();
- cfg_mut
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "[composio-direct] save config failed",
- false,
- )
- })?;
+ cfg_mut.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "[composio-direct] save config failed",
+ false,
+ )
+ })?;
"mode=direct"
} else {
"mode unchanged"
@@ -155,16 +152,13 @@ pub async fn composio_clear_api_key(
.await
.map_err(|e| format!("[composio-direct] reload config failed: {e}"))?;
cfg_mut.composio.mode = crate::config::schema::COMPOSIO_MODE_BACKEND.into();
- cfg_mut
- .save()
- .await
- .map_err(|error| {
- crate::config::ops::config_save_error_with_context(
- error,
- "[composio-direct] save config failed",
- false,
- )
- })?;
+ cfg_mut.save().await.map_err(|error| {
+ crate::config::ops::config_save_error_with_context(
+ error,
+ "[composio-direct] save config failed",
+ false,
+ )
+ })?;
direct_auth::reset_all_direct_auth_failures();
crate::core::bus::BUS.publish(crate::core::events::DomainEvent::ComposioConfigChanged {
diff --git a/crates/openhuman-core/src/memory/schemas/handlers.rs b/crates/openhuman-core/src/memory/schemas/handlers.rs
index 673cffb94a..aa455676d8 100644
--- a/crates/openhuman-core/src/memory/schemas/handlers.rs
+++ b/crates/openhuman-core/src/memory/schemas/handlers.rs
@@ -45,7 +45,9 @@ async fn save(config: &Config) -> MemoryResult<()> {
if let Some(conflict) = crate::config::ops::config_save_conflict(&error, false) {
return Err(MemoryError::ConfigConflict(conflict));
}
- Err(MemoryError::Engine(format!("saving config failed: {error:#}")))
+ Err(MemoryError::Engine(format!(
+ "saving config failed: {error:#}"
+ )))
}
}
}