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(config): preserve bootstrap tables when document CAS loses
Steven Enamakel114a88be082c
diff --git a/crates/openhuman-core/src/channels/host/adapters.rs b/crates/openhuman-core/src/channels/host/adapters.rsindex a7dbe35444..8560968790 100644--- a/crates/openhuman-core/src/channels/host/adapters.rs+++ b/crates/openhuman-core/src/channels/host/adapters.rs@@ -295,13 +295,12 @@ impl ConfigAllowlistStore {.context("could not find home directory")?;let openhuman_dir = home.join(".openhuman");let config_path = openhuman_dir.join("config.toml");- let contents = tokio::fs::read_to_string(&config_path)- .await- .with_context(|| format!("failed to read config file: {}", config_path.display()))?;- let mut config: Config = crate::config::schema::config_from_toml_str(&contents)- .context("failed to parse config.toml for allowlist")?;- config.config_path = config_path;- config.workspace_dir = openhuman_dir.join("workspace");+ let mut config = Config::load_from_config_path_without_env(+ &config_path,+ &openhuman_dir.join("workspace"),+ )+ .await+ .with_context(|| format!("failed to load config.toml for allowlist: {}", config_path.display()))?;match channel {"telegram" => {diff --git a/crates/openhuman-core/src/config/schema/load/branches.rs b/crates/openhuman-core/src/config/schema/load/branches.rsindex f4c0e2965f..9019c5e7c2 100644--- a/crates/openhuman-core/src/config/schema/load/branches.rs+++ b/crates/openhuman-core/src/config/schema/load/branches.rs@@ -307,10 +307,22 @@ 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);- Box::pin(config.save_file_export(&file)).await?;+ let document_result = config.save().await;+ if source.label() != "document" {+ return document_result;+ }++ // The corrupted primary file has already been moved aside. Restore its+ // bootstrap tables even when this node loses the document CAS race; a+ // later boot still needs the storage URL to reach the shared backend.+ let file = super::source::FileConfigSource::new(&config.config_path);+ let file_result = Box::pin(config.save_file_export(&file)).await;+ match (document_result, file_result) {+ (Ok(()), Ok(())) => Ok(()),+ (Err(document_error), Ok(())) => Err(document_error),+ (Ok(()), Err(file_error)) => Err(file_error),+ (Err(document_error), Err(file_error)) => Err(file_error.context(format!(+ "document persistence also failed: {document_error:#}"+ ))),}- Ok(())}diff --git a/crates/openhuman-core/src/tools/impl/system/proxy_config.rs b/crates/openhuman-core/src/tools/impl/system/proxy_config.rsindex 8b127f6786..beebb28af7 100644--- a/crates/openhuman-core/src/tools/impl/system/proxy_config.rs+++ b/crates/openhuman-core/src/tools/impl/system/proxy_config.rs@@ -157,7 +157,11 @@ impl ProxyConfigTool {}async fn handle_set(&self, args: &Value) -> anyhow::Result<ToolResult> {- let mut cfg = self.load_config_without_env()?;+ let mut cfg = Config::load_from_config_path_without_env(+ &self.config.config_path,+ &self.config.workspace_dir,+ )+ .await?;let previous_scope = cfg.proxy.scope;let mut proxy = cfg.proxy.clone();let mut touched_proxy_url = false;@@ -250,7 +254,11 @@ impl ProxyConfigTool {}async fn handle_disable(&self, args: &Value) -> anyhow::Result<ToolResult> {- let mut cfg = self.load_config_without_env()?;+ let mut cfg = Config::load_from_config_path_without_env(+ &self.config.config_path,+ &self.config.workspace_dir,+ )+ .await?;let clear_env_default = cfg.proxy.scope == ProxyScope::Environment;cfg.proxy.enabled = false;cfg.save().await?;