Skip to content

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

refactor(agent): remove test-only delivery slot scaffolding

Steven Enamakel3d8058e0a2f6
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
index 403b79c0bc..deee00f624 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery.rs
@@ -31,16 +31,12 @@ use crate::core::runtime::DispatchCtx;
use std::path::{Path, PathBuf};
use std::sync::{Arc, OnceLock};
use std::time::Duration;
-#[cfg(test)]
-use std::{collections::HashSet, future::Future, sync::Mutex};
use async_trait::async_trait;
use serde_json::json;
-#[cfg(test)]
-use tinyagents_tasks::CompletionRouter;
use tinyagents_tasks::{
- CompletionDelivery, CompletionDeliveryConfig, CompletionRecord, DeliveryOutcome,
- DeliveryTarget, ThreadDeliveryLeases,
+ CompletionDelivery, CompletionDeliveryConfig, DeliveryOutcome, DeliveryTarget,
+ ThreadDeliveryLeases,
};
use crate::core::bus::BUS;
@@ -48,15 +44,8 @@ use crate::core::events::DomainEvent;
use tinybus::EventHandler;
use tinybus::SubscriptionHandle;
-#[cfg(test)]
-mod slot;
-#[cfg(test)]
-use slot::DeliverySlot;
-
use super::background_completions;
use super::busy_guard::is_busy;
-#[cfg(test)]
-use super::busy_guard::{clear_busy_for_thread, TurnBusy};
use super::completion_notice::build_undelivered_notice;
use super::completion_owners;
use super::delivery_drain::{DrainFence, RECOVERY_BUSY_POLL};
@@ -76,14 +65,6 @@ const DEBOUNCE: Duration = Duration::from_secs(3);
/// delivery turn, so providers and the session store are up first.
const RECOVERY_DELAY: Duration = Duration::from_secs(15);
-/// Threads whose delivery turn is in flight — prevents two concurrent turns.
-/// Keyed by the tenant profile derived from the thread id, for the same reason.
-#[cfg(test)]
-fn delivering() -> &'static Mutex<HashSet<String>> {
- static D: OnceLock<Mutex<HashSet<String>>> = OnceLock::new();
- D.get_or_init(|| Mutex::new(HashSet::new()))
-}
-
/// Ask for a delivery attempt on `thread_id` soon (after a Stop cleared a stale
/// busy mark, or anything else that may have left a drain without its trigger).
pub(crate) fn kick_delivery(ctx: &DispatchCtx, thread_id: &str) {