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
chore(agent): thread dispatch context through recovery helpers
Steven Enamakel7e0e24acefaf
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rsindex 8d9aeb356b..2d7198c11c 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs@@ -51,9 +51,9 @@ pub(crate) use super::completion_target::tests::{};pub(crate) use super::completion_target::CompletionTarget;use super::completion_target::{awaiting_input_record_id, awaiting_input_record_prefix};-pub(crate) use super::completion_target::{claim_recovery_ctx, forget_recovery_ctx};#[cfg(test)]pub(crate) use super::completion_target::{claim_recovery, forget_recovery};+pub(crate) use super::completion_target::{claim_recovery_ctx, forget_recovery_ctx};/// How long a settled record (delivered / gave up / tombstoned) is kept before/// compaction drops it. Dropping a settled record also drops its dedupe and itsdiff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rsindex a048a20fcd..6b53bc2039 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_tests.rs@@ -656,8 +656,9 @@ async fn concurrent_degradation_installs_one_fallback() {let failing = router_for_workspace(w);// Two records saw the same failing router; both ask to degrade.- let first = degrade_to_memory(w, &failing);- let second = degrade_to_memory(w, &failing);+ let ctx = crate::core::runtime::DispatchCtx::ambient();+ let first = degrade_to_memory(&ctx, w, &failing);+ let second = degrade_to_memory(&ctx, w, &failing);assert!(Arc::ptr_eq(&first.router, &second.router),diff --git a/crates/openhuman-core/src/agent/orchestration/completion_target.rs b/crates/openhuman-core/src/agent/orchestration/completion_target.rsindex 3710f4e5f9..96b1a07912 100644--- a/crates/openhuman-core/src/agent/orchestration/completion_target.rs+++ b/crates/openhuman-core/src/agent/orchestration/completion_target.rs@@ -126,7 +126,10 @@ pub(crate) fn claim_recovery_ctx() -> bool {state().recovered_workspaces- .insert(super::background_completions::router_scope_for(ctx, workspace_dir))+ .insert(super::background_completions::router_scope_for(+ ctx,+ workspace_dir,+ ))}#[cfg(test)]@@ -138,10 +141,7 @@ pub(crate) fn claim_recovery(workspace_dir: &Path) -> bool {/// and drop its cached router when nothing is using it so the next scan replays/// the log another holder may have appended to. A router still in use stays,/// so a log never has two writers.-pub(crate) fn forget_recovery_ctx(- ctx: &crate::core::runtime::DispatchCtx,- workspace_dir: &Path,-) {+pub(crate) fn forget_recovery_ctx(ctx: &crate::core::runtime::DispatchCtx, workspace_dir: &Path) {let scope = super::background_completions::router_scope_for(ctx, workspace_dir);state().recovered_workspaces.remove(&scope);let Ok(Some(router)) = super::background_completions::router_pool().get(&scope) else {