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 the workspace

Steven Enamakel70319facd92c
diff --git a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
index 83fafdc9fd..6822ebc9b8 100644
--- a/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
+++ b/crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs
@@ -105,7 +105,8 @@ pub async fn start_member_run(
"[agent_team_runtime] start.entry team={team_id} member={member_id} task={task_id:?}"
);
- let member = run_ledger::get_agent_team_member(&config.workspace_dir, member_id).await?
+ let member = run_ledger::get_agent_team_member(&config.workspace_dir, member_id)
+ .await?
.filter(|m| m.team_id == team_id)
.ok_or_else(|| {
anyhow!(TeamError::UnknownMember {
@@ -150,7 +151,9 @@ pub async fn start_member_run(
&target.id,
member_id,
&run_id,
- ).await? {
+ )
+ .await?
+ {
ClaimOutcome::Claimed(task) => *task,
ClaimOutcome::AlreadyClaimed => return Ok(StartMemberOutcome::AlreadyClaimed),
ClaimOutcome::Blocked { unmet } => return Ok(StartMemberOutcome::Blocked { unmet }),
@@ -166,7 +169,8 @@ pub async fn start_member_run(
&claimed.id,
&run_id,
&run_id,
- ).await?;
+ )
+ .await?;
let agent_id = member
.agent_id
@@ -250,7 +254,8 @@ async fn run_member_loop(
task.id
);
let _ = run_ledger::release_agent_team_task(&config.workspace_dir, team_id, &task.id).await;
- let _ = run_ledger::mark_agent_team_member_idle(&config.workspace_dir, team_id, member_id).await;
+ let _ = run_ledger::mark_agent_team_member_idle(&config.workspace_dir, team_id, member_id)
+ .await;
record_failure_event(config, team_id, member_id, &task.id, &err.to_string()).await;
}
}
@@ -384,7 +389,8 @@ async fn drive_member(
&member_id,
&evidence,
false,
- ).await?;
+ )
+ .await?;
log::debug!(
target: LOG_TARGET,
"[agent_team_runtime] drive.completed team={team_id} member={member_id} task={task_id} outcome={outcome:?}"
@@ -393,7 +399,8 @@ async fn drive_member(
&config.workspace_dir,
&team_id,
&member_id,
- ).await?;
+ )
+ .await?;
Ok(())
}
}
@@ -417,12 +424,14 @@ async fn drive_member(
target: LOG_TARGET,
"[agent_team_runtime] drive.worker_failed team={team_id} member={member_id} task={task_id} reason={reason}"
);
- run_ledger::release_agent_team_task(&config.workspace_dir, &team_id, &task_id).await?;
+ run_ledger::release_agent_team_task(&config.workspace_dir, &team_id, &task_id)
+ .await?;
run_ledger::mark_agent_team_member_idle(
&config.workspace_dir,
&team_id,
&member_id,
- ).await?;
+ )
+ .await?;
record_failure_event(&config, &team_id, &member_id, &task_id, &reason).await;
Ok(())
}
@@ -458,7 +467,8 @@ async fn record_failure_event(
"reason": truncate_chars(reason, EVIDENCE_MAX_CHARS),
}),
},
- ).await;
+ )
+ .await;
}
/// The team ledger operations this runtime performs, on the calling tenant's
diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
index 49fc1dcfe2..d062a0efbe 100644
--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs
@@ -165,8 +165,7 @@ pub async fn stop_workflow_run(config: &Config, id: &str) -> Result<Option<Workf
/// definition no longer exists.
pub async fn resume_workflow_run(config: &Config, id: &str) -> Result<WorkflowRun> {
log::debug!(target: LOG_TARGET, "[workflow_run_engine] resume.entry run={id}");
- let run = get_workflow_run(config, id)?
- .ok_or_else(|| anyhow!("unknown workflow run: {id}"))?;
+ let run = get_workflow_run(config, id)?.ok_or_else(|| anyhow!("unknown workflow run: {id}"))?;
if matches!(run.status, WorkflowRunStatus::Completed) {
return Err(anyhow!("workflow run {id} is already completed"));
diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle_tests.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle_tests.rs
index deef9b8fca..acf776df89 100644
--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use serde_json::json;
use crate::agent::session_store::ledger_sync::upsert_workflow_run;
+use serde_json::json;
#[tokio::test]
async fn stop_fences_the_driver_and_makes_a_running_phase_resumable() {
diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops.rs
index 3189ca1f06..6a899c0b04 100644
--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops.rs
+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/ops.rs
@@ -8,10 +8,10 @@ use std::collections::BTreeMap;
use anyhow::Result;
use serde_json::json;
+use std::sync::Arc;
use tinyagents_orchestration::workflow::{
WorkflowDefinition, WorkflowDefinitionListResponse, WorkflowPhase,
};
-use std::sync::Arc;
use tinyagents_orchestration::workflow::SessionWorkflowStore;
use tinyagents_session::run_ledger::{
@@ -60,11 +60,10 @@ pub fn list_runs(
request: &WorkflowRunListRequest,
) -> Result<WorkflowRunListResponse> {
let request = request.clone();
- Ok(
- crate::agent::session_store::with_ledger(&config.workspace_dir, |ledger| async move {
- ledger.list_workflow_runs(&request).await
- })?,
- )
+ Ok(crate::agent::session_store::with_ledger(
+ &config.workspace_dir,
+ |ledger| async move { ledger.list_workflow_runs(&request).await },
+ )?)
}
pub fn get_run(config: &Config, id: &str) -> Result<Option<WorkflowRun>> {
@@ -74,11 +73,10 @@ pub fn get_run(config: &Config, id: &str) -> Result<Option<WorkflowRun>> {
/// The workflow run `id` on the calling tenant's run ledger.
pub(super) fn get_workflow_run(config: &Config, id: &str) -> Result<Option<WorkflowRun>> {
let id = id.to_string();
- Ok(
- crate::agent::session_store::with_ledger(&config.workspace_dir, |ledger| async move {
- ledger.get_workflow_run(&id).await
- })?,
- )
+ Ok(crate::agent::session_store::with_ledger(
+ &config.workspace_dir,
+ |ledger| async move { ledger.get_workflow_run(&id).await },
+ )?)
}
/// A host lifecycle transition (stop, resume) fenced on the revision the
@@ -88,13 +86,14 @@ pub(super) fn compare_and_swap_workflow_run_lifecycle(
upsert: WorkflowRunUpsert,
expected_revision: u64,
) -> Result<Option<WorkflowRun>> {
- Ok(
- crate::agent::session_store::with_ledger(&config.workspace_dir, |ledger| async move {
+ Ok(crate::agent::session_store::with_ledger(
+ &config.workspace_dir,
+ |ledger| async move {
ledger
.compare_and_swap_workflow_run_lifecycle(upsert, expected_revision)
.await
- })?,
- )
+ },
+ )?)
}
/// The engine's workflow store over the calling tenant's run ledger.
diff --git a/crates/openhuman-core/src/agent/session_db/schemas.rs b/crates/openhuman-core/src/agent/session_db/schemas.rs
index e72cca74b4..34dc3ffa6b 100644
--- a/crates/openhuman-core/src/agent/session_db/schemas.rs
+++ b/crates/openhuman-core/src/agent/session_db/schemas.rs
@@ -110,9 +110,10 @@ fn handle_run_ledger_list(params: Map<String, Value>) -> ControllerFuture {
s
})?
};
- let response = crate::agent::session_store::with_ledger_async(&config.workspace_dir, |ledger| async move {
- ledger.list_agent_runs(&request).await
- })
+ let response = crate::agent::session_store::with_ledger_async(
+ &config.workspace_dir,
+ |ledger| async move { ledger.list_agent_runs(&request).await },
+ )
.await
.map_err(|e| {
let s = e.to_string();
@@ -160,9 +161,10 @@ fn handle_run_ledger_events(params: Map<String, Value>) -> ControllerFuture {
log::warn!(target: "run_ledger_rpc", "[run_ledger_rpc][{cid}] events.bad_params err={s}");
s
})?;
- let response = crate::agent::session_store::with_ledger_async(&config.workspace_dir, |ledger| async move {
- ledger.list_recent_run_events(&request).await
- })
+ let response = crate::agent::session_store::with_ledger_async(
+ &config.workspace_dir,
+ |ledger| async move { ledger.list_recent_run_events(&request).await },
+ )
.await
.map_err(|e| {
let s = e.to_string();
diff --git a/crates/openhuman-core/src/agent/session_import/schemas.rs b/crates/openhuman-core/src/agent/session_import/schemas.rs
index 9980515795..438fed5e19 100644
--- a/crates/openhuman-core/src/agent/session_import/schemas.rs
+++ b/crates/openhuman-core/src/agent/session_import/schemas.rs
@@ -117,7 +117,9 @@ fn handle_session_import_run(params: Map<String, Value>) -> ControllerFuture {
let imports: Vec<Value> = reports
.iter()
.map(|report| match &report.outcome {
- Ok(outcome) => json!({ "domain": report.domain, "outcome": format!("{outcome:?}") }),
+ Ok(outcome) => {
+ json!({ "domain": report.domain, "outcome": format!("{outcome:?}") })
+ }
Err(error) => json!({ "domain": report.domain, "error": format!("{error:#}") }),
})
.collect();
diff --git a/crates/openhuman-core/src/agent/session_store/mod.rs b/crates/openhuman-core/src/agent/session_store/mod.rs
index d45604ff89..184534e669 100644
--- a/crates/openhuman-core/src/agent/session_store/mod.rs
+++ b/crates/openhuman-core/src/agent/session_store/mod.rs
@@ -27,7 +27,8 @@ mod workspace;
pub use rebound::{rebind_all, ReboundSessionStores};
pub use workspace::{
current_documents_for, ledger_for, provider_for_workspace, release_workspace_defaults,
- require_ledger, status_store_for, stores_for, stores_or_ephemeral, with_ledger, with_ledger_async, WorkspaceSessionStores,
+ require_ledger, status_store_for, stores_for, stores_or_ephemeral, with_ledger,
+ with_ledger_async, WorkspaceSessionStores,
};
static PROVIDER: LazyLock<RwLock<Option<Arc<dyn SessionStoreProvider>>>> =
diff --git a/crates/openhuman-core/src/agent/session_store/workspace.rs b/crates/openhuman-core/src/agent/session_store/workspace.rs
index 09e4228068..c78954ebf9 100644
--- a/crates/openhuman-core/src/agent/session_store/workspace.rs
+++ b/crates/openhuman-core/src/agent/session_store/workspace.rs
@@ -190,7 +190,9 @@ pub fn current_documents_for(workspace_dir: &Path) -> Option<Arc<dyn DocumentSto
/// `harness_run_status` documents of its agent scope, beside its session
/// stores. A call with no tenant gets a throwaway in-memory store.
#[must_use]
-pub fn status_store_for(workspace_dir: &Path) -> tinyagents_harness::observability::DriverStatusStore {
+pub fn status_store_for(
+ workspace_dir: &Path,
+) -> tinyagents_harness::observability::DriverStatusStore {
let docs = current_documents_for(workspace_dir).unwrap_or_else(|| {
log::warn!("[session_store] no tenant; using a throwaway run-status store");
let scoped = MemoryStorage::new()
diff --git a/crates/openhuman-core/src/agent/tinyagents/replay/ops.rs b/crates/openhuman-core/src/agent/tinyagents/replay/ops.rs
index dbece604f7..7ddf2913ca 100644
--- a/crates/openhuman-core/src/agent/tinyagents/replay/ops.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/replay/ops.rs
@@ -17,7 +17,8 @@ pub(crate) async fn read_run_events_page(
offset: u64,
limit: u64,
) -> anyhow::Result<RunEventsPage> {
- let journal = StoreEventJournal::new(crate::agent::session_store::stores_or_ephemeral(workspace).journal);
+ let journal =
+ StoreEventJournal::new(crate::agent::session_store::stores_or_ephemeral(workspace).journal);
replay::read_run_events_page(&journal, run_id, offset, limit)
.await
.map_err(|e| {
diff --git a/crates/openhuman-core/src/core/runtime/bootstrap.rs b/crates/openhuman-core/src/core/runtime/bootstrap.rs
index a44c2e1b5d..d7c78e057b 100644
--- a/crates/openhuman-core/src/core/runtime/bootstrap.rs
+++ b/crates/openhuman-core/src/core/runtime/bootstrap.rs
@@ -127,9 +127,10 @@ pub(crate) async fn bootstrap_core_runtime(
// rendering as perpetual "running" timeline entries on thread reopen.
if agent_enabled {
if !crate::storage::installed_is_shared() {
- match crate::agent::session_store::with_ledger(&cfg.workspace_dir, |ledger| async move {
- ledger.interrupt_orphaned_agent_runs().await
- }) {
+ match crate::agent::session_store::with_ledger(
+ &cfg.workspace_dir,
+ |ledger| async move { ledger.interrupt_orphaned_agent_runs().await },
+ ) {
Ok(0) => {}
Ok(count) => {
log::info!("[runtime] settled {count} orphaned agent run(s) on startup")
diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rs
index a91c6e3e61..681b0660c7 100644
--- a/crates/openhuman-core/src/cron/scheduler_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs
@@ -335,4 +335,3 @@ async fn a_pipeline_reports_its_last_stage_rather_than_pipefail() {
a failure and re-status every existing job with a pipeline in it: {output}"
);
}
-
diff --git a/crates/openhuman-core/src/desktop/notifications/store.rs b/crates/openhuman-core/src/desktop/notifications/store.rs
index 8d33109c1a..34a0e7b94a 100644
--- a/crates/openhuman-core/src/desktop/notifications/store.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store.rs
@@ -7,7 +7,6 @@
use anyhow::Result;
-
use crate::config::Config;
use super::types::{
diff --git a/crates/openhuman-core/src/desktop/notifications/store_documents.rs b/crates/openhuman-core/src/desktop/notifications/store_documents.rs
index 5f6b9e82d3..4804e014bf 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_documents.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_documents.rs
@@ -194,7 +194,12 @@ fn to_notification(stored: &Versioned<Value>) -> IntegrationNotification {
/// The dedup document id for one piece of content. Each part is length
/// prefixed, so no two distinct tuples hash the same input.
-pub(super) fn dedup_id(provider: &str, account_id: Option<&str>, title: &str, body: &str) -> String {
+pub(super) fn dedup_id(
+ provider: &str,
+ account_id: Option<&str>,
+ title: &str,
+ body: &str,
+) -> String {
let mut hasher = Sha256::new();
for part in [Some(provider), account_id, Some(title), Some(body)] {
match part {
diff --git a/crates/openhuman-core/src/desktop/notifications/store_import.rs b/crates/openhuman-core/src/desktop/notifications/store_import.rs
index c3f2e65cc0..14a8ee16b8 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_import.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_import.rs
@@ -23,9 +23,7 @@ use serde_json::json;
mod store_rows;
use store_rows::rows_to_notifications;
-use super::store_documents::{
- core_id, to_doc, CORE, LOCAL_WORKSPACE, NOTIFICATIONS, SETTINGS,
-};
+use super::store_documents::{core_id, to_doc, CORE, LOCAL_WORKSPACE, NOTIFICATIONS, SETTINGS};
use crate::config::Config;
use crate::storage::import::{table_exists, ImportDoc};
@@ -123,7 +121,6 @@ pub(crate) fn with_connection<T>(
f(&conn)
}
-
/// Reads every legacy row.
pub(crate) fn read(config: &Config) -> Result<Vec<ImportDoc>> {
read_for(config, LOCAL_WORKSPACE)
diff --git a/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs b/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs
index 433f5a57fd..ec62a87c8b 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_import_tests.rs
@@ -25,7 +25,12 @@ fn import(config: &Config) -> Outcome {
}
/// Writes a notification row the way the retired store did.
-fn seed_note(config: &Config, n: &IntegrationNotification, score: Option<(f64, &str)>, status: &str) {
+fn seed_note(
+ config: &Config,
+ n: &IntegrationNotification,
+ score: Option<(f64, &str)>,
+ status: &str,
+) {
with_connection(config, |conn| {
conn.execute(
"INSERT INTO integration_notifications
@@ -105,7 +110,12 @@ fn event(id: &str, ts: u64) -> CoreNotificationEvent {
fn legacy_notifications_are_imported_once_and_the_file_is_left_alone() {
let (_dir, config) = workspace();
seed_note(&config, &note("n-old", "slack", 60), None, "unread");
- seed_note(&config, &note("n-new", "gmail", 0), Some((0.8, "react")), "unread");
+ seed_note(
+ &config,
+ &note("n-new", "gmail", 0),
+ Some((0.8, "react")),
+ "unread",
+ );
seed_note(&config, &note("n-read", "gmail", 30), None, "read");
with_connection(&config, |conn| {
conn.execute(
@@ -122,7 +132,13 @@ fn legacy_notifications_are_imported_once_and_the_file_is_left_alone() {
let db = db_path(&config);
let before = std::fs::read(&db).unwrap();
- assert!(matches!(import(&config), Outcome::Imported { found: 6, written: 6 }));
+ assert!(matches!(
+ import(&config),
+ Outcome::Imported {
+ found: 6,
+ written: 6
+ }
+ ));
let listed = live::list(&config, 10, 0, None, None).unwrap();
let ids: Vec<_> = listed.iter().map(|n| n.id.as_str()).collect();
@@ -142,7 +158,11 @@ fn legacy_notifications_are_imported_once_and_the_file_is_left_alone() {
let core_ids: Vec<_> = core.iter().map(|e| e.id.as_str()).collect();
assert_eq!(core_ids, ["e2", "e1"]);
assert_eq!(live::unread_core_notification_count(&config).unwrap(), 1);
- assert_eq!(std::fs::read(&db).unwrap(), before, "notifications.db untouched");
+ assert_eq!(
+ std::fs::read(&db).unwrap(),
+ before,
+ "notifications.db untouched"
+ );
// A second run does not import again.
live::mark_dismissed(&config, "n-old").unwrap();
diff --git a/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs b/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
index 44ddba8a62..f127924657 100644
--- a/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
@@ -44,7 +44,13 @@ fn task(external_id: &str, title: &str) -> NormalizedTask {
}
/// Writes a `task_sources` row the way the retired store did.
-fn seed_source(config: &Config, id: &str, name: Option<&str>, conn_id: Option<&str>, interval: i64) {
+fn seed_source(
+ config: &Config,
+ id: &str,
+ name: Option<&str>,
+ conn_id: Option<&str>,
+ interval: i64,
+) {
with_connection(config, |conn| {
conn.execute(
"INSERT INTO task_sources
@@ -100,7 +106,10 @@ fn legacy_sources_and_ledger_are_imported_once_and_the_file_is_left_alone() {
assert!(matches!(
import(&config).unwrap(),
- Outcome::Imported { found: 5, written: 5 }
+ Outcome::Imported {
+ found: 5,
+ written: 5
+ }
));
let sources = live::list_sources(&config).unwrap();
@@ -154,7 +163,10 @@ fn an_undecodable_source_row_fails_the_import_and_it_is_retried() {
.unwrap();
let error = import(&config).unwrap_err();
- assert!(format!("{error:#}").contains("decode a task_sources row"), "{error:#}");
+ assert!(
+ format!("{error:#}").contains("decode a task_sources row"),
+ "{error:#}"
+ );
// No marker was written, so nothing is imported and the next boot retries.
assert!(live::list_sources(&config).unwrap().is_empty());
}
diff --git a/crates/openhuman-core/src/integrations/task_sources/store_tests.rs b/crates/openhuman-core/src/integrations/task_sources/store_tests.rs
index dc361188a5..fff87a4e59 100644
--- a/crates/openhuman-core/src/integrations/task_sources/store_tests.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/store_tests.rs
@@ -294,4 +294,3 @@ fn clear_all_removes_every_source() {
assert_eq!(removed, 1);
assert!(list_sources(&config).unwrap().is_empty());
}
-
diff --git a/crates/openhuman-core/src/security/approval/gate.rs b/crates/openhuman-core/src/security/approval/gate.rs
index e95ae2e7e0..ca3242ba06 100644
--- a/crates/openhuman-core/src/security/approval/gate.rs
+++ b/crates/openhuman-core/src/security/approval/gate.rs
@@ -358,11 +358,7 @@ impl Drop for WaiterGuard<'_> {
self.gate
.clear_thread_route_if_owned(thread_key, &self.request_id);
}
- let decided = store::decide_captured(
- &self.docs,
- &self.request_id,
- ApprovalDecision::Deny,
- );
+ let decided = store::decide_captured(&self.docs, &self.request_id, ApprovalDecision::Deny);
if let Ok(Some(row)) = decided {
let route = self.gate.take_request_route(&self.request_id);
BUS.publish(DomainEvent::ApprovalDecided {
diff --git a/crates/openhuman-core/src/security/approval/gate_intercept.rs b/crates/openhuman-core/src/security/approval/gate_intercept.rs
index 8e02226299..3087ce7b3e 100644
--- a/crates/openhuman-core/src/security/approval/gate_intercept.rs
+++ b/crates/openhuman-core/src/security/approval/gate_intercept.rs
@@ -295,7 +295,9 @@ impl ApprovalGate {
// Any park raised inside a sub-agent run — detached or inline — gets
// the shorter `SUBAGENT_APPROVAL_TTL` window.
let subagent_park = !forced
- && (detached || tinyagents_harness::context::current_run_depth().is_some_and(|facts| facts.depth > 0));
+ && (detached
+ || tinyagents_harness::context::current_run_depth()
+ .is_some_and(|facts| facts.depth > 0));
let chat_thread_id = chat_ctx
.as_ref()
.map(|c| c.thread_id.clone())
diff --git a/crates/openhuman-core/src/security/approval/store_documents_tests.rs b/crates/openhuman-core/src/security/approval/store_documents_tests.rs
index 74114b9dec..9738742c61 100644
--- a/crates/openhuman-core/src/security/approval/store_documents_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_documents_tests.rs
@@ -346,12 +346,9 @@ fn a_captured_store_decides_without_the_task_scope() {
#[test]
fn an_unresolved_scope_fails_the_captured_decide_instead_of_using_another_scope() {
let captured = Err("no acting agent".to_string());
- let error = crate::security::approval::store::decide_captured(
- &captured,
- "r",
- ApprovalDecision::Deny,
- )
- .unwrap_err();
+ let error =
+ crate::security::approval::store::decide_captured(&captured, "r", ApprovalDecision::Deny)
+ .unwrap_err();
assert!(error.to_string().contains("unresolved"), "{error}");
}
diff --git a/crates/openhuman-core/src/security/approval/store_flow_trust.rs b/crates/openhuman-core/src/security/approval/store_flow_trust.rs
index 7b5c821190..83a3351b72 100644
--- a/crates/openhuman-core/src/security/approval/store_flow_trust.rs
+++ b/crates/openhuman-core/src/security/approval/store_flow_trust.rs
@@ -30,16 +30,16 @@ pub fn record_flow_preauthorization(
session_id: &str,
) -> Result<()> {
super::super::store_documents::current(config)?.insert_decided(
- tool_name,
- PREAUTHORIZATION_SUMMARY,
- session_id,
- &ApprovalSourceContext::Flow {
- flow_id: flow_id.to_string(),
- run_id: String::new(),
- node_id: None,
- },
- ApprovalDecision::ApproveAlwaysForFlow,
- )
+ tool_name,
+ PREAUTHORIZATION_SUMMARY,
+ session_id,
+ &ApprovalSourceContext::Flow {
+ flow_id: flow_id.to_string(),
+ run_id: String::new(),
+ node_id: None,
+ },
+ ApprovalDecision::ApproveAlwaysForFlow,
+ )
}
/// Grant "approve always for this flow" trust to a `(flow_id, tool_name)`
diff --git a/crates/openhuman-core/src/security/approval/store_import.rs b/crates/openhuman-core/src/security/approval/store_import.rs
index 8055ab61e7..71cd5ecbcc 100644
--- a/crates/openhuman-core/src/security/approval/store_import.rs
+++ b/crates/openhuman-core/src/security/approval/store_import.rs
@@ -173,7 +173,10 @@ pub(crate) fn db_path(config: &Config) -> std::path::PathBuf {
/// Open (and migrate) the approval DB, then call `f` with a live
/// connection. Mirrors `notifications/store.rs::with_connection`.
-pub(crate) fn with_connection<T>(config: &Config, f: impl FnOnce(&Connection) -> Result<T>) -> Result<T> {
+pub(crate) fn with_connection<T>(
+ config: &Config,
+ f: impl FnOnce(&Connection) -> Result<T>,
+) -> Result<T> {
let db_path = db_path(config);
tracing::trace!(
diff --git a/crates/openhuman-core/src/security/approval/store_import_tests.rs b/crates/openhuman-core/src/security/approval/store_import_tests.rs
index 80a62a441e..3d4e5f6da2 100644
--- a/crates/openhuman-core/src/security/approval/store_import_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_import_tests.rs
@@ -90,7 +90,10 @@ fn legacy_rows_are_imported_once_and_the_file_is_left_alone() {
assert!(matches!(
import(&config),
- Outcome::Imported { found: 6, written: 6 }
+ Outcome::Imported {
+ found: 6,
+ written: 6
+ }
));
let pending = live::list_pending(&config).unwrap();
@@ -173,7 +176,10 @@ fn an_old_schema_is_brought_forward_and_its_session_ids_scrubbed() {
let pending = live::list_pending(&config).unwrap();
assert_eq!(pending.len(), 1);
assert_eq!(pending[0].request_id, "old");
- assert!(pending[0].agent_id.is_none(), "an old row is the process's own");
+ assert!(
+ pending[0].agent_id.is_none(),
+ "an old row is the process's own"
+ );
// The credential-shaped session id was scrubbed before it was read.
let docs = crate::storage::local::open("test", &config.workspace_dir)
.unwrap()
diff --git a/crates/openhuman-core/src/security/approval/store_persistence_tests.rs b/crates/openhuman-core/src/security/approval/store_persistence_tests.rs
index c03707a71b..8457a39088 100644
--- a/crates/openhuman-core/src/security/approval/store_persistence_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_persistence_tests.rs
@@ -490,4 +490,3 @@ fn agent_id_round_trips_and_older_rows_read_as_the_process() {
decide(&config, "owned", ApprovalDecision::Deny).unwrap();
assert_eq!(pending_agent(&config, "owned").unwrap(), None);
}
-
diff --git a/crates/openhuman-core/src/security/approval/store_tests.rs b/crates/openhuman-core/src/security/approval/store_tests.rs
index bbf4e266d9..eded0f6870 100644
--- a/crates/openhuman-core/src/security/approval/store_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_tests.rs
@@ -63,12 +63,8 @@ fn fetch_decision_state(
config: &Config,
request_id: &str,
) -> Option<(Option<String>, Option<String>)> {
- raw_doc(config, request_id).map(|doc| {
- (
- text_field(&doc, "decided_at"),
- text_field(&doc, "decision"),
- )
- })
+ raw_doc(config, request_id)
+ .map(|doc| (text_field(&doc, "decided_at"), text_field(&doc, "decision")))
}
// ── record_execution tests (#2135) ──────────
diff --git a/crates/openhuman-core/src/security/devices/store_import_tests.rs b/crates/openhuman-core/src/security/devices/store_import_tests.rs
index 9f76c0543a..fb482e1b9f 100644
--- a/crates/openhuman-core/src/security/devices/store_import_tests.rs
+++ b/crates/openhuman-core/src/security/devices/store_import_tests.rs
@@ -46,7 +46,10 @@ fn legacy_devices_are_imported_once_and_the_file_is_left_alone() {
let reports = run_with(&backend, &config, &[super::super::import_source()]);
assert!(matches!(
reports[0].outcome,
- Ok(Outcome::Imported { found: 3, written: 3 })
+ Ok(Outcome::Imported {
+ found: 3,
+ written: 3
+ })
));
let listed = live::list_devices(&config).unwrap();
diff --git a/crates/openhuman-core/src/storage/fenced_backend.rs b/crates/openhuman-core/src/storage/fenced_backend.rs
index bba653681d..d0ccffb6ec 100644
--- a/crates/openhuman-core/src/storage/fenced_backend.rs
+++ b/crates/openhuman-core/src/storage/fenced_backend.rs
@@ -29,8 +29,8 @@ use async_trait::async_trait;
use serde_json::Value;
use tinystoragedrivers::{
Blob, BlobMeta, BlobStore, Capabilities, Capability, CollectionSpec, ErrorKind, Filter, Page,
- Precondition, Query, ReadCheck, Result, SearchHit, Sort, StorageError, StreamEntry, StreamStore, Version,
- Versioned, WriteOp, WriteResult,
+ Precondition, Query, ReadCheck, Result, SearchHit, Sort, StorageError, StreamEntry,
+ StreamStore, Version, Versioned, WriteOp, WriteResult,
};
use super::fence::{FenceRegistry, LeaseFence};
diff --git a/crates/openhuman-core/src/storage/import/mod.rs b/crates/openhuman-core/src/storage/import/mod.rs
index 5b33daf4bf..f046d87b15 100644
--- a/crates/openhuman-core/src/storage/import/mod.rs
+++ b/crates/openhuman-core/src/storage/import/mod.rs
@@ -53,10 +53,10 @@ use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition};
use super::documents::Repo;
use super::rusqlite;
-use rusqlite::Connection;
-use serde_json::Value;
use super::{block_on, Scope, StorageBackend};
use crate::config::Config;
+use rusqlite::Connection;
+use serde_json::Value;
pub use snapshot::Snapshot;
@@ -187,10 +187,7 @@ pub async fn run(config: &Config) -> Vec<Report> {
return Vec::new();
}
let config = config.clone();
- let joined = tokio::task::spawn_blocking(move || {
- run_all(&backend, &config)
- })
- .await;
+ let joined = tokio::task::spawn_blocking(move || run_all(&backend, &config)).await;
match joined {
Ok(reports) => reports,
Err(error) => {
diff --git a/crates/openhuman-core/src/storage/import/sessions.rs b/crates/openhuman-core/src/storage/import/sessions.rs
index d9d4e8dde3..469a0c71c7 100644
--- a/crates/openhuman-core/src/storage/import/sessions.rs
+++ b/crates/openhuman-core/src/storage/import/sessions.rs
@@ -131,11 +131,12 @@ fn import(backend: &Arc<dyn StorageBackend>, config: &Config) -> Result<Outcome>
/// The agent definitions a stem may belong to, by the component their ids
/// encode to in a stem.
fn known_agents() -> HashMap<String, String> {
- let mut ids: Vec<String> = crate::agent::harness::definition::AgentDefinitionRegistry::builtins_only()
- .list()
- .iter()
- .map(|def| def.id.clone())
- .collect();
+ let mut ids: Vec<String> =
+ crate::agent::harness::definition::AgentDefinitionRegistry::builtins_only()
+ .list()
+ .iter()
+ .map(|def| def.id.clone())
+ .collect();
if let Some(current) = crate::agent::harness::definition::AgentDefinitionRegistry::current() {
ids.extend(current.list().iter().map(|def| def.id.clone()));
}
diff --git a/crates/openhuman-core/src/storage/import/sessions_tests.rs b/crates/openhuman-core/src/storage/import/sessions_tests.rs
index a37bf36a98..a08ed7c57a 100644
--- a/crates/openhuman-core/src/storage/import/sessions_tests.rs
+++ b/crates/openhuman-core/src/storage/import/sessions_tests.rs
@@ -80,7 +80,12 @@ fn legacy_workspace(config: &Config) {
.unwrap();
TurnStateStore::new(config.workspace_dir.clone())
- .put(&TurnState::started("thread-1", "req-1", 4, "2026-01-01T00:00:00Z"))
+ .put(&TurnState::started(
+ "thread-1",
+ "req-1",
+ 4,
+ "2026-01-01T00:00:00Z",
+ ))
.unwrap();
let db = config.workspace_dir.join(SESSIONS_DB);
@@ -119,7 +124,10 @@ fn a_classic_workspace_moves_into_the_backend_and_its_files_are_untouched() {
// resumes it.
let orchestrator = provider.try_for_agent("orchestrator").unwrap();
assert!(
- orchestrator.transcripts.root_for_thread("thread-1").is_some(),
+ orchestrator
+ .transcripts
+ .root_for_thread("thread-1")
+ .is_some(),
"the transcript is in the agent its stem names"
);
// The in-flight turn snapshot is the default agent's.
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index 128568ab93..8d6721e9d0 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -67,8 +67,12 @@ pub fn backend_for(workspace_dir: &Path) -> Result<Arc<dyn StorageBackend>> {
return Ok(Arc::clone(backend));
}
let url = super::config::default_url(workspace_dir);
- std::fs::create_dir_all(workspace_dir.join(super::config::DEFAULT_DIR))
- .with_context(|| format!("create the storage directory under {}", workspace_dir.display()))?;
+ std::fs::create_dir_all(workspace_dir.join(super::config::DEFAULT_DIR)).with_context(|| {
+ format!(
+ "create the storage directory under {}",
+ workspace_dir.display()
+ )
+ })?;
tracing::debug!(
target: "openhuman::storage",
workspace = %workspace_dir.display(),
@@ -93,8 +97,7 @@ pub fn backend_for(workspace_dir: &Path) -> Result<Arc<dyn StorageBackend>> {
pub fn open(domain: &'static str, workspace_dir: &Path) -> Result<Opened> {
let backend = backend_for(workspace_dir)
.with_context(|| format!("[{domain}] open the storage backend"))?;
- let scope =
- current_scope().with_context(|| format!("[{domain}] resolve the storage scope"))?;
+ let scope = current_scope().with_context(|| format!("[{domain}] resolve the storage scope"))?;
Ok(Opened { backend, scope })
}
diff --git a/crates/openhuman-core/src/storage/local_tests.rs b/crates/openhuman-core/src/storage/local_tests.rs
index 6241c2e569..91a6633f37 100644
--- a/crates/openhuman-core/src/storage/local_tests.rs
+++ b/crates/openhuman-core/src/storage/local_tests.rs
@@ -58,5 +58,9 @@ fn forgetting_a_workspace_reopens_the_same_data() {
forget(dir.path());
let second = open("things", dir.path()).unwrap();
assert!(!Arc::ptr_eq(&first.backend, &second.backend));
- assert_eq!(get_thing(&second, "kept"), Some(3), "a restart keeps the data");
+ assert_eq!(
+ get_thing(&second, "kept"),
+ Some(3),
+ "a restart keeps the data"
+ );
}
diff --git a/crates/openhuman-core/src/storage/rebind.rs b/crates/openhuman-core/src/storage/rebind.rs
index 77ff4a279b..88bff50ff6 100644
--- a/crates/openhuman-core/src/storage/rebind.rs
+++ b/crates/openhuman-core/src/storage/rebind.rs
@@ -84,8 +84,14 @@ pub(crate) fn rebind_with(
workspace = %config.workspace_dir.display(),
"[storage] the workspace moved; reopening the storage backend"
);
- std::fs::create_dir_all(config.workspace_dir.join(super::config::DEFAULT_DIR))
- .with_context(|| format!("create the storage directory under {}", config.workspace_dir.display()))?;
+ std::fs::create_dir_all(config.workspace_dir.join(super::config::DEFAULT_DIR)).with_context(
+ || {
+ format!(
+ "create the storage directory under {}",
+ config.workspace_dir.display()
+ )
+ },
+ )?;
let url = next.clone();
let backend = super::block_on_anyhow(async move { Ok(super::open(&url).await?) })
.with_context(|| format!("open the storage backend {redacted_to}"))?;
diff --git a/crates/openhuman-core/src/storage/rebind_tests.rs b/crates/openhuman-core/src/storage/rebind_tests.rs
index c51e76c952..ca3c359668 100644
--- a/crates/openhuman-core/src/storage/rebind_tests.rs
+++ b/crates/openhuman-core/src/storage/rebind_tests.rs
@@ -1,6 +1,6 @@
use super::*;
-use crate::storage::{CollectionSpec, Precondition, Scope};
use crate::storage::import::Outcome;
+use crate::storage::{CollectionSpec, Precondition, Scope};
use std::sync::Mutex;
use tempfile::TempDir;
@@ -24,7 +24,12 @@ impl Installed {
}
fn urls(&self) -> Vec<String> {
- self.0.lock().unwrap().iter().map(|(url, _)| url.clone()).collect()
+ self.0
+ .lock()
+ .unwrap()
+ .iter()
+ .map(|(url, _)| url.clone())
+ .collect()
}
}
@@ -65,9 +70,15 @@ fn the_new_workspace_is_a_different_database() {
let scoped = backend.for_scope(&Scope::local()).unwrap();
let docs = Arc::clone(scoped.documents());
crate::storage::block_on(async move {
- docs.ensure_collection(&CollectionSpec::new("probe")).await?;
- docs.put("probe", "k", serde_json::json!({"v": 1}), Precondition::None)
- .await
+ docs.ensure_collection(&CollectionSpec::new("probe"))
+ .await?;
+ docs.put(
+ "probe",
+ "k",
+ serde_json::json!({"v": 1}),
+ Precondition::None,
+ )
+ .await
})
.unwrap();
@@ -78,7 +89,8 @@ fn the_new_workspace_is_a_different_database() {
.unwrap();
let docs = Arc::clone(other.for_scope(&Scope::local()).unwrap().documents());
let found = crate::storage::block_on(async move {
- docs.ensure_collection(&CollectionSpec::new("probe")).await?;
+ docs.ensure_collection(&CollectionSpec::new("probe"))
+ .await?;
docs.get("probe", "k").await
})
.unwrap();
@@ -118,7 +130,10 @@ fn the_legacy_files_of_the_new_workspace_are_imported() {
.expect("the devices importer ran");
assert!(matches!(
devices.outcome,
- Ok(Outcome::Imported { found: 1, written: 1 })
+ Ok(Outcome::Imported {
+ found: 1,
+ written: 1
+ })
));
}
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rs
index faeb06718a..35cf5e16de 100644
--- a/crates/openhuman-embed/src/host_internals.rs
+++ b/crates/openhuman-embed/src/host_internals.rs
@@ -147,8 +147,8 @@ pub mod agent {
pub mod tinyagents {
pub mod discovery {
pub use openhuman_core::agent::tinyagents::discovery::{
- embedding_provider_is_usable, embedding_tool_ranker, embedding_tool_ranker_in, install_tool_ranker,
- installed_tool_ranker,
+ embedding_provider_is_usable, embedding_tool_ranker, embedding_tool_ranker_in,
+ install_tool_ranker, installed_tool_ranker,
};
}
// rpc: Socket.IO run-mode toggles.
@@ -293,8 +293,8 @@ pub mod platform {
pub mod storage {
pub use openhuman_core::storage::{
- block_on, block_on_anyhow, clear, configured_url, driver_is_shared, install, install_for_url,
- installed, open, url_from, StorageBackend, STORAGE_URL_VAR,
+ block_on, block_on_anyhow, clear, configured_url, driver_is_shared, install,
+ install_for_url, installed, open, url_from, StorageBackend, STORAGE_URL_VAR,
};
}
diff --git a/crates/openhuman-rpc/src/host.rs b/crates/openhuman-rpc/src/host.rs
index 759fdf6bc0..26e66d860a 100644
--- a/crates/openhuman-rpc/src/host.rs
+++ b/crates/openhuman-rpc/src/host.rs
@@ -110,9 +110,8 @@ pub fn cli(args: &[String]) -> anyhow::Result<()> {
// A one-shot command reads the same backend the server would: the
// resolved storage URL, opened on the core's storage runtime so the
// backend outlives this call.
- let provider = crate::core_host::storage::block_on_anyhow(
- crate::session_store::provider_for_host(),
- )?;
+ let provider =
+ crate::core_host::storage::block_on_anyhow(crate::session_store::provider_for_host())?;
log::debug!("[rpc:host] cli: storage-backed session store installed");
builder = builder.session_store(provider);
}
diff --git a/crates/openhuman-tinyhumans/src/jev/ranker.rs b/crates/openhuman-tinyhumans/src/jev/ranker.rs
index 794e62ef7d..e25abcb1a8 100644
--- a/crates/openhuman-tinyhumans/src/jev/ranker.rs
+++ b/crates/openhuman-tinyhumans/src/jev/ranker.rs
@@ -204,9 +204,10 @@ fn retriever_for(config: &Config) -> Result<Arc<dyn ToolRanker>, RankError> {
provider.name(),
provider.model_id()
);
- Ok(Arc::new(
- embedding_tool_ranker_in(provider, &config.workspace_dir),
- ))
+ Ok(Arc::new(embedding_tool_ranker_in(
+ provider,
+ &config.workspace_dir,
+ )))
}
fn fingerprint(secret: &str, base_url: &str) -> u64 {
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index d1c5f9cbe9..e5c773fa30 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -4111,10 +4111,12 @@ async fn json_rpc_agent_team_coordination_roundtrip() {
);
// Mark A done directly via the run ledger, then B claims fine.
- let task_a =
- openhuman_core::agent::session_store::ledger_sync::get_agent_team_task(&config.workspace_dir, &task_a_id)
- .expect("get task A")
- .expect("task A present");
+ let task_a = openhuman_core::agent::session_store::ledger_sync::get_agent_team_task(
+ &config.workspace_dir,
+ &task_a_id,
+ )
+ .expect("get task A")
+ .expect("task A present");
openhuman_core::agent::session_store::ledger_sync::upsert_agent_team_task(
&config.workspace_dir,
tinyagents_session::run_ledger::AgentTeamTaskUpsert {