Skip to content

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

fix(config): normalize config paths before anchor comparison

Steven Enamakel85623b3c9f7b
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 f508777bc8..c40991bc87 100644
--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs
+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs
@@ -399,7 +399,8 @@ impl Config {
(
Some(super::source::ConfigSourceAnchor::File(path)),
super::source::ConfigSourceAnchor::Document { .. }
- ) if path == &self.config_path && expected_snapshot.version.is_none()
+ ) if path == &super::source::normalized_path(&self.config_path)
+ && expected_snapshot.version.is_none()
);
if update_snapshot
&& expected_snapshot.anchor.as_ref().is_some_and(|anchor| {
diff --git a/crates/openhuman-core/src/config/schema/load/source/file.rs b/crates/openhuman-core/src/config/schema/load/source/file.rs
index cba87670f0..f5859b9437 100644
--- a/crates/openhuman-core/src/config/schema/load/source/file.rs
+++ b/crates/openhuman-core/src/config/schema/load/source/file.rs
@@ -41,7 +41,7 @@ impl ConfigSource for FileConfigSource {
}
fn anchor(&self) -> super::ConfigSourceAnchor {
- super::ConfigSourceAnchor::File(self.path.clone())
+ super::ConfigSourceAnchor::File(super::normalized_path(&self.path))
}
async fn exists(&self) -> Result<bool> {
diff --git a/crates/openhuman-core/src/config/schema/load/source/mod.rs b/crates/openhuman-core/src/config/schema/load/source/mod.rs
index a3d1786581..87793ce1bc 100644
--- a/crates/openhuman-core/src/config/schema/load/source/mod.rs
+++ b/crates/openhuman-core/src/config/schema/load/source/mod.rs
@@ -94,6 +94,22 @@ pub(crate) enum ConfigSourceAnchor {
},
}
+pub(crate) fn normalized_path(path: &Path) -> std::path::PathBuf {
+ let mut normalized = std::path::PathBuf::new();
+ for component in path.components() {
+ match component {
+ std::path::Component::CurDir => {}
+ std::path::Component::ParentDir => {
+ if !normalized.pop() {
+ normalized.push(component.as_os_str());
+ }
+ }
+ other => normalized.push(other.as_os_str()),
+ }
+ }
+ normalized
+}
+
/// A place a config's TOML text is read from and written to.
#[async_trait]
pub(crate) trait ConfigSource: Send + Sync {