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
fix(orchestration): handle transient parent admission failures gracefully
Steven Enamakela4267bd8979f
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rsindex 9f6bef2a03..1666dcc957 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs@@ -692,10 +692,22 @@ pub(crate) fn mark_stopped_task_if_thread_stopped(entry.router.resume_parent(thread_id);match entry.router.admit_child_generation(thread_id) {Ok(Some(_)) => {}- Ok(None) | Err(_) => {+ Ok(None) => {state().deleted_threads.insert(thread_key.clone());stopped = true;}+ Err(error) => {+ // Refuse this admission, but do not turn a transient store+ // failure into process-lifetime deletion. A later spawn can+ // retry once the owner store is healthy.+ log::warn!(+ "[background_completions] parent admission failed thread_id={thread_id} error={error}"+ );+ if let Err(tombstone_error) = entry.router.tombstone(task_id) {+ log::warn!("[background_completions] tombstone failed task_id={task_id} error={tombstone_error}");+ }+ return true;+ }}}}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.rsindex 96620b4940..d5fa5b42fc 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@@ -354,3 +354,36 @@ async fn degrading_a_leased_completion_keeps_its_lease() {"a fallback router must not make another delivery claim while the first lease is active");}++#[tokio::test]+async fn transient_parent_admission_failure_does_not_permanently_delete_thread() {+ let _guard = crate::config::TEST_ENV_LOCK.lock().await;+ let ws = workspace();+ let w = ws.path();+ let ctx = crate::core::runtime::DispatchCtx::ambient();+ let store = Arc::new(ToggleStore::default());+ install_store_for_test(w, store.clone());+ store.fail_writes.store(true, Ordering::SeqCst);++ assert!(mark_stopped_task_if_thread_stopped(+ &ctx,+ w,+ "retryable-parent",+ "rejected-child",+ ));++ store.fail_writes.store(false, Ordering::SeqCst);+ assert!(!mark_stopped_task_if_thread_stopped(+ &ctx,+ w,+ "retryable-parent",+ "accepted-child",+ ));+ assert!(CompletionTarget::new(+ ctx,+ w.to_path_buf(),+ "retryable-session".into(),+ Some("retryable-parent".into()),+ )+ .is_ok());+}