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
chore: files changed crates/openhuman-core/src/config/schema/load/branches.rs,crates/openhuman-core/
Steven Enamakelb212b69fa761
diff --git a/crates/openhuman-core/src/config/schema/load/branches.rs b/crates/openhuman-core/src/config/schema/load/branches.rsindex d08d6b1aaf..e7ab542304 100644--- a/crates/openhuman-core/src/config/schema/load/branches.rs+++ b/crates/openhuman-core/src/config/schema/load/branches.rs@@ -302,7 +302,10 @@ impl Config {/// strips the bootstrap tables and never writes the file, so the file is/// rewritten too: otherwise a storage URL that lived only in its `[storage]`/// table would be gone on the next boot.-async fn save_recovered(config: &Config, source: &dyn super::source::ConfigSource) -> Result<()> {+pub(super) async fn save_recovered(+ config: &Config,+ source: &dyn super::source::ConfigSource,+) -> Result<()> {config.save().await?;if source.label() == "document" {let file = super::source::FileConfigSource::new(&config.config_path);diff --git a/crates/openhuman-core/src/config/schema/load/impl_load.rs b/crates/openhuman-core/src/config/schema/load/impl_load.rsindex a8724317f6..01202f0b3a 100644--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs@@ -9,7 +9,9 @@ use super::migrate::{migrate_cloud_provider_slugs, migrate_legacy_inference_url, migrate_legacy_memory_backend,migrate_search_settings,};-use super::secrets::{decrypt_config_secrets, decrypt_config_secrets_strict, encrypt_config_secrets};+use super::secrets::{+ decrypt_config_secrets, decrypt_config_secrets_strict, encrypt_config_secrets,+};use anyhow::{Context, Result};use std::path::Path;use std::sync::{Mutex, OnceLock};diff --git a/crates/openhuman-core/src/config/schema/load/secrets.rs b/crates/openhuman-core/src/config/schema/load/secrets.rsindex 24f31cee22..5e2c4e5e74 100644--- a/crates/openhuman-core/src/config/schema/load/secrets.rs+++ b/crates/openhuman-core/src/config/schema/load/secrets.rs@@ -77,7 +77,10 @@ fn decrypt_optional_secret(/// open. The load path clears a field it cannot decrypt so the app stays/// usable; saving that cleared value over the shared document would turn a/// transient keychain failure into lost credentials, so this fails instead.-pub(super) fn decrypt_config_secrets_strict(config: &mut Config, openhuman_dir: &Path) -> Result<()> {+pub(super) fn decrypt_config_secrets_strict(+ config: &mut Config,+ openhuman_dir: &Path,+) -> Result<()> {DECRYPT_FAILURES.with(|failures| failures.set(0));decrypt_config_secrets(config, openhuman_dir)?;let failed = DECRYPT_FAILURES.with(|failures| failures.replace(0));diff --git a/crates/openhuman-core/src/config/schema/load/source/mod_tests.rs b/crates/openhuman-core/src/config/schema/load/source/mod_tests.rsindex 2eae2f174e..528f4e2ad3 100644--- a/crates/openhuman-core/src/config/schema/load/source/mod_tests.rs+++ b/crates/openhuman-core/src/config/schema/load/source/mod_tests.rs@@ -489,3 +489,60 @@ async fn a_document_save_never_nests_process_key_ciphertext() {assert!(body.contains("sk-node-local"), "{body}");assert!(!body.contains("enc2:"), "{body}");}++#[tokio::test]+async fn a_document_save_refuses_process_key_secrets_it_cannot_open() {+ let tmp = tempfile::tempdir().unwrap();+ let other_node = tempfile::tempdir().unwrap();+ let storage = MemoryStorage::new();+ let _forced = ForcedDocumentSource::new(+ scoped(&storage, "tenant-a"),+ Scope::new("tenant-a").unwrap(),+ keys(3),+ );+ let mut config = config_at(tmp.path(), "m");+ // Sealed under another node's key: this node cannot open it.+ config.api_key = Some(+ crate::security::keyring::SecretStore::new(other_node.path(), true)+ .encrypt("sk-elsewhere")+ .unwrap(),+ );+ let error = config.save().await.unwrap_err();+ assert!(+ format!("{error:#}").contains("could not be opened"),+ "{error:#}"+ );+ let docs = Arc::clone(scoped(&storage, "tenant-a").documents());+ docs.ensure_collection(&tinystoragedrivers::CollectionSpec::new("config"))+ .await+ .unwrap();+ assert!(+ docs.get("config", "tenant-a").await.unwrap().is_none(),+ "nothing was written over the shared document"+ );+}++#[tokio::test]+async fn a_recovered_file_fallback_rewrites_the_bootstrap_file_too() {+ let tmp = tempfile::tempdir().unwrap();+ let storage = MemoryStorage::new();+ let _forced = ForcedDocumentSource::new(+ scoped(&storage, "tenant-a"),+ Scope::new("tenant-a").unwrap(),+ keys(3),+ );+ let mut config = config_at(tmp.path(), "recovered");+ config.storage.url = Some("sqlite:/boot".to_string());+ let source = for_config(&config.config_path).unwrap();+ assert_eq!(source.label(), "document");++ crate::config::schema::load::branches::save_recovered(&config, source.as_ref())+ .await+ .unwrap();++ let file = std::fs::read_to_string(&config.config_path).unwrap();+ assert!(file.contains("[storage]"), "{file}");+ let body = source.read().await.unwrap();+ assert!(body.from_document);+ assert!(body.contents.contains("recovered"));+}diff --git a/crates/openhuman-core/src/security/keyring/ops_adoption_tests.rs b/crates/openhuman-core/src/security/keyring/ops_adoption_tests.rsindex d7307e49c6..388775c460 100644--- a/crates/openhuman-core/src/security/keyring/ops_adoption_tests.rs+++ b/crates/openhuman-core/src/security/keyring/ops_adoption_tests.rs@@ -96,10 +96,7 @@ fn a_failing_legacy_backend_reads_as_nothing_to_adopt() {legacy_or_warn(Err(KeyringError::Backend("locked".into()))),None);- assert_eq!(- legacy_or_warn(Ok(Some("v".into()))).as_deref(),- Some("v")- );+ assert_eq!(legacy_or_warn(Ok(Some("v".into()))).as_deref(), Some("v"));// With nothing legacy to adopt, the storage read is still answered.let storage = MemoryStorage::new();let secrets = storage_secrets_in(&storage, "local");