Skip to content

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

fix(credentials): resolve user-scoped credentials by owner

Steven Enamakeld87f505e56e2
diff --git a/crates/openhuman-core/src/security/credentials/ops/credential.rs b/crates/openhuman-core/src/security/credentials/ops/credential.rs
index acbca00bc7..8be9a7e175 100644
--- a/crates/openhuman-core/src/security/credentials/ops/credential.rs
+++ b/crates/openhuman-core/src/security/credentials/ops/credential.rs
@@ -295,7 +295,7 @@ pub async fn set_credential(
logs.push("credential refreshed (same secret, same user)".to_string());
config.clone()
} else {
- logs.extend(activate_user_scope(&user_id)?);
+ logs.extend(activate_user_scope(&ctx, &user_id)?);
// Reload so auth-profiles.json, the encryption key and the workspace
// resolve to the user-scoped location before the profile is written.
let effective = reload_config_or(&ctx, config).await?;
diff --git a/crates/openhuman-core/src/security/credentials/ops/user_scope.rs b/crates/openhuman-core/src/security/credentials/ops/user_scope.rs
index 7c3bc9f3ca..90b97ff9ec 100644
--- a/crates/openhuman-core/src/security/credentials/ops/user_scope.rs
+++ b/crates/openhuman-core/src/security/credentials/ops/user_scope.rs
@@ -52,7 +52,7 @@ mod tests;
/// anonymous pre-login conversation store is purged so a fresh account never
/// inherits demo or scratch threads from the pre-login bucket (#1157).
/// Returns human-readable log lines for the RPC outcome.
-pub(super) fn activate_user_scope(user_id: &str) -> Result<Vec<String>, String> {
+pub(super) fn activate_user_scope(ctx: &DispatchCtx, user_id: &str) -> Result<Vec<String>, String> {
let mut logs = Vec::new();
if !operator_user_activation_allowed() {
log::debug!("{LOG_PREFIX} embedder host; skipping global user activation for {user_id}");
@@ -74,7 +74,7 @@ pub(super) fn activate_user_scope(user_id: &str) -> Result<Vec<String>, String>
// concurrent thread RPC in this process cannot interleave.
let pre_ws = pre_login_user_dir(&root_dir).join("workspace");
let pre_ws_log = pre_ws.display().to_string();
- match conversations::purge_threads(&DispatchCtx::ambient(), pre_ws) {
+ match conversations::purge_threads(ctx, pre_ws) {
Ok(stats) => {
tracing::info!(
pre_login_workspace = %pre_ws_log,