Skip to content

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

chore: files changed crates/openhuman-core/src/config/schema/load/dirs.rs,crates/openhuman-core/src/

Steven Enamakeleaec156b0b1a
diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rs
index 3b62387eb1..e9337633ff 100644
--- a/crates/openhuman-core/src/config/schema/load/dirs.rs
+++ b/crates/openhuman-core/src/config/schema/load/dirs.rs
@@ -453,7 +453,8 @@ pub(super) async fn resolve_config_dirs_ignoring_env(
));
}
- let profile = crate::config::schema::ProfileLayout::at(pre_login_user_dir(default_openhuman_dir));
+ let profile =
+ crate::config::schema::ProfileLayout::at(pre_login_user_dir(default_openhuman_dir));
tracing::debug!(
user_id = %PRE_LOGIN_USER_ID,
user_dir = %profile.dir.display(),
diff --git a/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs b/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs
index 2377f75c03..eb0a1d7ca8 100644
--- a/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs
@@ -47,5 +47,8 @@ async fn the_pre_login_profile_resolves_to_its_profile_layout() {
assert_eq!(config_dir, layout.dir);
assert_eq!(workspace_dir, layout.workspace_dir);
assert_eq!(config_dir, root.join("users").join("local"));
- assert_eq!(workspace_dir, root.join("users").join("local").join("workspace"));
+ assert_eq!(
+ workspace_dir,
+ root.join("users").join("local").join("workspace")
+ );
}
diff --git a/crates/openhuman-core/src/config/schema/profile_layout_tests.rs b/crates/openhuman-core/src/config/schema/profile_layout_tests.rs
index 9cd382527a..e483c16a78 100644
--- a/crates/openhuman-core/src/config/schema/profile_layout_tests.rs
+++ b/crates/openhuman-core/src/config/schema/profile_layout_tests.rs
@@ -4,9 +4,18 @@ use super::*;
fn every_path_sits_under_the_profile_directory() {
let layout = ProfileLayout::new(Path::new("/srv/oh"), "alice");
assert_eq!(layout.dir, Path::new("/srv/oh/users/alice"));
- assert_eq!(layout.meta_path, Path::new("/srv/oh/users/alice/profile.toml"));
- assert_eq!(layout.config_path, Path::new("/srv/oh/users/alice/config.toml"));
- assert_eq!(layout.workspace_dir, Path::new("/srv/oh/users/alice/workspace"));
+ assert_eq!(
+ layout.meta_path,
+ Path::new("/srv/oh/users/alice/profile.toml")
+ );
+ assert_eq!(
+ layout.config_path,
+ Path::new("/srv/oh/users/alice/config.toml")
+ );
+ assert_eq!(
+ layout.workspace_dir,
+ Path::new("/srv/oh/users/alice/workspace")
+ );
assert_eq!(layout.sandbox_dir, Path::new("/srv/oh/users/alice/sandbox"));
}
diff --git a/crates/openhuman-core/src/profiles/background_tests.rs b/crates/openhuman-core/src/profiles/background_tests.rs
index c325590180..dc75414a6f 100644
--- a/crates/openhuman-core/src/profiles/background_tests.rs
+++ b/crates/openhuman-core/src/profiles/background_tests.rs
@@ -24,7 +24,11 @@ async fn nothing_to_do_does_nothing() {
let tmp = tempfile::tempdir().unwrap();
let host = host(&tmp, 3600);
assert_eq!(tick(&host).await, TickReport::default());
- let id = ProfileId::for_user(&format!("idle-{}", uuid::Uuid::new_v4()), crate::profiles::ProfileIdMode::Raw).unwrap();
+ let id = ProfileId::for_user(
+ &format!("idle-{}", uuid::Uuid::new_v4()),
+ crate::profiles::ProfileIdMode::Raw,
+ )
+ .unwrap();
host.provision(&id).unwrap();
assert_eq!(tick(&host).await, TickReport::default());
assert!(
@@ -37,8 +41,16 @@ async fn nothing_to_do_does_nothing() {
async fn only_agents_with_queued_memory_jobs_are_run() {
let tmp = tempfile::tempdir().unwrap();
let host = host(&tmp, 3600);
- let busy = ProfileId::for_user(&format!("busy-{}", uuid::Uuid::new_v4()), crate::profiles::ProfileIdMode::Raw).unwrap();
- let quiet = ProfileId::for_user(&format!("quiet-{}", uuid::Uuid::new_v4()), crate::profiles::ProfileIdMode::Raw).unwrap();
+ let busy = ProfileId::for_user(
+ &format!("busy-{}", uuid::Uuid::new_v4()),
+ crate::profiles::ProfileIdMode::Raw,
+ )
+ .unwrap();
+ let quiet = ProfileId::for_user(
+ &format!("quiet-{}", uuid::Uuid::new_v4()),
+ crate::profiles::ProfileIdMode::Raw,
+ )
+ .unwrap();
host.provision(&busy).unwrap();
host.provision(&quiet).unwrap();
@@ -60,7 +72,11 @@ async fn only_agents_with_queued_memory_jobs_are_run() {
async fn a_tick_sweeps_idle_agents() {
let tmp = tempfile::tempdir().unwrap();
let host = host(&tmp, 0);
- let id = ProfileId::for_user(&format!("sweep-{}", uuid::Uuid::new_v4()), crate::profiles::ProfileIdMode::Raw).unwrap();
+ let id = ProfileId::for_user(
+ &format!("sweep-{}", uuid::Uuid::new_v4()),
+ crate::profiles::ProfileIdMode::Raw,
+ )
+ .unwrap();
host.provision(&id).unwrap();
drop(host.open(&id).unwrap());
assert!(host.is_open(&id));
diff --git a/crates/openhuman-core/src/profiles/credentials.rs b/crates/openhuman-core/src/profiles/credentials.rs
index 014dca90d9..b22e6aa72e 100644
--- a/crates/openhuman-core/src/profiles/credentials.rs
+++ b/crates/openhuman-core/src/profiles/credentials.rs
@@ -81,7 +81,9 @@ pub fn store(
UserCredentialKind::ApiKey => remove_provider(config, APP_SESSION_PROVIDER),
};
if let Err(error) = replaced {
- log::warn!("[profiles][credentials] stored {kind:?} but could not remove the other kind: {error}");
+ log::warn!(
+ "[profiles][credentials] stored {kind:?} but could not remove the other kind: {error}"
+ );
return Err(format!(
"stored the new credential but could not remove the previous one: {error}"
));
diff --git a/crates/openhuman-core/src/profiles/credentials_tests.rs b/crates/openhuman-core/src/profiles/credentials_tests.rs
index 9490304269..179378416c 100644
--- a/crates/openhuman-core/src/profiles/credentials_tests.rs
+++ b/crates/openhuman-core/src/profiles/credentials_tests.rs
@@ -1,14 +1,18 @@
use super::*;
+use crate::profiles::layout::{profile_config, ProfileLayout};
+use crate::profiles::ProfileId;
use crate::security::credentials::session_support::{
resolve_backend_credential, BackendCredential,
};
-use crate::profiles::layout::{profile_config, ProfileLayout};
-use crate::profiles::ProfileId;
/// Credential secrets live in the process keyring keyed by agent id, which
/// every test in this binary shares; each test therefore uses its own users.
fn agent(tmp: &tempfile::TempDir, user: &str) -> Config {
- let id = ProfileId::for_user(&format!("{user}-{}", uuid::Uuid::new_v4()), crate::profiles::ProfileIdMode::Raw).unwrap();
+ let id = ProfileId::for_user(
+ &format!("{user}-{}", uuid::Uuid::new_v4()),
+ crate::profiles::ProfileIdMode::Raw,
+ )
+ .unwrap();
let layout = ProfileLayout::new(tmp.path(), &id);
std::fs::create_dir_all(&layout.workspace_dir).unwrap();
profile_config(&layout, &id)
diff --git a/crates/openhuman-core/src/profiles/gateway.rs b/crates/openhuman-core/src/profiles/gateway.rs
index d6fc431093..2c5bcf61b5 100644
--- a/crates/openhuman-core/src/profiles/gateway.rs
+++ b/crates/openhuman-core/src/profiles/gateway.rs
@@ -108,7 +108,8 @@ pub fn resolve_scope(
return Ok(GatewayScope::Operator);
};
let host = host::host().ok_or_else(|| GatewayRefusal::new(503, "this core serves no users"))?;
- let profile = ProfileId::for_user(user_id, host.saas().profile_ids).map_err(|e| GatewayRefusal::new(400, e))?;
+ let profile = ProfileId::for_user(user_id, host.saas().profile_ids)
+ .map_err(|e| GatewayRefusal::new(400, e))?;
if host.saas().require_user_signature {
let signature = signature
.ok_or_else(|| GatewayRefusal::new(401, format!("missing {USER_SIG_HEADER}")))?;
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index 9ad5567ff3..47f7bebccb 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -30,9 +30,7 @@ pub struct Profile {
impl std::fmt::Debug for Profile {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- f.debug_struct("Profile")
- .field("id", &self.id)
- .finish()
+ f.debug_struct("Profile").field("id", &self.id).finish()
}
}
diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rs
index 7ba2a8d1df..20eb74bf35 100644
--- a/crates/openhuman-core/src/profiles/host_tests.rs
+++ b/crates/openhuman-core/src/profiles/host_tests.rs
@@ -239,11 +239,7 @@ fn one_unreadable_agent_does_not_hide_the_rest() {
let (a, b) = (agent("alice"), agent("bob"));
host.provision(&a).unwrap();
host.provision(&b).unwrap();
- std::fs::write(
- ProfileLayout::new(tmp.path(), &a).meta_path,
- "not toml = [",
- )
- .unwrap();
+ std::fs::write(ProfileLayout::new(tmp.path(), &a).meta_path, "not toml = [").unwrap();
let listed = host.list().unwrap();
assert_eq!(listed.len(), 1);
assert_eq!(listed[0].profile_id, b);
diff --git a/crates/openhuman-core/src/profiles/ops.rs b/crates/openhuman-core/src/profiles/ops.rs
index 06bc899e14..79676afcac 100644
--- a/crates/openhuman-core/src/profiles/ops.rs
+++ b/crates/openhuman-core/src/profiles/ops.rs
@@ -6,7 +6,7 @@
use super::credentials::{self, UserCredentialKind};
use super::host::{self, ProfileHost};
use super::types::{
- CredentialResult, DeprovisionResult, ProvisionResult, ProfileId, ProfileSummary,
+ CredentialResult, DeprovisionResult, ProfileId, ProfileSummary, ProvisionResult,
};
use crate::core::Outcome;
@@ -31,7 +31,10 @@ pub(crate) fn provision_on(
format!("{profile_id} was already provisioned")
};
Ok(Outcome::single_log(
- ProvisionResult { profile_id, created },
+ ProvisionResult {
+ profile_id,
+ created,
+ },
log,
))
}
@@ -53,7 +56,10 @@ pub(crate) fn deprovision_on(
format!("{profile_id} was not provisioned")
};
Ok(Outcome::single_log(
- DeprovisionResult { profile_id, removed },
+ DeprovisionResult {
+ profile_id,
+ removed,
+ },
log,
))
}
diff --git a/crates/openhuman-core/src/profiles/types_tests.rs b/crates/openhuman-core/src/profiles/types_tests.rs
index 094801db96..0444fba9fd 100644
--- a/crates/openhuman-core/src/profiles/types_tests.rs
+++ b/crates/openhuman-core/src/profiles/types_tests.rs
@@ -25,10 +25,19 @@ fn a_user_maps_to_one_stable_profile() {
fn raw_mode_keeps_ids_that_fit_the_charset() {
// The desktop's 24-hex backend ids pass unchanged.
let backend_id = "65f1c0ffee0123456789abcd";
- assert_eq!(ProfileId::for_user(backend_id, RAW).unwrap().as_str(), backend_id);
- assert_eq!(ProfileId::for_user("alice_1-b", RAW).unwrap().as_str(), "alice_1-b");
+ assert_eq!(
+ ProfileId::for_user(backend_id, RAW).unwrap().as_str(),
+ backend_id
+ );
+ assert_eq!(
+ ProfileId::for_user("alice_1-b", RAW).unwrap().as_str(),
+ "alice_1-b"
+ );
let longest = "a".repeat(MAX_RAW_ID_LEN);
- assert_eq!(ProfileId::for_user(&longest, RAW).unwrap().as_str(), longest);
+ assert_eq!(
+ ProfileId::for_user(&longest, RAW).unwrap().as_str(),
+ longest
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 109a24cde1..08a66eb8d5 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -927,9 +927,7 @@ pub fn all_tools_with_runtime(
let mut tools: Vec<Box<dyn Tool>> = if let Some(set) = domains {
tools
.into_iter()
- .filter(|t| {
- crate::profiles::tools::admits(t.name(), set.allows(tool_group(t.name())))
- })
+ .filter(|t| crate::profiles::tools::admits(t.name(), set.allows(tool_group(t.name()))))
.collect()
} else {
// No ambient context (unit tests / pre-boot) ⇒ no domain filtering.
diff --git a/tests/saas_mode_e2e.rs b/tests/saas_mode_e2e.rs
index ddeecacf24..d886bc67f7 100644
--- a/tests/saas_mode_e2e.rs
+++ b/tests/saas_mode_e2e.rs
@@ -247,9 +247,12 @@ fn a_safe_deployment_serves_core_and_the_operator_plane_behind_the_gateway_beare
.to_string();
assert_eq!(
profile_id,
- openhuman_core::profiles::ProfileId::for_user("[email protected]", openhuman_core::profiles::ProfileIdMode::Raw)
- .unwrap()
- .to_string(),
+ openhuman_core::profiles::ProfileId::for_user(
+ openhuman_core::profiles::ProfileIdMode::Raw
+ )
+ .unwrap()
+ .to_string(),
"a user id outside the raw charset maps to its deterministic hash"
);
assert!(!body.to_string().contains("alice"), "{body}");
@@ -364,7 +367,11 @@ fn gateway_requests_run_under_the_named_users_agent() {
"openhuman.profiles_provision",
json!({ "user_id": "alice" }),
);
- let alice = openhuman_core::profiles::ProfileId::for_user("alice", openhuman_core::profiles::ProfileIdMode::Raw).unwrap();
+ let alice = openhuman_core::profiles::ProfileId::for_user(
+ "alice",
+ openhuman_core::profiles::ProfileIdMode::Raw,
+ )
+ .unwrap();
assert!(body.to_string().contains(alice.as_str()), "{body}");
let (_, body) = rpc_with(
&client,
@@ -464,9 +471,12 @@ fn provision(client: &reqwest::blocking::Client, base: &str, user: &str) -> Stri
json!({ "user_id": user }),
);
assert!(body.get("result").is_some(), "provision {user}: {body}");
- openhuman_core::profiles::ProfileId::for_user(user, openhuman_core::profiles::ProfileIdMode::Raw)
- .unwrap()
- .to_string()
+ openhuman_core::profiles::ProfileId::for_user(
+ user,
+ openhuman_core::profiles::ProfileIdMode::Raw,
+ )
+ .unwrap()
+ .to_string()
}
fn thread_ids(body: &Value) -> Vec<String> {