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/impl_load.rs,crates/openhuman-core
Steven Enamakel28dd736b36ae
diff --git a/crates/openhuman-core/src/config/schema/load/impl_load.rs b/crates/openhuman-core/src/config/schema/load/impl_load.rsindex 3aaa718410..a8724317f6 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,7 @@ use super::migrate::{migrate_cloud_provider_slugs, migrate_legacy_inference_url, migrate_legacy_memory_backend,migrate_search_settings,};-use super::secrets::{decrypt_config_secrets, 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};@@ -525,6 +525,12 @@ impl Config {// Where the text lives is the source's business: the file (atomic// replace with a `.bak`) or, on a shared backend, the config document.let source = super::source::for_config(&self.config_path)?;+ self.save_to(source.as_ref()).await+ }++ /// Save into `source`. The loader also uses it to rewrite the local+ /// bootstrap file when a document-backed load recovered it.+ pub(super) async fn save_to(&self, source: &dyn super::source::ConfigSource) -> Result<()> {let mut config_to_save = self.clone();super::super::cli_overrides::restore_persisted_inference_fields(&mut config_to_save);// A document source seals the whole body under the scope's data key;@@ -539,7 +545,7 @@ impl Config {.parent().context("Config path must have a parent directory")?.to_path_buf();- decrypt_config_secrets(&mut config_to_save, &openhuman_dir)?;+ decrypt_config_secrets_strict(&mut config_to_save, &openhuman_dir)?;} else {encrypt_config_secrets(&mut config_to_save)?;}diff --git a/crates/openhuman-core/src/config/schema/load/secrets.rs b/crates/openhuman-core/src/config/schema/load/secrets.rsindex ae97f88ff2..24f31cee22 100644--- a/crates/openhuman-core/src/config/schema/load/secrets.rs+++ b/crates/openhuman-core/src/config/schema/load/secrets.rs@@ -15,6 +15,12 @@ fn migration_flag() -> &'static AtomicBool {&MIGRATED}+thread_local! {+ /// Fields a `decrypt_config_secrets` pass on this thread could not open+ /// (and cleared). The pass is synchronous, so a thread-local is exact.+ static DECRYPT_FAILURES: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };+}+/// Decrypt one optional secret in place.////// When the stored value uses the legacy, insecure `enc:` (XOR) format this@@ -57,6 +63,7 @@ fn decrypt_optional_secret(field_name,&e.to_string(),);+ DECRYPT_FAILURES.with(|failures| failures.set(failures.get() + 1));*value = None;}}@@ -65,6 +72,24 @@ fn decrypt_optional_secret(Ok(())}+/// [`decrypt_config_secrets`] for a config about to be written somewhere+/// other nodes read (the shared config document): every process-key field must+/// 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<()> {+ DECRYPT_FAILURES.with(|failures| failures.set(0));+ decrypt_config_secrets(config, openhuman_dir)?;+ let failed = DECRYPT_FAILURES.with(|failures| failures.replace(0));+ if failed > 0 {+ anyhow::bail!(+ "{failed} config secret(s) are sealed under this node's key and could not be opened; \+ not saving them to the shared config document"+ );+ }+ Ok(())+}+fn encrypt_optional_secret(store: &crate::security::keyring::SecretStore,value: &mut Option<String>,