Skip to content

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

refactor(orchestration): clean up background completions implementation

Steven Enamakele5aaf84868f7
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_migration_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_migration_tests.rs
index d24b81abba..96620b4940 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_migration_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_migration_tests.rs
@@ -103,10 +103,7 @@ impl CompletionStore for FullDisk {
) -> tinyagents_harness::error::Result<Vec<CompletionRecord>> {
self.0.try_list(parent_key)
}
- fn compact(
- &self,
- retain: std::time::Duration,
- ) -> tinyagents_harness::error::Result<usize> {
+ fn compact(&self, retain: std::time::Duration) -> tinyagents_harness::error::Result<usize> {
self.0.compact(retain)
}
}
@@ -234,10 +231,7 @@ impl CompletionStore for ToggleStore {
self.inner.try_list(parent_key)
}
- fn compact(
- &self,
- retain: std::time::Duration,
- ) -> tinyagents_harness::error::Result<usize> {
+ fn compact(&self, retain: std::time::Duration) -> tinyagents_harness::error::Result<usize> {
self.inner.compact(retain)
}
}
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
index 9dc6b1ef72..cf22f68b09 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs
@@ -591,7 +591,13 @@ fn deleting_a_thread_with_only_compacted_completion_history_stays_durable() {
let _guard = test_guard();
let ws = workspace();
let w = ws.path();
- record(w, "sess-cm-history", "sub-1", "x", Some("thread-cm-history"));
+ record(
+ w,
+ "sess-cm-history",
+ "sub-1",
+ "x",
+ Some("thread-cm-history"),
+ );
let router = router_for_workspace(w);
let claimed = router
.claim_pending("thread-cm-history", usize::MAX)
diff --git a/crates/openhuman-core/src/agent/orchestration/completion_target.rs b/crates/openhuman-core/src/agent/orchestration/completion_target.rs
index 6af4b53c85..9676c2bdab 100644
--- a/crates/openhuman-core/src/agent/orchestration/completion_target.rs
+++ b/crates/openhuman-core/src/agent/orchestration/completion_target.rs
@@ -60,10 +60,8 @@ impl CompletionTarget {
parent_thread_id: Option<String>,
) -> anyhow::Result<Self> {
let parent_epoch = if let Some(thread_id) = parent_thread_id.as_deref() {
- let router = super::background_completions::router_for_workspace_ctx(
- &ctx,
- &workspace_dir,
- );
+ let router =
+ super::background_completions::router_for_workspace_ctx(&ctx, &workspace_dir);
Some(
router
.admit_child_generation(thread_id)?
@@ -105,7 +103,9 @@ impl CompletionTarget {
&self.parent_session,
task_id,
agent_id,
- format!("[SUBAGENT_FAILED] the async sub-agent errored before producing a result: {error}"),
+ format!(
+ "[SUBAGENT_FAILED] the async sub-agent errored before producing a result: {error}"
+ ),
self.parent_thread_id.clone(),
self.parent_epoch,
BackgroundAgentOutcome::Failed,