The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(session_store): parse the storage URL to pick the recovery mode
Steven Enamakelba9286845cd5
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rsindex 323ad90317..60fac79fa2 100644--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs@@ -196,8 +196,11 @@ fn install_request_turns_on_the_handle_preview_by_default() {assert!(request.options.router_enabled);assert!(request.options.ccr_enabled);assert!(request.options.repl_handle);- // The plain-text copy on disk is opt-in.- assert_eq!(request.options.repl_save_dir, None);+ // The host owns the plain-text copy path; it is not sent over the module bus.+ assert_eq!(+ repl_save_dir(&config.workspace_dir),+ std::path::PathBuf::from(".tokenjuice/repl")+ );}#[test]@@ -214,10 +217,7 @@ fn install_request_handle_mode_follows_every_switch_it_needs() {config.tokenjuice.repl_save_enabled = true;let request = install_request(&config);assert!(!request.options.repl_handle);- assert_eq!(- request.options.repl_save_dir, None,- "no handle, so nothing to save a copy of"- );+ assert!(!request.options.repl_handle, "no handle means no copy is written");}}@@ -227,9 +227,10 @@ fn install_request_saves_a_copy_under_the_workspace_when_asked() {config.workspace_dir = std::path::PathBuf::from("/ws");config.tokenjuice.repl_save_enabled = true;let request = install_request(&config);+ assert!(request.options.repl_handle);assert_eq!(- request.options.repl_save_dir,- Some(std::path::PathBuf::from("/ws/.tokenjuice/repl"))+ repl_save_dir(&config.workspace_dir),+ std::path::PathBuf::from("/ws/.tokenjuice/repl"));}diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rsindex 28aff07f59..518f30c79a 100644--- a/crates/openhuman-embed/src/host_internals.rs+++ b/crates/openhuman-embed/src/host_internals.rs@@ -452,7 +452,7 @@ pub mod platform {pub mod storage {pub use openhuman_core::storage::{block_on, block_on_anyhow, clear, configured_url, driver_is_shared, install,- install_for_url, installed, open, url_from, StorageBackend, STORAGE_URL_VAR,+ install_for_url, installed, open, url_from, StorageBackend, StorageUrl, STORAGE_URL_VAR,};/// The layout v1 -> v2 migration the host runs at boot whendiff --git a/crates/openhuman-rpc/src/session_store/mod.rs b/crates/openhuman-rpc/src/session_store/mod.rsindex b11bb7c814..405fca6a10 100644--- a/crates/openhuman-rpc/src/session_store/mod.rs+++ b/crates/openhuman-rpc/src/session_store/mod.rs@@ -179,11 +179,14 @@ async fn provider_for_url_with(log::debug!("[rpc:session_store] no storage url; one default database per workspace");return Ok(Arc::new(WorkspaceSessionStores));};+ let driver = crate::core_host::storage::StorageUrl::parse(&url)+ .context("parsing the configured storage URL")?+ .driver();let backend = crate::core_host::storage::open(&url).await.context("opening the configured storage backend")?;let recover = recover_on_open- .unwrap_or_else(|| !crate::core_host::storage::driver_is_shared(backend.driver()));+ .unwrap_or_else(|| !crate::core_host::storage::driver_is_shared(driver));let provider = ReboundSessionStores::new(Arc::clone(&backend), recover).context("starting the session store bridge")?;// Only a fully working bridge makes the backend the process's storage.diff --git a/crates/openhuman-rpc/src/session_store/mod_tests.rs b/crates/openhuman-rpc/src/session_store/mod_tests.rsindex 238b89f849..856e0894cf 100644--- a/crates/openhuman-rpc/src/session_store/mod_tests.rs+++ b/crates/openhuman-rpc/src/session_store/mod_tests.rs@@ -32,10 +32,7 @@ async fn a_storage_url_installs_the_driver_backed_store() {"{:?}",provider.destination_key());- assert_eq!(- crate::core_host::storage::installed().map(|b| b.driver()),- Some("memory")- );+ assert!(crate::core_host::storage::installed().is_some());// Agents are kept apart in the shared backend.let alice = provider.for_agent("alice");alice@@ -60,16 +57,13 @@ async fn a_storage_url_installs_the_driver_backed_store() {feature = "storage-file",feature = "storage-mongodb"))]-async fn driver_backed_store_keeps_agents_apart(url: String, driver: &str) {+async fn driver_backed_store_keeps_agents_apart(url: String) {let _turn = SLOTS.lock().await;let previous = crate::core_host::agent::session_store::installed();let previous_backend = crate::core_host::storage::installed();install_for_url(Some(url)).await.unwrap();- assert_eq!(- crate::core_host::storage::installed().map(|b| b.driver()),- Some(driver)- );+ assert!(crate::core_host::storage::installed().is_some());let provider = crate::core_host::agent::session_store::installed().unwrap();let alice = provider.for_agent("alice");alice@@ -93,7 +87,7 @@ async fn driver_backed_store_keeps_agents_apart(url: String, driver: &str) {async fn the_sqlite_backend_keeps_agents_apart() {let dir = tempfile::tempdir().unwrap();let url = format!("sqlite:{}", dir.path().join("sessions").display());- driver_backed_store_keeps_agents_apart(url, "sqlite").await;+ driver_backed_store_keeps_agents_apart(url).await;}#[tokio::test]@@ -117,7 +111,7 @@ async fn the_host_reads_the_storage_url_from_the_environment() {std::env::set_var(var, " memory ");let booted = install_for_host().await;- let driver = crate::core_host::storage::installed().map(|b| b.driver());+ let installed = crate::core_host::storage::installed().is_some();std::env::set_var(var, "ftp://nowhere");let refused = install_for_host().await;@@ -130,7 +124,7 @@ async fn the_host_reads_the_storage_url_from_the_environment() {crate::core_host::agent::session_store::restore(previous);booted.unwrap();- assert_eq!(driver, Some("memory"));+ assert!(installed);assert!(refused.is_err(), "an unusable env URL fails the boot");}@@ -143,7 +137,7 @@ async fn provider_for_url_returns_the_store_without_installing_it() {let backed = provider_for_url(Some("memory".into())).await.unwrap();let backed_key = backed.destination_key();- let backend_driver = crate::core_host::storage::installed().map(|b| b.driver());+ let backend_installed = crate::core_host::storage::installed().is_some();let left_uninstalled = crate::core_host::agent::session_store::installed().is_none();// No URL: each workspace keeps its sessions in its own default database.@@ -159,7 +153,7 @@ async fn provider_for_url_returns_the_store_without_installing_it() {.is_some_and(|key| key.starts_with("memory://")),"{backed_key:?}");- assert_eq!(backend_driver, Some("memory"), "the backend is installed");+ assert!(backend_installed, "the backend is installed");assert!(left_uninstalled,"the provider is handed back, not installed"