Skip to content

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

fix(subagent_sessions): skip import when legacy data already present

Steven Enamakel788ad6fd043b
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
index 2a643e6bc0..445c93f1b8 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
@@ -114,7 +114,12 @@ impl Docs {
let id = marker_id(source);
let claimed =
crate::storage::import_claim::with_claim(&self.0, IMPORTED, &id.clone(), || {
+ // The process that held the claim before us may have finished.
+ if self.legacy_imported(source)? {
+ return Ok(());
+ }
self.save(sessions)?;
+ let id = id.clone();
self.0.run(|docs| async move {
match docs
.put(
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
index a2af40bf4e..e711f382eb 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
@@ -143,6 +143,7 @@ impl Docs {
log::debug!("[composio:store] document import id={id}");
let claimed =
crate::storage::import_claim::with_claim(&self.0, IMPORTED, &id.clone(), || {
+ let (id, doc) = (id.clone(), doc.clone());
self.0.run(|docs| async move {
let wrote = match docs.put(STATE, &id, doc, Precondition::Absent).await {
Ok(_) => true,