Skip to content

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

feat(threads): validate thread ids and install session store in saas

Steven Enamakel9962d3aaab09
diff --git a/crates/openhuman-core/src/threads/schemas/handlers.rs b/crates/openhuman-core/src/threads/schemas/handlers.rs
index c6a46a9432..021661027f 100644
--- a/crates/openhuman-core/src/threads/schemas/handlers.rs
+++ b/crates/openhuman-core/src/threads/schemas/handlers.rs
@@ -23,6 +23,12 @@ pub(super) fn handle_list(_params: Map<String, Value>) -> ControllerFuture {
pub(super) fn handle_upsert(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = parse::<UpsertConversationThreadRequest>(params)?;
+ // A SaaS user picks thread ids for their own threads only; reserved
+ // prefixes and path-like ids are refused (no-op outside SaaS).
+ crate::user_agents::surface::check_thread_id(&p.id)?;
+ if let Some(parent) = p.parent_thread_id.as_deref() {
+ crate::user_agents::surface::check_thread_id(parent)?;
+ }
to_json(ops::thread_upsert(p).await?)
})
}
diff --git a/crates/openhuman-rpc/src/server/shims.rs b/crates/openhuman-rpc/src/server/shims.rs
index 230e5e5b89..d20884f370 100644
--- a/crates/openhuman-rpc/src/server/shims.rs
+++ b/crates/openhuman-rpc/src/server/shims.rs
@@ -45,14 +45,16 @@ pub async fn run_server_headless(host: Option<&str>, port: Option<u16>) -> anyho
/// Runs a SaaS core: many users behind a trusted gateway, booted from the
/// operator's config file and refused unless its boot guard passes.
///
-/// No session store is installed: the SaaS presets enable no domain that
-/// keeps conversations yet.
+/// The on-disk session store is installed before boot. It resolves the
+/// workspace of the context each call runs under, so every user agent keeps
+/// its sessions, transcripts and turn states in its own workspace.
pub async fn run_server_saas(
host: Option<&str>,
port: Option<u16>,
saas_config: &std::path::Path,
) -> anyhow::Result<()> {
let config = openhuman_core::core::runtime::SaasConfig::load(saas_config)?;
+ crate::session_store::install();
let runtime =
openhuman_core::core::runtime::saas::build(config, host.map(str::to_owned), port).await?;
super::serve::serve(&runtime, None, None).await