The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(orchestration): cover repeated pauses and inline collection
Steven Enamakel49313aad4339
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rsindex ce206bb42d..a3c0954d08 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs@@ -416,7 +416,10 @@ fn encoded_task_id(task_id: &str) -> String {}fn awaiting_input_record_prefix(task_id: &str) -> String {- format!("{AWAITING_INPUT_RECORD_PREFIX}{}:", encoded_task_id(task_id))+ format!(+ "{AWAITING_INPUT_RECORD_PREFIX}{}:",+ encoded_task_id(task_id)+ )}fn awaiting_input_record_id(task_id: &str) -> String {@@ -505,15 +508,17 @@ pub(crate) fn mark_collected(workspace_dir: &Path, task_id: &str) -> bool {.map(|record| record.task_id).collect();let pauses_collected = pauses.into_iter().fold(false, |collected, pause_id| {- let suppressed = matches!(router.tombstone(&pause_id), Ok(TombstoneOutcome::Suppressed));+ let suppressed = matches!(+ router.tombstone(&pause_id),+ Ok(TombstoneOutcome::Suppressed)+ );collected | suppressed});log::debug!("[background_completions] mark_collected task_id={task_id} completion={completion:?} \pauses_collected={pauses_collected}");- matches!(completion, Ok(TombstoneOutcome::Suppressed))- || pauses_collected+ matches!(completion, Ok(TombstoneOutcome::Suppressed)) || pauses_collected}/// Drop every queued completion for `thread_id` and everything that finishesdiff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rsindex 1978b8c58d..bebe8b71c6 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs@@ -1,6 +1,6 @@use super::*;use crate::core::runtime::DispatchCtx;-use tinyagents_tasks::CompletionStatus;+use tinyagents_tasks::{CompletionFormatter, CompletionStatus};use tokio::sync::MutexGuard;/// The context these tests dispatch under: the calling task's own.@@ -346,6 +346,63 @@ fn awaiting_input_does_not_dedupe_the_later_completion() {pause.task_id, completion.task_id,"pause has a separate dedupe key");++ let claimed = router_for_workspace(w)+ .claim_pending("thread-resume", usize::MAX)+ .unwrap();+ assert_eq!(+ claimed.len(),+ 2,+ "pause and completion are both deliverable"+ );+ let notice = BackgroundCompletionFormatter.format_batch(&claimed);+ assert!(notice.contains("<background_agent_needs_input id=\"sub-resume\""));+ assert!(notice.contains("<background_agent_result id=\"sub-resume\""));+}++#[test]+fn repeated_pauses_are_distinct_and_inline_collection_sweeps_them() {+ let _guard = test_guard();+ let ws = workspace();+ let w = ws.path();+ for question in ["which repo?", "which branch?"] {+ futures::executor::block_on(record_awaiting_input(+ &cx(),+ w,+ "sess-repeat-pause",+ "sub-repeat-pause",+ "researcher",+ question,+ true,+ Some("thread-repeat-pause".into()),+ ));+ }+ record(+ w,+ "sess-repeat-pause",+ "sub-repeat-pause",+ "finished after answers",+ Some("thread-repeat-pause"),+ );++ let pending = pending_for(w, "thread-repeat-pause");+ assert_eq!(+ pending.len(),+ 3,+ "each pause and the final result are retained"+ );+ let pause_ids: HashSet<_> = pending+ .iter()+ .filter(|record| record.label.as_deref() == Some(AWAITING_INPUT_LABEL))+ .map(|record| record.task_id.as_str())+ .collect();+ assert_eq!(pause_ids.len(), 2, "each pause gets a unique router key");++ assert!(mark_collected(w, "sub-repeat-pause"));+ assert!(+ pending_for(w, "thread-repeat-pause").is_empty(),+ "collecting the final result also withdraws its queued pause notices"+ );}#[test]diff --git a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rsindex 4e95969c44..dc85844b49 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs@@ -206,7 +206,7 @@ impl DelegateGraphTool {};let agent_id = match args.get("agent_id").and_then(|v| v.as_str()) {Some(s) if !s.trim().is_empty() => s.trim().to_string(),- _ => return Ok(ToolResult::error("delegate: `agent_id` is required.")),+ _ => return Ok(ToolResult::error("delegate_graph: `agent_id` is required.")),};let task = match args.get("task").and_then(|v| v.as_str()) {Some(s) if !s.trim().is_empty() => s.to_string(),diff --git a/vendor/tinyagents b/vendor/tinyagentsindex 45d44dbdda..0e53ebd7fb 160000--- a/vendor/tinyagents+++ b/vendor/tinyagents@@ -1 +1 @@-Subproject commit 45d44dbddaddfbc708a1926325c29274b91485bc+Subproject commit 0e53ebd7fbad32137e5f2a9eefe9264c87744b60