The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: apply rustfmt formatting across the crate
Steven Enamakelc0c533f2ad6d
diff --git a/crates/openhuman-core/src/agent/artifacts/files_tests.rs b/crates/openhuman-core/src/agent/artifacts/files_tests.rsindex 8c8f94f3bc..210ad49076 100644--- a/crates/openhuman-core/src/agent/artifacts/files_tests.rs+++ b/crates/openhuman-core/src/agent/artifacts/files_tests.rs@@ -15,9 +15,16 @@ async fn create_ready(title: &str,bytes: &[u8],) -> ArtifactMeta {- let (meta, path) = create_artifact(workspace, files_dir, ArtifactKind::Document, title, "txt", None)- .await- .expect("create_artifact");+ let (meta, path) = create_artifact(+ workspace,+ files_dir,+ ArtifactKind::Document,+ title,+ "txt",+ None,+ )+ .await+ .expect("create_artifact");tokio::fs::write(&path, bytes).await.unwrap();finalize_artifact(workspace, &meta.id, bytes.len() as u64, None).awaitdiff --git a/crates/openhuman-core/src/agent/artifacts/store.rs b/crates/openhuman-core/src/agent/artifacts/store.rsindex b0d8373c87..b7a1918e9d 100644--- a/crates/openhuman-core/src/agent/artifacts/store.rs+++ b/crates/openhuman-core/src/agent/artifacts/store.rs@@ -580,7 +580,9 @@ pub async fn fail_artifact(/// non-chat callers (CLI, cron, sub-agent runners) so artifact emit hooks/// degrade gracefully: the event is still published but the web subscriber/// drops it for lack of a routing target.-fn chat_route(chat: Option<&ApprovalChatContext>) -> (Option<String>, Option<String>, Option<String>) {+fn chat_route(+ chat: Option<&ApprovalChatContext>,+) -> (Option<String>, Option<String>, Option<String>) {match chat {Some(ctx) => (Some(ctx.thread_id.clone()),diff --git a/crates/openhuman-core/src/agent/goals/runtime_tests.rs b/crates/openhuman-core/src/agent/goals/runtime_tests.rsindex fe49d1f860..4f42dd8d48 100644--- a/crates/openhuman-core/src/agent/goals/runtime_tests.rs+++ b/crates/openhuman-core/src/agent/goals/runtime_tests.rs@@ -1,6 +1,6 @@use super::*;-use tinyagents_harness::cost::TurnCost;use crate::inference::provider::BilledUsage;+use tinyagents_harness::cost::TurnCost;fn cost_with_tokens(input: u64, output: u64) -> TurnCost {let mut tc = crate::agent::cost::turn_cost();diff --git a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rsindex 78f0d4f1fa..f0c4f187da 100644--- a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs+++ b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs@@ -29,8 +29,8 @@ use std::path::{Path, PathBuf};use std::sync::Arc;use serde_json::Value;-use tinystoragedrivers::BlobStore;use tinyagents_harness::artifacts::tool_results::{self, ArtifactRead, ToolResultArtifactStore};+use tinystoragedrivers::BlobStore;use crate::agent::harness::artifact_offload::{SanitizingRedactor, READ_TOOL};use tinytools_std::filesystem::FileReadTool;diff --git a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rsindex 4828497bc5..17d69363ae 100644--- a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs+++ b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs@@ -37,7 +37,10 @@ async fn threshold_persists_to_blobs_and_file_read_serves_the_key() {assert!(out.contains(&format!("artifact_path: {key}\n")), "{out}");assert!(out.contains("[preview]"));assert!(!out.contains(secret));- assert!(!root.exists(), "nothing is on disk until a read asks for it");+ assert!(+ !root.exists(),+ "nothing is on disk until a read asks for it"+ );assert_eq!(std::fs::read_dir(&project).unwrap().count(), 0);// The model's `file_read {"path": key}` is recognised and pointed at the@@ -46,7 +49,10 @@ async fn threshold_persists_to_blobs_and_file_read_serves_the_key() {let read = artifact_read_target(Some(&store), "file_read", &args).expect("artifact read");store.resolve_read(&mut args, &read).await;let pointer = args["path"].as_str().unwrap().to_string();- assert_eq!(std::path::Path::new(&pointer), root.join("session_one/shell/call-1.txt"));+ assert_eq!(+ std::path::Path::new(&pointer),+ root.join("session_one/shell/call-1.txt")+ );let cfg = crate::config::AutonomyConfig {enabled: true,diff --git a/crates/openhuman-core/src/agent/hooks.rs b/crates/openhuman-core/src/agent/hooks.rsindex 9346a2e807..1add09e49f 100644--- a/crates/openhuman-core/src/agent/hooks.rs+++ b/crates/openhuman-core/src/agent/hooks.rs@@ -293,9 +293,7 @@ pub fn embedder_tool_hooks() -> Vec<Arc<dyn ToolHook>> {/// Snapshot tool hooks supplied by the embedding host, plus the agent-local/// ones of the agent `ctx` runs for.-pub fn embedder_tool_hooks_in(- ctx: &crate::core::runtime::DispatchCtx,-) -> Vec<Arc<dyn ToolHook>> {+pub fn embedder_tool_hooks_in(ctx: &crate::core::runtime::DispatchCtx) -> Vec<Arc<dyn ToolHook>> {let mut hooks = EMBEDDER_TOOL_HOOKS.lock().expect("embedder tool hooks poisoned")diff --git a/crates/openhuman-core/src/agent/hooks_scope.rs b/crates/openhuman-core/src/agent/hooks_scope.rsindex e3c2ac076f..153f398516 100644--- a/crates/openhuman-core/src/agent/hooks_scope.rs+++ b/crates/openhuman-core/src/agent/hooks_scope.rs@@ -19,7 +19,8 @@ use super::{PostTurnHook, ToolHook};pub struct HookScope {tools: Vec<Arc<dyn ToolHook>>,post_turn: Vec<Arc<dyn PostTurnHook>>,- stop: Vec<Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>>,+ stop:+ Vec<Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>>,}impl HookScope {@@ -54,7 +55,8 @@ impl HookScope {/// The scope's own stop policies, in registration order.pub fn stop_hooks(&self,- ) -> &[Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>] {+ ) -> &[Arc<dyn tinyagents_harness::middleware::StopHook<tinyagents_harness::cost::TurnCost>>]+ {&self.stop}diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rsindex 785d7651b6..dcaf64a65f 100644--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs@@ -446,9 +446,11 @@ fn render_connected_mcp_servers() -> String {use crate::mcp::registry::connections;let servers = match tokio::runtime::Handle::try_current() {Ok(handle) if handle.runtime_flavor() == tokio::runtime::RuntimeFlavor::MultiThread => {- tokio::task::block_in_place(|| handle.block_on(connections::connected_overview(- &crate::core::runtime::DispatchCtx::ambient(),- )))+ tokio::task::block_in_place(|| {+ handle.block_on(connections::connected_overview(+ &crate::core::runtime::DispatchCtx::ambient(),+ ))+ })}_ => Vec::new(),};diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rsindex 36687f1d6f..b9a22ec940 100644--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs@@ -389,7 +389,9 @@ impl OpenHumanSessionHost {None => SystemPromptBuilder::with_defaults(),};let post_turn_hooks: Vec<Arc<dyn crate::agent::hooks::PostTurnHook>> =- crate::agent::hooks::embedder_post_turn_hooks_in(&crate::core::runtime::DispatchCtx::ambient());+ crate::agent::hooks::embedder_post_turn_hooks_in(+ &crate::core::runtime::DispatchCtx::ambient(),+ );// Best-effort prewarm from the shared Composio cache. This avoids// building the session with a knowingly stale `&[]` integration viewdiff --git a/crates/openhuman-core/src/agent/session_host/builder/host_only.rs b/crates/openhuman-core/src/agent/session_host/builder/host_only.rsindex 1f916aa7e3..fd8754ec5f 100644--- a/crates/openhuman-core/src/agent/session_host/builder/host_only.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/host_only.rs@@ -42,13 +42,28 @@ use tinyagents_definition::{SandboxMode, ToolScope};/// host's policy and never widens it.pub struct HostOnlyToolPolicy {allowed: HashSet<String>,- host: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,+ host: Option<+ Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ >,}impl HostOnlyToolPolicy {/// Admit exactly `allowed`, subject to `host`'s own decision.#[must_use]- pub fn new(allowed: HashSet<String>, host: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>) -> Self {+ pub fn new(+ allowed: HashSet<String>,+ host: Option<+ Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ >,+ ) -> Self {Self { allowed, host }}}@@ -59,7 +74,11 @@ impl ToolCallPolicy<OpenHumanRunContext> for HostOnlyToolPolicy {"host_only"}- async fn check(&self, ctx: &RunContext<OpenHumanRunContext>, call: &ToolCall) -> PolicyDecision {+ async fn check(+ &self,+ ctx: &RunContext<OpenHumanRunContext>,+ call: &ToolCall,+ ) -> PolicyDecision {if !self.allowed.contains(&call.name) {log::debug!("[agent::host_only] denied tool outside the host belt: {}",@@ -90,8 +109,20 @@ pub(super) fn empty_belt() -> HashSet<String> {pub(super) fn session_policy(host_only: bool,tools: &[Box<dyn tinytools::Tool>],- host: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,-) -> Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>> {+ host: Option<+ Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ >,+) -> Option<+ Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+> {if !host_only {return host;}diff --git a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rsindex 2013b161f0..d2dac7f629 100644--- a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs@@ -61,7 +61,13 @@ pub struct HostTurnTools {/// enforce one through the session's tool policy.pub withheld: HashSet<String>,/// The session's admission gate, if the host sets one.- pub policy: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,+ pub policy: Option<+ Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ >,}impl HostTurnTools {@@ -170,7 +176,14 @@ impl HostTurnTools {/// session should keep an existing policy for calls the host does not own,/// the host composes the two and passes the result here.#[must_use]- pub fn with_policy(mut self, policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>) -> Self {+ pub fn with_policy(+ mut self,+ policy: Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ ) -> Self {self.policy = Some(policy);self}@@ -189,7 +202,13 @@ impl HostTurnTools {/// The parts of a host turn belt that the session builder applies after/// expanding the agent's static scope.pub(super) struct MergedHostTurnTools {- pub policy: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,+ pub policy: Option<+ Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ >,pub withheld: HashSet<String>,pub permanent: HashSet<String>,pub scope_additions: HashSet<String>,diff --git a/crates/openhuman-core/src/agent/session_host/builder/setters.rs b/crates/openhuman-core/src/agent/session_host/builder/setters.rsindex cd160d2972..29dc99e8b8 100644--- a/crates/openhuman-core/src/agent/session_host/builder/setters.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/setters.rs@@ -377,7 +377,14 @@ impl SessionHostBuilder {////// The default policy allows all calls. Custom policies can deny a call/// before `Tool::execute_with_options` runs.- pub fn tool_policy(mut self, policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>) -> Self {+ pub fn tool_policy(+ mut self,+ policy: Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ ) -> Self {self.tool_policy = Some(policy);self}diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rsindex 746d449827..22d32d0c3d 100644--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs@@ -384,11 +384,12 @@ impl OpenHumanTurnPrelude {connected.len(),self.agent_definition_id);- let mcp_servers = crate::mcp::registry::connections::connected_overview(&self.dispatch_ctx())- .await- .into_iter()- .map(|server| server.qualified_name)- .collect::<std::collections::HashSet<_>>();+ let mcp_servers =+ crate::mcp::registry::connections::connected_overview(&self.dispatch_ctx())+ .await+ .into_iter()+ .map(|server| server.qualified_name)+ .collect::<std::collections::HashSet<_>>();let mut mutable = self.mutable.lock()@@ -427,11 +428,12 @@ impl OpenHumanTurnPrelude {mutable.connected_integrations_authoritative = authoritative;}}- let connected_mcp = crate::mcp::registry::connections::connected_overview(&self.dispatch_ctx())- .await- .into_iter()- .map(|server| server.qualified_name)- .collect::<Vec<_>>();+ let connected_mcp =+ crate::mcp::registry::connections::connected_overview(&self.dispatch_ctx())+ .await+ .into_iter()+ .map(|server| server.qualified_name)+ .collect::<Vec<_>>();let mut mutable = self.mutable.lock()diff --git a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rsindex e76ed17900..49a79d1008 100644--- a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs@@ -44,7 +44,8 @@ impl OpenHumanSessionHost {origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,approval: crate::security::approval::ApprovalTurnContext,) -> Result<String> {- let origin = origin.or_else(|| crate::core::runtime::DispatchCtx::ambient_turn().turn_origin());+ let origin =+ origin.or_else(|| crate::core::runtime::DispatchCtx::ambient_turn().turn_origin());let guard = enforce_prompt_input(message,PromptEnforcementContext {diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex ed3f3b70fe..f90393734e 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -74,7 +74,11 @@ struct OpenHumanTurnPrelude {/// Host prompt/utilisation state, shared by the runtime hooks. It is not/// generic conversation state and the runtime never persists it.context: Arc<std::sync::Mutex<crate::agent::context::ContextManager>>,- tool_policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>,+ tool_policy: Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,tool_dispatcher: Arc<dyn tinytools_agent::dialect::ToolDialect>,workspace_dir: std::path::PathBuf,action_dir: std::path::PathBuf,@@ -278,9 +282,7 @@ impl OpenHumanTurnPrelude {.filter(|spec| !withheld.contains(&spec.name)).filter(|spec| {self.thread_id.is_some()- || !crate::agent::tinyagents::tool_registration::is_thread_goal_tool(- &spec.name,- )+ || !crate::agent::tinyagents::tool_registration::is_thread_goal_tool(&spec.name)}).map(|spec| spec.as_ref().clone()).collect::<Vec<_>>();diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/tool_rules.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/tool_rules.rsindex efac2e4726..38ebbe9299 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session/tool_rules.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/tool_rules.rs@@ -61,11 +61,10 @@ impl OpenHumanTurnPrelude {/// Records the user text a turn begins with, for its user-side effects.pub(super) fn begin_user_effects(&self, request: &SessionTurnRequest) {- let user_text =- crate::core::runtime::DispatchCtx::ambient_turn()- .turn_origin()- .is_some_and(|origin| origin.is_user_authored())- .then(|| request.input.text());+ let user_text = crate::core::runtime::DispatchCtx::ambient_turn()+ .turn_origin()+ .is_some_and(|origin| origin.is_user_authored())+ .then(|| request.input.text());self.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner)diff --git a/crates/openhuman-core/src/agent/session_host/tool_progress.rs b/crates/openhuman-core/src/agent/session_host/tool_progress.rsindex 73aa006c1a..3a8f8feaa9 100644--- a/crates/openhuman-core/src/agent/session_host/tool_progress.rs+++ b/crates/openhuman-core/src/agent/session_host/tool_progress.rs@@ -9,9 +9,9 @@use async_trait::async_trait;-use tinyagents_harness::cost::TurnCost;use crate::agent::progress::AgentProgress;use crate::inference::provider::ProviderDelta;+use tinyagents_harness::cost::TurnCost;/// What the engine emits as a turn progresses. All methods default to no-ops so/// an impl only overrides the events its flavor cares about.diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rsindex 97d04e265b..43f6147b16 100644--- a/crates/openhuman-core/src/agent/session_host/types.rs+++ b/crates/openhuman-core/src/agent/session_host/types.rs@@ -448,7 +448,11 @@ pub struct OpenHumanSessionHost {/// Pre-execution policy hook for tool calls in this session. The/// default policy allows all calls so existing agents keep their/// behaviour unless a caller opts into stricter policy.- pub(super) tool_policy: Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>,+ pub(super) tool_policy: Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,/// Hash of the Composio connection set this OpenHumanSessionHost last reconciled/// against. Compared at top-of-turn to a fresh hash computed from/// [`crate::integrations::composio::cached_active_integrations`]; on@@ -633,7 +637,13 @@ pub struct SessionHostBuilder {/// Per-agent TokenJuice tool-output compression profile.pub(super) tokenjuice_compression: tinyjuice_bus::types::AgentTokenjuiceCompression,/// Optional pre-execution tool policy. Defaults to allow-all.- pub(super) tool_policy: Option<Arc<dyn tinyagents_harness::middleware::ToolCallPolicy<crate::agent::tinyagents::host::OpenHumanRunContext>>>,+ pub(super) tool_policy: Option<+ Arc<+ dyn tinyagents_harness::middleware::ToolCallPolicy<+ crate::agent::tinyagents::host::OpenHumanRunContext,+ >,+ >,+ >,}impl Default for SessionHostBuilder {diff --git a/crates/openhuman-core/src/agent/session_store/mod.rs b/crates/openhuman-core/src/agent/session_store/mod.rsindex da2ee00c34..cc16251790 100644--- a/crates/openhuman-core/src/agent/session_store/mod.rs+++ b/crates/openhuman-core/src/agent/session_store/mod.rs@@ -26,9 +26,9 @@ mod workspace;pub use rebound::{rebind_all, ReboundSessionStores, StoreRegistry};pub use workspace::{artifact_blobs_for, attachment_stash_for, current_documents_for, default_turn_states_for,- ledger_for, provider_for_workspace, release_workspace, release_workspace_defaults, require_ledger,- status_store_for, stores_for, stores_or_ephemeral, turn_states_for, with_ledger,- with_ledger_async, WorkspaceSessionStores,+ ledger_for, provider_for_workspace, release_workspace, release_workspace_defaults,+ require_ledger, status_store_for, stores_for, stores_or_ephemeral, turn_states_for,+ with_ledger, with_ledger_async, WorkspaceSessionStores,};static PROVIDER: LazyLock<RwLock<Option<Arc<dyn SessionStoreProvider>>>> =diff --git a/crates/openhuman-core/src/agent/stop_hooks.rs b/crates/openhuman-core/src/agent/stop_hooks.rsindex a03d900765..02116dab85 100644--- a/crates/openhuman-core/src/agent/stop_hooks.rs+++ b/crates/openhuman-core/src/agent/stop_hooks.rs@@ -19,8 +19,8 @@//! The per-turn tool budget ([`tool_call_limit`]) also lives here; a host//! narrows it through `HostTurnEnv::tool_call_limit`.-use tinyagents_harness::cost::TurnCost;use async_trait::async_trait;+use tinyagents_harness::cost::TurnCost;use tinyagents_harness::middleware::{StopDecision, StopHook, TurnState};diff --git a/crates/openhuman-core/src/agent/stop_hooks_tests.rs b/crates/openhuman-core/src/agent/stop_hooks_tests.rsindex a7daa44065..c59b88eef5 100644--- a/crates/openhuman-core/src/agent/stop_hooks_tests.rs+++ b/crates/openhuman-core/src/agent/stop_hooks_tests.rs@@ -14,7 +14,8 @@ fn host_tool_cap_only_narrows_the_default_and_keeps_zero() {#[test]fn host_tool_cap_and_stop_hooks_flow_into_the_run_context_and_its_children() {- let hook: Arc<dyn StopHook<tinyagents_harness::cost::TurnCost>> = Arc::new(BudgetStopHook::new(1.0));+ let hook: Arc<dyn StopHook<tinyagents_harness::cost::TurnCost>> =+ Arc::new(BudgetStopHook::new(1.0));let mut hooks = crate::agent::hooks::HookScope::default();hooks.push_stop(Arc::clone(&hook));let env = crate::agent::turn_env::HostTurnEnv {diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 41f3a1e4e6..63e75ea9c8 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -295,7 +295,9 @@ impl OpenHumanSubagentHost {task_key: task_key.clone(),};let (entry, is_leader) = {- let mut entries = host_in_flight(&parent.data.dispatch_ctx()).lock_owned().await;+ let mut entries = host_in_flight(&parent.data.dispatch_ctx())+ .lock_owned()+ .await;match entries.get(&lifecycle_key) {Some(entry) => (entry.clone(), false),None => {@@ -333,7 +335,9 @@ impl OpenHumanSubagentHost {)).await;entry.complete(result.as_ref().ok().cloned()).await;- let mut entries = host_in_flight(&parent.data.dispatch_ctx()).lock_owned().await;+ let mut entries = host_in_flight(&parent.data.dispatch_ctx())+ .lock_owned()+ .await;if entries.get(&lifecycle_key).is_some_and(|current| Arc::ptr_eq(current, &entry))diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 216203d26d..9bb3b487ac 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -420,7 +420,8 @@ pub(crate) use super::operation_context::tool_context_with_approval;pub use super::operation_context::OpenHumanRunExt;pub(crate) use super::operation_context::{approval_for_tool, dispatch_ctx_for_tool, memory_identity_for_tool, parent_agent_id_for_tool,- sandbox_mode_for_tool, task_recency_window_for_tool, turn_origin_for_tool, HostOperationContext,+ sandbox_mode_for_tool, task_recency_window_for_tool, turn_origin_for_tool,+ HostOperationContext,};impl Default for OpenHumanRunContext {diff --git a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs b/crates/openhuman-core/src/agent/tinyagents/live_harness.rsindex 1a85b13785..f0b1b8ef92 100644--- a/crates/openhuman-core/src/agent/tinyagents/live_harness.rs+++ b/crates/openhuman-core/src/agent/tinyagents/live_harness.rs@@ -121,7 +121,8 @@ pub(crate) fn assemble_live_tool_harness(route_session,),));- let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks_in(&crate::core::runtime::DispatchCtx::ambient());+ let mut embedder_tool_hooks =+ crate::agent::hooks::embedder_tool_hooks_in(&crate::core::runtime::DispatchCtx::ambient());embedder_tool_hooks.extend(tool_hooks);if !embedder_tool_hooks.is_empty() {harness.push_middleware(Arc::new(diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rsindex 1974cf7f12..024e4bd1cb 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output.rs@@ -21,9 +21,7 @@ use crate::agent::harness::tool_result_artifacts::{};use crate::agent::tinyagents::payload_summarizer::DynPayloadSummarizer;use crate::inference::tokenjuice::generate::GenerateTicket;-use tinyagents_harness::artifacts::tool_results::{- ArtifactRead, ToolResultArtifactOutcome,-};+use tinyagents_harness::artifacts::tool_results::{ArtifactRead, ToolResultArtifactOutcome};use tinyagents_harness::middleware::library::{plan_output_stages, run_output_ladder, CompactedOutput, OutputCapPolicy, OutputLadderInput,OutputProcessor,@@ -447,11 +445,7 @@ impl Middleware<(), crate::agent::tinyagents::host::OpenHumanRunContext> for Too}}if let Some(read) =- artifact_read_target(- self.artifact_store.as_deref(),- &call.name,- &call.arguments,- )+ artifact_read_target(self.artifact_store.as_deref(), &call.name, &call.arguments){tracing::debug!(tool = %call.name,diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rsindex afe12796b4..713a97aa83 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs@@ -16,8 +16,8 @@ use tinyinference_llm::message::Message;use tinyinference_llm::model::{ModelRequest, ModelResponse, ResolvedModelRoute};use tinytools::{ToolPolicy as TaToolPolicy, ToolResult as TaToolResult};-use crate::agent::tinyagents::payload_summarizer::DynPayloadSummarizer;use crate::agent::harness::tool_result_artifacts::HostArtifactStore;+use crate::agent::tinyagents::payload_summarizer::DynPayloadSummarizer;use tinyagents_harness::turn_outcome::ToolCallOutcome;use tinyjuice_bus::types::AgentTokenjuiceCompression;diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rsindex 64352e909e..2c8cccc1b1 100644--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs@@ -57,14 +57,14 @@ mod steering_forwarder;pub(crate) mod stop_hooks;pub mod todos;pub(crate) mod tool_registration;+mod turn_exec;+mod turn_middleware;mod turn_models;mod turn_outcome;+mod turn_plan;mod turn_policy;mod turn_run_error;mod turn_run_finalize;-mod turn_exec;-mod turn_middleware;-mod turn_plan;mod use_skill_dispatch;mod verify_before_finish;@@ -76,6 +76,7 @@ pub(crate) use crate::agent::message_convert::ta_call_to_oh_call;pub(crate) use embeddings::ProviderEmbeddingModel;pub(crate) use observability::SubagentScope;pub(crate) use reasoning::{apply_requested_effort, parse_reasoning_effort};+pub(crate) use turn_exec::TurnSpec;pub use turn_models::TurnModelSource;pub(crate) use turn_models::TurnModels;pub(crate) use turn_outcome::TinyagentsTurnOutcome;@@ -85,7 +86,6 @@ pub(crate) use turn_policy::{agent_turn_wall_clock_ms_for, chat_provider_is_local, local_web_turn_backstop_secs,ToolPolicyEnforcement,};-pub(crate) use turn_exec::TurnSpec;// Test-only glue so `tinyagents_tests.rs`'s `use super::*;` sees the// lower-level policy helpers it exercises directly (they otherwise staydiff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rsindex b406d4077d..bd4f0d821a 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs@@ -562,7 +562,8 @@ pub(super) fn install_turn_middleware(// observation-only (never mutates the result), so running first in the// reverse-order `after_tool` chain is safe — it cannot perturb the// summarization/cap or tool-outcome capture layers.- let mut embedder_tool_hooks = crate::agent::hooks::embedder_tool_hooks_in(&crate::core::runtime::DispatchCtx::ambient());+ let mut embedder_tool_hooks =+ crate::agent::hooks::embedder_tool_hooks_in(&crate::core::runtime::DispatchCtx::ambient());embedder_tool_hooks.extend(scoped_tool_hooks);if !embedder_tool_hooks.is_empty() {harness.push_middleware(Arc::new(diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs b/crates/openhuman-core/src/agent/tinyagents/turn_models.rsindex 331f0d85e2..07f41b612f 100644--- a/crates/openhuman-core/src/agent/tinyagents/turn_models.rs+++ b/crates/openhuman-core/src/agent/tinyagents/turn_models.rs@@ -206,9 +206,7 @@ fn build_turn_models_crate(// The primary honours an explicit provider-string override when the producer's// effective provider differs from `provider_for_role(role)` (triage #1257).let build_primary = |m: &str| -> anyhow::Result<TurnChatModel> {- if let Some(chat) = ctx.host_overrides()- .and_then(|local| local.model_for(role))- {+ if let Some(chat) = ctx.host_overrides().and_then(|local| local.model_for(role)) {return Ok(chat);}let managed = primary_override@@ -218,10 +216,9 @@ fn build_turn_models_crate(}).unwrap_or_else(|| factory::resolves_to_managed_backend(role, config));if managed {- let (backend, _) =- factory::make_openhuman_backend_model_for_thread(- role, config, m, true, thread_id, &egress,- )?;+ let (backend, _) = factory::make_openhuman_backend_model_for_thread(+ role, config, m, true, thread_id, &egress,+ )?;return Ok(Arc::new(RouteRecordingModel::new(crate::agent::attachments::provider::wrap(backend,@@ -265,90 +262,88 @@ fn build_turn_models_crate(};let (primary, routes, summarizer): BuiltTurnModels = (|| {- let primary = build_primary(model)?;-- // Additive workload-tier routes: one crate-native model per tier (skipping the- // turn's own model, which is registered as the default primary), each pinned to- // the tier alias so the crate registry resolves cross-route fallback across them.- let mut routes: TierRoutes = Vec::new();- for &tier in tinyinference_llm::model::workload::WORKLOAD_ROUTE_TIERS {- if tier == model {- continue;- }- let tier_role = factory::role_for_model_tier(tier);- if let Some(custom) = ctx.host_overrides()- .and_then(|local| {- local- .role_models- .get(tier)- .or_else(|| local.role_models.get(tier_role))- .cloned()- })- {- routes.push((- tier.to_string(),- crate::agent::attachments::provider::wrap_injected(- custom,+ let primary = build_primary(model)?;++ // Additive workload-tier routes: one crate-native model per tier (skipping the+ // turn's own model, which is registered as the default primary), each pinned to+ // the tier alias so the crate registry resolves cross-route fallback across them.+ let mut routes: TierRoutes = Vec::new();+ for &tier in tinyinference_llm::model::workload::WORKLOAD_ROUTE_TIERS {+ if tier == model {+ continue;+ }+ let tier_role = factory::role_for_model_tier(tier);+ if let Some(custom) = ctx.host_overrides().and_then(|local| {+ local+ .role_models+ .get(tier)+ .or_else(|| local.role_models.get(tier_role))+ .cloned()+ }) {+ routes.push((+ tier.to_string(),+ crate::agent::attachments::provider::wrap_injected(+ custom,+ Arc::new(config.clone()),+ ),+ ));+ continue;+ }+ let route = if factory::resolves_to_managed_backend(tier_role, config) {+ factory::make_openhuman_backend_model_for_thread(+ tier_role, config, tier, true, thread_id, &egress,+ )+ .map(|(backend, _)| (backend, "openhuman".to_string(), tier.to_string()))+ } else {+ factory::create_turn_chat_model_with_native_tools_and_route(+ ctx,+ tier_role,+ config,+ tier,+ temperature,+ true,+ &egress,+ )+ };+ match route {+ Ok((route_model, provider, resolved_model)) => routes.push((+ tier.to_string(),+ Arc::new(RouteRecordingModel::new(+ crate::agent::attachments::provider::wrap(+ route_model,Arc::new(config.clone()),+ &resolved_model,+ &provider,),- ));- continue;- }- let route = if factory::resolves_to_managed_backend(tier_role, config) {- factory::make_openhuman_backend_model_for_thread(- tier_role, config, tier, true, thread_id, &egress,- )- .map(|(backend, _)| (backend, "openhuman".to_string(), tier.to_string()))- } else {- factory::create_turn_chat_model_with_native_tools_and_route(- ctx,- tier_role,- config,- tier,- temperature,- true,- &egress,- )- };- match route {- Ok((route_model, provider, resolved_model)) => routes.push((- tier.to_string(),- Arc::new(RouteRecordingModel::new(- crate::agent::attachments::provider::wrap(- route_model,- Arc::new(config.clone()),- &resolved_model,- &provider,- ),- ResolvedModelRoute::new(provider, resolved_model, tier),- )),+ ResolvedModelRoute::new(provider, resolved_model, tier),)),- Err(e) => {- // A route that can't be built (e.g. an unconfigured BYOK tier) is- // skipped, not fatal — the primary still dispatches (parity with the- // `Provider` path, where an unresolved tier simply isn't registered).- tracing::debug!(- route = tier,- error = %e,- "[models] skipping crate-native workload route that failed to build"- );- }+ )),+ Err(e) => {+ // A route that can't be built (e.g. an unconfigured BYOK tier) is+ // skipped, not fatal — the primary still dispatches (parity with the+ // `Provider` path, where an unresolved tier simply isn't registered).+ tracing::debug!(+ route = tier,+ error = %e,+ "[models] skipping crate-native workload route that failed to build"+ );}}+ }- // The summarizer is a distinct adapter instance (own empty error slot).- let summarizer = match ctx.host_overrides()- .and_then(|local| local.role_models.get("summarization").cloned())- {- Some(custom) => crate::agent::attachments::provider::wrap_injected(- custom,- Arc::new(config.clone()),- ),- None => build_primary(model)?,- };+ // The summarizer is a distinct adapter instance (own empty error slot).+ let summarizer = match ctx+ .host_overrides()+ .and_then(|local| local.role_models.get("summarization").cloned())+ {+ Some(custom) => {+ crate::agent::attachments::provider::wrap_injected(custom, Arc::new(config.clone()))+ }+ None => build_primary(model)?,+ };- anyhow::Ok((primary, routes, summarizer))- })()?;+ anyhow::Ok((primary, routes, summarizer))+ })()?;let supports_vision = primary.profile().is_some_and(|p| p.modalities.image_in);Ok(TurnModels {@@ -685,15 +680,11 @@ impl TurnModelSource {});}if let Some(cn) = &self.crate_native {- if let Some(custom) = cn- .ctx()- .host_overrides()- .and_then(|local| {- local- .model_for("summarization")- .or_else(|| local.model_for(&cn.role))- })- {+ if let Some(custom) = cn.ctx().host_overrides().and_then(|local| {+ local+ .model_for("summarization")+ .or_else(|| local.model_for(&cn.role))+ }) {return Ok(crate::agent::attachments::provider::wrap_injected(custom,cn.config.clone(),diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rsindex 210bd1a88d..2680a01bec 100644--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch.rs@@ -31,8 +31,8 @@ use tinyagents_harness::context::RunContext;use tinyagents_harness::tool::{ToolDispatch, ToolExecutionContext};use tinytools::{Tool, ToolCallOptions, ToolResult};-use super::tool_registration::typed_dispatch_for;use super::host::OpenHumanRunContext;+use super::tool_registration::typed_dispatch_for;use crate::tools::toolpacks::registry::CATALOG;use tinyagents_harness::tool::packs::{named_tool, PackRegistryHandle};@@ -96,9 +96,8 @@ impl ToolDispatch<(), OpenHumanRunContext> for UseSkillDispatch {.get("args").cloned().unwrap_or_else(|| serde_json::json!({}));- let Some(inner_adapter) =- super::tool_registration::shared_tool_adapter(vec![tools], name)- .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)+ let Some(inner_adapter) = super::tool_registration::shared_tool_adapter(vec![tools], name)+ .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)else {// Freeze the not-found result too: a target appearing after// authorization must not turn a rejected call into an execution.@@ -167,9 +166,8 @@ impl ToolDispatch<(), OpenHumanRunContext> for UseSkillDispatch {// adapter is equivalent to the one that would have been registered// had the model reached `name` directly instead of through// `use_skill`.- let Some(inner_adapter) =- super::tool_registration::shared_tool_adapter(vec![tools], &name)- .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)+ let Some(inner_adapter) = super::tool_registration::shared_tool_adapter(vec![tools], &name)+ .map(|adapter| Arc::new(adapter) as Arc<dyn Tool>)else {return self.tooldiff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rsindex b89b14005b..555701d00d 100644--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs@@ -135,11 +135,8 @@ fn build_use_skill_dispatch_with_handle() -> (UseSkillDispatch, PackRegistryHandlet durable: Arc<Vec<Box<dyn Tool>>> = Arc::new(vec![use_skill_tool, create_image_tool]);handle.bind(Arc::downgrade(&durable));- let adapter = shared_tool_adapter(- vec![durable],- tinyagents_harness::tool::packs::USE_SKILL,- )- .expect("use_skill resolves in the durable registry it was just placed in");+ let adapter = shared_tool_adapter(vec![durable], tinyagents_harness::tool::packs::USE_SKILL)+ .expect("use_skill resolves in the durable registry it was just placed in");(UseSkillDispatch::new(Arc::new(adapter), handle.clone()),handle,diff --git a/crates/openhuman-core/src/agent/tools/run_workflow.rs b/crates/openhuman-core/src/agent/tools/run_workflow.rsindex e5f4a3f4c2..f45f5ca99a 100644--- a/crates/openhuman-core/src/agent/tools/run_workflow.rs+++ b/crates/openhuman-core/src/agent/tools/run_workflow.rs@@ -378,7 +378,8 @@ impl Tool for RunWorkflowTool {Err(e) => return Ok(ToolResult::error(format!("run_workflow: {e}"))),};- let started = match spawn_workflow_run_background(workflow_id.clone(), inputs, origin).await {+ let started = match spawn_workflow_run_background(workflow_id.clone(), inputs, origin).await+ {Ok(s) => {if let Err(e) = guard::account_spawn(&dispatch) {return Ok(ToolResult::error(format!("run_workflow: {e}")));diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rsindex 16fe49d7cf..27d2b1da53 100644--- a/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs+++ b/crates/openhuman-core/src/channels/runtime/dispatch/processor/turn.rs@@ -462,8 +462,7 @@ pub(crate) async fn process_channel_runtime_message()),};let llm_result =- tokio::time::timeout(Duration::from_secs(ctx.message_timeout_secs), agent_call)- .await;+ tokio::time::timeout(Duration::from_secs(ctx.message_timeout_secs), agent_call).await;// Wait for draft updater to finishif let Some(handle) = draft_updater {diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rsindex 46ac3d4d1d..11ba680c27 100644--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs@@ -68,8 +68,11 @@ pub(super) async fn import_legacy_delivery(workspace: &Path) -> anyhow::Result<Olet Some(backend) = crate::storage::installed() else {return Ok(Outcome::NoBackend);};- let scope = crate::modules::storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), MODULE_ID)- .map_err(|error| anyhow::anyhow!("resolve the module scope: {:?}", error.kind()))?;+ let scope = crate::modules::storage_host::current_module_scope(+ &crate::core::runtime::DispatchCtx::ambient(),+ MODULE_ID,+ )+ .map_err(|error| anyhow::anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope).map_err(|error| anyhow::anyhow!("open the module scope: {:?}", error.kind()))?;diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex 63eb9e7425..beef7d1a38 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -538,7 +538,9 @@ impl CoreContext {/// it would turn a labelled turn into an unlabelled one the approval gate/// refuses.pub async fn scope<F: Future>(ctx: Arc<CoreContext>, fut: F) -> F::Output {- CURRENT_CONTEXT.scope(Self::keeping_turn_origin(ctx), fut).await+ CURRENT_CONTEXT+ .scope(Self::keeping_turn_origin(ctx), fut)+ .await}/// [`scope`](Self::scope) for a synchronous closure.diff --git a/crates/openhuman-core/src/core/runtime/context_test_support.rs b/crates/openhuman-core/src/core/runtime/context_test_support.rsindex e9d610fce7..741aca0b3a 100644--- a/crates/openhuman-core/src/core/runtime/context_test_support.rs+++ b/crates/openhuman-core/src/core/runtime/context_test_support.rs@@ -35,9 +35,12 @@ impl CoreContext {/// Test-only: given `[components]` switches.pub(crate) fn for_test_with_components(c: crate::core::runtime::ComponentSet) -> Arc<Self> {- let mut ctx = Arc::try_unwrap(Self::for_test(crate::core::runtime::DomainSet::full(), None))- .ok()- .unwrap();+ let mut ctx = Arc::try_unwrap(Self::for_test(+ crate::core::runtime::DomainSet::full(),+ None,+ ))+ .ok()+ .unwrap();ctx.components = c;Arc::new(ctx)}diff --git a/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs b/crates/openhuman-core/src/core/runtime/dispatch_ctx.rsindex 38e9a0952d..9d524d7cf8 100644--- a/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs+++ b/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs@@ -141,14 +141,17 @@ impl DispatchCtx {/// Whether the interactive approval gate is off for the agent this call/// runs for.pub fn approvals_disabled(&self) -> bool {- self.resolved().is_some_and(|core| core.approvals_disabled())+ self.resolved()+ .is_some_and(|core| core.approvals_disabled())}/// The origin of the turn this call belongs to. Only a bound context/// supplies one: the process default never carries authority, so an/// unbound call answers `None` and the gate reads it as `Unknown`.pub fn turn_origin(&self) -> Option<crate::agent::turn_origin::AgentTurnOrigin> {- self.core.as_ref().and_then(|core| core.turn_origin().cloned())+ self.core+ .as_ref()+ .and_then(|core| core.turn_origin().cloned())}/// [`turn_origin`](Self::turn_origin) of this call, else the origin thediff --git a/crates/openhuman-core/src/cron/tools/add.rs b/crates/openhuman-core/src/cron/tools/add.rsindex 5ebcf062cc..4602758374 100644--- a/crates/openhuman-core/src/cron/tools/add.rs+++ b/crates/openhuman-core/src/cron/tools/add.rs@@ -109,7 +109,8 @@ impl Tool for CronAddTool {options: ToolCallOptions,tool_context: Option<&dyn tinytools::ToolRunContext>,) -> anyhow::Result<ToolResult> {- let origin = crate::agent::tinyagents::host::run_context::turn_origin_for_tool(tool_context);+ let origin =+ crate::agent::tinyagents::host::run_context::turn_origin_for_tool(tool_context);if !self.config.cron.enabled {return Ok(ToolResult::error("cron is disabled by config (cron.enabled=false)".to_string(),diff --git a/crates/openhuman-core/src/flows/memory_tools.rs b/crates/openhuman-core/src/flows/memory_tools.rsindex c395b8e6bb..8ffd79e339 100644--- a/crates/openhuman-core/src/flows/memory_tools.rs+++ b/crates/openhuman-core/src/flows/memory_tools.rs@@ -304,7 +304,8 @@ impl Tool for FlowMemoryRecallTool {_options: tinytools::ToolCallOptions,tool_context: Option<&dyn tinytools::ToolRunContext>,) -> anyhow::Result<ToolResult> {- let origin = crate::agent::tinyagents::host::run_context::turn_origin_for_tool(tool_context);+ let origin =+ crate::agent::tinyagents::host::run_context::turn_origin_for_tool(tool_context);let query = match args.get("query").and_then(|v| v.as_str()) {Some(q) => q.trim(),None => return Ok(ToolResult::error("Missing 'query' parameter".to_string())),@@ -450,7 +451,8 @@ impl Tool for FlowMemoryRememberTool {_options: tinytools::ToolCallOptions,tool_context: Option<&dyn tinytools::ToolRunContext>,) -> anyhow::Result<ToolResult> {- let origin = crate::agent::tinyagents::host::run_context::turn_origin_for_tool(tool_context);+ let origin =+ crate::agent::tinyagents::host::run_context::turn_origin_for_tool(tool_context);let flow_id_arg = args.get("flow_id").and_then(|v| v.as_str());let Some(key) = args.get("key").and_then(|v| v.as_str()) else {return Ok(ToolResult::error("Missing 'key' parameter".to_string()));diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rsindex 53b09cfadf..027147e7a7 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs@@ -172,7 +172,8 @@ impl ToolBackend for ComposioToolBackend {let (outcome, audit_id) = if tier_decision == GateDecision::Allow {(crate::security::approval::GateOutcome::Allow, None)} else {- super::super::gate_call_for_tier(ctx.approval, tier_decision, slug, &summary, redacted).await+ super::super::gate_call_for_tier(ctx.approval, tier_decision, slug, &summary, redacted)+ .await};if let crate::security::approval::GateOutcome::Deny { reason } = outcome {tracing::warn!(diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rsindex 06cb06d465..e7ca8050ed 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs@@ -48,9 +48,14 @@ impl ToolBackend for NativeToolBackend {let tier_decision = super::super::enforce_node_tier_gate(ctx.security, class, "tool_call")?;let summary = crate::security::approval::summarize_action(tool_name, &args);let redacted = crate::security::approval::redact_args(&args);- let (outcome, audit_id) =- super::super::gate_call_for_tier(ctx.approval, tier_decision, tool_name, &summary, redacted)- .await;+ let (outcome, audit_id) = super::super::gate_call_for_tier(+ ctx.approval,+ tier_decision,+ tool_name,+ &summary,+ redacted,+ )+ .await;if let crate::security::approval::GateOutcome::Deny { reason } = outcome {return Err(EngineError::Capability(reason));}diff --git a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rsindex 737c528a41..fd50ee8258 100644--- a/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs+++ b/crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs@@ -144,9 +144,14 @@ impl OpenHumanMemory {let tier_decision = enforce_node_tier_gate(&self.security, CommandClass::Write, op)?;let summary = summarize_action(&tool_name, action);let redacted = redact_args(action);- let (outcome, audit_id) =- gate_call_for_tier(&self.approval, tier_decision, &tool_name, &summary, redacted)- .await;+ let (outcome, audit_id) = gate_call_for_tier(+ &self.approval,+ tier_decision,+ &tool_name,+ &summary,+ redacted,+ )+ .await;if let GateOutcome::Deny { reason } = outcome {tracing::warn!(target: "flows", op, "{LOG_PREFIX} write: approval gate denied");return Err(EngineError::Capability(reason));diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rsindex ab6547b28c..c68c48ffae 100644--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs@@ -87,24 +87,31 @@ pub(super) fn create_chat_model_with_model_id_inner(if resolves_to_managed_backend(role, config) {return make_openhuman_backend_model(role, config);}- if let Some(result) = try_create_claude_agent_sdk_chat_model(role, config, &EgressLedger::none()) {+ if let Some(result) =+ try_create_claude_agent_sdk_chat_model(role, config, &EgressLedger::none())+ {return result;}- if let Some(result) = try_create_claude_code_chat_model(role, config, None, &EgressLedger::none()) {+ if let Some(result) =+ try_create_claude_code_chat_model(role, config, None, &EgressLedger::none())+ {return result;}// Local OpenAI-compatible runtimes (Ollama / LM Studio / MLX / OMLX /// local-openai) → crate-native `ChatModel` (issue #4727 Motion B) instead// of a crate-adapted host provider. Cloud/BYOK/bespoke providers// return `None` here and fall through to the `Provider` path below.- if let Some(result) = try_create_local_runtime_chat_model(role, config, &EgressLedger::none()) {+ if let Some(result) =+ try_create_local_runtime_chat_model(role, config, &EgressLedger::none())+ {return result;}// Wire-equivalent BYOK cloud slugs (Anthropic / None / plain-Bearer, no// codex-oauth or `/v1/responses` fallback) → crate-native `ChatModel`// (issue #4727 Phase 3, conservative subset). `openai`/codex, custom// proxy slugs, and the managed entry return `None` and fall through.- if let Some(result) = try_create_cloud_slug_chat_model(role, config, &EgressLedger::none()) {+ if let Some(result) = try_create_cloud_slug_chat_model(role, config, &EgressLedger::none())+ {return result;}}@@ -244,35 +251,29 @@ pub(super) fn create_chat_model_from_string_with_model_id_inner(if resolved == PROVIDER_OPENHUMAN {return make_openhuman_backend_model(role, config);}- if let Some(result) =- try_create_claude_agent_sdk_chat_model_from_string(- role,- &resolved,- config,- &EgressLedger::none(),- )- {+ if let Some(result) = try_create_claude_agent_sdk_chat_model_from_string(+ role,+ &resolved,+ config,+ &EgressLedger::none(),+ ) {return result;}- if let Some(result) =- try_create_claude_code_chat_model_from_string(- role,- &resolved,- config,- None,- &EgressLedger::none(),- )- {+ if let Some(result) = try_create_claude_code_chat_model_from_string(+ role,+ &resolved,+ config,+ None,+ &EgressLedger::none(),+ ) {return result;}- if let Some(result) =- try_create_local_runtime_chat_model_from_string(- role,- &resolved,- config,- &EgressLedger::none(),- )- {+ if let Some(result) = try_create_local_runtime_chat_model_from_string(+ role,+ &resolved,+ config,+ &EgressLedger::none(),+ ) {return result;}if let Some(result) = try_create_cloud_slug_chat_model_from_string(@@ -280,8 +281,7 @@ pub(super) fn create_chat_model_from_string_with_model_id_inner(&resolved,config,&EgressLedger::none(),- )- {+ ) {return result;}}diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex 6c51247ea1..ad6d7d4836 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@ -338,16 +338,15 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(}let model_override =(!effective_model.trim().is_empty()).then_some(effective_model.as_str());- let (backend, pinned_model) =- match resolve_managed_backend_with_model_override(- role,- config,- model_override,- egress,- ) {- Ok(result) => result,- Err(error) => return Some(Err(error)),- };+ let (backend, pinned_model) = match resolve_managed_backend_with_model_override(+ role,+ config,+ model_override,+ egress,+ ) {+ Ok(result) => result,+ Err(error) => return Some(Err(error)),+ };return Some(Ok((Arc::new(backend.with_native_tool_calling(native_tool_calling)),pinned_model,diff --git a/crates/openhuman-core/src/inference/provider/factory/turn_model.rs b/crates/openhuman-core/src/inference/provider/factory/turn_model.rsindex 029d1c3a0b..d7ecf3dee0 100644--- a/crates/openhuman-core/src/inference/provider/factory/turn_model.rs+++ b/crates/openhuman-core/src/inference/provider/factory/turn_model.rs@@ -88,8 +88,7 @@ pub(super) fn create_turn_chat_model_with_native_tools_and_route_inner(native_tool_calling: bool,egress: &EgressLedger,) -> anyhow::Result<(Arc<dyn ChatModel<()>>, String, String)> {- if let Some(chat) = ctx.host_overrides().and_then(|local| local.model_for(role))- {+ if let Some(chat) = ctx.host_overrides().and_then(|local| local.model_for(role)) {return Ok((chat, "host".into(), model.to_owned()));}#[cfg(any(test, feature = "e2e-test-support", feature = "rss-bench"))]@@ -157,14 +156,12 @@ pub(super) fn create_turn_chat_model_with_native_tools_and_route_inner(return result.map(|(chat, resolved_model)| (chat, provider_name.clone(), resolved_model));}- if let Some(result) =- try_create_cloud_slug_chat_model_with_native_tools(- role,- config,- native_tool_calling,- egress,- )- {+ if let Some(result) = try_create_cloud_slug_chat_model_with_native_tools(+ role,+ config,+ native_tool_calling,+ egress,+ ) {return result.map(|(chat, resolved_model)| (chat, provider_name.clone(), resolved_model));}@@ -244,8 +241,7 @@ pub(crate) fn create_turn_chat_model_from_string_with_native_tools_and_route(native_tool_calling: bool,egress: &EgressLedger,) -> anyhow::Result<(Arc<dyn ChatModel<()>>, String, String)> {- if let Some(chat) = ctx.host_overrides().and_then(|local| local.model_for(role))- {+ if let Some(chat) = ctx.host_overrides().and_then(|local| local.model_for(role)) {return Ok((chat, "host".into(), model.to_owned()));}#[cfg(any(test, feature = "e2e-test-support", feature = "rss-bench"))]diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rsindex 95909f9a84..eb058a1499 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs@@ -697,7 +697,10 @@ async fn managed_construction_ledger_collapses_repeat_disclosures() {build(&EgressLedger::none());let sentinel = "egress-ledger-factory-sentinel";- crate::security::egress::emit_external_transfer(None, crate::security::egress::EgressDescriptor::network_fetch(sentinel));+ crate::security::egress::emit_external_transfer(+ None,+ crate::security::egress::EgressDescriptor::network_fetch(sentinel),+ );let mut disclosures = 0;loop {match rx.recv().await {diff --git a/crates/openhuman-core/src/inference/provider/mod.rs b/crates/openhuman-core/src/inference/provider/mod.rsindex 7e2da0905c..c9df66196c 100644--- a/crates/openhuman-core/src/inference/provider/mod.rs+++ b/crates/openhuman-core/src/inference/provider/mod.rs@@ -30,8 +30,7 @@ pub(crate) use factory::is_raw_passthrough_model;pub use factory::{create_chat_model, create_chat_model_from_string, create_chat_model_from_string_with_model_id,create_chat_model_with_model_id, create_chat_model_with_model_id_in, probe_inference_readiness,- provider_for_role,- role_for_model_tier, BYOK_INCOMPLETE_SENTINEL,+ provider_for_role, role_for_model_tier, BYOK_INCOMPLETE_SENTINEL,};pub use openhuman_backend_model::{OpenHumanBackendModel, PROVIDER_LABEL};pub use ops::*;diff --git a/crates/openhuman-core/src/integrations/client_api_key_tests.rs b/crates/openhuman-core/src/integrations/client_api_key_tests.rsindex 733517af99..1106a5392b 100644--- a/crates/openhuman-core/src/integrations/client_api_key_tests.rs+++ b/crates/openhuman-core/src/integrations/client_api_key_tests.rs@@ -44,7 +44,10 @@ async fn json_requests_send_the_api_key_as_x_api_key_and_no_bearer() {let client = api_key_client(start_mock_backend(app).await);assert!(client.uses_api_key());client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect("an API-key client reaches composio");@@ -69,7 +72,10 @@ async fn binary_download_sends_the_api_key_as_x_api_key() {);let client = api_key_client(start_mock_backend(app).await);let (bytes, _, _) = client- .get_bytes(&Default::default(), "/agent-integrations/file-storage/files/f1/download")+ .get_bytes(+ &Default::default(),+ "/agent-integrations/file-storage/files/f1/download",+ ).await.expect("download with an API key");assert_eq!(&bytes[..], b"bytes");@@ -108,7 +114,10 @@ async fn presigned_download_redirect_does_not_forward_api_key() {);let client = api_key_client(start_mock_backend(backend).await);let (bytes, _, _) = client- .get_bytes(&Default::default(), "/agent-integrations/file-storage/files/f1/download")+ .get_bytes(+ &Default::default(),+ "/agent-integrations/file-storage/files/f1/download",+ ).await.unwrap();assert_eq!(&bytes[..], b"stored bytes");diff --git a/crates/openhuman-core/src/integrations/client_error_propagation_tests.rs b/crates/openhuman-core/src/integrations/client_error_propagation_tests.rsindex e3d6615bc2..e394972079 100644--- a/crates/openhuman-core/src/integrations/client_error_propagation_tests.rs+++ b/crates/openhuman-core/src/integrations/client_error_propagation_tests.rs@@ -182,14 +182,22 @@ async fn verb_methods_block_user_data_egress_under_local_only() {assert_blocked("upload_multipart",client- .upload_multipart::<serde_json::Value>(&Default::default(), path, reqwest::multipart::Form::new())+ .upload_multipart::<serde_json::Value>(+ &Default::default(),+ path,+ reqwest::multipart::Form::new(),+ ).await.unwrap_err().to_string(),);assert_blocked("get_bytes",- client.get_bytes(&Default::default(), path).await.unwrap_err().to_string(),+ client+ .get_bytes(&Default::default(), path)+ .await+ .unwrap_err()+ .to_string(),);}@@ -250,7 +258,10 @@ async fn verb_methods_never_expose_admin_or_webhook_routes() {);assert_blocked("get_bytes",- client.get_bytes(&Default::default(), "/webhooks/core").await.unwrap_err(),+ client+ .get_bytes(&Default::default(), "/webhooks/core")+ .await+ .unwrap_err(),);}@@ -394,7 +405,10 @@ async fn local_only_rejects_user_data_verb_before_transport() {// gate and DOES reach transport (surfaces the mock's 403) — proving the// gate is selective, not a blanket network kill.let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("control-plane reaches transport and surfaces the mock 403");let msg = format!("{err:#}");@@ -419,7 +433,10 @@ async fn get_403_propagates_backend_error_envelope_message() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("403 must surface as Err");let msg = format!("{err:#}");diff --git a/crates/openhuman-core/src/integrations/client_session_expiry_tests.rs b/crates/openhuman-core/src/integrations/client_session_expiry_tests.rsindex dbca617357..4c580411a9 100644--- a/crates/openhuman-core/src/integrations/client_session_expiry_tests.rs+++ b/crates/openhuman-core/src/integrations/client_session_expiry_tests.rs@@ -95,7 +95,10 @@ async fn get_401_session_jwt_classifies_as_session_expired() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("401 must surface as Err");let msg = format!("{err:#}");@@ -137,7 +140,10 @@ async fn non_401_4xx_does_not_classify_as_session_expired() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/connections")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/connections",+ ).await.expect_err("403 must surface as Err");let msg = format!("{err:#}");@@ -247,7 +253,10 @@ async fn get_401_composio_triggers_keeps_sentinel_for_in_place_cta() {let base = start_mock_backend(app).await;let client = client_for(base);let err = client- .get::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/triggers/available?toolkit=gmail")+ .get::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/triggers/available?toolkit=gmail",+ ).await.expect_err("401 must surface as Err");let msg = format!("{err:#}");diff --git a/crates/openhuman-core/src/integrations/client_tests.rs b/crates/openhuman-core/src/integrations/client_tests.rsindex 25e1e7f87e..19623e2618 100644--- a/crates/openhuman-core/src/integrations/client_tests.rs+++ b/crates/openhuman-core/src/integrations/client_tests.rs@@ -86,10 +86,17 @@ async fn product_identity_seen_by_backend() -> ProductIdentitySeen {let client = client_for(base);let sdk_result = client- .post::<serde_json::Value>(&Default::default(), "/agent-integrations/composio/execute", &json!({}))+ .post::<serde_json::Value>(+ &Default::default(),+ "/agent-integrations/composio/execute",+ &json!({}),+ ).await;let download_result = client- .get_bytes(&Default::default(), "/agent-integrations/file-storage/files/f1/download")+ .get_bytes(+ &Default::default(),+ "/agent-integrations/file-storage/files/f1/download",+ ).await;sdk_result.expect("mock backend returns a success envelope");diff --git a/crates/openhuman-core/src/integrations/composio/tools/execute.rs b/crates/openhuman-core/src/integrations/composio/tools/execute.rsindex 8259a27fc8..e8f8d5edfe 100644--- a/crates/openhuman-core/src/integrations/composio/tools/execute.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/execute.rs@@ -110,14 +110,16 @@ impl Tool for ComposioExecuteTool {_options: ToolCallOptions,context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {- let (config, outcome) = Box::pin(self.execute_unredacted(- args,- sandbox_mode_for_tool(context),- task_recency_window_for_tool(context),- crate::agent::tinyagents::host::run_context::approval_for_tool(context)- .chat- .as_ref(),- ))+ let (config, outcome) = Box::pin(+ self.execute_unredacted(+ args,+ sandbox_mode_for_tool(context),+ task_recency_window_for_tool(context),+ crate::agent::tinyagents::host::run_context::approval_for_tool(context)+ .chat+ .as_ref(),+ ),+ ).await;redact_composio_outcome(&config, outcome)}diff --git a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rsindex 49d066ce54..4c3fbc01e4 100644--- a/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/tools_metadata_and_sandbox_tests.rs@@ -198,7 +198,12 @@ async fn connect_tool_validates_before_gating_in_chat_context() {client_id: "c-test".into(),request_id: None,};- let result = tool.execute_with_context(serde_json::json!({ "toolkit": "google_drive" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(ctx)))+ let result = tool+ .execute_with_context(+ serde_json::json!({ "toolkit": "google_drive" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(ctx)),+ ).await.unwrap();assert!(result.is_error);diff --git a/crates/openhuman-core/src/integrations/file_storage/tools/list.rs b/crates/openhuman-core/src/integrations/file_storage/tools/list.rsindex ea731dfe8b..9e0b46161b 100644--- a/crates/openhuman-core/src/integrations/file_storage/tools/list.rs+++ b/crates/openhuman-core/src/integrations/file_storage/tools/list.rs@@ -63,7 +63,11 @@ impl StorageListFilesTool {approval: &crate::security::approval::ApprovalTurnContext,) -> anyhow::Result<ToolResult> {tracing::debug!("[file_storage] listing files");- match self.client.get::<ListFilesResponse>(approval, FILES_PATH).await {+ match self+ .client+ .get::<ListFilesResponse>(approval, FILES_PATH)+ .await+ {Ok(resp) => {let mut lines = vec![format!("{} file(s), using {} of {} bytes:",diff --git a/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rs b/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rsindex 49b02a00c6..8e83b47b19 100644--- a/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rs+++ b/crates/openhuman-core/src/integrations/file_storage/tools/visibility.rs@@ -105,7 +105,8 @@ impl StorageSetVisibilityTool {tracing::debug!("[file_storage] setting visibility={visibility} for file_id={file_id}");match self.client- .patch::<FileMeta>(approval,+ .patch::<FileMeta>(+ approval,&file_path(&file_id, ""),&json!({ "visibility": visibility }),)diff --git a/crates/openhuman-core/src/integrations/tools/stock_prices.rs b/crates/openhuman-core/src/integrations/tools/stock_prices.rsindex 220db092d3..6aea5592e3 100644--- a/crates/openhuman-core/src/integrations/tools/stock_prices.rs+++ b/crates/openhuman-core/src/integrations/tools/stock_prices.rs@@ -209,7 +209,11 @@ impl StockQuoteTool {tracing::info!("[stock_quote] symbol={}", symbol);let body = json!({ "symbol": symbol });- match self.client.post::<QuoteResponse>(approval, PATH_QUOTE, &body).await {+ match self+ .client+ .post::<QuoteResponse>(approval, PATH_QUOTE, &body)+ .await+ {Ok(resp) => {let q = &resp.quote;let mut out = format!(diff --git a/crates/openhuman-core/src/mcp/registry/mod.rs b/crates/openhuman-core/src/mcp/registry/mod.rsindex 8b87611977..e52561b7fe 100644--- a/crates/openhuman-core/src/mcp/registry/mod.rs+++ b/crates/openhuman-core/src/mcp/registry/mod.rs@@ -92,7 +92,9 @@ pub mod connections {////// Sorted by qualified name, so a prompt built from this does not reshuffle/// between turns and cost its cached prefix.- pub async fn connected_overview(ctx: &crate::core::runtime::DispatchCtx) -> Vec<ConnectedServerOverview> {+ pub async fn connected_overview(+ ctx: &crate::core::runtime::DispatchCtx,+ ) -> Vec<ConnectedServerOverview> {let Some(config) = host::ambient_config(ctx) else {return Vec::new();};diff --git a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs b/crates/openhuman-core/src/mcp/server/tools/dispatch.rsindex b7d82454ff..1e9b2d4673 100644--- a/crates/openhuman-core/src/mcp/server/tools/dispatch.rs+++ b/crates/openhuman-core/src/mcp/server/tools/dispatch.rs@@ -209,7 +209,9 @@ async fn enforce_act_policy(ctx: &DispatchCtx, tool_name: &str) -> Result<(), To.map_err(ToolCallError::InvalidParams)}-async fn load_config_and_init_registry(ctx: &DispatchCtx) -> Result<crate::config::Config, ToolCallError> {+async fn load_config_and_init_registry(+ ctx: &DispatchCtx,+) -> Result<crate::config::Config, ToolCallError> {let config = ctx.load_config().await@@ -222,7 +224,9 @@ async fn load_config_and_init_registry(ctx: &DispatchCtx) -> Result<crate::confiOk(config)}-async fn build_orchestrator_agent(ctx: &DispatchCtx) -> Result<OpenHumanSessionHost, ToolCallError> {+async fn build_orchestrator_agent(+ ctx: &DispatchCtx,+) -> Result<OpenHumanSessionHost, ToolCallError> {let config = load_config_and_init_registry(ctx).await?;let mut agent =OpenHumanSessionHost::from_config_for_agent(&config, "orchestrator").map_err(|err| {@@ -319,7 +323,10 @@ async fn list_subagents(ctx: &DispatchCtx) -> Result<Value, ToolCallError> {}))}-async fn run_subagent_tool(ctx: &DispatchCtx, params: &Map<String, Value>) -> Result<Value, ToolCallError> {+async fn run_subagent_tool(+ ctx: &DispatchCtx,+ params: &Map<String, Value>,+) -> Result<Value, ToolCallError> {use super::super::subagent_depth;let agent_id = validated_param(params, "agent_id")?;diff --git a/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs b/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rsindex ade2038994..981ede1b1a 100644--- a/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs+++ b/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs@@ -11,9 +11,14 @@ async fn call_tool_records_write_argument_rejection() {.await.expect("config");- let err = call_tool(&crate::core::runtime::DispatchCtx::ambient(), "memory.learn", json!({ "kind": "fact" }), "mcp:test")- .await- .expect_err("missing text should reject");+ let err = call_tool(+ &crate::core::runtime::DispatchCtx::ambient(),+ "memory.learn",+ json!({ "kind": "fact" }),+ "mcp:test",+ )+ .await+ .expect_err("missing text should reject");assert!(err.message().contains("missing required argument `text`"),"got: {}",@@ -53,9 +58,14 @@ async fn call_tool_records_write_argument_rejection() {#[tokio::test]async fn call_tool_rejects_v1_memory_tools_as_unknown() {for name in ["memory.search", "memory.store", "memory.note", "tree.tag"] {- let err = call_tool(&crate::core::runtime::DispatchCtx::ambient(), name, json!({}), "mcp:test")- .await- .expect_err("removed tool");+ let err = call_tool(+ &crate::core::runtime::DispatchCtx::ambient(),+ name,+ json!({}),+ "mcp:test",+ )+ .await+ .expect_err("removed tool");assert!(err.message().contains("unknown MCP tool"), "{name}");}}@@ -71,12 +81,17 @@ async fn call_tool_validates_memory_arguments_before_dispatch() {unsafe {std::env::set_var("OPENHUMAN_WORKSPACE", tmp.path());}- let err = call_tool(&crate::core::runtime::DispatchCtx::ambient(), "memory.forget", json!({ "ids": [] }), "mcp:test")- .await- .expect_err("empty ids rejected before any RPC");+ let err = call_tool(+ &crate::core::runtime::DispatchCtx::ambient(),+ "memory.forget",+ json!({ "ids": [] }),+ "mcp:test",+ )+ .await+ .expect_err("empty ids rejected before any RPC");assert!(err.message().contains("`ids`"), "got: {}", err.message());let err = call_tool(-&crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),"memory.recall",json!({ "question": "q", "filter": { "x": 1 } }),"mcp:test",diff --git a/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs b/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rsindex 27ff38cb5f..9c69958005 100644--- a/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs+++ b/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs@@ -165,7 +165,7 @@ async fn test_dispatch_write_tool_rpc_error_records_audit_and_returns_tool_errorlet params = serde_json::Map::new();let result = dispatch_write_tool(-&crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),"memory.learn","openhuman.memory_learn",¶ms,@@ -251,7 +251,7 @@ async fn test_dispatch_write_tool_unregistered_rpc_is_a_tool_error() {std::fs::create_dir_all(&config.workspace_dir).unwrap();let val = dispatch_write_tool(-&crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),"memory.forget","openhuman.memory_no_such_method",&Map::new(),diff --git a/crates/openhuman-core/src/media/generation/artifact_tool.rs b/crates/openhuman-core/src/media/generation/artifact_tool.rsindex a85e2ccc06..c02f0f5f55 100644--- a/crates/openhuman-core/src/media/generation/artifact_tool.rs+++ b/crates/openhuman-core/src/media/generation/artifact_tool.rs@@ -63,9 +63,8 @@ pub struct MediaArtifactTool<T: Tool> {per_call: Option<PerCallInner<T>>,}-type PerCallInner<T> = std::sync::Arc<- dyn Fn(ProgressFn, Option<&ApprovalChatContext>) -> T + Send + Sync,->;+type PerCallInner<T> =+ std::sync::Arc<dyn Fn(ProgressFn, Option<&ApprovalChatContext>) -> T + Send + Sync>;impl<T: Tool> MediaArtifactTool<T> {/// `kind` is the artifact category to file every generated output@@ -146,8 +145,16 @@ impl<T: Tool> MediaArtifactTool<T> {else {continue;};- self.file_one(entry, &src_path, args, index, total, call_id.as_deref(), chat)- .await;+ self.file_one(+ entry,+ &src_path,+ args,+ index,+ total,+ call_id.as_deref(),+ chat,+ )+ .await;}result}@@ -199,14 +206,21 @@ impl<T: Tool> MediaArtifactTool<T> {}}Err(err) => {- let _ = fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &err, chat)- .await;+ let _ = fail_artifact(+ &self.workspace_dir,+ &self.files_dir,+ &meta.id,+ &err,+ chat,+ )+ .await;set_artifact_error(entry, &err);}}}Err(err) => {- let _ = fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &err, chat).await;+ let _ =+ fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &err, chat).await;tracing::warn!(target: "media_generation",err = %err,diff --git a/crates/openhuman-core/src/media/generation/provider.rs b/crates/openhuman-core/src/media/generation/provider.rsindex b5bb1f4df6..719412a1a6 100644--- a/crates/openhuman-core/src/media/generation/provider.rs+++ b/crates/openhuman-core/src/media/generation/provider.rs@@ -39,8 +39,11 @@ use crate::security::credentials::session_support::{pub const OPENROUTER_PROXY_PATH: &str = "/agent-integrations/openrouter";/// Rebuilds the generators so their egress disclosures reach `chat`.-type GeneratorRouter =- Arc<dyn Fn(Option<ApprovalChatContext>) -> (Arc<dyn ImageGenerator>, Arc<dyn VideoGenerator>) + Send + Sync>;+type GeneratorRouter = Arc<+ dyn Fn(Option<ApprovalChatContext>) -> (Arc<dyn ImageGenerator>, Arc<dyn VideoGenerator>)+ + Send+ + Sync,+>;/// The image and video generators for this process.pub struct MediaGenerators {diff --git a/crates/openhuman-core/src/media/generation/provider_tests.rs b/crates/openhuman-core/src/media/generation/provider_tests.rsindex 318a6f4fd8..60343427b4 100644--- a/crates/openhuman-core/src/media/generation/provider_tests.rs+++ b/crates/openhuman-core/src/media/generation/provider_tests.rs@@ -80,4 +80,3 @@ fn generators_without_a_router_are_returned_as_they_are() {assert!(Arc::ptr_eq(&generators.image, &routed.image));assert!(Arc::ptr_eq(&generators.video, &routed.video));}-diff --git a/crates/openhuman-core/src/modules/mod.rs b/crates/openhuman-core/src/modules/mod.rsindex 3b6aebf22a..b7d02a328b 100644--- a/crates/openhuman-core/src/modules/mod.rs+++ b/crates/openhuman-core/src/modules/mod.rs@@ -237,7 +237,10 @@ whereF: std::future::Future<Output = anyhow::Result<T>>,T: std::fmt::Debug + Settled,{- let scope = match storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), module_id) {+ let scope = match storage_host::current_module_scope(+ &crate::core::runtime::DispatchCtx::ambient(),+ module_id,+ ) {Ok(scope) => format!("{scope:?}"),Err(error) => {log::warn!("[{kind}] legacy storage import skipped: {:?}", error.kind());@@ -327,7 +330,13 @@ pub(crate) fn expiring_blob_module_scopes() -> Vec<crate::storage::Scope> {{[storage_grant_tinyjuice::MODULE_ID].into_iter()- .filter_map(|id| storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), id).ok())+ .filter_map(|id| {+ storage_host::current_module_scope(+ &crate::core::runtime::DispatchCtx::ambient(),+ id,+ )+ .ok()+ }).collect()}// Without the loader no module holds blobs.diff --git a/crates/openhuman-core/src/modules/storage_import_support.rs b/crates/openhuman-core/src/modules/storage_import_support.rsindex c4b55dc8f3..be5631cde0 100644--- a/crates/openhuman-core/src/modules/storage_import_support.rs+++ b/crates/openhuman-core/src/modules/storage_import_support.rs@@ -20,8 +20,11 @@ pub(super) fn module_scope(module_id: &str) -> Result<Option<ScopedStorage>> {let Some(backend) = crate::storage::installed() else {return Ok(None);};- let scope = super::storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), module_id)- .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;+ let scope = super::storage_host::current_module_scope(+ &crate::core::runtime::DispatchCtx::ambient(),+ module_id,+ )+ .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope).map_err(|error| anyhow!("open the module scope: {:?}", error.kind()))?;diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rsindex db517d7bdf..91e340273a 100644--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs@@ -73,8 +73,11 @@ pub(crate) async fn import_legacy(data_dir: &Path) -> Result<Outcome> {let Some(backend) = crate::storage::installed() else {return Ok(Outcome::NoBackend);};- let scope = super::storage_host::current_module_scope(&crate::core::runtime::DispatchCtx::ambient(), MODULE_ID)- .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;+ let scope = super::storage_host::current_module_scope(+ &crate::core::runtime::DispatchCtx::ambient(),+ MODULE_ID,+ )+ .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope).map_err(|error| anyhow!("open the module scope: {:?}", error.kind()))?;diff --git a/crates/openhuman-core/src/modules/wallet_host.rs b/crates/openhuman-core/src/modules/wallet_host.rsindex 9efb502c92..9f0c0f7fa7 100644--- a/crates/openhuman-core/src/modules/wallet_host.rs+++ b/crates/openhuman-core/src/modules/wallet_host.rs@@ -697,8 +697,9 @@ impl WalletHost {&self,request: AuthorizeX402PaymentRequest,) -> tinybus::Result<HostResponse> {- let owner_matches =- x402_request_owner_matches(&request, crate::core::runtime::DispatchCtx::ambient_turn()+ let owner_matches = x402_request_owner_matches(+ &request,+ crate::core::runtime::DispatchCtx::ambient_turn().turn_origin().as_ref(),);diff --git a/crates/openhuman-core/src/modules/wallet_service_tests.rs b/crates/openhuman-core/src/modules/wallet_service_tests.rsindex ac194d05d2..52eaad7610 100644--- a/crates/openhuman-core/src/modules/wallet_service_tests.rs+++ b/crates/openhuman-core/src/modules/wallet_service_tests.rs@@ -195,7 +195,7 @@ fn native_service_reuses_its_handle_for_identical_user_state() {#[tokio::test]async fn unconfirmed_execution_is_rejected_before_wallet_service_or_secret_access() {let error = execute_native_transfer(-&crate::core::runtime::DispatchCtx::ambient(),+ &crate::core::runtime::DispatchCtx::ambient(),&crate::config::Config::default(),None,tinywallet_bus::wire::ExecutePreparedParams {diff --git a/crates/openhuman-core/src/sandbox/shell_exec.rs b/crates/openhuman-core/src/sandbox/shell_exec.rsindex f83b792ff8..6d14d2ec17 100644--- a/crates/openhuman-core/src/sandbox/shell_exec.rs+++ b/crates/openhuman-core/src/sandbox/shell_exec.rs@@ -97,7 +97,10 @@ pub(crate) static USE_FIXTURE: std::sync::atomic::AtomicBool =/// Run `run` through the module and collect its output.////// A worker owns cancellation and resource cleanup if the caller drops its wait.-pub(crate) async fn run(config: &Config, mut run: NativeShellRun) -> anyhow::Result<SandboxExecResult> {+pub(crate) async fn run(+ config: &Config,+ mut run: NativeShellRun,+) -> anyhow::Result<SandboxExecResult> {#[cfg(test)]if !run.is_jailed() && USE_FIXTURE.load(std::sync::atomic::Ordering::SeqCst) {let _ = config;diff --git a/crates/openhuman-core/src/security/approval/gate_forced_tests.rs b/crates/openhuman-core/src/security/approval/gate_forced_tests.rsindex b90f6764aa..fc38a6870d 100644--- a/crates/openhuman-core/src/security/approval/gate_forced_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_forced_tests.rs@@ -130,7 +130,12 @@ async fn forced_approval_still_denies_automation_and_channel_origins() {#[test]fn saas_outcome_is_absent_outside_saas() {- assert!(saas_outcome_with(&crate::core::runtime::DispatchCtx::ambient(), false, "shell").is_none());+ assert!(saas_outcome_with(+ &crate::core::runtime::DispatchCtx::ambient(),+ false,+ "shell"+ )+ .is_none());}#[test]diff --git a/crates/openhuman-core/src/security/approval/gate_tests.rs b/crates/openhuman-core/src/security/approval/gate_tests.rsindex 46c73f565a..e8eb394d6d 100644--- a/crates/openhuman-core/src/security/approval/gate_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs@@ -212,7 +212,7 @@ mod subagent_tests;mod tenant_tests;#[path = "gate_triage_tests.rs"]mod triage_tests;-#[path = "gate_turn_context_tests.rs"]-mod turn_context_tests;#[path = "gate_ttl_and_triage_tests.rs"]mod ttl_and_triage_tests;+#[path = "gate_turn_context_tests.rs"]+mod turn_context_tests;diff --git a/crates/openhuman-core/src/security/devices/owner_tests.rs b/crates/openhuman-core/src/security/devices/owner_tests.rsindex 0c78d211af..69a2901e45 100644--- a/crates/openhuman-core/src/security/devices/owner_tests.rs+++ b/crates/openhuman-core/src/security/devices/owner_tests.rs@@ -49,7 +49,8 @@ async fn a_remembered_owner_that_lost_the_device_is_forgotten() {scoped_config(tmp.path()),);remember("owner-test-stale", None);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),owner_of(&DispatchCtx::new(context.clone()), "owner-test-stale", None),).await;@@ -68,8 +69,13 @@ async fn a_revoked_device_is_not_its_agents_any_more() {crate::core::runtime::DomainSet::full(),config,);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),- owner_of(&DispatchCtx::new(context.clone()), "owner-test-revoked", None),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),+ owner_of(+ &DispatchCtx::new(context.clone()),+ "owner-test-revoked",+ None,+ ),).await;assert_eq!(owner, Ok(None));@@ -105,7 +111,8 @@ async fn a_device_found_in_the_local_scope_belongs_to_local_and_is_remembered()crate::core::runtime::DomainSet::full(),config,);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),owner_of(&DispatchCtx::new(context.clone()), "owner-test-found", None),).await;@@ -120,8 +127,13 @@ async fn a_channel_no_scope_knows_is_local_and_not_remembered() {crate::core::runtime::DomainSet::full(),scoped_config(tmp.path()),);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),- owner_of(&DispatchCtx::new(context.clone()), "owner-test-missing", None),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),+ owner_of(+ &DispatchCtx::new(context.clone()),+ "owner-test-missing",+ None,+ ),).await;assert_eq!(owner, Ok(None));@@ -171,8 +183,13 @@ async fn a_revoked_device_with_a_live_cipher_is_dropped() {super::super::crypto::TunnelCipher::new(&[7u8; 32]),)),);- let owner = crate::core::runtime::CoreContext::scope(context.clone(),- owner_of(&DispatchCtx::new(context.clone()), "owner-test-cipher", None),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),+ owner_of(+ &DispatchCtx::new(context.clone()),+ "owner-test-cipher",+ None,+ ),).await;super::super::rpc::ACTIVE_CIPHERS@@ -226,7 +243,8 @@ async fn a_leftover_pairing_session_does_not_outlive_a_revocation() {super::super::store::insert_device(&config, "owner-test-leftover", "label", "pk", "hash").unwrap();super::super::store::revoke_device(&config, "owner-test-leftover").unwrap();- let owner = crate::core::runtime::CoreContext::scope(context.clone(),+ let owner = crate::core::runtime::CoreContext::scope(+ context.clone(),owner_of(&DispatchCtx::new(context.clone()),"owner-test-leftover",diff --git a/crates/openhuman-core/src/security/egress/emit_tests.rs b/crates/openhuman-core/src/security/egress/emit_tests.rsindex abcd36e9d9..7fffe44e59 100644--- a/crates/openhuman-core/src/security/egress/emit_tests.rs+++ b/crates/openhuman-core/src/security/egress/emit_tests.rs@@ -58,7 +58,10 @@ async fn local_transfer_does_not_publish() {// A local (non-external) transfer must NOT emit; a following external one// must. If we reach the sentinel without having seen the local marker, the// local transfer was correctly suppressed.- emit_external_transfer(None, EgressDescriptor::inference("ollama", local_marker, false));+ emit_external_transfer(+ None,+ EgressDescriptor::inference("ollama", local_marker, false),+ );emit_external_transfer(None, EgressDescriptor::network_fetch(sentinel_marker));loop {diff --git a/crates/openhuman-core/src/threads/store/mod.rs b/crates/openhuman-core/src/threads/store/mod.rsindex d63aec580d..5cd48bfb50 100644--- a/crates/openhuman-core/src/threads/store/mod.rs+++ b/crates/openhuman-core/src/threads/store/mod.rs@@ -33,10 +33,10 @@ pub mod blocking;mod bus;mod legacy_import;-mod transcript_key;#[cfg(test)]#[path = "legacy_import_tests.rs"]mod legacy_import_tests;+mod transcript_key;use backend as store;use tinyagents_session::threads as types;@@ -66,12 +66,12 @@ impl From<types::ConversationPurgeStats> for ConversationPurgeStats {#[cfg(feature = "channels")]pub(crate) use bus::claim_channel_turn;pub use bus::register_conversation_persistence_subscriber;-pub(crate) use transcript_key::bind_transcript_key;pub use store::{append_message, delete_messages_from, delete_thread, ensure_thread, get_messages, list_threads,purge_threads, update_message, update_thread_labels, update_thread_title,update_thread_working_dir, ConversationStore,};+pub(crate) use transcript_key::bind_transcript_key;pub use types::{is_deterministic_message_id, reply_run_id, run_reply_message_id, ConversationThread,CreateConversationThread, CrossThreadHit, ThreadMessage as ConversationMessage,diff --git a/crates/openhuman-core/src/tools/impl/document/mod.rs b/crates/openhuman-core/src/tools/impl/document/mod.rsindex ed3b09ceb3..58b8e9025a 100644--- a/crates/openhuman-core/src/tools/impl/document/mod.rs+++ b/crates/openhuman-core/src/tools/impl/document/mod.rs@@ -291,7 +291,14 @@ impl DocumentTool {.map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();let reason = format!("failed to write generated document ({filename}): {err}");- let _ = fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &reason, chat).await;+ let _ = fail_artifact(+ &self.workspace_dir,+ &self.files_dir,+ &meta.id,+ &reason,+ chat,+ )+ .await;tracing::warn!(target: "document",err = %err,@@ -303,7 +310,8 @@ impl DocumentTool {}let size_bytes = bytes.len() as u64;- let updated = match finalize_artifact(&self.workspace_dir, &meta.id, size_bytes, chat).await {+ let updated = match finalize_artifact(&self.workspace_dir, &meta.id, size_bytes, chat).await+ {Ok(updated) => updated,Err(err) => {let reason = format!("failed to finalize artifact: {err}");@@ -312,8 +320,14 @@ impl DocumentTool {// stuck `Pending` spinner. Fail-artifact errors are// swallowed — they can only recur if the same ledger backend// is unavailable.- let _ =- fail_artifact(&self.workspace_dir, &self.files_dir, &meta.id, &reason, chat).await;+ let _ = fail_artifact(+ &self.workspace_dir,+ &self.files_dir,+ &meta.id,+ &reason,+ chat,+ )+ .await;tracing::warn!(target: "document",err = %err,diff --git a/crates/openhuman-core/src/tools/impl/network/host.rs b/crates/openhuman-core/src/tools/impl/network/host.rsindex 8bbd4fcc9a..e49d25cb44 100644--- a/crates/openhuman-core/src/tools/impl/network/host.rs+++ b/crates/openhuman-core/src/tools/impl/network/host.rs@@ -315,10 +315,15 @@ mod x402 {thread_id: context.thread_id.clone(),client_id: context.client_id.clone(),});- let (service, payment) =- x402_service::prepare_payment(&self.ctx, &config, url.to_owned(), challenge.to_owned(), owner)- .await- .map_err(|error| format!("x402 payment failed: {error}"))?;+ let (service, payment) = x402_service::prepare_payment(+ &self.ctx,+ &config,+ url.to_owned(),+ challenge.to_owned(),+ owner,+ )+ .await+ .map_err(|error| format!("x402 payment failed: {error}"))?;log::debug!("[tool.http_request] retrying with x402 payment header amount={} asset={}",diff --git a/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs b/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rsindex d64089813c..2f72f6bbf6 100644--- a/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs+++ b/crates/openhuman-core/src/tools/impl/system/install_tool_tests.rs@@ -34,7 +34,12 @@ fn chat_tool_context(#[tokio::test]async fn blocked_when_install_disabled() {let tool = InstallToolTool::new(policy(false, AutonomyLevel::Full));- let result = tool.execute_with_context(json!({ "package": "jq" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(chat_ctx())))+ let result = tool+ .execute_with_context(+ json!({ "package": "jq" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(chat_ctx())),+ ).await.unwrap();assert!(result.is_error);@@ -44,7 +49,12 @@ async fn blocked_when_install_disabled() {#[tokio::test]async fn blocked_when_readonly() {let tool = InstallToolTool::new(policy(true, AutonomyLevel::ReadOnly));- let result = tool.execute_with_context(json!({ "package": "jq" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(chat_ctx())))+ let result = tool+ .execute_with_context(+ json!({ "package": "jq" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(chat_ctx())),+ ).await.unwrap();assert!(result.is_error);@@ -54,7 +64,12 @@ async fn blocked_when_readonly() {#[tokio::test]async fn rejects_injection_in_package_name() {let tool = InstallToolTool::new(policy(true, AutonomyLevel::Full));- let result = tool.execute_with_context(json!({ "package": "jq; rm -rf /" }), tinytools::ToolCallOptions::default(), Some(&chat_tool_context(chat_ctx())))+ let result = tool+ .execute_with_context(+ json!({ "package": "jq; rm -rf /" }),+ tinytools::ToolCallOptions::default(),+ Some(&chat_tool_context(chat_ctx())),+ ).await.unwrap();assert!(result.is_error);diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rsindex bca567cd96..0fbbdb0191 100644--- a/crates/openhuman-core/src/tools/mod.rs+++ b/crates/openhuman-core/src/tools/mod.rs@@ -1,9 +1,9 @@pub mod host_extensions;pub(crate) mod native_ops;-pub(crate) mod per_call;mod native_ops_types;pub mod ops;pub mod orchestrator_tools;+pub(crate) mod per_call;pub(crate) mod policy_session;pub mod registry;pub mod rules;diff --git a/crates/openhuman-core/src/util/mod.rs b/crates/openhuman-core/src/util/mod.rsindex 4164758baa..74079955d7 100644--- a/crates/openhuman-core/src/util/mod.rs+++ b/crates/openhuman-core/src/util/mod.rs@@ -40,7 +40,7 @@ pub use text::{};pub use types::MaybeSet;-#[cfg(test)]-pub(crate) mod module_test_process;#[cfg(test)]pub(crate) mod classic_transcript_fixture;+#[cfg(test)]+pub(crate) mod module_test_process;diff --git a/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs b/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rsindex 7c05eeb495..204a821acc 100644--- a/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs+++ b/crates/openhuman-core/src/voice/realtime_harness/turn_handler.rs@@ -236,7 +236,8 @@ pub async fn handle_voice_harness_turn(return;}};- let outcome = run_voice_turn(&ctx, &turn_cid, &turn_messages, &turn_prompt, progress_tx).await;+ let outcome =+ run_voice_turn(&ctx, &turn_cid, &turn_messages, &turn_prompt, progress_tx).await;// Hand the result to the foreground. If it already deferred (dropped the// receiver at the ack deadline), the send fails and we deliver the reply// into the user's chat instead.diff --git a/crates/openhuman-core/src/web_chat/progress_bridge.rs b/crates/openhuman-core/src/web_chat/progress_bridge.rsindex 7e71eb09e1..e26efe9df0 100644--- a/crates/openhuman-core/src/web_chat/progress_bridge.rs+++ b/crates/openhuman-core/src/web_chat/progress_bridge.rs@@ -10,8 +10,8 @@ use crate::web_chat::{SubagentProgressDetail, WebChannelEvent};use tinyagents_session::{port::TurnStates, turn_state::TurnStateMirror};use super::event_bus::publish_web_channel_event_in;-use crate::core::runtime::DispatchCtx;use super::types::ChatRequestMetadata;+use crate::core::runtime::DispatchCtx;#[path = "progress_bridge_subagent_events.rs"]mod subagent_events;@@ -281,7 +281,8 @@ pub(crate) fn spawn_progress_bridge(request_id: String,turn_state_store: std::sync::Arc<dyn TurnStates>,metadata: ChatRequestMetadata,- config: crate::config::Config, dispatch_ctx: crate::core::runtime::DispatchCtx,+ config: crate::config::Config,+ dispatch_ctx: crate::core::runtime::DispatchCtx,) -> ProgressBridgeHandle {use crate::agent::progress::AgentProgress;use std::collections::HashMap;@@ -684,7 +685,8 @@ pub(crate) fn spawn_progress_bridge(parent_call_id,..} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_spawned(&ctx,&mut emit_seq,@@ -713,7 +715,8 @@ pub(crate) fn spawn_progress_bridge(dirty_status,..} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_completed(&ctx,&mut emit_seq,@@ -737,7 +740,8 @@ pub(crate) fn spawn_progress_bridge(task_id,error,} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_failed(&ctx,&mut emit_seq,@@ -756,7 +760,8 @@ pub(crate) fn spawn_progress_bridge(worker_thread_id,checkpoint_path,} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_awaiting_user(&ctx,&mut emit_seq,@@ -776,7 +781,8 @@ pub(crate) fn spawn_progress_bridge(max_iterations,extended_policy,} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_iteration_started(&ctx,&mut emit_seq,@@ -798,7 +804,8 @@ pub(crate) fn spawn_progress_bridge(display_label,display_detail,} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_tool_call_started(&ctx,&mut emit_seq,@@ -830,7 +837,8 @@ pub(crate) fn spawn_progress_bridge(display_detail,structured,} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_tool_call_completed(&ctx,&mut emit_seq,@@ -857,7 +865,8 @@ pub(crate) fn spawn_progress_bridge(delta,iteration,} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_text_delta(&ctx,&mut emit_seq,@@ -874,7 +883,8 @@ pub(crate) fn spawn_progress_bridge(delta,iteration,} => {- let ctx = BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);+ let ctx =+ BridgeCtx::new(&client_id, &thread_id, &request_id, &config, &dispatch_ctx);subagent_events::on_subagent_thinking_delta(&ctx,&mut emit_seq,@@ -1131,7 +1141,11 @@ pub(crate) fn spawn_progress_bridge(let live_spans = collector.spans().to_vec();let journal_export = if let Some(trace_ctx) = journal_trace_ctx.take() {super::journal_shadow::shadow_compare_journal_projection(- &dispatch_ctx, &request_id, trace_ctx.clone(), parent_max_iterations, &live_spans,+ &dispatch_ctx,+ &request_id,+ trace_ctx.clone(),+ parent_max_iterations,+ &live_spans,).await.map(|observations| (trace_ctx, observations))diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rsindex e5c1d707f5..531b57c308 100644--- a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs+++ b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs@@ -114,7 +114,8 @@ async fn tool_call_completed_forwards_real_output_on_tool_result() {"req-out".into(),store,ChatRequestMetadata::default(),- config, crate::core::runtime::DispatchCtx::ambient(),+ config,+ crate::core::runtime::DispatchCtx::ambient(),);tx.send(crate::agent::progress::AgentProgress::ToolCallCompleted {@@ -226,7 +227,8 @@ fn spawn_test_bridge(request_id.to_string(),store,ChatRequestMetadata::default(),- Config::default(), crate::core::runtime::DispatchCtx::ambient(),+ Config::default(),+ crate::core::runtime::DispatchCtx::ambient(),);tx}@@ -421,7 +423,8 @@ async fn wait_drained_returns_after_queued_events_are_forwarded() {"req-drain".into(),store,ChatRequestMetadata::default(),- drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),+ drain_test_config(&tmp),+ crate::core::runtime::DispatchCtx::ambient(),);tx.send(AgentProgress::ToolCallCompleted {@@ -478,7 +481,8 @@ async fn wait_drained_is_bounded_when_the_turn_never_completes() {"req-drain-timeout".into(),store,ChatRequestMetadata::default(),- drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),+ drain_test_config(&tmp),+ crate::core::runtime::DispatchCtx::ambient(),);assert!(!handle.wait_drained(Duration::from_millis(50)).await);// Closing the channel ends the bridge, which counts as drained.@@ -503,7 +507,8 @@ async fn short_narration_is_flushed_on_the_rounds_first_tool_call() {"req-short".into(),store,ChatRequestMetadata::default(),- drain_test_config(&tmp), crate::core::runtime::DispatchCtx::ambient(),+ drain_test_config(&tmp),+ crate::core::runtime::DispatchCtx::ambient(),);tx.send(AgentProgress::TextDelta {delta: "Let me check.".into(),@@ -699,7 +704,8 @@ async fn hold_text_stream_suppresses_text_delta_but_keeps_interim() {hold_text_stream: true,..Default::default()},- config, crate::core::runtime::DispatchCtx::ambient(),+ config,+ crate::core::runtime::DispatchCtx::ambient(),);tx.send(AgentProgress::TextDelta {diff --git a/crates/openhuman-embed/tests/profile_host_capabilities.rs b/crates/openhuman-embed/tests/profile_host_capabilities.rsindex 50d0867182..0ee50149a6 100644--- a/crates/openhuman-embed/tests/profile_host_capabilities.rs+++ b/crates/openhuman-embed/tests/profile_host_capabilities.rs@@ -424,15 +424,14 @@ async fn scenario() {None,),);- let alice_profile =- handles[0]- .scope(async {- openhuman_core::profiles::current(+ let alice_profile = handles[0]+ .scope(async {+ openhuman_core::profiles::current(&openhuman_core::core::runtime::DispatchCtx::ambient(),).unwrap()- })- .await;+ })+ .await;let closed_hook = no_callback.hook(handles[0].id(), alice_profile.lease_fence().clone());assert!(handles[0].scope(closed_hook.before_tool_decision(&hook_context))@@ -510,15 +509,14 @@ async fn scenario() {);}handles.insert(0, reopened);- let alice_profile =- handles[0]- .scope(async {- openhuman_core::profiles::current(+ let alice_profile = handles[0]+ .scope(async {+ openhuman_core::profiles::current(&openhuman_core::core::runtime::DispatchCtx::ambient(),).unwrap()- })- .await;+ })+ .await;let alice_hook = handles[0].context().host_overrides()diff --git a/crates/openhuman-rpc/src/server/http/events_tests.rs b/crates/openhuman-rpc/src/server/http/events_tests.rsindex b3ea3e3a46..c27a7dc467 100644--- a/crates/openhuman-rpc/src/server/http/events_tests.rs+++ b/crates/openhuman-rpc/src/server/http/events_tests.rs@@ -104,7 +104,8 @@ async fn events_stream_forwards_only_the_bound_client() {let token = crate::core_host::core::event_bind_tokens::issue("stream-client", None).expect("bind token").token;- let response = events_handler(HeaderMap::new(), None, query("stream-client", Some(&token))).await;+ let response =+ events_handler(HeaderMap::new(), None, query("stream-client", Some(&token))).await;assert_eq!(response.status(), StatusCode::OK);let mut body = response.into_body().into_data_stream();diff --git a/tests/x402_twit_sh_live.rs b/tests/x402_twit_sh_live.rsindex 8d16a4ce5a..e2f40ec0c8 100644--- a/tests/x402_twit_sh_live.rs+++ b/tests/x402_twit_sh_live.rs@@ -26,8 +26,7 @@ async fn x402_pay_twit_sh_for_hal_finney_tweet() {action_dir: tmp.path().to_path_buf(),..SecurityPolicy::default()});- let tool =- openhuman_core::tools::http_request_tool(+ let tool = openhuman_core::tools::http_request_tool(&openhuman_core::core::runtime::DispatchCtx::process_default(),security,vec!["x402.twit.sh".into()],