Skip to content

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

fix(embed): report memory storage info for stateless workspaces

Steven Enamakel4a37ea7851e3
diff --git a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
index 43e6f473e5..67a5fef495 100644
--- a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
+++ b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
@@ -64,6 +64,11 @@ async fn the_same_agent_key_is_isolated_between_operator_and_profile_scopes() {
agent: Some("asha".into()),
});
let profile = router.for_agent(&profile_key);
+ let escaped_key = crate::core::runtime::session_key(&crate::core::runtime::Tenant {
+ profile: Some("a~b%c".into()),
+ agent: Some("asha".into()),
+ });
+ let escaped_profile = router.for_agent(&escaped_key);
operator
.kv
@@ -75,6 +80,11 @@ async fn the_same_agent_key_is_isolated_between_operator_and_profile_scopes() {
.put("scope-test", "owner", serde_json::json!("alice"))
.await
.unwrap();
+ escaped_profile
+ .kv
+ .put("scope-test", "owner", serde_json::json!("escaped"))
+ .await
+ .unwrap();
assert_eq!(
operator.kv.get("scope-test", "owner").await.unwrap(),
@@ -84,4 +94,12 @@ async fn the_same_agent_key_is_isolated_between_operator_and_profile_scopes() {
profile.kv.get("scope-test", "owner").await.unwrap(),
Some(serde_json::json!("alice"))
);
+ assert_eq!(
+ escaped_profile
+ .kv
+ .get("scope-test", "owner")
+ .await
+ .unwrap(),
+ Some(serde_json::json!("escaped"))
+ );
}
diff --git a/crates/openhuman-embed/src/runtime/build.rs b/crates/openhuman-embed/src/runtime/build.rs
index ff77260bca..d17f87aa8e 100644
--- a/crates/openhuman-embed/src/runtime/build.rs
+++ b/crates/openhuman-embed/src/runtime/build.rs
@@ -159,6 +159,11 @@ impl RuntimeBuilder {
// build cannot undo (the stored API key, the host memory engine), so
// a refused controller extension leaves neither behind. Restorable
// seams are undone by this guard if the boot below fails.
+ let mut storage_info = super::StorageInfo::describe(
+ self.seams.storage.as_ref(),
+ config.as_ref().unwrap_or(&Config::default()),
+ self.seams.storage_driver.as_deref(),
+ );
let mut host_seams = std::mem::take(&mut self.seams);
if host_seams.storage.is_none() {
if let Some(config) = &config {
@@ -174,12 +179,8 @@ impl RuntimeBuilder {
// storage seam, and removed with the runtime.
if host_seams.storage.is_none() && matches!(self.workspace, Workspace::Stateless) {
host_seams.storage = Some(super::StorageSource::Url("memory".into()));
+ storage_info = super::StorageInfo::url("backend", "memory");
}
- let mut storage_info = super::StorageInfo::describe(
- host_seams.storage.as_ref(),
- config.as_ref().unwrap_or(&Config::default()),
- host_seams.storage_driver.as_deref(),
- );
validate_storage_feature(host_seams.storage.as_ref())?;
host_seams
.open_storage()
diff --git a/crates/openhuman-embed/src/runtime/info.rs b/crates/openhuman-embed/src/runtime/info.rs
index 9fefa9d3a0..74e7c0b831 100644
--- a/crates/openhuman-embed/src/runtime/info.rs
+++ b/crates/openhuman-embed/src/runtime/info.rs
@@ -107,7 +107,7 @@ impl StorageInfo {
},
}
}
- fn url(source: &str, url: &str) -> Self {
+ pub(super) fn url(source: &str, url: &str) -> Self {
let driver = openhuman_core::storage::StorageUrl::parse(url)
.ok()
.map(|u| u.driver().to_string());