Skip to content

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

feat(orchestration): track completion owners for off-task delivery

Steven Enamakelce71a972d7b8
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
index 936222a801..807f2e6f68 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
@@ -22,7 +22,6 @@
//! [`super::completion_notice`].
use std::collections::{HashMap, HashSet, VecDeque};
-
// Keys of `HostState`'s thread and session maps: per profile (see `profile_key`).
use crate::core::runtime::tenant::profile_key as key;
use std::path::{Path, PathBuf};
@@ -168,9 +167,7 @@ fn degrade_to_memory(workspace_dir: &Path, failed: &Arc<CompletionRouter>) -> Ar
router: Arc::new(new_router(store.clone())),
store,
});
- state()
- .routers
- .insert(workspace_dir.to_path_buf(), entry.clone());
+ state().routers.insert(workspace_dir.to_path_buf(), entry.clone());
log::error!(
"[background_completions] degraded to an in-memory queue workspace_dir={}",
workspace_dir.display()
@@ -327,6 +324,8 @@ pub(crate) async fn record_outcome(
}
note_thread_workspace(&thread_id, workspace_dir);
note_session_thread(parent_session, &thread_id);
+ // For the off-task delivery subscriber: whose profile this result is.
+ super::completion_owners::note(&[&task_id, parent_session]);
let record = CompletionRecord::new(
task_id.clone(),
diff --git a/crates/openhuman-core/src/agent/orchestration/mod.rs b/crates/openhuman-core/src/agent/orchestration/mod.rs
index 64b2413075..ab6d387c47 100644
--- a/crates/openhuman-core/src/agent/orchestration/mod.rs
+++ b/crates/openhuman-core/src/agent/orchestration/mod.rs
@@ -20,6 +20,7 @@ pub(crate) mod background_completions;
pub(crate) mod background_delivery;
pub mod command_center;
pub(crate) mod completion_notice;
+pub(crate) mod completion_owners;
pub(crate) mod completion_target;
pub(crate) mod delegation;
pub use delegation::open_delegation_checkpointer;
@@ -45,6 +46,10 @@ mod ops_tests;
#[path = "background_completions_tenant_tests.rs"]
mod background_completions_tenant_tests;
+#[cfg(test)]
+#[path = "background_delivery_tenant_tests.rs"]
+mod background_delivery_tenant_tests;
+
pub use agent_teams::{all_agent_team_controller_schemas, all_agent_team_registered_controllers};
pub use command_center::{
all_command_center_controller_schemas, all_command_center_registered_controllers,