Skip to content

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

fix(threads): canonicalize workspace paths for admission keys

Steven Enamakel662fcc64e23a
diff --git a/crates/openhuman-core/src/threads/store/backend.rs b/crates/openhuman-core/src/threads/store/backend.rs
index 6f2f0948f6..03fcb087e4 100644
--- a/crates/openhuman-core/src/threads/store/backend.rs
+++ b/crates/openhuman-core/src/threads/store/backend.rs
@@ -66,7 +66,26 @@ fn normalized_workspace_path(workspace_dir: &Path) -> PathBuf {
other => normalized.push(other.as_os_str()),
}
}
- normalized
+ if let Ok(canonical) = std::fs::canonicalize(&normalized) {
+ return canonical;
+ }
+ let mut existing = normalized.as_path();
+ let mut suffix = Vec::new();
+ while !existing.exists() {
+ let Some(name) = existing.file_name() else {
+ break;
+ };
+ suffix.push(name.to_os_string());
+ let Some(parent) = existing.parent() else {
+ break;
+ };
+ existing = parent;
+ }
+ let mut key = std::fs::canonicalize(existing).unwrap_or_else(|_| existing.to_path_buf());
+ for component in suffix.into_iter().rev() {
+ key.push(component);
+ }
+ key
}
fn thread_admission(workspace_dir: &Path) -> Arc<WorkspaceThreadAdmission> {