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
style: format merged Rust sources
Steven Enamakel502f3a4a0b68
diff --git a/crates/openhuman-core/src/agent/artifacts/store_documents.rs b/crates/openhuman-core/src/agent/artifacts/store_documents.rsindex 09b3f260ac..5bf8063a68 100644--- a/crates/openhuman-core/src/agent/artifacts/store_documents.rs+++ b/crates/openhuman-core/src/agent/artifacts/store_documents.rs@@ -267,7 +267,8 @@ pub(super) async fn on_docs<T: Send + 'static>(docs: Docs,f: impl FnOnce(Docs) -> anyhow::Result<T> + Send + 'static,) -> Result<T, String> {- crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || f(docs))+ crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || f(docs)).await.map_err(|e| format!("[artifacts] storage task failed: {e}"))?.map_err(|e| format!("[artifacts] storage: {e:#}"))diff --git a/crates/openhuman-core/src/agent/attachments/provider_fallback.rs b/crates/openhuman-core/src/agent/attachments/provider_fallback.rsindex f6a82c1f1b..acfef34063 100644--- a/crates/openhuman-core/src/agent/attachments/provider_fallback.rs+++ b/crates/openhuman-core/src/agent/attachments/provider_fallback.rs@@ -239,7 +239,13 @@ impl AttachmentModel {.profile().and_then(|p| p.provider.as_deref()).unwrap_or("unknown");- let prepared = wrap(&self.dispatch_ctx(), vision.clone(), self.config.clone(), &model_id, provider);+ let prepared = wrap(+ &self.dispatch_ctx(),+ vision.clone(),+ self.config.clone(),+ &model_id,+ provider,+ );let known = prepared.profile().is_some_and(|p| p.modalities.image_in)|| provider == "injected" && vision.profile().is_some_and(|p| p.modalities.image_in);if !known || !vision.supports_input(InputModality::Image, mime, InputSource::Base64) {diff --git a/crates/openhuman-core/src/agent/attachments/provider_history_tests.rs b/crates/openhuman-core/src/agent/attachments/provider_history_tests.rsindex aec79bb626..90b38cc22c 100644--- a/crates/openhuman-core/src/agent/attachments/provider_history_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/provider_history_tests.rs@@ -13,7 +13,13 @@ async fn missing_historical_media_does_not_block_latest_valid_media() {let mut config = Config::default();config.action_dir = temp.path().into();let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config), "gpt-4o", "openai");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config),+ "gpt-4o",+ "openai",+ );let image = |path: &str| {Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Image(ImageRef {diff --git a/crates/openhuman-core/src/agent/attachments/provider_security_tests.rs b/crates/openhuman-core/src/agent/attachments/provider_security_tests.rsindex 7fd222e9fe..5da1265398 100644--- a/crates/openhuman-core/src/agent/attachments/provider_security_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/provider_security_tests.rs@@ -112,7 +112,11 @@ async fn fifo_attachment_is_rejected_without_waiting_for_a_writer() {config.action_dir = temp.path().to_path_buf();config.workspace_dir = temp.path().join("internal");let model = Arc::new(NeverCalled::default());- let wrapped = wrap_injected(&crate::core::runtime::DispatchCtx::host_default(), model.clone(), Arc::new(config));+ let wrapped = wrap_injected(+ &crate::core::runtime::DispatchCtx::host_default(),+ model.clone(),+ Arc::new(config),+ );let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Image(ImageRef {diff --git a/crates/openhuman-core/src/agent/attachments/provider_tests.rs b/crates/openhuman-core/src/agent/attachments/provider_tests.rsindex 8d8c6740cc..994b631fba 100644--- a/crates/openhuman-core/src/agent/attachments/provider_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/provider_tests.rs@@ -34,7 +34,13 @@ async fn local_native_resolution_changes_only_ephemeral_request() {config.action_dir = temp.path().into();config.workspace_dir = temp.path().join("internal");let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config), "gpt-4o", "openai");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config),+ "gpt-4o",+ "openai",+ );let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Image(ImageRef {@@ -67,7 +73,13 @@ async fn blocked_attachment_fails_before_model_call() {let mut config = Config::default();config.multimodal_files.max_files = 0;let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config), "gpt-4o", "openai");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config),+ "gpt-4o",+ "openai",+ );let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Image(ImageRef {@@ -81,7 +93,8 @@ async fn blocked_attachment_fails_before_model_call() {}#[test]fn unknown_model_does_not_inherit_transport_vision() {- let model = wrap(&crate::core::runtime::DispatchCtx::host_default(),+ let model = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),Arc::new(Probe::default()),Arc::new(Config::default()),"unknown-model",@@ -99,7 +112,13 @@ async fn persisted_image_without_mime_uses_magic_over_extension() {let mut config = Config::default();config.action_dir = temp.path().into();let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config), "gpt-4o", "openai");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config),+ "gpt-4o",+ "openai",+ );let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Image(ImageRef {@@ -119,7 +138,8 @@ async fn persisted_image_without_mime_uses_magic_over_extension() {#[tokio::test]async fn too_many_typed_images_reject_before_read_or_inference() {let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(),+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),probe.clone(),Arc::new(Config::default()),"gpt-4o",@@ -146,7 +166,8 @@ async fn too_many_typed_images_reject_before_read_or_inference() {async fn external_channel_cannot_rehydrate_a_local_image() {use crate::agent::turn_origin::AgentTurnOrigin;let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(),+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),probe.clone(),Arc::new(Config::default()),"gpt-4o",@@ -185,7 +206,13 @@ async fn unknown_video_retains_path_as_metadata_without_specialist() {let mut config = Config::default();config.action_dir = temp.path().into();let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config), "unknown", "custom");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config),+ "unknown",+ "custom",+ );let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Video(MediaRef::Path {@@ -316,7 +343,8 @@ fn endpoint_discovery_denial_overrides_offline_vision_facts() {source: LimitSource::ProviderListing,}),);- let model = wrap(&crate::core::runtime::DispatchCtx::host_default(),+ let model = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),Arc::new(Probe::default()),Arc::new(config),"gpt-4o",@@ -330,7 +358,13 @@ async fn legacy_inline_source_is_bounded_and_malformed_base64_rejects_before_prilet probe = Arc::new(Probe::default());let mut config = Config::default();config.multimodal.max_image_size_mb = 1;- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config), "gpt-4o", "openai");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config),+ "gpt-4o",+ "openai",+ );for source in ["data:image/png;base64,%%%".to_owned(),format!("data:image/png;base64,{}", "A".repeat(2 * 1024 * 1024)),@@ -351,7 +385,8 @@ async fn legacy_inline_source_is_bounded_and_malformed_base64_rejects_before_pri#[tokio::test]async fn disabled_remote_replay_is_rejected_before_inference() {let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(),+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),probe.clone(),Arc::new(Config::default()),"unknown",@@ -386,7 +421,13 @@ async fn inline_native_replay_materializes_original_and_keeps_durable_message_unlet mut config = Config::default();config.action_dir = temp.path().into();let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config), "gpt-4o", "openai");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config),+ "gpt-4o",+ "openai",+ );let bytes = b"\x89PNG\r\n\x1a\noriginal";let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {@@ -434,7 +475,13 @@ async fn derivative_cache_cannot_overwrite_original_named_like_cache() {assert_eq!(files.len(), 1);assert_eq!(files[0].name, ".openhuman-intake.txt");let probe = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), probe.clone(), Arc::new(config.clone()), "unknown", "custom");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ probe.clone(),+ Arc::new(config.clone()),+ "unknown",+ "custom",+ );let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Document(MediaRef::Path {@@ -506,7 +553,13 @@ async fn unknown_model_legacy_inline_replay_uses_specialist_once_across_model_re)]);for _ in 0..2 {let main = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), main.clone(), config.clone(), "unknown-model", "custom");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ main.clone(),+ config.clone(),+ "unknown-model",+ "custom",+ );assert!(wrapper.invoke(&(), request.clone()).await.is_err());let captured = main.requests.lock().unwrap().clone();assert_eq!(captured.len(), 1);@@ -529,7 +582,13 @@ async fn legacy_audio_base64_unsupported_transport_becomes_workspace_reference()let mut config = Config::default();config.action_dir = temp.path().into();let main = Arc::new(Probe::default());- let wrapper = wrap(&crate::core::runtime::DispatchCtx::host_default(), main.clone(), Arc::new(config), "unknown", "custom");+ let wrapper = wrap(+ &crate::core::runtime::DispatchCtx::host_default(),+ main.clone(),+ Arc::new(config),+ "unknown",+ "custom",+ );let request = ModelRequest::new(vec![Message::User(tinyinference_llm::message::UserMessage {content: vec![ContentBlock::Audio(MediaRef::Base64 {diff --git a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rsindex 1eae8e910f..5d6450070a 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/bundle.rs@@ -176,7 +176,10 @@ impl OpenHumanHostBundleFactory {security = security.with_tool_policy(policy);}let security = Arc::new(security);- let models = Arc::new(OpenHumanModelResolver::new(Arc::clone(&inputs.config)).with_dispatch(turn.dispatch_ctx()));+ let models = Arc::new(+ OpenHumanModelResolver::new(Arc::clone(&inputs.config))+ .with_dispatch(turn.dispatch_ctx()),+ );let budget = Arc::new(OpenHumanBudgetGate::new(Arc::clone(&inputs.config)).with_dispatch(turn.dispatch_ctx()),);diff --git a/crates/openhuman-core/src/agent/tinyagents/host/model_resolver.rs b/crates/openhuman-core/src/agent/tinyagents/host/model_resolver.rsindex bcf8513b14..306ef8e149 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/model_resolver.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/model_resolver.rs@@ -315,20 +315,20 @@ impl OpenHumanModelResolver {// The one construction chokepoint: provider resolution, BYOK/local/managed// selection, and the egress disclosure all happen inside here.- let (model, model_id) =- create_chat_model_with_model_id_in(- &self.dispatch.clone().unwrap_or_else(crate::core::runtime::DispatchCtx::host_default),- role,- &self.config,- self.temperature,- )- .map_err(- |error| {- TinyAgentsError::Model(format!(- "openhuman: no model for workload role `{role}`: {error}"- ))- },- )?;+ let (model, model_id) = create_chat_model_with_model_id_in(+ &self+ .dispatch+ .clone()+ .unwrap_or_else(crate::core::runtime::DispatchCtx::host_default),+ role,+ &self.config,+ self.temperature,+ )+ .map_err(|error| {+ TinyAgentsError::Model(format!(+ "openhuman: no model for workload role `{role}`: {error}"+ ))+ })?;tracing::debug!(target: "tinyagents",diff --git a/crates/openhuman-core/src/agent/tinyagents/reaper.rs b/crates/openhuman-core/src/agent/tinyagents/reaper.rsindex 4d6123b04f..e2a2dce8a9 100644--- a/crates/openhuman-core/src/agent/tinyagents/reaper.rs+++ b/crates/openhuman-core/src/agent/tinyagents/reaper.rs@@ -24,10 +24,10 @@ pub(crate) async fn reap_orphaned_runs(workspace: &Path) -> usize {"run reaper",|_| reap_unless_shared(workspace, shared),)- .await- .into_iter()- .map(|(_, reaped)| reaped)- .sum()+ .await+ .into_iter()+ .map(|(_, reaped)| reaped)+ .sum()}async fn reap_unless_shared(workspace: &Path, shared: bool) -> usize {diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs b/crates/openhuman-core/src/agent/tinyagents/turn_models.rsindex b7d85c9a29..b4e9b2ce14 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_models.rs@@ -260,9 +260,11 @@ fn build_turn_models_crate(.host_overrides().and_then(|local| local.role_models.get("summarization").cloned()){- Some(custom) => {- crate::agent::attachments::provider::wrap_injected(ctx, custom, Arc::new(config.clone()))- }+ Some(custom) => crate::agent::attachments::provider::wrap_injected(+ ctx,+ custom,+ Arc::new(config.clone()),+ ),None => build_primary(model)?,};@@ -511,7 +513,11 @@ impl TurnModelSource {);let (primary, summarizer) = match &self.attachment_config {Some(config) => (- crate::agent::attachments::provider::wrap_injected(&self.dispatch_ctx(), primary, config.clone()),+ crate::agent::attachments::provider::wrap_injected(+ &self.dispatch_ctx(),+ primary,+ config.clone(),+ ),crate::agent::attachments::provider::wrap_injected(&self.dispatch_ctx(),direct.clone(),@@ -592,9 +598,11 @@ impl TurnModelSource {.with_request_temperature(temperature),);return Ok(match &self.attachment_config {- Some(config) => {- crate::agent::attachments::provider::wrap_injected(&self.dispatch_ctx(), summarizer, config.clone())- }+ Some(config) => crate::agent::attachments::provider::wrap_injected(+ &self.dispatch_ctx(),+ summarizer,+ config.clone(),+ ),None => summarizer,});}diff --git a/crates/openhuman-core/src/channels/host/adapters.rs b/crates/openhuman-core/src/channels/host/adapters.rsindex 609ad434f6..ac5b8cbeba 100644--- a/crates/openhuman-core/src/channels/host/adapters.rs+++ b/crates/openhuman-core/src/channels/host/adapters.rs@@ -212,12 +212,9 @@ impl ConversationStore for ConversationHistoryStore {limit: usize,) -> anyhow::Result<Vec<ConversationMessage>> {let ctx = DispatchCtx::host_default();- let messages = crate::threads::store::get_messages(- &ctx,- self.workspace_dir.clone(),- session_key,- )- .map_err(|e| anyhow::anyhow!(e))?;+ let messages =+ crate::threads::store::get_messages(&ctx, self.workspace_dir.clone(), session_key)+ .map_err(|e| anyhow::anyhow!(e))?;let start = messages.len().saturating_sub(limit);Ok(messages[start..].iter()diff --git a/crates/openhuman-core/src/channels/host/remote_control.rs b/crates/openhuman-core/src/channels/host/remote_control.rsindex 181790bff7..6b433b3aa5 100644--- a/crates/openhuman-core/src/channels/host/remote_control.rs+++ b/crates/openhuman-core/src/channels/host/remote_control.rs@@ -20,11 +20,8 @@ pub(crate) async fn dispatch_callback(}match request {Request::ListThreads => {- let threads = conversations::list_threads(- dispatch,- ctx.workspace_dir.to_path_buf(),- )- .map_err(|_| tinybus::Error::failed("conversation state unavailable"))?;+ let threads = conversations::list_threads(dispatch, ctx.workspace_dir.to_path_buf())+ .map_err(|_| tinybus::Error::failed("conversation state unavailable"))?;Ok(Response::Threads(threads.into_iter()diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rsindex 115ace0656..73869968f5 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs@@ -154,7 +154,12 @@ pub(crate) async fn run_relay_turn(SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir).with_privacy_mode(config.privacy.mode),);- let parts = match build_channel_turn_parts(&dispatch_ctx, &config, &security, PromptToolDescs::Registered) {+ let parts = match build_channel_turn_parts(+ &dispatch_ctx,+ &config,+ &security,+ PromptToolDescs::Registered,+ ) {Ok(parts) => parts,Err(error) => {tracing::error!(diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rsindex e7693174a4..2a3926f070 100644--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs@@ -29,16 +29,17 @@ async fn relayed_thread_and_external_authority_survive_scoped_spawn() {async {crate::agent::turn_origin::with_origin(origin, async {let (child_thread, child_agent, child_origin) =- crate::core::runtime::DispatchCtx::ambient().spawn(async {- (- CoreContext::current_channel_thread(),- CoreContext::scoped()- .and_then(|ctx| ctx.session_agent().map(str::to_owned)),- crate::agent::turn_origin::current(),- )- })- .await- .unwrap();+ crate::core::runtime::DispatchCtx::ambient()+ .spawn(async {+ (+ CoreContext::current_channel_thread(),+ CoreContext::scoped()+ .and_then(|ctx| ctx.session_agent().map(str::to_owned)),+ crate::agent::turn_origin::current(),+ )+ })+ .await+ .unwrap();assert_eq!(child_thread.as_deref(), Some(thread.as_str()));assert_eq!(child_agent.as_deref(), Some("relay-agent"));assert!(matches!(diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rsindex 008c2b6504..e27ab30361 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers_tests.rs@@ -43,8 +43,7 @@ async fn canceled_waiter_closes_handle_returned_by_in_flight_typing_start() {stopped: std::sync::Mutex::new(Some(sender)),});let cancellation = tokio_util::sync::CancellationToken::new();- let waiter =- spawn_typing_task(channel.clone(), "recipient".into(), cancellation.clone());+ let waiter = spawn_typing_task(channel.clone(), "recipient".into(), cancellation.clone());channel.started.notified().await;waiter.abort();cancellation.cancel();diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rsindex 9a0afbbd8f..e62cc81605 100644--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs@@ -50,7 +50,9 @@ impl ModuleChannelRuntime {// Queued deliveries from before the storage contract move into the// module's storage before it starts and reads its queue. Best effort:// a failure is retried at the next start, never fatal to channels.- match super::delivery_import::import_legacy_delivery(dispatch_ctx, &config.workspace_dir).await {+ match super::delivery_import::import_legacy_delivery(dispatch_ctx, &config.workspace_dir)+ .await+ {Ok(outcome) => tracing::debug!("[channels] legacy delivery import: {outcome:?}"),Err(error) => {tracing::warn!("[channels] legacy delivery import failed, will retry: {error:#}");diff --git a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rsindex f1bd7a66c6..7d9dfe7093 100644--- a/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/turn_parts.rs@@ -145,8 +145,7 @@ pub(crate) fn build_channel_turn_parts(config.workspace_dir.clone(),)?;let workspace = config.workspace_dir.clone();- let capabilities =- crate::profiles::capabilities::ProfileCapabilities::in_ctx(dispatch);+ let capabilities = crate::profiles::capabilities::ProfileCapabilities::in_ctx(dispatch);let tools_registry = Arc::new(if capabilities.is_some() {// The profile host route builds the selected belt once with the exact// durable thread. No second, unnamed factory invocation is needed here.diff --git a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rsindex d297fe4c58..a170e8b0f5 100644--- a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs+++ b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs@@ -156,14 +156,15 @@ async fn a_context_spawn_keeps_the_agent_context_and_tokio_spawn_does_not() {);let (scoped, bare) = CoreContext::scope(alpha, async {- let scoped = DispatchCtx::ambient().spawn(async {- (- current_agent_id(),- DispatchCtx::ambient().agent_policy().map(|p| p.autonomy),- )- })- .await- .unwrap();+ let scoped = DispatchCtx::ambient()+ .spawn(async {+ (+ current_agent_id(),+ DispatchCtx::ambient().agent_policy().map(|p| p.autonomy),+ )+ })+ .await+ .unwrap();let bare = tokio::spawn(async { CoreContext::scoped().is_some() }).await.unwrap();diff --git a/crates/openhuman-core/src/core/runtime/bootstrap.rs b/crates/openhuman-core/src/core/runtime/bootstrap.rsindex 280583d039..fad50400ff 100644--- a/crates/openhuman-core/src/core/runtime/bootstrap.rs+++ b/crates/openhuman-core/src/core/runtime/bootstrap.rs@@ -164,10 +164,8 @@ pub(crate) async fn bootstrap_core_runtime(// result never reached its chat thread is still pending in the durable// completion log (`<workspace>/.openhuman/background_completions.jsonl`).// Schedule its delivery turn through the normal idle-gated path.- let redelivering = crate::agent::orchestration::background_delivery::recover_on_boot(- ctx,- &workspace_dir,- );+ let redelivering =+ crate::agent::orchestration::background_delivery::recover_on_boot(ctx, &workspace_dir);if redelivering > 0 {log::info!("[runtime] scheduled redelivery of undelivered background completions for \diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex 15a090cd54..4ffde87879 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -305,8 +305,13 @@ impl CoreContext {// background jobs start later, from CoreRuntime::start_services(), after a transport binds// succeeds.let runtime_config = config.clone();- super::bootstrap::bootstrap_core_runtime(host_kind, config, domains, &super::DispatchCtx::new(ctx.clone()))- .await;+ super::bootstrap::bootstrap_core_runtime(+ host_kind,+ config,+ domains,+ &super::DispatchCtx::new(ctx.clone()),+ )+ .await;Ok((ctx, has_operator_token, runtime_config))}diff --git a/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs b/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rsindex 916dd94cfd..cec66735b2 100644--- a/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs+++ b/crates/openhuman-core/src/core/runtime/context_turn_origin_tests.rs@@ -113,10 +113,10 @@ async fn bound_external_authority_wins_over_legacy_trusted_automation() {Some(AgentTurnOrigin::ExternalChannel { sender, .. })if sender.as_deref() == Some("external-sender")));- let child =- crate::core::runtime::DispatchCtx::ambient().spawn(async { turn_origin::current() })- .await- .unwrap();+ let child = crate::core::runtime::DispatchCtx::ambient()+ .spawn(async { turn_origin::current() })+ .await+ .unwrap();assert!(matches!(child,Some(AgentTurnOrigin::ExternalChannel { .. })@@ -174,27 +174,28 @@ async fn concurrent_channel_turns_keep_tenant_agent_thread_and_policy_isolated()};let turn = context.derive_channel_turn(Some(thread.clone()), Some(origin));CoreContext::scope(turn, async move {- crate::core::runtime::DispatchCtx::ambient().spawn(async move {- barrier.wait().await;- let child = CoreContext::scoped().unwrap();- assert_eq!(child.profile(), Some(format!("profile-{label}").as_str()));- assert_eq!(- child.session_agent(),- Some(format!("agent-{label}").as_str())- );- assert_eq!(CoreContext::current_channel_thread(), Some(thread));- assert_eq!(child.domains(), DomainSet::none());- assert_eq!(child.tool_groups(), Default::default());- assert_eq!(child.embedder_config().unwrap().workspace_dir, workspace);- assert!(Arc::ptr_eq(&child.agent_policy().unwrap(), &policy));- assert!(matches!(- turn_origin::current(),- Some(AgentTurnOrigin::ExternalChannel { channel, sender, .. })- if channel == label && sender == Some(format!("sender-{label}"))- ));- })- .await- .unwrap();+ crate::core::runtime::DispatchCtx::ambient()+ .spawn(async move {+ barrier.wait().await;+ let child = CoreContext::scoped().unwrap();+ assert_eq!(child.profile(), Some(format!("profile-{label}").as_str()));+ assert_eq!(+ child.session_agent(),+ Some(format!("agent-{label}").as_str())+ );+ assert_eq!(CoreContext::current_channel_thread(), Some(thread));+ assert_eq!(child.domains(), DomainSet::none());+ assert_eq!(child.tool_groups(), Default::default());+ assert_eq!(child.embedder_config().unwrap().workspace_dir, workspace);+ assert!(Arc::ptr_eq(&child.agent_policy().unwrap(), &policy));+ assert!(matches!(+ turn_origin::current(),+ Some(AgentTurnOrigin::ExternalChannel { channel, sender, .. })+ if channel == label && sender == Some(format!("sender-{label}"))+ ));+ })+ .await+ .unwrap();}).await;assert!(context.turn_origin.is_none());@@ -208,10 +209,10 @@ async fn concurrent_channel_turns_keep_tenant_agent_thread_and_policy_isolated()#[tokio::test]async fn scoped_spawn_does_not_invent_missing_turn_authority() {CoreContext::scope(ctx("/tmp/origin-missing"), async {- let child =- crate::core::runtime::DispatchCtx::ambient().spawn(async { crate::agent::turn_origin::current() })- .await- .unwrap();+ let child = crate::core::runtime::DispatchCtx::ambient()+ .spawn(async { crate::agent::turn_origin::current() })+ .await+ .unwrap();assert!(child.is_none());}).await;diff --git a/crates/openhuman-core/src/core/runtime/event_ctx_tests.rs b/crates/openhuman-core/src/core/runtime/event_ctx_tests.rsindex 15b7511436..e3a1e3c9f2 100644--- a/crates/openhuman-core/src/core/runtime/event_ctx_tests.rs+++ b/crates/openhuman-core/src/core/runtime/event_ctx_tests.rs@@ -40,7 +40,10 @@ async fn an_event_is_handled_under_its_tenant_while_another_is_active() {assert_eq!(config_a.workspace_dir, spawned.workspace_dir);let for_b = DispatchCtx::for_event(Some(&tenant_of("evt-ctx-b"))).expect("b is live");- (config_a.workspace_dir, for_b.load_config().await.unwrap().workspace_dir)+ (+ config_a.workspace_dir,+ for_b.load_config().await.unwrap().workspace_dir,+ )}).await;diff --git a/crates/openhuman-core/src/core/runtime/spawn_tests.rs b/crates/openhuman-core/src/core/runtime/spawn_tests.rsindex 6dbd654c91..a630311a29 100644--- a/crates/openhuman-core/src/core/runtime/spawn_tests.rs+++ b/crates/openhuman-core/src/core/runtime/spawn_tests.rs@@ -73,7 +73,10 @@ async fn a_task_spawned_from_a_context_keeps_it_across_awaits_and_nested_spawns(.spawn(async {tokio::task::yield_now().await;// A nested spawn from inside re-hands the ambient context.- DispatchCtx::ambient().spawn(async { seen() }).await.unwrap()+ DispatchCtx::ambient()+ .spawn(async { seen() })+ .await+ .unwrap()}).await.unwrap();diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run.rs b/crates/openhuman-core/src/cron/scheduler/agent_run.rsindex 71af68fe89..9e582933a3 100644--- a/crates/openhuman-core/src/cron/scheduler/agent_run.rs+++ b/crates/openhuman-core/src/cron/scheduler/agent_run.rs@@ -20,7 +20,13 @@ pub(super) async fn run_agent_job(job: &CronJob,) -> (bool, String, Option<String>) {let run_id = uuid::Uuid::new_v4().to_string();- run_agent_job_for_run(&crate::core::runtime::DispatchCtx::host_default(), config, job, &run_id).await+ run_agent_job_for_run(+ &crate::core::runtime::DispatchCtx::host_default(),+ config,+ job,+ &run_id,+ )+ .await}pub(super) async fn run_agent_job_for_run(diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rsindex e8e68fb883..263dfcb93b 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs@@ -263,19 +263,21 @@ async fn deliver_to_web_thread(let persist_request = request_id.clone();let persist_text = text.to_string();let persist_ctx = ctx.clone();- persist_ctx.clone().spawn_blocking(move || {- crate::web_chat::persist_delivered_reply(- &persist_ctx,- &workspace,- &persist_thread,- &persist_request,- &persist_text,- &[],- )- })- .await- .map_err(|e| anyhow!("origin reply persistence task failed: {e}"))?- .map_err(|e| anyhow!("could not store the reply in the origin thread: {e}"))?;+ persist_ctx+ .clone()+ .spawn_blocking(move || {+ crate::web_chat::persist_delivered_reply(+ &persist_ctx,+ &workspace,+ &persist_thread,+ &persist_request,+ &persist_text,+ &[],+ )+ })+ .await+ .map_err(|e| anyhow!("origin reply persistence task failed: {e}"))?+ .map_err(|e| anyhow!("could not store the reply in the origin thread: {e}"))?;publish_web_channel_event(WebChannelEvent {event: "proactive_message".to_string(),diff --git a/crates/openhuman-core/src/desktop/control/tools.rs b/crates/openhuman-core/src/desktop/control/tools.rsindex 5c8ab6947c..90c66c11e6 100644--- a/crates/openhuman-core/src/desktop/control/tools.rs+++ b/crates/openhuman-core/src/desktop/control/tools.rs@@ -180,17 +180,20 @@ impl Tool for DesktopTool {Err(error) => Err(error.into()),},DesktopToolKind::Goal => {- let live_config = match crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context)+ let live_config =+ match crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(+ context,+ ).load_config().await- {- Ok(config) => config,- Err(error) => {- return Ok(ToolResult::error(format!(- "Desktop approval setting is unavailable: {error}"- )))- }- };+ {+ Ok(config) => config,+ Err(error) => {+ return Ok(ToolResult::error(format!(+ "Desktop approval setting is unavailable: {error}"+ )))+ }+ };approvals_enabled = live_config.desktop.approvals_enabled;match declared::goal_request(&args, approvals_enabled) {Ok((member, request)) => {diff --git a/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rs b/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rsindex f8d3af1b85..c6f673c54b 100644--- a/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rs+++ b/crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rs@@ -553,12 +553,22 @@ async fn a_noted_cron_completion_names_its_agent() {success: true,output: String::new(),};- let owner = event_owner(&crate::core::runtime::DispatchCtx::host_default(), &crate::config::Config::default(), &event).await;+ let owner = event_owner(+ &crate::core::runtime::DispatchCtx::host_default(),+ &crate::config::Config::default(),+ &event,+ )+ .await;assert_eq!(owner, Ok(Some("notif-owner-agent".to_string())));// Taken: asked again, the job is no one's (no backend installed here).if crate::storage::installed().is_none() {assert_eq!(- event_owner(&crate::core::runtime::DispatchCtx::host_default(), &crate::config::Config::default(), &event).await,+ event_owner(+ &crate::core::runtime::DispatchCtx::host_default(),+ &crate::config::Config::default(),+ &event+ )+ .await,Ok(None));}diff --git a/crates/openhuman-core/src/flows/bus/dedup_commit.rs b/crates/openhuman-core/src/flows/bus/dedup_commit.rsindex 8097ec1ef8..931c2179bf 100644--- a/crates/openhuman-core/src/flows/bus/dedup_commit.rs+++ b/crates/openhuman-core/src/flows/bus/dedup_commit.rs@@ -206,10 +206,7 @@ impl DedupCommitSubscriber {ctx: &crate::core::runtime::DispatchCtx,flow_id: &str,) -> Vec<String> {- match store::get_flow(- &super::owner::config_for_scope(ctx, &self.config),- flow_id,- ) {+ match store::get_flow(&super::owner::config_for_scope(ctx, &self.config), flow_id) {Ok(Some(flow)) => flow.graph.nodesdiff --git a/crates/openhuman-core/src/flows/bus/owner.rs b/crates/openhuman-core/src/flows/bus/owner.rsindex 3f8244db4e..375e12423d 100644--- a/crates/openhuman-core/src/flows/bus/owner.rs+++ b/crates/openhuman-core/src/flows/bus/owner.rs@@ -86,12 +86,7 @@ async fn resolve(/// Runs `step`, handed the owner's context, as `flow_id`'s owner; logs and skips it when the owner is/// unknown (a failed lookup) or no context can act for it.-pub(super) async fn as_owner<F, Fut>(- ctx: &DispatchCtx,- config: &Config,- flow_id: &str,- step: F,-)+pub(super) async fn as_owner<F, Fut>(ctx: &DispatchCtx, config: &Config, flow_id: &str, step: F)whereF: FnOnce(DispatchCtx) -> Fut,Fut: std::future::Future<Output = ()>,diff --git a/crates/openhuman-core/src/flows/bus/owner_tests.rs b/crates/openhuman-core/src/flows/bus/owner_tests.rsindex e4c8beb3db..22c03fb828 100644--- a/crates/openhuman-core/src/flows/bus/owner_tests.rs+++ b/crates/openhuman-core/src/flows/bus/owner_tests.rs@@ -11,7 +11,10 @@ async fn without_a_backend_every_flow_is_local() {workspace_dir: dir.path().to_path_buf(),..Config::default()};- assert_eq!(flow_owner(&DispatchCtx::unbound(), &config, "any-flow").await, Ok(None));+ assert_eq!(+ flow_owner(&DispatchCtx::unbound(), &config, "any-flow").await,+ Ok(None)+ );}#[test]@@ -51,18 +54,27 @@ async fn a_cached_owner_is_dropped_once_its_scope_loses_the_flow() {crate::flows::store::upsert_flow(&config, &local_flow("owner-test-revalidate")).unwrap();// Found in `local`, and remembered there.- assert_eq!(resolve(&DispatchCtx::unbound(), &config, "owner-test-revalidate").await, Ok(None));+ assert_eq!(+ resolve(&DispatchCtx::unbound(), &config, "owner-test-revalidate").await,+ Ok(None)+ );assert_eq!(OWNERS.lock().unwrap().get("owner-test-revalidate"),Some(&None));// Still there: the cached answer stands.- assert_eq!(resolve(&DispatchCtx::unbound(), &config, "owner-test-revalidate").await, Ok(None));+ assert_eq!(+ resolve(&DispatchCtx::unbound(), &config, "owner-test-revalidate").await,+ Ok(None)+ );assert!(OWNERS.lock().unwrap().contains_key("owner-test-revalidate"));// Gone: the cache entry is dropped and nothing is found.crate::flows::store::remove_flow(&config, "owner-test-revalidate").unwrap();- assert_eq!(resolve(&DispatchCtx::unbound(), &config, "owner-test-revalidate").await, Ok(None));+ assert_eq!(+ resolve(&DispatchCtx::unbound(), &config, "owner-test-revalidate").await,+ Ok(None)+ );assert!(!OWNERS.lock().unwrap().contains_key("owner-test-revalidate"));}diff --git a/crates/openhuman-core/src/flows/bus/trigger.rs b/crates/openhuman-core/src/flows/bus/trigger.rsindex bacc3c701b..3f35049287 100644--- a/crates/openhuman-core/src/flows/bus/trigger.rs+++ b/crates/openhuman-core/src/flows/bus/trigger.rs@@ -112,10 +112,7 @@ impl FlowTriggerSubscriber {}/// The configuration to handle an event under (`super::owner::config_for_scope`).- pub(super) fn config_for_scope(- &self,- ctx: &crate::core::runtime::DispatchCtx,- ) -> Arc<Config> {+ pub(super) fn config_for_scope(&self, ctx: &crate::core::runtime::DispatchCtx) -> Arc<Config> {super::owner::config_for_scope(ctx, &self.config)}diff --git a/crates/openhuman-core/src/flows/bus_subscriber_tests.rs b/crates/openhuman-core/src/flows/bus_subscriber_tests.rsindex 58be8c1b7c..746332878b 100644--- a/crates/openhuman-core/src/flows/bus_subscriber_tests.rs+++ b/crates/openhuman-core/src/flows/bus_subscriber_tests.rs@@ -65,7 +65,11 @@ async fn handle_does_not_panic_on_arbitrary_events() {job_type: "shell".into(),}).await;- sub.dispatch_schedule_tick(&crate::core::runtime::DispatchCtx::host_default(), "missing-flow").await;+ sub.dispatch_schedule_tick(+ &crate::core::runtime::DispatchCtx::host_default(),+ "missing-flow",+ )+ .await;}#[test]@@ -160,7 +164,11 @@ async fn handle_schedule_tick_ignores_disabled_flow() {// Must not panic and must not spawn a run for a disabled flow — we// can't directly observe "no run happened" without a full flows_run// fixture, but this exercises the early-return path without error.- sub.dispatch_schedule_tick(&crate::core::runtime::DispatchCtx::host_default(), "sched-flow").await;+ sub.dispatch_schedule_tick(+ &crate::core::runtime::DispatchCtx::host_default(),+ "sched-flow",+ )+ .await;}// ── in-flight dedupe (CodeRabbit finding B) ─────────────────────diff --git a/crates/openhuman-core/src/flows/memory_tools.rs b/crates/openhuman-core/src/flows/memory_tools.rsindex e264776b9c..714d9b5e6a 100644--- a/crates/openhuman-core/src/flows/memory_tools.rs+++ b/crates/openhuman-core/src/flows/memory_tools.rs@@ -347,15 +347,18 @@ impl Tool for FlowMemoryRecallTool {.and_then(serde_json::Value::as_u64).map_or(5, |v| v as usize);- let config = match crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context)- .load_config().await {- Ok(config) => config,- Err(error) => {- return Ok(ToolResult::error(format!(- "Flow memory recall failed: {error}"- )))- }- };+ let config =+ match crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context)+ .load_config()+ .await+ {+ Ok(config) => config,+ Err(error) => {+ return Ok(ToolResult::error(format!(+ "Flow memory recall failed: {error}"+ )))+ }+ };tracing::debug!(target: "flows",scope,@@ -497,15 +500,18 @@ impl Tool for FlowMemoryRememberTool {));}- let config = match crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context)- .load_config().await {- Ok(config) => config,- Err(error) => {- return Ok(ToolResult::error(format!(- "Failed to store flow memory: {error}"- )))- }- };+ let config =+ match crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(tool_context)+ .load_config()+ .await+ {+ Ok(config) => config,+ Err(error) => {+ return Ok(ToolResult::error(format!(+ "Failed to store flow memory: {error}"+ )))+ }+ };match remember_keyed(&config, &flow_id, key, content, kind).await {Ok(_) => Ok(ToolResult::success(format!("Stored flow memory: {key}"))),Err(error) => {diff --git a/crates/openhuman-core/src/flows/ops/run_management.rs b/crates/openhuman-core/src/flows/ops/run_management.rsindex 1e47eb6328..6f0a17b2f6 100644--- a/crates/openhuman-core/src/flows/ops/run_management.rs+++ b/crates/openhuman-core/src/flows/ops/run_management.rs@@ -268,19 +268,15 @@ pub async fn sweep_orphaned_running_runs_on_boot(config: &Config) -> usize {tracing::info!(target: "flows", "[flows] boot sweep: skipped, the storage backend is shared");0}- rm::BootSweepPlan::EveryScope => {- crate::storage::agents::for_each_scope(- &crate::core::runtime::DispatchCtx::host_default(),- "flows boot sweep",- |_| {- sweep_orphaned_running_runs_in_scope(config)- },- )- .await- .into_iter()- .map(|(_, swept)| swept)- .sum()- }+ rm::BootSweepPlan::EveryScope => crate::storage::agents::for_each_scope(+ &crate::core::runtime::DispatchCtx::host_default(),+ "flows boot sweep",+ |_| sweep_orphaned_running_runs_in_scope(config),+ )+ .await+ .into_iter()+ .map(|(_, swept)| swept)+ .sum(),}}diff --git a/crates/openhuman-core/src/flows/ops/triggers.rs b/crates/openhuman-core/src/flows/ops/triggers.rsindex f231f742d2..bc72fcb801 100644--- a/crates/openhuman-core/src/flows/ops/triggers.rs+++ b/crates/openhuman-core/src/flows/ops/triggers.rs@@ -178,13 +178,12 @@ pub async fn reconcile_schedule_triggers_on_boot(config: &Config) -> Result<(),// (`crate::storage::agents`); each scope's flows get their cron jobs in// that scope, where the scheduler visits them.let mut errors = Vec::new();- for (agent, result) in- crate::storage::agents::for_each_scope(- &crate::core::runtime::DispatchCtx::host_default(),- "flows schedule reconcile",- |_| reconcile_schedule_triggers_in_scope(config),- )- .await+ for (agent, result) in crate::storage::agents::for_each_scope(+ &crate::core::runtime::DispatchCtx::host_default(),+ "flows schedule reconcile",+ |_| reconcile_schedule_triggers_in_scope(config),+ )+ .await{if let Err(error) = result {errors.push(format!("{}: {error}", agent.as_deref().unwrap_or("local")));diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs b/crates/openhuman-core/src/flows/tinyflows/caps/agent.rsindex b38ca55cec..9c57af3b11 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/agent.rs@@ -266,7 +266,7 @@ impl AgentRunner for OpenHumanAgentRunner {entry_model.as_deref(),None,)- .await+ .await}AgentRoute::RegistryFallback => {tracing::info!(@@ -385,11 +385,9 @@ impl OpenHumanAgentRunner {let built = match &host {Some(host) => host.session_host(effective.as_ref(), None),- None => OpenHumanSessionHost::from_config_for_agent(- dispatch,- effective.as_ref(),- agent_ref,- ),+ None => {+ OpenHumanSessionHost::from_config_for_agent(dispatch, effective.as_ref(), agent_ref)+ }};let mut agent = built.map_err(|e| {EngineError::Capability(format!(@@ -526,18 +524,15 @@ impl OpenHumanAgentRunner {conn: Option<&str>,) -> Result<Value> {// Resolve + validate the requested agent kind against the registry.- let entry = crate::agent::registry::get_agent(- dispatch,- agent_ref,- )- .await- .map_err(EngineError::Capability)?- .ok_or_else(|| {- EngineError::Capability(format!(+ let entry = crate::agent::registry::get_agent(dispatch, agent_ref)+ .await+ .map_err(EngineError::Capability)?+ .ok_or_else(|| {+ EngineError::Capability(format!("agent node: unknown agent_ref '{agent_ref}' (neither a harness definition nor \a custom agent registry entry)"))- })?;+ })?;if !entry.enabled {return Err(EngineError::Capability(format!("agent node: agent_ref '{agent_ref}' is disabled"diff --git a/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rs b/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rsindex c77ff6d85f..62b20d462b 100644--- a/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rs+++ b/crates/openhuman-core/src/integrations/composio/bus/connection_created_subscriber.rs@@ -95,9 +95,7 @@ impl EventHandler<DomainEvent> for ComposioConnectionCreatedSubscriber {// The cache refresh runs for every toolkit; only the profile fetch is gated on a native provider.let toolkit = toolkit.clone();let connection_id = connection_id.clone();- tokio::spawn(async move {- on_connection_created(&ctx, toolkit, connection_id).await- });+ tokio::spawn(async move { on_connection_created(&ctx, toolkit, connection_id).await });}}diff --git a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rsindex f012b6d6ee..319b8ecd6e 100644--- a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs+++ b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs@@ -195,11 +195,7 @@ impl EventHandler<DomainEvent> for ComposioTriggerSubscriber {// spawned task, because `AGENT_TURN_ORIGIN` is a task-local// and does not cross `tokio::spawn`.let origin = remote_trigger_origin(&envelope);- if let Err(e) = with_origin(- origin,- apply_decision(&ctx, run, &envelope),- )- .await+ if let Err(e) = with_origin(origin, apply_decision(&ctx, run, &envelope)).await{tracing::error!(label = %envelope.display_label,diff --git a/crates/openhuman-core/src/integrations/composio/file_store.rs b/crates/openhuman-core/src/integrations/composio/file_store.rsindex a635f058c1..239c543ee2 100644--- a/crates/openhuman-core/src/integrations/composio/file_store.rs+++ b/crates/openhuman-core/src/integrations/composio/file_store.rs@@ -30,13 +30,10 @@ async fn import_legacy(name: &'static str,) -> Result<(), String> {let marker_docs = docs.clone();- let done =- tokio::task::spawn_blocking(move || marker_docs.legacy_imported(name))- .await- .map_err(|error| format!("[composio:store] checking legacy {name} failed: {error}"))?- .map_err(|error| {- format!("[composio:store] checking legacy {name} failed: {error:#}")- })?;+ let done = tokio::task::spawn_blocking(move || marker_docs.legacy_imported(name))+ .await+ .map_err(|error| format!("[composio:store] checking legacy {name} failed: {error}"))?+ .map_err(|error| format!("[composio:store] checking legacy {name} failed: {error:#}"))?;if done {return Ok(());}@@ -53,13 +50,10 @@ async fn import_legacy(let value: serde_json::Value = serde_json::from_slice(&bytes).map_err(|error| format!("[composio:store] parsing legacy {name} failed: {error}"))?;let docs = docs.clone();- let wrote =- tokio::task::spawn_blocking(move || docs.import_if_absent(name, value))- .await- .map_err(|error| format!("[composio:store] importing legacy {name} failed: {error}"))?- .map_err(|error| {- format!("[composio:store] importing legacy {name} failed: {error:#}")- })?;+ let wrote = tokio::task::spawn_blocking(move || docs.import_if_absent(name, value))+ .await+ .map_err(|error| format!("[composio:store] importing legacy {name} failed: {error}"))?+ .map_err(|error| format!("[composio:store] importing legacy {name} failed: {error:#}"))?;log::debug!("[composio:store] legacy import name={name} wrote={wrote}");Ok(())}diff --git a/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rsindex 9dfbe44a72..a59995c219 100644--- a/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/ops_direct_mode_and_error_classification_tests.rs@@ -177,9 +177,14 @@ async fn composio_authorize_routes_through_direct_mode() {// "composio unavailable / no backend session" instead.let tmp = tempfile::tempdir().unwrap();let config = direct_mode_config(&tmp);- let err = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "gmail", None)- .await- .unwrap_err();+ let err = composio_authorize(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ "gmail",+ None,+ )+ .await+ .unwrap_err();assert!(!err.contains("no backend session"),"direct mode must not surface backend-auth errors, got: {err}"diff --git a/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rsindex 803cb310ed..688f889bbe 100644--- a/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/ops_no_session_and_cache_tests.rs@@ -76,9 +76,14 @@ async fn composio_authorize_errors_without_session() {let _serialised = module_guard().await;let tmp = tempfile::tempdir().unwrap();let config = test_config(&tmp);- let err = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "gmail", None)- .await- .unwrap_err();+ let err = composio_authorize(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ "gmail",+ None,+ )+ .await+ .unwrap_err();// Backend mode (default) without a session — the mode-aware factory// surfaces "no backend session token" once `composio_authorize`// routes through `resolve_composio_route`. Accept either the@@ -348,9 +353,14 @@ async fn composio_authorize_clears_pending_meta_connection_before_handoff() {let base = start_mock_backend(app).await;let tmp = tempfile::tempdir().unwrap();let config = config_with_backend(&tmp, base);- let outcome = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "instagram", None)- .await- .unwrap();+ let outcome = composio_authorize(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ "instagram",+ None,+ )+ .await+ .unwrap();assert_eq!(outcome.value.connection_id, "c-new");assert_eq!(deletes.load(Ordering::SeqCst), 1);}@@ -370,7 +380,14 @@ async fn composio_authorize_via_mock_publishes_event_and_returns_url() {let base = start_mock_backend(app).await;let tmp = tempfile::tempdir().unwrap();let config = config_with_backend(&tmp, base);- let outcome = composio_authorize(&crate::core::runtime::DispatchCtx::host_default(), &config, "gmail", None).await.unwrap();+ let outcome = composio_authorize(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ "gmail",+ None,+ )+ .await+ .unwrap();assert_eq!(outcome.value.connect_url, "https://x");assert_eq!(outcome.value.connection_id, "c1");}diff --git a/crates/openhuman-core/src/integrations/composio/tools/authorize.rs b/crates/openhuman-core/src/integrations/composio/tools/authorize.rsindex 0fde35e67d..ed6d6b8c23 100644--- a/crates/openhuman-core/src/integrations/composio/tools/authorize.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/authorize.rs@@ -7,8 +7,8 @@ use serde_json::{json, Value};use super::live_config::live_composio_config;use super::redact::redact_composio_outcome;-use crate::config::Config;use crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool;+use crate::config::Config;use crate::core::runtime::DispatchCtx;use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolResult, ToolRunContext};@@ -76,7 +76,11 @@ impl Tool for ComposioAuthorizeTool {}impl ComposioAuthorizeTool {- async fn execute_unredacted(&self, ctx: &DispatchCtx, args: Value) -> anyhow::Result<ToolResult> {+ async fn execute_unredacted(+ &self,+ ctx: &DispatchCtx,+ args: Value,+ ) -> anyhow::Result<ToolResult> {let toolkit = args.get("toolkit").and_then(|v| v.as_str())diff --git a/crates/openhuman-core/src/integrations/composio/trigger_history.rs b/crates/openhuman-core/src/integrations/composio/trigger_history.rsindex 03b4a888b7..acf9f0a007 100644--- a/crates/openhuman-core/src/integrations/composio/trigger_history.rs+++ b/crates/openhuman-core/src/integrations/composio/trigger_history.rs@@ -157,11 +157,9 @@ impl TriggerHistory {/// Release the module resource while retaining all persisted documents.pub async fn close(&self) -> Result<(), String> {let lease = Arc::clone(&self.lease);- tokio::spawn(async move {- Self::release(&mut *lease.lock_owned().await).await- })- .await- .map_err(|_| "trigger archive release task failed".to_owned())?+ tokio::spawn(async move { Self::release(&mut *lease.lock_owned().await).await })+ .await+ .map_err(|_| "trigger archive release task failed".to_owned())?}}diff --git a/crates/openhuman-core/src/integrations/task_sources/bus.rs b/crates/openhuman-core/src/integrations/task_sources/bus.rsindex bb3648692b..42bd0bb284 100644--- a/crates/openhuman-core/src/integrations/task_sources/bus.rs+++ b/crates/openhuman-core/src/integrations/task_sources/bus.rs@@ -126,8 +126,9 @@ async fn fire_for_connection(let ctx = ctx.clone();// Scoped: the fetch keeps the scope's agent context.ctx.clone().spawn(async move {- let _ = pipeline::run_source_once(&ctx, &config, &source, FetchReason::ConnectionCreated)- .await;+ let _ =+ pipeline::run_source_once(&ctx, &config, &source, FetchReason::ConnectionCreated)+ .await;});}}diff --git a/crates/openhuman-core/src/integrations/task_sources/bus_tests.rs b/crates/openhuman-core/src/integrations/task_sources/bus_tests.rsindex c4923dd248..aa475edcc6 100644--- a/crates/openhuman-core/src/integrations/task_sources/bus_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/bus_tests.rs@@ -40,9 +40,23 @@ async fn a_new_connection_fires_the_matching_sources_of_the_scope() {).unwrap();}- fire_for_connection(&crate::core::runtime::DispatchCtx::host_default(), &config, ProviderSlug::Github, "github", "conn-1").await;+ fire_for_connection(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ ProviderSlug::Github,+ "github",+ "conn-1",+ )+ .await;// A toolkit with no sources fires nothing.- fire_for_connection(&crate::core::runtime::DispatchCtx::host_default(), &config, ProviderSlug::Notion, "notion", "conn-1").await;+ fire_for_connection(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ ProviderSlug::Notion,+ "notion",+ "conn-1",+ )+ .await;assert_eq!(store::list_sources(&config).unwrap().len(), 2);}@@ -58,7 +72,14 @@ async fn an_unreadable_scope_is_skipped() {action_dir: blocked,..crate::config::Config::default()};- fire_for_connection(&crate::core::runtime::DispatchCtx::host_default(), &config, ProviderSlug::Github, "github", "conn-1").await;+ fire_for_connection(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ ProviderSlug::Github,+ "github",+ "conn-1",+ )+ .await;}/// Smoke test: the subscriber handles connection events through the scope'sdiff --git a/crates/openhuman-core/src/integrations/task_sources/periodic.rs b/crates/openhuman-core/src/integrations/task_sources/periodic.rsindex cc29e1393f..6492efa4c9 100644--- a/crates/openhuman-core/src/integrations/task_sources/periodic.rs+++ b/crates/openhuman-core/src/integrations/task_sources/periodic.rs@@ -98,11 +98,12 @@ async fn run_loop() {ticker.tick().await;// `local`, then every agent that keeps its sources in its own storage// scope (`crate::storage::agents`).- for (agent, result) in- crate::storage::agents::for_each_live_scope(&DispatchCtx::host_default(), "task_sources", |ctx| async move {- run_one_tick(&ctx).await- })- .await+ for (agent, result) in crate::storage::agents::for_each_live_scope(+ &DispatchCtx::host_default(),+ "task_sources",+ |ctx| async move { run_one_tick(&ctx).await },+ )+ .await{if let Err(e) = result {tracing::warn!(error = %e, agent = agent.as_deref().unwrap_or("local"), "[task_sources:periodic] tick failed (continuing)");diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs b/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rsindex dc2bece709..bcf968301a 100644--- a/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs@@ -196,7 +196,13 @@ async fn manual_fetch_still_returns_the_explanatory_error() {std::fs::create_dir_all(&config.workspace_dir).expect("workspace");let s = source("ts-manual-path-xyz", 1800);- let outcome = pipeline::run_source_once(&crate::core::runtime::DispatchCtx::host_default(), &config, &s, FetchReason::Manual).await;+ let outcome = pipeline::run_source_once(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &s,+ FetchReason::Manual,+ )+ .await;let error = outcome.errordiff --git a/crates/openhuman-core/src/integrations/task_sources/pipeline_tests.rs b/crates/openhuman-core/src/integrations/task_sources/pipeline_tests.rsindex 1329b341fe..64622951d4 100644--- a/crates/openhuman-core/src/integrations/task_sources/pipeline_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/pipeline_tests.rs@@ -61,7 +61,13 @@ async fn fetch_surfaces_error_for_every_toolkit() {let config = test_config(&tmp);let source = add_github_source(&config);- let outcome = run_source_once(&crate::core::runtime::DispatchCtx::host_default(), &config, &source, FetchReason::Manual).await;+ let outcome = run_source_once(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &source,+ FetchReason::Manual,+ )+ .await;assert!(outcome.error.is_some(), "fetch must refuse, not panic");assert_eq!(outcome.fetched, 0);assert_eq!(outcome.routed, 0);@@ -78,8 +84,20 @@ async fn refusal_is_stable_across_repeated_passes() {let config = test_config(&tmp);let source = add_github_source(&config);- let first = run_source_once(&crate::core::runtime::DispatchCtx::host_default(), &config, &source, FetchReason::Manual).await;- let second = run_source_once(&crate::core::runtime::DispatchCtx::host_default(), &config, &source, FetchReason::Manual).await;+ let first = run_source_once(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &source,+ FetchReason::Manual,+ )+ .await;+ let second = run_source_once(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &source,+ FetchReason::Manual,+ )+ .await;assert!(first.error.is_some());assert!(second.error.is_some());assert_eq!(second.routed, 0);@@ -92,7 +110,13 @@ async fn refusal_records_a_fetch_history_entry() {let config = test_config(&tmp);let source = add_github_source(&config);- let _ = run_source_once(&crate::core::runtime::DispatchCtx::host_default(), &config, &source, FetchReason::Manual).await;+ let _ = run_source_once(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &source,+ FetchReason::Manual,+ )+ .await;// `run_source_once` records the failed pass so the UI can show why a// source has never ingested anything, rather than looking silently idle.@@ -165,7 +189,13 @@ async fn missing_provider_surfaces_error_in_outcome() {).unwrap();- let outcome = run_source_once(&crate::core::runtime::DispatchCtx::host_default(), &config, &source, FetchReason::Manual).await;+ let outcome = run_source_once(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &source,+ FetchReason::Manual,+ )+ .await;assert!(outcome.error.is_some());assert_eq!(outcome.routed, 0);}diff --git a/crates/openhuman-core/src/integrations/task_sources/route_tests.rs b/crates/openhuman-core/src/integrations/task_sources/route_tests.rsindex 0801de810d..8122ac00bb 100644--- a/crates/openhuman-core/src/integrations/task_sources/route_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/route_tests.rs@@ -55,7 +55,12 @@ async fn collect_only_target_routes_without_side_effects() {let config = Config::default();let src = github_source(SourceTarget::TodoOnly);- route_enriched(&crate::core::runtime::DispatchCtx::host_default(), &config, &src, &enriched("123"))- .await- .expect("collect-only routing is a no-op");+ route_enriched(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ &src,+ &enriched("123"),+ )+ .await+ .expect("collect-only routing is a no-op");}diff --git a/crates/openhuman-core/src/integrations/task_sources/tools.rs b/crates/openhuman-core/src/integrations/task_sources/tools.rsindex 2ba7f22cd8..4fac0081f1 100644--- a/crates/openhuman-core/src/integrations/task_sources/tools.rs+++ b/crates/openhuman-core/src/integrations/task_sources/tools.rs@@ -194,7 +194,10 @@ impl Tool for TaskSourceFetchTool {log::debug!("[tool][task_sources] fetch invoked");let id = read_required_str(&args, "id")?;let ctx = crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context);- emit!(ops::fetch(&ctx, &self.config, &id).await, "task_source_fetch")+ emit!(+ ops::fetch(&ctx, &self.config, &id).await,+ "task_source_fetch"+ )}}diff --git a/crates/openhuman-core/src/mcp/server/module.rs b/crates/openhuman-core/src/mcp/server/module.rsindex 18faa5a940..2b5124f220 100644--- a/crates/openhuman-core/src/mcp/server/module.rs+++ b/crates/openhuman-core/src/mcp/server/module.rs@@ -411,7 +411,8 @@ impl ServerSession {{*pending = Some(PendingCallback::Running {id: callback_id.clone(),- task: crate::core::runtime::DispatchCtx::ambient().spawn((self.callback_dispatch)(call)),+ task: crate::core::runtime::DispatchCtx::ambient()+ .spawn((self.callback_dispatch)(call)),});}let result = match pending.as_mut() {diff --git a/crates/openhuman-core/src/memory/backfill.rs b/crates/openhuman-core/src/memory/backfill.rsindex 22b2a6fc80..8605898230 100644--- a/crates/openhuman-core/src/memory/backfill.rs+++ b/crates/openhuman-core/src/memory/backfill.rs@@ -209,7 +209,8 @@ pub async fn status(ctx: &DispatchCtx, config: &Config) -> MemoryResult<Backfillpub async fn start(ctx: &DispatchCtx,config: &Config,- params: BackfillStartParams) -> MemoryResult<BackfillView> {+ params: BackfillStartParams,+) -> MemoryResult<BackfillView> {if !params.consent {return Err(MemoryError::invalid("storing past chats uploads them to the selected engine; pass consent: true",diff --git a/crates/openhuman-core/src/memory/backfill_tests.rs b/crates/openhuman-core/src/memory/backfill_tests.rsindex 76eb1129a8..fac061d695 100644--- a/crates/openhuman-core/src/memory/backfill_tests.rs+++ b/crates/openhuman-core/src/memory/backfill_tests.rs@@ -67,13 +67,21 @@ async fn wait_done(config: &Config) -> BackfillView {async fn refuses_without_consent_and_with_memory_off() {let tmp = tempfile::tempdir().unwrap();let config = config_in(&tmp);- let error = start(&DispatchCtx::ambient(), &config, BackfillStartParams { consent: false })- .await- .unwrap_err();+ let error = start(+ &DispatchCtx::ambient(),+ &config,+ BackfillStartParams { consent: false },+ )+ .await+ .unwrap_err();assert_eq!(error.code(), INVALID_REQUEST);- let error = start(&DispatchCtx::ambient(), &config, BackfillStartParams { consent: true })- .await- .unwrap_err();+ let error = start(+ &DispatchCtx::ambient(),+ &config,+ BackfillStartParams { consent: true },+ )+ .await+ .unwrap_err();assert_eq!(error.code(), MEMORY_OFF);}@@ -128,9 +136,13 @@ async fn stores_past_chats_once_and_skips_what_live_logging_took() {assert_eq!(before.state.phase, ImportPhase::Idle);assert_eq!((before.pending_threads, before.pending_turns), (2, 3));- let started = start(&DispatchCtx::ambient(), &config, BackfillStartParams { consent: true })- .await- .unwrap();+ let started = start(+ &DispatchCtx::ambient(),+ &config,+ BackfillStartParams { consent: true },+ )+ .await+ .unwrap();assert_eq!(started.state.threads_total, 2);let done = wait_done(&config).await;assert_eq!(done.state.phase, ImportPhase::Done, "{:?}", done.state);@@ -152,9 +164,13 @@ async fn stores_past_chats_once_and_skips_what_live_logging_took() {);// A second run has nothing to send.- start(&DispatchCtx::ambient(), &config, BackfillStartParams { consent: true })- .await- .unwrap();+ start(+ &DispatchCtx::ambient(),+ &config,+ BackfillStartParams { consent: true },+ )+ .await+ .unwrap();let again = wait_done(&config).await;assert_eq!(again.state.items_stored, 0);assert_eq!(stored(&engine, filter).await.len(), 6);diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rsindex 10c660133a..3006d94eda 100644--- a/crates/openhuman-core/src/memory/import.rs+++ b/crates/openhuman-core/src/memory/import.rs@@ -325,12 +325,13 @@ async fn launch(let driver = importer(config, bound.engine, consent, paused);let begin = {let driver = driver.clone();- crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || match mode {- Mode::Import => driver.begin(),- Mode::Retry => driver.begin_retry(),- Mode::ResumeRetry => Ok(driver.begin_retry_resume()),- })- .await+ crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || match mode {+ Mode::Import => driver.begin(),+ Mode::Retry => driver.begin_retry(),+ Mode::ResumeRetry => Ok(driver.begin_retry_resume()),+ })+ .await};let begun: Begun = match begin {Ok(Ok(begun)) => begun,diff --git a/crates/openhuman-core/src/memory/lifecycle/date_hint.rs b/crates/openhuman-core/src/memory/lifecycle/date_hint.rsindex f92bf71f12..0b69927a18 100644--- a/crates/openhuman-core/src/memory/lifecycle/date_hint.rs+++ b/crates/openhuman-core/src/memory/lifecycle/date_hint.rs@@ -25,15 +25,19 @@ const INSTRUCTION: &str = "Return the calendar date range (local dates) that the/// requires of its hint.pub async fn extract(ctx: &crate::core::runtime::DispatchCtx,- config: &Config, user_text: &str, zone: &str) -> Option<TimeHint> {- let (model, model_id) =- match crate::inference::provider::create_chat_model_with_model_id_in(ctx, "chat", config, 0.0) {- Ok(model) => model,- Err(error) => {- tracing::debug!(%error, "[memory:date_hint] no chat model");- return None;- }- };+ config: &Config,+ user_text: &str,+ zone: &str,+) -> Option<TimeHint> {+ let (model, model_id) = match crate::inference::provider::create_chat_model_with_model_id_in(+ ctx, "chat", config, 0.0,+ ) {+ Ok(model) => model,+ Err(error) => {+ tracing::debug!(%error, "[memory:date_hint] no chat model");+ return None;+ }+ };let system = format!("{}\n\n{INSTRUCTION}",crate::agent::prompts::current_datetime_line(Some(zone))diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks.rs b/crates/openhuman-core/src/memory/lifecycle/hooks.rsindex 2f83c67710..0909d0dda4 100644--- a/crates/openhuman-core/src/memory/lifecycle/hooks.rs+++ b/crates/openhuman-core/src/memory/lifecycle/hooks.rs@@ -212,9 +212,7 @@ pub async fn pre_turn(let dispatch = ctx.clone();let identity = identity.clone();let thread = input.thread_id.clone();- let task = ctx.spawn(async move {- pre_turn_work(&dispatch, &config, &identity, input).await- });+ let task = ctx.spawn(async move { pre_turn_work(&dispatch, &config, &identity, input).await });let pack = match tokio::time::timeout(timeout, task).await {Ok(Ok(pack)) => pack,Ok(Err(error)) => {@@ -279,10 +277,13 @@ pub(crate) async fn pre_turn_work(tokio::time::Instant::now() + timeout.saturating_sub(Duration::from_millis(100));async move {let zone = config.time_zone();- tokio::time::timeout_at(deadline, super::date_hint::extract(&ctx, &config, &text, &zone))- .await- .ok()- .flatten()+ tokio::time::timeout_at(+ deadline,+ super::date_hint::extract(&ctx, &config, &text, &zone),+ )+ .await+ .ok()+ .flatten()}});let pack = async move {diff --git a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rsindex 71ed7ce97f..5fd78aee0f 100644--- a/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/prefetch_tests.rs@@ -376,13 +376,15 @@ async fn queued_work_keeps_the_callers_core_context() {enqueue(cache.clone(),key.clone(),- Box::pin(crate::core::runtime::DispatchCtx::ambient().enter(async move {- assert!(Arc::ptr_eq(- &crate::core::runtime::CoreContext::scoped().unwrap(),- &expected- ));- Some(pack("scoped"))- })),+ Box::pin(+ crate::core::runtime::DispatchCtx::ambient().enter(async move {+ assert!(Arc::ptr_eq(+ &crate::core::runtime::CoreContext::scoped().unwrap(),+ &expected+ ));+ Some(pack("scoped"))+ }),+ ),);drain(&cache, &key).await;assert_eq!(completed(&cache, &key).unwrap().markdown, "scoped");diff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rsindex 96c8a43d61..915430e01d 100644--- a/crates/openhuman-core/src/memory/tool_writes.rs+++ b/crates/openhuman-core/src/memory/tool_writes.rs@@ -434,19 +434,20 @@ pub(crate) async fn fence_and_clear(config: &Config) -> MemoryResult<WriteFence>};fence.guard = Some(state.barrier.clone().write_owned().await);let snapshot_config = config.clone();- crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {- let _guard = LOCK- .lock()- .unwrap_or_else(std::sync::PoisonError::into_inner);- for file in partitions(&snapshot_config)? {- queue(&file)- .clear_stale(state.gate.process(), fencing_generation)- .map_err(map_pending)?;- }- Ok::<_, MemoryError>(())- })- .await- .map_err(|_| unavailable())??;+ crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || {+ let _guard = LOCK+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner);+ for file in partitions(&snapshot_config)? {+ queue(&file)+ .clear_stale(state.gate.process(), fencing_generation)+ .map_err(map_pending)?;+ }+ Ok::<_, MemoryError>(())+ })+ .await+ .map_err(|_| unavailable())??;tracing::debug!("[memory:tool_writes] erase fence in force; prior pending writes cleared");Ok(fence)}@@ -466,19 +467,19 @@ pub(super) fn schedule_all(config: Arc<Config>) {}crate::core::runtime::DispatchCtx::ambient().spawn(async move {let scan_config = config.clone();- let files =- match crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || partitions(&scan_config))- .await- {- Ok(Ok(files)) => files,- _ => {- tracing::debug!(- code = "QUEUE_UNAVAILABLE",- "[memory:tool_writes] retry discovery deferred"- );- return;- }- };+ let files = match crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || partitions(&scan_config))+ .await+ {+ Ok(Ok(files)) => files,+ _ => {+ tracing::debug!(+ code = "QUEUE_UNAVAILABLE",+ "[memory:tool_writes] retry discovery deferred"+ );+ return;+ }+ };for file in files {schedule_partition(config.clone(), file);}diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rsindex 82b532d549..2d6894f9e9 100644--- a/crates/openhuman-core/src/memory/tools.rs+++ b/crates/openhuman-core/src/memory/tools.rs@@ -391,10 +391,9 @@ impl Tool for MemoryTool {let config = self.config.clone();let write_args = args.clone();let queued_root = facts.reach.at.clone();- let queued = crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {- super::tool_writes::enqueue(&config, &write_args, &facts)- })- .await;+ let queued = crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || super::tool_writes::enqueue(&config, &write_args, &facts))+ .await;return Ok(match queued.unwrap_or_else(|_| {Err(MemoryError::Unavailable(diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rsindex 5e44c61a55..0d955ea436 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs@@ -91,10 +91,9 @@ async fn import_into(scoped: &ScopedStorage, state_dir: &Path) -> Result<Outcomereturn Ok(Outcome::NoSource);}- let legacy =- tokio::task::spawn_blocking(move || read_legacy(&prefs_dir, &triggers_dir))- .await- .context("the legacy reader panicked")??;+ let legacy = tokio::task::spawn_blocking(move || read_legacy(&prefs_dir, &triggers_dir))+ .await+ .context("the legacy reader panicked")??;docs.ensure_collection(&CollectionSpec::new(PREFS_COLLECTION)).awaitdiff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rsindex d69e5a9652..088fbfba61 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs@@ -92,10 +92,9 @@ async fn import_into(}let dir = root.to_owned();- let (originals, mut skipped) =- tokio::task::spawn_blocking(move || read_originals(&dir, now))- .await- .context("the legacy reader panicked")??;+ let (originals, mut skipped) = tokio::task::spawn_blocking(move || read_originals(&dir, now))+ .await+ .context("the legacy reader panicked")??;let (mut imported, mut expired) = (0usize, 0usize);for original in originals {diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rsindex 96a1cb53fc..c5be8a9b03 100644--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs@@ -112,22 +112,21 @@ async fn import_into(}// The files are read on a blocking thread, from copies.- let (legacy_servers, legacy_audit) =- tokio::task::spawn_blocking(move || -> Result<_> {- let servers = if clients.exists() {- read_servers(&clients)?- } else {- Vec::new()- };- let audit = if audit.exists() {- read_audit(&audit)?- } else {- Vec::new()- };- Ok((servers, audit))- })- .await- .context("the legacy reader panicked")??;+ let (legacy_servers, legacy_audit) = tokio::task::spawn_blocking(move || -> Result<_> {+ let servers = if clients.exists() {+ read_servers(&clients)?+ } else {+ Vec::new()+ };+ let audit = if audit.exists() {+ read_audit(&audit)?+ } else {+ Vec::new()+ };+ Ok((servers, audit))+ })+ .await+ .context("the legacy reader panicked")??;for name in [SERVERS, SERVER_NAMES] {docs.ensure_collection(&CollectionSpec::new(name))diff --git a/crates/openhuman-core/src/sandbox/shell_exec.rs b/crates/openhuman-core/src/sandbox/shell_exec.rsindex 84e01f81d6..e864774869 100644--- a/crates/openhuman-core/src/sandbox/shell_exec.rs+++ b/crates/openhuman-core/src/sandbox/shell_exec.rs@@ -122,12 +122,13 @@ pub(crate) async fn run(// cancellation is acknowledged only after the command is gone.let hold = tinytools_std::timeout::ProcessCleanup::hold();let (_caller, abandoned) = tokio::sync::oneshot::channel::<std::convert::Infallible>();- crate::core::runtime::DispatchCtx::ambient().spawn(async move {- let _hold = hold;- run_owned(&config, run, abandoned, meter).await- })- .await- .map_err(|_| anyhow::anyhow!("TinyBox shell worker did not finish"))?+ crate::core::runtime::DispatchCtx::ambient()+ .spawn(async move {+ let _hold = hold;+ run_owned(&config, run, abandoned, meter).await+ })+ .await+ .map_err(|_| anyhow::anyhow!("TinyBox shell worker did not finish"))?}#[cfg(not(feature = "modules"))]{diff --git a/crates/openhuman-core/src/security/credentials/tools.rs b/crates/openhuman-core/src/security/credentials/tools.rsindex f1bd633d94..5c08ec5289 100644--- a/crates/openhuman-core/src/security/credentials/tools.rs+++ b/crates/openhuman-core/src/security/credentials/tools.rs@@ -30,8 +30,7 @@ async fn invoke_hosted(method: &str,params: serde_json::Map<String, Value>,) -> anyhow::Result<Value> {- match crate::core::all::try_invoke_registered_rpc(ctx, method, params).await- {+ match crate::core::all::try_invoke_registered_rpc(ctx, method, params).await {Some(Ok(value)) => Ok(strip_log_envelope(value)),Some(Err(err)) => Err(anyhow::anyhow!("{err}")),None => {@@ -240,9 +239,13 @@ impl Tool for OAuthListTool {) -> anyhow::Result<ToolResult> {let ctx = crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context);log::debug!("[tool][credentials] oauth_list invoked");- let value = invoke_hosted(ctx, "openhuman.auth_oauth_list_integrations", Default::default())- .await- .map_err(|e| anyhow::anyhow!("oauth_list: {e}"))?;+ let value = invoke_hosted(+ ctx,+ "openhuman.auth_oauth_list_integrations",+ Default::default(),+ )+ .await+ .map_err(|e| anyhow::anyhow!("oauth_list: {e}"))?;Ok(ToolResult::success(serde_json::to_string(&value)?))}fn is_concurrency_safe(&self, _args: &serde_json::Value) -> bool {diff --git a/crates/openhuman-core/src/security/devices/owner.rs b/crates/openhuman-core/src/security/devices/owner.rsindex e05f352505..1b1a93ad61 100644--- a/crates/openhuman-core/src/security/devices/owner.rs+++ b/crates/openhuman-core/src/security/devices/owner.rs@@ -152,10 +152,11 @@ pub(super) async fn owner_of(Some(Ok(false)) | None => forget(channel_id),}}- let lookups = crate::storage::agents::for_each_scope(ctx, "device owner", |scope_ctx| async move {- has_live_device(&scope_ctx, channel_id).await- })- .await;+ let lookups =+ crate::storage::agents::for_each_scope(ctx, "device owner", |scope_ctx| async move {+ has_live_device(&scope_ctx, channel_id).await+ })+ .await;let owner = decide(lookups)?;if let Some(owner) = &owner {log::debug!(diff --git a/crates/openhuman-core/src/skills/webhooks/bus.rs b/crates/openhuman-core/src/skills/webhooks/bus.rsindex 6763573b6b..6a50ed0069 100644--- a/crates/openhuman-core/src/skills/webhooks/bus.rs+++ b/crates/openhuman-core/src/skills/webhooks/bus.rs@@ -320,11 +320,7 @@ async fn run_agent_trigger(let origin = crate::agent::triage::remote_trigger_origin(envelope);crate::agent::turn_origin::with_origin(origin,- crate::agent::triage::apply_decision(- ctx,- run.clone(),- envelope,- ),+ crate::agent::triage::apply_decision(ctx, run.clone(), envelope),).await.map_err(|e| format!("apply_decision failed: {e}"))?;diff --git a/crates/openhuman-core/src/storage/agents_tests.rs b/crates/openhuman-core/src/storage/agents_tests.rsindex d8ec5ced5f..2e7ecff80a 100644--- a/crates/openhuman-core/src/storage/agents_tests.rs+++ b/crates/openhuman-core/src/storage/agents_tests.rs@@ -132,34 +132,60 @@ async fn without_a_backend_only_the_local_scope_runs() {return;}let agent = live_agent("agents-test-unvisited");- let runs = for_each_scope(&crate::core::runtime::DispatchCtx::host_default(), "test", |_| async {- CoreContext::current().and_then(|c| c.session_agent().map(str::to_string))- })+ let runs = for_each_scope(+ &crate::core::runtime::DispatchCtx::host_default(),+ "test",+ |_| async { CoreContext::current().and_then(|c| c.session_agent().map(str::to_string)) },+ ).await;assert_eq!(runs.len(), 1);assert_eq!(runs[0].0, None);assert!(for_each_agent("test", |_| async {}).await.is_empty());assert_eq!(- find_owner(&crate::core::runtime::DispatchCtx::host_default(), "test", |_| async { Ok(false) }).await,+ find_owner(+ &crate::core::runtime::DispatchCtx::host_default(),+ "test",+ |_| async { Ok(false) }+ )+ .await,Ok(None),"nothing anywhere");assert_eq!(- find_owner(&crate::core::runtime::DispatchCtx::host_default(), "test", |_| async { Ok(true) }).await,+ find_owner(+ &crate::core::runtime::DispatchCtx::host_default(),+ "test",+ |_| async { Ok(true) }+ )+ .await,Ok(Some(None)));assert!(- find_owner(&crate::core::runtime::DispatchCtx::host_default(), "test", |_| async { Err("down".to_string()) })- .await- .is_err(),+ find_owner(+ &crate::core::runtime::DispatchCtx::host_default(),+ "test",+ |_| async { Err("down".to_string()) }+ )+ .await+ .is_err(),"a failed lookup with no match fails closed");- let inside = within_agent(&crate::core::runtime::DispatchCtx::host_default(), Some("agents-test-unvisited"), async {- CoreContext::current().and_then(|c| c.session_agent().map(str::to_string))- })+ let inside = within_agent(+ &crate::core::runtime::DispatchCtx::host_default(),+ Some("agents-test-unvisited"),+ async { CoreContext::current().and_then(|c| c.session_agent().map(str::to_string)) },+ ).await;assert_eq!(inside.flatten().as_deref(), Some("agents-test-unvisited"));- assert_eq!(within_agent(&crate::core::runtime::DispatchCtx::host_default(), None, async { 7 }).await, Some(7));+ assert_eq!(+ within_agent(+ &crate::core::runtime::DispatchCtx::host_default(),+ None,+ async { 7 }+ )+ .await,+ Some(7)+ );AgentContextRegistry::deregister("agents-test-unvisited", &agent);}@@ -169,7 +195,12 @@ async fn without_a_backend_the_live_pass_runs_only_local() {return;}let agent = live_agent("agents-test-live-pass");- let runs = for_each_live_scope(&crate::core::runtime::DispatchCtx::host_default(), "test", |_| async { 1 }).await;+ let runs = for_each_live_scope(+ &crate::core::runtime::DispatchCtx::host_default(),+ "test",+ |_| async { 1 },+ )+ .await;assert_eq!(runs, vec![(None, 1)]);AgentContextRegistry::deregister("agents-test-live-pass", &agent);}@@ -199,9 +230,13 @@ async fn the_local_pass_runs_outside_the_callers_agent() {}let agent = live_agent("agents-test-caller");let seen = CoreContext::scope(Arc::clone(&agent), async {- for_each_scope(&crate::core::runtime::DispatchCtx::host_default(), "test", |_| async {- CoreContext::current().and_then(|c| c.session_agent().map(str::to_string))- })+ for_each_scope(+ &crate::core::runtime::DispatchCtx::host_default(),+ "test",+ |_| async {+ CoreContext::current().and_then(|c| c.session_agent().map(str::to_string))+ },+ ).await}).await;diff --git a/crates/openhuman-core/src/storage/import/mod.rs b/crates/openhuman-core/src/storage/import/mod.rsindex 233f895c4a..25708689d8 100644--- a/crates/openhuman-core/src/storage/import/mod.rs+++ b/crates/openhuman-core/src/storage/import/mod.rs@@ -190,8 +190,7 @@ pub async fn run(config: &Config) -> Vec<Report> {return Vec::new();}let config = config.clone();- let joined =- tokio::task::spawn_blocking(move || run_all(&backend, &config)).await;+ let joined = tokio::task::spawn_blocking(move || run_all(&backend, &config)).await;match joined {Ok(reports) => reports,Err(error) => {diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rsindex d4e2616398..c8029f383d 100644--- a/crates/openhuman-core/src/threads/ops/edit.rs+++ b/crates/openhuman-core/src/threads/ops/edit.rs@@ -109,12 +109,17 @@ pub async fn edit_message(let store_owned = store.clone();let thread_id_owned = thread_id.clone();let cut_request_id_owned = cut_request_id.clone();- crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {- truncate_transcript_before_turn(&store_owned, &thread_id_owned, &cut_request_id_owned)- })- .await- .map_err(|e| ThreadsError::Message(format!("truncate transcript task: {e}")))?- .map_err(ThreadsError::Message)?;+ crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || {+ truncate_transcript_before_turn(+ &store_owned,+ &thread_id_owned,+ &cut_request_id_owned,+ )+ })+ .await+ .map_err(|e| ThreadsError::Message(format!("truncate transcript task: {e}")))?+ .map_err(ThreadsError::Message)?;clear_dropped_turn_states(&dir, &thread_id, cut_request_id).await;}@@ -181,19 +186,20 @@ pub async fn regenerate(let store_for_blocking = store.clone();let thread_id_for_blocking = thread_id.clone();let target_for_blocking = target_request_id.clone();- let (prompt, cut_request_id) = crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {- truncate_transcript_for_regenerate(- &store_for_blocking,- &thread_id_for_blocking,- target_for_blocking.as_deref(),- )- })- .await- .map_err(|e| ThreadsError::Message(format!("truncate transcript task: {e}")))?- .map_err(ThreadsError::Message)?- .ok_or_else(|| {- ThreadsError::Message(format!("thread {thread_id} has no turn to regenerate"))- })?;+ let (prompt, cut_request_id) = crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || {+ truncate_transcript_for_regenerate(+ &store_for_blocking,+ &thread_id_for_blocking,+ target_for_blocking.as_deref(),+ )+ })+ .await+ .map_err(|e| ThreadsError::Message(format!("truncate transcript task: {e}")))?+ .map_err(ThreadsError::Message)?+ .ok_or_else(|| {+ ThreadsError::Message(format!("thread {thread_id} has no turn to regenerate"))+ })?;clear_dropped_turn_states(&dir, &thread_id, &cut_request_id).await;super::delete_after(ctx, &thread_id, &run_reply_message_id(&cut_request_id)).await?;diff --git a/crates/openhuman-core/src/threads/store/blocking.rs b/crates/openhuman-core/src/threads/store/blocking.rsindex f497204dc9..cc25f8e4e7 100644--- a/crates/openhuman-core/src/threads/store/blocking.rs+++ b/crates/openhuman-core/src/threads/store/blocking.rs@@ -70,7 +70,10 @@ whereF: FnOnce() -> Result<T, String> + Send + 'static,T: Send + 'static,{- match crate::core::runtime::DispatchCtx::ambient().spawn_blocking(f).await {+ match crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(f)+ .await+ {Ok(result) => result,Err(error) => {tracing::warn!(diff --git a/crates/openhuman-core/src/threads/welcome_migration_tests.rs b/crates/openhuman-core/src/threads/welcome_migration_tests.rsindex 3b57dabb3e..d83cee7236 100644--- a/crates/openhuman-core/src/threads/welcome_migration_tests.rs+++ b/crates/openhuman-core/src/threads/welcome_migration_tests.rs@@ -43,7 +43,9 @@ fn migration_updates_thread_labels_and_transcripts() {fs::create_dir_all(md.parent().unwrap()).unwrap();fs::write(&md, "# Session transcript — welcome_thread-abc\n").unwrap();- let result = migrate_welcome_agent_artifacts(&crate::core::runtime::DispatchCtx::ambient(), workspace).unwrap();+ let result =+ migrate_welcome_agent_artifacts(&crate::core::runtime::DispatchCtx::ambient(), workspace)+ .unwrap();assert_eq!(result.threads_updated, 1);assert_eq!(result.transcripts_updated, 1);@@ -84,7 +86,9 @@ fn migration_is_idempotent_after_marker() {fs::create_dir_all(workspace.join("state/migrations")).unwrap();fs::write(workspace.join(MIGRATION_MARKER), b"done\n").unwrap();- let result = migrate_welcome_agent_artifacts(&crate::core::runtime::DispatchCtx::ambient(), workspace).unwrap();+ let result =+ migrate_welcome_agent_artifacts(&crate::core::runtime::DispatchCtx::ambient(), workspace)+ .unwrap();assert!(result.already_done);assert_eq!(result.threads_updated, 0);assert_eq!(result.transcripts_updated, 0);@@ -100,7 +104,9 @@ fn migration_returns_error_without_marker_when_destination_exists() {let dest = workspace.join("session_raw/1715000000_orchestrator_thread-abc.jsonl");write_transcript(&dest, "orchestrator_thread-abc", "thread-abc");- let err = migrate_welcome_agent_artifacts(&crate::core::runtime::DispatchCtx::ambient(), workspace).unwrap_err();+ let err =+ migrate_welcome_agent_artifacts(&crate::core::runtime::DispatchCtx::ambient(), workspace)+ .unwrap_err();assert!(err.contains("partial migration"),diff --git a/crates/openhuman-core/src/tinymemes/callbacks.rs b/crates/openhuman-core/src/tinymemes/callbacks.rsindex 0e69b16d4f..395cfd25cf 100644--- a/crates/openhuman-core/src/tinymemes/callbacks.rs+++ b/crates/openhuman-core/src/tinymemes/callbacks.rs@@ -207,12 +207,17 @@ async fn answer(session: &Session, member: &str, payload: Value) -> Result<Value}async fn complete(session: &Session, request: CompleteRequest) -> HostResult<String> {- inference::complete(&session.dispatch_ctx(), &session.config, &request.system, &request.user)- .await- .map_err(|error| {- log::warn!("[tinymemes] complete callback failed: {error}");- HostFailure::Backend- })+ inference::complete(+ &session.dispatch_ctx(),+ &session.config,+ &request.system,+ &request.user,+ )+ .await+ .map_err(|error| {+ log::warn!("[tinymemes] complete callback failed: {error}");+ HostFailure::Backend+ })}async fn evaluate(session: &Session, envelope: EvaluateEnvelope) -> HostResult<EvaluateEnvelope> {@@ -241,7 +246,9 @@ async fn search(session: &Session,request: SearchRequest,) -> HostResult<Vec<tinymemes_bus::SearchResult>> {- let Some(backend) = search::OpenHumanSearch::available(&session.dispatch_ctx(), &session.config) else {+ let Some(backend) =+ search::OpenHumanSearch::available(&session.dispatch_ctx(), &session.config)+ else {return Err(HostFailure::Unsupported);};backend@@ -272,10 +279,7 @@ async fn load_index(session: &Session, request: LoadIndexRequest) -> HostResult<async fn save_index(session: &Session, request: SaveIndexRequest) -> HostResult<()> {let config = session.config.clone();- match tokio::task::spawn_blocking(move || {- docs::save(&config, request.kind, request.json)- })- .await+ match tokio::task::spawn_blocking(move || docs::save(&config, request.kind, request.json)).await{Ok(Ok(())) => Ok(()),Ok(Err(error)) => {diff --git a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs b/crates/openhuman-core/src/tinymemes/callbacks_tests.rsindex 80005fd136..c89614746e 100644--- a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs+++ b/crates/openhuman-core/src/tinymemes/callbacks_tests.rs@@ -16,7 +16,10 @@ fn decode<T: DeserializeOwned>(value: Value) -> HostResult<T> {#[tokio::test]async fn an_index_saved_through_the_host_loads_back_per_kind() {let dir = tempfile::tempdir().unwrap();- let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));+ let session = Session::new(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir.path()),+ );let missing = dispatch(&session,@@ -60,7 +63,10 @@ async fn an_index_saved_through_the_host_loads_back_per_kind() {#[tokio::test]async fn without_managed_jev_evaluate_is_unsupported() {let dir = tempfile::tempdir().unwrap();- let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));+ let session = Session::new(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir.path()),+ );let request = json!([{ "body": { "questions": {}, "messages": [] } }]);let result = dispatch(&session, host_methods::EVALUATE, request).await@@ -93,7 +99,10 @@ async fn search_switched_off_is_unsupported() {#[tokio::test]async fn deliver_is_acknowledged_and_unknown_members_are_refused() {let dir = tempfile::tempdir().unwrap();- let session = Session::new(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));+ let session = Session::new(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir.path()),+ );let delivered = dispatch(&session,host_methods::DELIVER,@@ -129,7 +138,10 @@ fn registrations_are_independent_and_forgotten_on_drop() {#[test]fn a_kept_registration_lives_until_the_module_reports_the_end() {let dir = tempfile::tempdir().unwrap();- let registration = register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));+ let registration = register(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir.path()),+ );let id = registration.correlation().to_owned();registration.keep_for_background();assert!(@@ -165,7 +177,10 @@ async fn a_remix_session_answers_under_the_context_that_registered_it() {let dir = tempfile::tempdir().unwrap();let caller = CoreContext::for_test(DomainSet::full(), None);let other = CoreContext::for_test(DomainSet::full(), None);- let session = Session::new(&DispatchCtx::new(Arc::clone(&caller)), &config_in(dir.path()));+ let session = Session::new(+ &DispatchCtx::new(Arc::clone(&caller)),+ &config_in(dir.path()),+ );// A callback arrives on the module bus while some other context is active.let seen = CoreContext::scope(Arc::clone(&other), async { session.dispatch_ctx() }).await;assert!(Arc::ptr_eq(seen.core().expect("bound"), &caller));diff --git a/crates/openhuman-core/src/tinymemes/e2e_tests.rs b/crates/openhuman-core/src/tinymemes/e2e_tests.rsindex 56ba381dfc..e99743ee44 100644--- a/crates/openhuman-core/src/tinymemes/e2e_tests.rs+++ b/crates/openhuman-core/src/tinymemes/e2e_tests.rs@@ -67,9 +67,13 @@ async fn the_real_module_fails_open_and_reads_its_documents_through_the_host() {let config = config_in(dir.path(), &artifact);write_legacy(&config, "remixed.json", "[\"old-1\"]");- let response = service::remix(&crate::core::runtime::DispatchCtx::host_default(), &config, request("That's done."))- .await- .expect("the module answered");+ let response = service::remix(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ request("That's done."),+ )+ .await+ .expect("the module answered");assert!(!response.remixed, "{response:?}");assert_eq!(response.reply, "That's done.");// The module reported the request finished, so nothing is kept for it.@@ -94,7 +98,13 @@ async fn a_disabled_request_passes_through_without_a_callback() {write_legacy(&config, "remixed.json", "[\"untouched\"]");let mut disabled = request("hello");disabled.enabled = false;- let response = service::remix(&crate::core::runtime::DispatchCtx::host_default(), &config, disabled).await.unwrap();+ let response = service::remix(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ disabled,+ )+ .await+ .unwrap();assert_eq!(response.reply, "hello");assert_eq!(response.skipped, Some(SkipReason::Disabled));assert_eq!(diff --git a/crates/openhuman-core/src/tinymemes/inference.rs b/crates/openhuman-core/src/tinymemes/inference.rsindex 214ec21fdb..0d6bc2825d 100644--- a/crates/openhuman-core/src/tinymemes/inference.rs+++ b/crates/openhuman-core/src/tinymemes/inference.rs@@ -26,8 +26,9 @@ pub(crate) async fn complete() -> Result<String, String> {// Built per call so a provider change in Settings applies without a// restart; construction is cheap and synchronous.- let (model, resolved) = provider::create_chat_model_with_model_id_in(ctx, ROLE, config, TEMPERATURE)- .map_err(|e| format!("openhuman inference unavailable: {e}"))?;+ let (model, resolved) =+ provider::create_chat_model_with_model_id_in(ctx, ROLE, config, TEMPERATURE)+ .map_err(|e| format!("openhuman inference unavailable: {e}"))?;// Reasoning off for tinymemes' calls only (the rest of OpenHuman keeps// its configured reasoning). The managed backend honours the// `without_reasoning` flag; a BYOK route to OpenRouter needsdiff --git a/crates/openhuman-core/src/tinymemes/inference_tests.rs b/crates/openhuman-core/src/tinymemes/inference_tests.rsindex 31861c771c..96eaa121d2 100644--- a/crates/openhuman-core/src/tinymemes/inference_tests.rs+++ b/crates/openhuman-core/src/tinymemes/inference_tests.rs@@ -24,5 +24,9 @@ fn the_model_label_never_fails() {config.workspace_dir = dir.path().join("workspace");config.secrets.encrypt = false;// Either the resolved model id or an `unavailable (...)` label.- assert!(!resolved_model(&crate::core::runtime::DispatchCtx::host_default(), &config).trim().is_empty());+ assert!(+ !resolved_model(&crate::core::runtime::DispatchCtx::host_default(), &config)+ .trim()+ .is_empty()+ );}diff --git a/crates/openhuman-core/src/tinymemes/mod.rs b/crates/openhuman-core/src/tinymemes/mod.rsindex e075c548fc..bbcef290bb 100644--- a/crates/openhuman-core/src/tinymemes/mod.rs+++ b/crates/openhuman-core/src/tinymemes/mod.rs@@ -196,18 +196,15 @@ async fn load(let config = config.clone();let thread_id = thread_id.to_owned();let ctx = ctx.clone();- ctx.clone().spawn_blocking(move || {- crate::threads::store::get_messages(- &ctx,- config.workspace_dir.clone(),- &thread_id,- )- .map_err(|e| log::warn!("[tinymemes] thread history unavailable: {e}"))+ ctx.clone()+ .spawn_blocking(move || {+ crate::threads::store::get_messages(&ctx, config.workspace_dir.clone(), &thread_id)+ .map_err(|e| log::warn!("[tinymemes] thread history unavailable: {e}"))+ .ok()+ })+ .await.ok()- })- .await- .ok()- .flatten()+ .flatten()}/// What the host decides for the module: the meme cooldowndiff --git a/crates/openhuman-core/src/tinymemes/mod_tests.rs b/crates/openhuman-core/src/tinymemes/mod_tests.rsindex e293c1b4e1..831f14a573 100644--- a/crates/openhuman-core/src/tinymemes/mod_tests.rs+++ b/crates/openhuman-core/src/tinymemes/mod_tests.rs@@ -292,7 +292,13 @@ async fn component_off_refuses_the_remix_before_any_module_load() {reply_id: None,options: RemixOptions::default(),};- let err = service::remix(&crate::core::runtime::DispatchCtx::host_default(), &config, request).await.unwrap_err();+ let err = service::remix(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ request,+ )+ .await+ .unwrap_err();assert!(err.contains("component is off"), "{err}");}diff --git a/crates/openhuman-core/src/tinymemes/search.rs b/crates/openhuman-core/src/tinymemes/search.rsindex 694fdda47b..f7f120313c 100644--- a/crates/openhuman-core/src/tinymemes/search.rs+++ b/crates/openhuman-core/src/tinymemes/search.rs@@ -48,13 +48,9 @@ impl OpenHumanSearch {name: TOOL.to_string(),arguments: json!({ "query": query, "max_results": max_results.clamp(1, 20) }),};- let response = crate::modules::search::execute_tool(- &self.ctx,- &self.config,- request,- )- .await- .map_err(|e| crate::search::tools::user_facing_error(&e))?;+ let response = crate::modules::search::execute_tool(&self.ctx, &self.config, request)+ .await+ .map_err(|e| crate::search::tools::user_facing_error(&e))?;Ok(response.results.into_iter()diff --git a/crates/openhuman-core/src/tinymemes/search_tests.rs b/crates/openhuman-core/src/tinymemes/search_tests.rsindex eb142aeee1..e01c29f90c 100644--- a/crates/openhuman-core/src/tinymemes/search_tests.rs+++ b/crates/openhuman-core/src/tinymemes/search_tests.rs@@ -4,7 +4,11 @@ use super::*;fn search_switched_off_in_settings_is_unavailable() {let mut config = Config::default();config.search.enabled = Some(false);- assert!(OpenHumanSearch::available(&crate::core::runtime::DispatchCtx::host_default(), &config).is_none());+ assert!(OpenHumanSearch::available(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config+ )+ .is_none());}#[test]@@ -13,7 +17,9 @@ fn availability_follows_the_configured_providers() {// when search is on; it never panics on a default config.let mut config = Config::default();config.search.enabled = Some(true);- if let Some(search) = OpenHumanSearch::available(&crate::core::runtime::DispatchCtx::host_default(), &config) {+ if let Some(search) =+ OpenHumanSearch::available(&crate::core::runtime::DispatchCtx::host_default(), &config)+ {assert!(search.config.search.is_enabled());}}diff --git a/crates/openhuman-core/src/tinymemes/service_tests.rs b/crates/openhuman-core/src/tinymemes/service_tests.rsindex 9305605065..63c0c7f439 100644--- a/crates/openhuman-core/src/tinymemes/service_tests.rs+++ b/crates/openhuman-core/src/tinymemes/service_tests.rs@@ -60,7 +60,10 @@ fn decode<T: serde::de::DeserializeOwned>(value: Value) -> HostResult<T> {async fn only_the_module_may_call_back_and_only_for_a_live_remix() {let dir = tempfile::tempdir().unwrap();let bus = bus().await;- let registration = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));+ let registration = callbacks::register(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir.path()),+ );let correlation = registration.correlation().to_owned();let deliver = json!({ "correlation": correlation, "reply": "hi", "remixed": true });@@ -108,8 +111,14 @@ async fn a_direct_call_without_the_brokers_context_is_unauthenticated() {async fn remixes_for_different_workspaces_are_served_at_once_each_for_its_own() {let (dir_a, dir_b) = (tempfile::tempdir().unwrap(), tempfile::tempdir().unwrap());let bus = bus().await;- let a = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir_a.path()));- let b = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir_b.path()));+ let a = callbacks::register(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir_a.path()),+ );+ let b = callbacks::register(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir_b.path()),+ );assert_ne!(a.correlation(), b.correlation());// Both are live together: neither waits for the other.@@ -140,7 +149,10 @@ async fn remixes_for_different_workspaces_are_served_at_once_each_for_its_own()async fn end_retires_the_remix_and_is_harmless_when_repeated_or_unknown() {let dir = tempfile::tempdir().unwrap();let bus = bus().await;- let registration = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));+ let registration = callbacks::register(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir.path()),+ );let correlation = registration.correlation().to_owned();registration.keep_for_background();@@ -175,7 +187,10 @@ async fn end_retires_the_remix_and_is_harmless_when_repeated_or_unknown() {}// A stranger cannot end somebody else's remix.let dir2 = tempfile::tempdir().unwrap();- let live = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir2.path()));+ let live = callbacks::register(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir2.path()),+ );let refused = bus.call(&bus.intruder,@@ -191,7 +206,10 @@ async fn end_retires_the_remix_and_is_harmless_when_repeated_or_unknown() {async fn an_unavailable_capability_is_reported_not_faked() {let dir = tempfile::tempdir().unwrap();let bus = bus().await;- let registration = callbacks::register(&crate::core::runtime::DispatchCtx::host_default(), &config_in(dir.path()));+ let registration = callbacks::register(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config_in(dir.path()),+ );let reply = bus.call(&bus.module,@@ -212,7 +230,13 @@ async fn component_off_refuses_before_any_module_load() {config.components.memes = false;let request: RemixRequest =serde_json::from_str(r#"{"conversation":[],"reply":"hi"}"#).unwrap();- let error = remix(&crate::core::runtime::DispatchCtx::host_default(), &config, request).await.unwrap_err();+ let error = remix(+ &crate::core::runtime::DispatchCtx::host_default(),+ &config,+ request,+ )+ .await+ .unwrap_err();assert!(error.contains("component is off"), "{error}");}diff --git a/crates/openhuman-core/src/tools/timeout/mod.rs b/crates/openhuman-core/src/tools/timeout/mod.rsindex 2c9d2b7c06..cfb400f89b 100644--- a/crates/openhuman-core/src/tools/timeout/mod.rs+++ b/crates/openhuman-core/src/tools/timeout/mod.rs@@ -35,7 +35,9 @@ fn ensure_configured() {CONFIGURE.call_once(|| {let secs = module::resolve_effective(module::DEFAULT_TIMEOUT_SECS, read_env().as_deref());module::configure(module::TimeoutSettings::with_inherited_secs(secs));- module::set_task_wrapper(|fut| Box::pin(crate::core::runtime::DispatchCtx::ambient().enter(fut)));+ module::set_task_wrapper(|fut| {+ Box::pin(crate::core::runtime::DispatchCtx::ambient().enter(fut))+ });log::debug!("[tool_timeout] configured module settings inherited={secs}s");});}diff --git a/crates/openhuman-core/src/voice/live/persist_tests.rs b/crates/openhuman-core/src/voice/live/persist_tests.rsindex bb8a879579..c8bc1db826 100644--- a/crates/openhuman-core/src/voice/live/persist_tests.rs+++ b/crates/openhuman-core/src/voice/live/persist_tests.rs@@ -1,7 +1,13 @@use super::*;fn persister(dir: &std::path::Path) -> TranscriptPersister {- TranscriptPersister::new(DispatchCtx::ambient(), dir.to_path_buf(), "t1".into(), "s1".into(), "sarvam".into())+ TranscriptPersister::new(+ DispatchCtx::ambient(),+ dir.to_path_buf(),+ "t1".into(),+ "s1".into(),+ "sarvam".into(),+ )}#[test]diff --git a/crates/openhuman-core/src/voice/live/session.rs b/crates/openhuman-core/src/voice/live/session.rsindex b019adbf81..169e377845 100644--- a/crates/openhuman-core/src/voice/live/session.rs+++ b/crates/openhuman-core/src/voice/live/session.rs@@ -136,12 +136,8 @@ pub(crate) async fn start("[voice-live] starting session");- let mut host = OpenHumanSessionHost::from_config_for_agent(- ctx,- &config,- LIVE_AGENT_ID,- )- .map_err(|e| LiveVoiceError::internal(format!("agent build failed: {e}")))?;+ let mut host = OpenHumanSessionHost::from_config_for_agent(ctx, &config, LIVE_AGENT_ID)+ .map_err(|e| LiveVoiceError::internal(format!("agent build failed: {e}")))?;host.set_event_context(format!("voice_live_{session_id}"), "voice");host.set_thread_id(Some(&thread_id));let harness = assemble_live_tool_harness(host.live_tool_surface());diff --git a/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs b/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rsindex 97a350f154..fa33d95e27 100644--- a/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs+++ b/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs@@ -44,10 +44,15 @@ fn guarded_turn_env_shares_its_cancellation_with_the_stop_handle() {#[tokio::test(start_paused = true)]async fn backstop_firing_yields_a_classified_turn_timeout_error() {let err = drive_turn_with_deadline(- &crate::core::runtime::DispatchCtx::host_default(),Some(Duration::from_secs(900)), None, None, |_| async {- std::future::pending::<()>().await;- Ok(result("never"))- })+ &crate::core::runtime::DispatchCtx::host_default(),+ Some(Duration::from_secs(900)),+ None,+ None,+ |_| async {+ std::future::pending::<()>().await;+ Ok(result("never"))+ },+ ).await.expect_err("backstop fires");assert!(super::super::super::web_errors::is_outer_backstop_timeout(@@ -74,13 +79,18 @@ const CEILING: Option<Duration> = Some(Duration::from_secs(3_600));#[tokio::test(start_paused = true)]async fn a_turn_that_keeps_progressing_outlives_the_idle_window() {let res = drive_turn_with_deadline(- &crate::core::runtime::DispatchCtx::host_default(),CEILING, IDLE, None, |activity| async move {- for _ in 0..90 {- tokio::time::sleep(Duration::from_secs(17)).await;- activity.observe(&text_delta());- }- Ok(result("done after 25 minutes"))- })+ &crate::core::runtime::DispatchCtx::host_default(),+ CEILING,+ IDLE,+ None,+ |activity| async move {+ for _ in 0..90 {+ tokio::time::sleep(Duration::from_secs(17)).await;+ activity.observe(&text_delta());+ }+ Ok(result("done after 25 minutes"))+ },+ ).await.expect("idle guard must not fire on a progressing turn");assert_eq!(res.full_response, "done after 25 minutes");@@ -92,10 +102,15 @@ async fn a_turn_that_keeps_progressing_outlives_the_idle_window() {async fn a_silent_turn_ends_after_the_idle_window() {let started = tokio::time::Instant::now();let err = drive_turn_with_deadline(- &crate::core::runtime::DispatchCtx::host_default(),CEILING, IDLE, None, |_| async {- std::future::pending::<()>().await;- Ok(result("never"))- })+ &crate::core::runtime::DispatchCtx::host_default(),+ CEILING,+ IDLE,+ None,+ |_| async {+ std::future::pending::<()>().await;+ Ok(result("never"))+ },+ ).await.expect_err("idle guard fires");let waited = started.elapsed();@@ -112,12 +127,17 @@ async fn a_silent_turn_ends_after_the_idle_window() {#[tokio::test(start_paused = true)]async fn a_turn_busy_past_the_ceiling_hits_the_backstop() {let err = drive_turn_with_deadline(- &crate::core::runtime::DispatchCtx::host_default(),CEILING, IDLE, None, |activity| async move {- loop {- tokio::time::sleep(Duration::from_secs(30)).await;- activity.observe(&text_delta());- }- })+ &crate::core::runtime::DispatchCtx::host_default(),+ CEILING,+ IDLE,+ None,+ |activity| async move {+ loop {+ tokio::time::sleep(Duration::from_secs(30)).await;+ activity.observe(&text_delta());+ }+ },+ ).await.expect_err("backstop fires");assert!(err.contains("3600s wall-clock budget"), "{err}");diff --git a/crates/openhuman-core/src/web_chat/turn_close.rs b/crates/openhuman-core/src/web_chat/turn_close.rsindex dfc5f3c489..78f0fcc3b2 100644--- a/crates/openhuman-core/src/web_chat/turn_close.rs+++ b/crates/openhuman-core/src/web_chat/turn_close.rs@@ -289,10 +289,12 @@ async fn read_snapshot(request_id: &str,) -> Option<TurnState> {let (thread_id, request_id) = (thread_id.to_string(), request_id.to_string());- let read = crate::core::runtime::DispatchCtx::ambient().spawn_blocking(move || {- crate::agent::session_store::turn_states_for(&workspace).get_turn(&thread_id, &request_id)- })- .await;+ let read = crate::core::runtime::DispatchCtx::ambient()+ .spawn_blocking(move || {+ crate::agent::session_store::turn_states_for(&workspace)+ .get_turn(&thread_id, &request_id)+ })+ .await;match read {Ok(Ok(snapshot)) => snapshot,Ok(Err(error)) => {diff --git a/tests/storage_agent_scopes_e2e.rs b/tests/storage_agent_scopes_e2e.rsindex cee0e93cd2..2ed9a9463b 100644--- a/tests/storage_agent_scopes_e2e.rs+++ b/tests/storage_agent_scopes_e2e.rs@@ -197,7 +197,12 @@ async fn two_agents_keep_cron_and_flows_apart(case: Case) {assert!(job_names(&config).is_empty());// Background visits see the agents' jobs under their own ids.- let visited = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;+ let visited = for_each_scope(+ &openhuman_core::core::runtime::DispatchCtx::host_default(),+ "e2e",+ |_| async { job_names(&config) },+ )+ .await;assert!(visited.contains(&(Some("agent-alpha".to_string()),@@ -268,7 +273,12 @@ async fn no_acting_agent_falls_back_to_the_local_scope(case: Case) {// The operator's records are what the `local` visit of a background loop// sees.- let visited = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;+ let visited = for_each_scope(+ &openhuman_core::core::runtime::DispatchCtx::host_default(),+ "e2e",+ |_| async { job_names(&config) },+ )+ .await;assert!(visited.contains(&(None, vec!["operator-job".to_string()])),"{visited:?}"diff --git a/tests/storage_scope_e2e.rs b/tests/storage_scope_e2e.rsindex 20fbd285e0..65e8f7d979 100644--- a/tests/storage_scope_e2e.rs+++ b/tests/storage_scope_e2e.rs@@ -79,7 +79,12 @@ async fn background_work_visits_every_agent_scope(case: Case) {assert!(job_names(&config).is_empty());// Visited through the live agent context …- let live = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;+ let live = for_each_scope(+ &openhuman_core::core::runtime::DispatchCtx::host_default(),+ "e2e",+ |_| async { job_names(&config) },+ )+ .await;assert!(live.contains(&(Some("agent-e2e".to_string()), vec!["agent-job".to_string()])),"{live:?}"@@ -87,26 +92,37 @@ async fn background_work_visits_every_agent_scope(case: Case) {// An event naming only the job resolves to its owner, and handling it// there sees the job.- let job_id = within_agent(&openhuman_core::core::runtime::DispatchCtx::host_default(), Some("agent-e2e"), async {- cron::list_jobs(&config).unwrap()[0].id.clone()- })+ let job_id = within_agent(+ &openhuman_core::core::runtime::DispatchCtx::host_default(),+ Some("agent-e2e"),+ async { cron::list_jobs(&config).unwrap()[0].id.clone() },+ ).await.expect("the live agent has a context");- let owner = find_owner(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async {- Ok(cron::get_job(&config, &job_id).is_ok())- })+ let owner = find_owner(+ &openhuman_core::core::runtime::DispatchCtx::host_default(),+ "e2e",+ |_| async { Ok(cron::get_job(&config, &job_id).is_ok()) },+ ).await;assert_eq!(owner, Ok(Some(Some("agent-e2e".to_string()))));- let missing = find_owner(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async {- Ok(cron::get_job(&config, "nope").is_ok())- })+ let missing = find_owner(+ &openhuman_core::core::runtime::DispatchCtx::host_default(),+ "e2e",+ |_| async { Ok(cron::get_job(&config, "nope").is_ok()) },+ ).await;assert_eq!(missing, Ok(None));// … and, once the agent is gone, through the id the backend recorded.assert!(AgentContextRegistry::deregister("agent-e2e", &agent));drop(agent);- let recorded = for_each_scope(&openhuman_core::core::runtime::DispatchCtx::host_default(), "e2e", |_| async { job_names(&config) }).await;+ let recorded = for_each_scope(+ &openhuman_core::core::runtime::DispatchCtx::host_default(),+ "e2e",+ |_| async { job_names(&config) },+ )+ .await;assert!(recorded.contains(&(Some("agent-e2e".to_string()), vec!["agent-job".to_string()])),"{recorded:?}"