Skip to content

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

fix(orchestration): fall back to memory stores when storage is not shared

Steven Enamakelacb0b4eaf9f1
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs
index 82a41708cf..461420a20b 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions/store_adapter.rs
@@ -2,8 +2,8 @@
use super::*;
use tinyagents_tasks::{
- CompletionRouterPool, CompletionStoreReplaceOutcome, DriverCompletionStore,
- InMemoryCompletionStore, DEFAULT_MAX_ATTEMPTS,
+ CompletionRouterPool, CompletionStoreFallback, CompletionStoreReplaceOutcome,
+ InMemoryCompletionStore, DEFAULT_MAX_ATTEMPTS, open_driver_completion_store_or_memory,
};
pub(in crate::agent::orchestration) fn router_scope_for(
@@ -37,9 +37,13 @@ pub(in crate::agent::orchestration) fn open_driver_store(
// previous document-backed adapter. The owner API now needs the
// backend and exact scope so it can provide its own fenced store.
let opened = crate::storage::local::open("background_completions", workspace_dir)?;
- let store = DriverCompletionStore::new(opened.backend, opened.scope)
- .map_err(|error| anyhow::anyhow!("start the completion store bridge: {error}"))?;
- Ok(Arc::new(store) as Arc<dyn CompletionStore>)
+ let fallback = if crate::storage::installed_is_shared() {
+ CompletionStoreFallback::FailClosed
+ } else {
+ CompletionStoreFallback::LocalMemory
+ };
+ open_driver_completion_store_or_memory(opened.backend, opened.scope, fallback)
+ .map_err(|error| anyhow::anyhow!("open the completion store: {error}"))
})
}
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
index d83a33280e..f14aa8f9a9 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
@@ -14,8 +14,8 @@ use tinyagents_orchestration::subagent::{
orphaned_subagent_reason, record_agent_id, record_parent_session, task_status_label,
};
use tinyagents_tasks::{
- reconcile_orphaned_tasks, DriverTaskStore, InMemoryTaskStore, OrchestrationTaskFilter,
- TaskStore, TaskStoreRegistry,
+ InMemoryTaskStore, OrchestrationTaskFilter, TaskStore, TaskStoreRegistry,
+ open_driver_task_store_or_memory, reconcile_orphaned_tasks,
};
/// One cached ledger: a workspace and the storage scope it was opened for.
@@ -49,9 +49,9 @@ fn task_stores() -> &'static TaskStoreRegistry<LedgerKey> {
fn open_driver_store(workspace_dir: &Path) -> anyhow::Result<Arc<dyn TaskStore>> {
let opened = crate::storage::local::open(DOMAIN, workspace_dir)?;
let scoped = opened.scoped()?;
- let store = DriverTaskStore::new(Arc::clone(scoped.documents()))
- .map_err(|error| anyhow::anyhow!("start the task store bridge: {error}"))?;
- Ok(Arc::new(store))
+ Ok(open_driver_task_store_or_memory(Arc::clone(
+ scoped.documents(),
+ )))
}
/// The cache key for this call: the storage scope joins the workspace, so two