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(security): persist keyring entries to the file store
Steven Enamakelb32eef771a71
diff --git a/crates/openhuman-core/src/security/keyring/adapter.rs b/crates/openhuman-core/src/security/keyring/adapter.rsindex 9e7f6f4aed..4f2141b41a 100644--- a/crates/openhuman-core/src/security/keyring/adapter.rs+++ b/crates/openhuman-core/src/security/keyring/adapter.rs@@ -82,9 +82,16 @@ pub(super) fn recover_corrupt_file() -> Result<(), KeyringError> {let _guard = file_store::lock_for_write(path)?;let store = EncryptedFileSecrets::at_path(path, Zeroizing::new(*key));- if crate::storage::block_on(async move { store.list("").await }).is_ok() {- log::info!("[keyring:encrypted_file] secrets file readable again; not quarantining");- return Ok(());+ match crate::storage::block_on(async move { store.list("").await }) {+ Ok(_) => {+ log::info!("[keyring:encrypted_file] secrets file readable again; not quarantining");+ return Ok(());+ }+ // Still corrupt: fall through to quarantine.+ Err(error) if is_corruption(&error) => {}+ // Anything else (a transient read or permission error) says nothing+ // about the file's contents: never move a possibly healthy file aside.+ Err(error) => return Err(backend_error(error)),}log::error!("[keyring:encrypted_file] secrets file unreadable ({}): master key may have changed \diff --git a/crates/openhuman-core/src/security/keyring/file_store.rs b/crates/openhuman-core/src/security/keyring/file_store.rsindex 04b93570c1..eef3657306 100644--- a/crates/openhuman-core/src/security/keyring/file_store.rs+++ b/crates/openhuman-core/src/security/keyring/file_store.rs@@ -201,7 +201,15 @@ fn temp_path_for(path: &Path) -> PathBuf {/// a recognisable extension.pub fn quarantine_corrupt(path: &Path, suffix: &str) -> Option<PathBuf> {let stamp = chrono::Utc::now().timestamp();- let target = path.with_extension(format!("{suffix}.corrupt.{stamp}"));+ let mut target = path.with_extension(format!("{suffix}.corrupt.{stamp}"));+ // Two recoveries within one second must not share a name: `rename`+ // replaces an existing destination on every platform, which would destroy+ // the earlier preserved bytes.+ let mut attempt = 1u32;+ while target.exists() {+ target = path.with_extension(format!("{suffix}.corrupt.{stamp}.{attempt}"));+ attempt += 1;+ }match std::fs::rename(path, &target) {Ok(()) => {log::error!(