Skip to content

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

fix(profiles): route host tool calls through the gateway

Steven Enamakel2d8df81f9c77
diff --git a/crates/openhuman-core/src/profiles/gateway.rs b/crates/openhuman-core/src/profiles/gateway.rs
index 8619442ee1..bb36159356 100644
--- a/crates/openhuman-core/src/profiles/gateway.rs
+++ b/crates/openhuman-core/src/profiles/gateway.rs
@@ -108,7 +108,7 @@ pub fn resolve_scope(
return Ok(GatewayScope::Operator);
};
let host = host::host().ok_or_else(|| GatewayRefusal::new(503, "this core serves no users"))?;
- let agent = ProfileId::for_user(user_id).map_err(|e| GatewayRefusal::new(400, e))?;
+ let agent = 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 dd799d5d95..5c8401b740 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -252,7 +252,7 @@ impl ProfileHost {
/// Every provisioned agent, open or not.
pub fn list(&self) -> Result<Vec<ProfileSummary>, String> {
- let dir = layout::agents_dir(&self.saas.root);
+ let dir = layout::users_dir(&self.saas.root);
let entries = match std::fs::read_dir(&dir) {
Ok(entries) => entries,
Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(Vec::new()),
diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rs
index d200841514..7ba2a8d1df 100644
--- a/crates/openhuman-core/src/profiles/host_tests.rs
+++ b/crates/openhuman-core/src/profiles/host_tests.rs
@@ -126,7 +126,7 @@ fn list_reports_provisioned_agents_only() {
let (a, b) = (agent("a"), agent("b"));
host.provision(&a).unwrap();
host.provision(&b).unwrap();
- std::fs::create_dir_all(layout::agents_dir(tmp.path()).join("not-an-agent")).unwrap();
+ std::fs::create_dir_all(layout::users_dir(tmp.path()).join("not-an-agent")).unwrap();
let _held = host.open(&b).unwrap();
let listed = host.list().unwrap();
assert_eq!(listed.len(), 2);
diff --git a/crates/openhuman-core/src/profiles/ops.rs b/crates/openhuman-core/src/profiles/ops.rs
index 2fe46f4278..3636c127f4 100644
--- a/crates/openhuman-core/src/profiles/ops.rs
+++ b/crates/openhuman-core/src/profiles/ops.rs
@@ -23,7 +23,7 @@ pub(crate) fn provision_on(
host: &ProfileHost,
user_id: &str,
) -> Result<Outcome<ProvisionResult>, String> {
- let profile_id = ProfileId::for_user(user_id)?;
+ let profile_id = ProfileId::for_user(user_id, host.saas().profile_ids)?;
let created = host.provision(&profile_id)?;
let log = if created {
format!("provisioned {profile_id}")
diff --git a/crates/openhuman-core/src/profiles/tools.rs b/crates/openhuman-core/src/profiles/tools.rs
index c63138768b..6d1ec47cc6 100644
--- a/crates/openhuman-core/src/profiles/tools.rs
+++ b/crates/openhuman-core/src/profiles/tools.rs
@@ -207,7 +207,7 @@ pub fn sandbox_policy_with(
action_dir: &Path,
state_dir: &Path,
) -> Result<SandboxPolicy, String> {
- let agents = super::layout::agents_dir(saas_root);
+ let agents = super::layout::users_dir(saas_root);
let agent_dir = action_dir.parent();
let is_user_sandbox = agent_dir.and_then(Path::parent) == Some(agents.as_path())
&& agent_dir