Skip to content

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

fix(profiles): content-free outcome messages, keep profile when credential cleanup fails, clarify raw-mode docs

Steven Enamakel57ac5abfc010
diff --git a/crates/openhuman-core/src/profiles/README.md b/crates/openhuman-core/src/profiles/README.md
index b309a41571..5fa79be79f 100644
--- a/crates/openhuman-core/src/profiles/README.md
+++ b/crates/openhuman-core/src/profiles/README.md
@@ -55,9 +55,10 @@ Changing the mode may re-map users onto different profiles.
## Rules
- **Gateway user ids become profile ids in `ops.rs` and `gateway.rs`.** The
- user id itself is never logged or stored; under raw mode a user id that
- fits the charset *is* the profile id, so use `"hashed"` where user ids must
- not reach paths and logs.
+ user id itself is never logged. Under raw mode a user id that fits the
+ charset *is* the profile id, so it reaches paths, storage and the
+ provisioning response; use `"hashed"` where user ids must not. Log lines and
+ `Outcome` messages never carry the profile id.
- **A profile's config is forced, not configured.**
- Every path sits under the profile's directory.
- Memory is bound to the profile (`[memory] agent_id`, `root = user:<id>`).
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index 47f7bebccb..24698770be 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -150,7 +150,10 @@ impl ProfileHost {
// not only in the profile's directory, so archiving the directory alone
// would let a re-provisioned profile pick the old credential back up.
if let Err(e) = super::credentials::clear(&layout::profile_config(&layout, id)) {
- log::warn!("[profiles] clearing credentials of profile={id} before archiving: {e}");
+ log::warn!("[profiles] clearing credentials before archiving failed: {e}");
+ // Keep the profile so cleanup can be retried; archiving now would
+ // leave the secret for a re-provisioned profile to inherit.
+ return Err(format!("clearing credentials before archiving: {e}"));
}
let archive = layout::archive_dir(&self.saas.root);
std::fs::create_dir_all(&archive)
diff --git a/crates/openhuman-core/src/profiles/ops.rs b/crates/openhuman-core/src/profiles/ops.rs
index 7d51aa73c5..d59b555fe1 100644
--- a/crates/openhuman-core/src/profiles/ops.rs
+++ b/crates/openhuman-core/src/profiles/ops.rs
@@ -1,7 +1,10 @@
//! Operator-plane operations on profiles.
//!
-//! Gateway user ids are taken here and turned into profile ids at once; they
-//! are never logged, stored or returned.
+//! Gateway user ids are taken here and turned into profile ids at once. The
+//! user id itself is never logged, stored or returned; under raw `profile_ids`
+//! mode a qualifying id *is* the profile id, so it is stored and returned as
+//! one (use `"hashed"` where that must not happen). Log lines and `Outcome`
+//! messages stay content-free either way.
use super::credentials::{self, UserCredentialKind};
use super::host::{self, ProfileHost};
@@ -26,9 +29,9 @@ pub(crate) fn provision_on(
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}")
+ "profile provisioned"
} else {
- format!("{profile_id} was already provisioned")
+ "profile already provisioned"
};
Ok(Outcome::single_log(
ProvisionResult {
@@ -51,9 +54,9 @@ pub(crate) fn deprovision_on(
let profile_id = ProfileId::parse(profile_id)?;
let removed = host.deprovision(&profile_id)?;
let log = if removed {
- format!("archived {profile_id}")
+ "profile archived"
} else {
- format!("{profile_id} was not provisioned")
+ "profile was not provisioned"
};
Ok(Outcome::single_log(
DeprovisionResult {
@@ -83,10 +86,10 @@ pub(crate) fn status_on(
let profile_id = ProfileId::parse(profile_id)?;
let summary = host
.summary(&profile_id)?
- .ok_or_else(|| format!("profile {profile_id} is not provisioned"))?;
+ .ok_or_else(|| "profile is not provisioned".to_string())?;
Ok(Outcome::single_log(
summary,
- format!("status of {profile_id}"),
+ "profile status read",
))
}
@@ -118,7 +121,7 @@ pub(crate) fn set_credential_on(
profile_id: profile_id.clone(),
has_credential: true,
},
- format!("credential installed for {profile_id}"),
+ "credential installed",
))
}
@@ -136,9 +139,9 @@ pub(crate) fn clear_credential_on(
let removed = credentials::clear(&config)?;
log::info!("[profiles] credential cleared removed={removed}");
let log = if removed {
- format!("credential cleared for {profile_id}")
+ "credential cleared"
} else {
- format!("{profile_id} held no credential")
+ "profile held no credential"
};
Ok(Outcome::single_log(
CredentialResult {