Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(config): remove unused conflict refresh helper

Steven Enamakel26ffdfad9dda
diff --git a/crates/openhuman-core/src/config/schema/load/impl_load.rs b/crates/openhuman-core/src/config/schema/load/impl_load.rs
index 05be616ce7..e4345eca6c 100644
--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs
+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs
@@ -1,5 +1,6 @@
use super::super::Config;
use super::branches::pre_login_config_boxed;
+use super::context_refresh::is_document_conflict;
use super::dirs::{
default_action_dir, default_config_and_workspace_dirs, resolve_action_dir,
resolve_config_dirs_ignoring_env, resolve_runtime_config_dirs_with, ConfigResolutionSource,
@@ -493,61 +494,6 @@ impl Config {
Ok(())
}
- fn refresh_context_after_conflict<'a>(
- &'a self,
- expected: &'a super::super::ConfigDocumentSnapshot,
- ) -> std::pin::Pin<Box<dyn std::future::Future<Output = ()> + Send + 'a>> {
- Box::pin(async move {
- let Some(snapshot) = self
- .context_snapshot
- .as_ref()
- .and_then(std::sync::Weak::upgrade)
- else {
- return;
- };
- let (config_path, workspace_dir, runtime) = {
- let current = snapshot.lock().unwrap();
- if *current.document_snapshot.lock().unwrap() != *expected {
- return;
- }
- (
- current.config_path.clone(),
- current.workspace_dir.clone(),
- current.clone(),
- )
- };
- let Ok(mut refreshed) = Self::load_from_config_path(&config_path, &workspace_dir).await
- else {
- return;
- };
- if refreshed.document_snapshot.lock().unwrap().anchor != expected.anchor {
- return;
- }
- let overlay = runtime.context_overlay.lock().unwrap().clone();
- if let Some(overlay) = overlay {
- let Ok(merged) = overlay.reapply(&refreshed) else {
- return;
- };
- refreshed = merged;
- } else {
- super::context_overlay::copy_runtime_bindings(&runtime, &mut refreshed);
- }
- refreshed.context_snapshot = Some(std::sync::Arc::downgrade(&snapshot));
-
- let mut current = snapshot.lock().unwrap();
- if *current.document_snapshot.lock().unwrap() == *expected {
- *current = refreshed;
- }
- })
- }
-}
-
-fn is_document_conflict(error: &anyhow::Error) -> bool {
- error.chain().any(|cause| {
- cause
- .downcast_ref::<tinystoragedrivers::StorageError>()
- .is_some_and(|error| error.kind() == tinystoragedrivers::ErrorKind::Conflict)
- })
}
impl Config {