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 and rpc crates

Steven Enamakel56074f9c2309
diff --git a/crates/openhuman-core/src/agent/harness/definition/registry_tests.rs b/crates/openhuman-core/src/agent/harness/definition/registry_tests.rs
index 52252f0443..c2fbf1b6dc 100644
--- a/crates/openhuman-core/src/agent/harness/definition/registry_tests.rs
+++ b/crates/openhuman-core/src/agent/harness/definition/registry_tests.rs
@@ -61,15 +61,16 @@ fn builtins_only_registry_holds_builtins_only() {
#[test]
fn an_extra_definition_is_not_builtins_only() {
- let extra = AgentDefinitionRegistry::builtins_only()
- .with_definitions([named("own-worker", "added")]);
+ let extra =
+ AgentDefinitionRegistry::builtins_only().with_definitions([named("own-worker", "added")]);
assert!(!extra.holds_builtins_only());
}
#[test]
fn a_file_sourced_override_is_not_builtins_only() {
let mut overridden = named("orchestrator", "from a workspace file");
- overridden.source = DefinitionSource::File("/ws/agents/orchestrator.toml".into());
+ overridden.source =
+ crate::agent::harness::DefinitionSource::File("/ws/agents/orchestrator.toml".into());
let registry = AgentDefinitionRegistry::builtins_only().with_definitions([overridden]);
assert!(!registry.holds_builtins_only());
}
diff --git a/crates/openhuman-core/src/memory/engine_tests.rs b/crates/openhuman-core/src/memory/engine_tests.rs
index 14ca151f0a..d8dfd2f0b2 100644
--- a/crates/openhuman-core/src/memory/engine_tests.rs
+++ b/crates/openhuman-core/src/memory/engine_tests.rs
@@ -392,7 +392,10 @@ fn host_binding_is_ignored_in_saas() {
assert_eq!(host_binding_with(true, Some(1), None).unwrap(), None);
// The scope-root refusal never fires in SaaS: the host engine is not
// in play at all.
- assert_eq!(host_binding_with(true, Some(1), Some("user:a")).unwrap(), None);
+ assert_eq!(
+ host_binding_with(true, Some(1), Some("user:a")).unwrap(),
+ None
+ );
}
#[test]
@@ -404,5 +407,8 @@ fn host_binding_is_used_without_a_scope_root_outside_saas() {
#[test]
fn host_binding_refuses_a_scope_root_outside_saas() {
assert!(host_binding_with(false, Some(1), Some("user:a")).is_err());
- assert_eq!(host_binding_with::<u8>(false, None, Some("user:a")).unwrap(), None);
+ assert_eq!(
+ host_binding_with::<u8>(false, None, Some("user:a")).unwrap(),
+ None
+ );
}
diff --git a/crates/openhuman-core/src/security/policy/enforcement_scratch_dir_tests_tests.rs b/crates/openhuman-core/src/security/policy/enforcement_scratch_dir_tests_tests.rs
index faa0a7eb9d..956e2a6bfe 100644
--- a/crates/openhuman-core/src/security/policy/enforcement_scratch_dir_tests_tests.rs
+++ b/crates/openhuman-core/src/security/policy/enforcement_scratch_dir_tests_tests.rs
@@ -27,7 +27,11 @@ fn roots(saas: bool) -> Vec<String> {
&tmp.path().join("ws"),
&tmp.path().join("act"),
);
- policy.trusted_roots.iter().map(|r| r.path.clone()).collect()
+ policy
+ .trusted_roots
+ .iter()
+ .map(|r| r.path.clone())
+ .collect()
}
#[test]
@@ -37,8 +41,14 @@ fn saas_policy_skips_the_shared_projects_and_scratch_grants() {
.to_string();
let scratch = openhuman_scratch_dir().to_string_lossy().to_string();
let saas = roots(true);
- assert!(!saas.contains(&projects), "projects home must not be granted in SaaS");
- assert!(!saas.contains(&scratch), "/tmp/openhuman must not be granted in SaaS");
+ assert!(
+ !saas.contains(&projects),
+ "projects home must not be granted in SaaS"
+ );
+ assert!(
+ !saas.contains(&scratch),
+ "/tmp/openhuman must not be granted in SaaS"
+ );
let single = roots(false);
assert!(single.contains(&projects));
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index a93878aa0a..2a97156bee 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -365,14 +365,12 @@ impl ShellTool {
// SaaS: every command runs in the user's container, whatever the
// agent's sandbox mode says, and never on the host.
let saas_action_dir = self.effective_action_dir_for_context(context);
- if let Some(resolved) =
- saas_sandbox_with(crate::core::runtime::is_saas(), || {
- crate::user_agents::tools::sandbox_policy(
- &saas_action_dir,
- &self.security.workspace_dir,
- )
- })
- {
+ if let Some(resolved) = saas_sandbox_with(crate::core::runtime::is_saas(), || {
+ crate::user_agents::tools::sandbox_policy(
+ &saas_action_dir,
+ &self.security.workspace_dir,
+ )
+ }) {
let action_dir = saas_action_dir;
return match resolved {
Ok(policy) => {
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rs
index 14100576ff..a62f196b8c 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_runtime_and_sandbox_tests.rs
@@ -275,7 +275,9 @@ fn saas_sandbox_refuses_instead_of_falling_back_to_the_host() {
let (allowed, result) = saas_sandbox_refusal(&why);
assert!(!allowed);
assert!(result.is_error);
- assert!(result.output().contains("Sandbox unavailable: no such sandbox"));
+ assert!(result
+ .output()
+ .contains("Sandbox unavailable: no such sandbox"));
}
#[test]
diff --git a/crates/openhuman-rpc/src/server/saas_gateway.rs b/crates/openhuman-rpc/src/server/saas_gateway.rs
index d7bdae3678..d211872e95 100644
--- a/crates/openhuman-rpc/src/server/saas_gateway.rs
+++ b/crates/openhuman-rpc/src/server/saas_gateway.rs
@@ -129,9 +129,9 @@ pub(crate) fn decide(
let Some(secret) = secret else {
return Err(refuse(503, "the core is not ready"));
};
- if !bearer(req).is_some_and(|supplied| {
- crate::core_host::core::auth::bearer_matches(supplied, secret)
- }) {
+ if !bearer(req)
+ .is_some_and(|supplied| crate::core_host::core::auth::bearer_matches(supplied, secret))
+ {
return Err(refuse(401, "unauthorized"));
}
// Checked after the bearer, so an unauthenticated caller learns nothing.
@@ -143,9 +143,8 @@ pub(crate) fn decide(
return Err(refuse(400, "more than one user signature header"));
}
let signature = signature.and_then(|value| value.to_str().ok());
- resolve(Some(user), signature, secret, now).map_err(|refusal| {
- refuse(refusal.status, &refusal.message)
- })
+ resolve(Some(user), signature, secret, now)
+ .map_err(|refusal| refuse(refusal.status, &refusal.message))
}
#[cfg(test)]
diff --git a/crates/openhuman-rpc/src/server/saas_gateway_tests.rs b/crates/openhuman-rpc/src/server/saas_gateway_tests.rs
index fd6a8f6b6c..9ed79de79f 100644
--- a/crates/openhuman-rpc/src/server/saas_gateway_tests.rs
+++ b/crates/openhuman-rpc/src/server/saas_gateway_tests.rs
@@ -120,10 +120,7 @@ mod decision {
#[tokio::test]
async fn no_user_header_runs_on_the_operator_plane() {
- assert_eq!(
- status(app(Some(SECRET)), "/rpc", &[]).await,
- StatusCode::OK
- );
+ assert_eq!(status(app(Some(SECRET)), "/rpc", &[]).await, StatusCode::OK);
}
#[tokio::test]
@@ -160,7 +157,10 @@ mod decision {
#[tokio::test]
async fn a_valid_signed_user_is_admitted() {
let headers = [bearer_header(), user("alice"), sig("alice", NOW)];
- assert_eq!(status(app(Some(SECRET)), "/rpc", &headers).await, StatusCode::OK);
+ assert_eq!(
+ status(app(Some(SECRET)), "/rpc", &headers).await,
+ StatusCode::OK
+ );
}
#[tokio::test]