Skip to content

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

fix(flows): match tool contracts by separated action slug alias

Steven Enamakelfa003a55959e
diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rs
index 6d36f31020..ba783fdecd 100644
--- a/crates/openhuman-core/src/agent/mod.rs
+++ b/crates/openhuman-core/src/agent/mod.rs
@@ -71,9 +71,6 @@ pub mod session_host;
pub mod session_import;
pub mod session_store;
pub mod stop_hooks;
-/// Wall-clock deadline of one top-level turn: the outer backstop and the
-/// harness wind-down / hard-stop points derived from it.
-pub mod turn_deadline;
/// Product-specific adapters around `tinyagents_orchestration::subagent`.
/// Generic lifecycle ordering and task-key coalescing live in TinyAgents;
/// definitions, prompts, tools, policy, checkpoints and progress remain here.
@@ -83,6 +80,9 @@ pub mod todos;
pub mod tool_policy;
pub mod tools;
pub mod triage;
+/// Wall-clock deadline of one top-level turn: the outer backstop and the
+/// harness wind-down / hard-stop points derived from it.
+pub mod turn_deadline;
/// Turn-origin task-local — explicit trust/routing label scoped by every
/// entry point that invokes the agent (web chat, channel runtime, cron,
/// background jobs, CLI). Read by the approval gate to make
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/finish.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/finish.rs
index dd1943b305..10484cdfae 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/finish.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/finish.rs
@@ -170,10 +170,7 @@ impl SpanCollector {
.unwrap_or(fallback_end);
let mut extra = BTreeMap::new();
if matches!(kind, SpanKind::Tool | SpanKind::Subagent) {
- extra.insert(
- FORCE_CLOSED_ATTR.to_string(),
- serde_json::Value::Bool(true),
- );
+ extra.insert(FORCE_CLOSED_ATTR.to_string(), serde_json::Value::Bool(true));
extra.insert(LEVEL_ATTR.to_string(), json_str("WARNING"));
log::debug!(
"[agent-tracing] force-closed span name={} start={start} end={end} \
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs
index ca1225c274..570c969038 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/state.rs
@@ -203,7 +203,11 @@ impl SpanCollector {
/// = the parent turn) was dispatched at `start_unix_ms`. Consumed by that
/// call's generation span. Used by the journal projection, whose
/// `ModelCompleted` carries the real request start.
- pub(crate) fn set_next_call_start(&mut self, subagent_task_id: Option<&str>, start_unix_ms: u64) {
+ pub(crate) fn set_next_call_start(
+ &mut self,
+ subagent_task_id: Option<&str>,
+ start_unix_ms: u64,
+ ) {
let clock = match subagent_task_id {
None => Some(&mut self.call_clock),
Some(id) => self
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
index 506ae8cb5c..4303153673 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
@@ -483,7 +483,7 @@ async fn a_curated_orchestrator_sees_and_holds_every_juice_tool_in_handle_mode()
// (`ToolScope::Named`) belt that lacked them was told to call tools it
// could not dispatch.
use crate::agent::session_host::types::OpenHumanSessionHost;
- use crate::inference::tokenjuice::{RETRIEVE_TOOL_NAME, REPL_TOOL_NAMES};
+ use crate::inference::tokenjuice::{REPL_TOOL_NAMES, RETRIEVE_TOOL_NAME};
let _ = crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins();
@@ -505,7 +505,10 @@ async fn a_curated_orchestrator_sees_and_holds_every_juice_tool_in_handle_mode()
let registered: std::collections::HashSet<&str> =
agent.tools().iter().map(|t| t.name()).collect();
for name in REPL_TOOL_NAMES.iter().copied().chain([RETRIEVE_TOOL_NAME]) {
- assert!(visible.contains(name), "{name} must be visible to the orchestrator");
+ assert!(
+ visible.contains(name),
+ "{name} must be visible to the orchestrator"
+ );
assert!(
registered.contains(name),
"{name} must be registered so a call to it dispatches"
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs
index d278b94112..10420b791c 100644
--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs
@@ -35,7 +35,11 @@ fn classified_halt_returns_partial_work_without_provider_usage() {
let close = classified_halt_close(&outcome).expect("classified halt");
assert_eq!(close.usage.model_calls, 0);
assert!(close.output.contains("permission"), "{}", close.output);
- assert!(close.output.contains("`list` succeeded"), "{}", close.output);
+ assert!(
+ close.output.contains("`list` succeeded"),
+ "{}",
+ close.output
+ );
assert!(
!close.output.contains("three items"),
"no raw tool output: {}",
diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations_tests.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations_tests.rs
index a1abc0b8fc..f5af882412 100644
--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations_tests.rs
@@ -15,7 +15,11 @@ fn item(toolkit: &str, connected: bool) -> crate::agent::prompts::ConnectedInteg
#[test]
fn only_connected_toolkits_seed_the_announced_set() {
- let items = vec![item("gmail", true), item("notion", false), item("slack", false)];
+ let items = vec![
+ item("gmail", true),
+ item("notion", false),
+ item("slack", false),
+ ];
let seeded = connected_toolkit_slugs(&items);
assert_eq!(seeded, HashSet::from(["gmail".to_string()]));
}
@@ -46,7 +50,11 @@ fn a_new_connection_is_announced_once_and_a_revoke_is_dropped() {
let mut pending = Vec::new();
// Notion becomes connected; gmail is revoked (still listed, not connected).
- let current = vec![item("gmail", false), item("notion", true), item("slack", false)];
+ let current = vec![
+ item("gmail", false),
+ item("notion", true),
+ item("slack", false),
+ ];
merge_integration_announcements(&mut announced, &mut pending, &current);
assert_eq!(pending, vec!["notion".to_string()]);
assert_eq!(announced, HashSet::from(["notion".to_string()]));
diff --git a/crates/openhuman-core/src/agent/session_host/stop_summary.rs b/crates/openhuman-core/src/agent/session_host/stop_summary.rs
index 315b3f818b..106091ce1f 100644
--- a/crates/openhuman-core/src/agent/session_host/stop_summary.rs
+++ b/crates/openhuman-core/src/agent/session_host/stop_summary.rs
@@ -105,7 +105,9 @@ impl StopReasonKind {
Self::Authentication => "a service rejected my credentials",
Self::Permission => "I don't have permission for a step this needs",
Self::Policy => "a step this needs is blocked by your security settings",
- Self::MissingProgram => "a program or feature this needs is not available on this device",
+ Self::MissingProgram => {
+ "a program or feature this needs is not available on this device"
+ }
Self::NotFound => "something this needs could not be found",
Self::InvalidCalls => "a tool kept rejecting my requests as invalid",
Self::Unavailable => "a tool this needs is not available right now",
diff --git a/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rs b/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rs
index c85419f629..6bf52a3640 100644
--- a/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn_checkpoint_tests.rs
@@ -194,7 +194,10 @@ fn the_final_summary_of_a_halted_turn_gives_a_reason_and_names_the_tools() {
out.starts_with("I stopped this turn early because the same step kept failing."),
"lead missing: {out}"
);
- assert!(!out.contains("Stopping:"), "the stop note is not quoted: {out}");
+ assert!(
+ !out.contains("Stopping:"),
+ "the stop note is not quoted: {out}"
+ );
assert!(
out.contains("- `install_item` failed: no direct download"),
"the tool and its error line follow: {out}"
diff --git a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
index c055f28836..5f8b969dba 100644
--- a/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/budget_stop_turn_tests.rs
@@ -261,9 +261,19 @@ async fn deadline_wind_down_pauses_the_hosted_turn_inner() {
);
assert_eq!(tool_calls.load(std::sync::atomic::Ordering::SeqCst), 1);
assert_eq!(outcome.tool_calls, 1);
- assert!(outcome.text.trim().is_empty(), "no final answer yet: the close writes it");
- assert_eq!(outcome.tool_outcomes.len(), 1, "the completed round is kept");
- assert!(!outcome.hit_cap, "a deadline wind-down is not an iteration cap");
+ assert!(
+ outcome.text.trim().is_empty(),
+ "no final answer yet: the close writes it"
+ );
+ assert_eq!(
+ outcome.tool_outcomes.len(),
+ 1,
+ "the completed round is kept"
+ );
+ assert!(
+ !outcome.hit_cap,
+ "a deadline wind-down is not an iteration cap"
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs
index ae22c8317e..ce7f6beb55 100644
--- a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs
@@ -21,7 +21,10 @@ fn pauses_once_after_the_wind_down_point() {
let now = Instant::now();
let deadline = TurnDeadline::new(now - Duration::from_secs(781), Duration::from_secs(900));
let mw = DeadlineWindDownMiddleware::new(handle(), deadline);
- assert!(mw.maybe_pause("after_tool", now), "first checkpoint past wind-down pauses");
+ assert!(
+ mw.maybe_pause("after_tool", now),
+ "first checkpoint past wind-down pauses"
+ );
assert!(mw.fired());
assert!(
!mw.maybe_pause("after_model", now),
@@ -34,8 +37,7 @@ fn pauses_once_after_the_wind_down_point() {
/// bring it below the backstop.
#[test]
fn the_default_harness_ceiling_is_clamped_below_the_backstop() {
- let backstop =
- Duration::from_secs(crate::agent::turn_deadline::DEFAULT_TURN_BACKSTOP_SECS);
+ let backstop = Duration::from_secs(crate::agent::turn_deadline::DEFAULT_TURN_BACKSTOP_SECS);
let default_ms = crate::agent::tinyagents::DEFAULT_AGENT_TURN_TIMEOUT_SECS * 1_000;
assert!(
default_ms > backstop.as_millis() as u64,
@@ -62,8 +64,14 @@ fn install_clamps_the_policy_and_adds_the_middleware_for_a_root_turn() {
.limits
.max_wall_clock_ms
.expect("bounded wall clock");
- assert!(clamped <= 840_000, "clamped to the hard stop, got {clamped}");
- assert!(clamped > 830_000, "measured from the deadline start, got {clamped}");
+ assert!(
+ clamped <= 840_000,
+ "clamped to the hard stop, got {clamped}"
+ );
+ assert!(
+ clamped > 830_000,
+ "measured from the deadline start, got {clamped}"
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/call_effect.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/call_effect.rs
index a1be76ca59..6ead445f74 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/call_effect.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/call_effect.rs
@@ -55,7 +55,8 @@ pub(crate) struct ToolEffectFacts {
}
/// Looks up the declarations of a registered tool by name, for these args.
-pub(crate) type ToolFactsLookup = Arc<dyn Fn(&str, &Value) -> Option<ToolEffectFacts> + Send + Sync>;
+pub(crate) type ToolFactsLookup =
+ Arc<dyn Fn(&str, &Value) -> Option<ToolEffectFacts> + Send + Sync>;
/// The facts `tool` declares for a call with `args`.
pub(crate) fn facts_for_tool(tool: &dyn Tool, args: &Value) -> ToolEffectFacts {
@@ -137,22 +138,83 @@ pub(crate) fn dispatch_target<'a>(tool: &str, args: &'a Value) -> Option<Dispatc
/// Operation verbs that read without changing anything.
const READING_VERBS: &[&str] = &[
- "browse", "cat", "check", "count", "describe", "dig", "fetch", "find", "get", "grep",
- "info", "inspect", "list", "lookup", "ls", "peek", "poll", "preview", "query", "read",
- "recall", "retrieve", "search", "show", "stat", "status", "view", "whois",
+ "browse", "cat", "check", "count", "describe", "dig", "fetch", "find", "get", "grep", "info",
+ "inspect", "list", "lookup", "ls", "peek", "poll", "preview", "query", "read", "recall",
+ "retrieve", "search", "show", "stat", "status", "view", "whois",
];
/// Operation verbs that change state. One of these anywhere in the name makes
/// the call an action, even beside a reading verb.
const MUTATING_VERBS: &[&str] = &[
- "add", "apply", "approve", "archive", "authorize", "book", "bridge", "buy", "cancel",
- "clear", "close", "commit", "connect", "copy", "create", "delete", "deploy", "disable",
- "disconnect", "edit", "enable", "exec", "execute", "follow", "forward", "insert", "install",
- "invite", "kill", "like", "mark", "merge", "mint", "modify", "move", "open", "patch", "pay",
- "post", "publish", "purchase", "push", "put", "remove", "rename", "replace", "reply",
- "reset", "restart", "run", "save", "schedule", "send", "set", "share", "sign", "star",
- "start", "stop", "store", "submit", "swap", "transfer", "trash", "uninstall", "update",
- "upload", "upsert", "write",
+ "add",
+ "apply",
+ "approve",
+ "archive",
+ "authorize",
+ "book",
+ "bridge",
+ "buy",
+ "cancel",
+ "clear",
+ "close",
+ "commit",
+ "connect",
+ "copy",
+ "create",
+ "delete",
+ "deploy",
+ "disable",
+ "disconnect",
+ "edit",
+ "enable",
+ "exec",
+ "execute",
+ "follow",
+ "forward",
+ "insert",
+ "install",
+ "invite",
+ "kill",
+ "like",
+ "mark",
+ "merge",
+ "mint",
+ "modify",
+ "move",
+ "open",
+ "patch",
+ "pay",
+ "post",
+ "publish",
+ "purchase",
+ "push",
+ "put",
+ "remove",
+ "rename",
+ "replace",
+ "reply",
+ "reset",
+ "restart",
+ "run",
+ "save",
+ "schedule",
+ "send",
+ "set",
+ "share",
+ "sign",
+ "star",
+ "start",
+ "stop",
+ "store",
+ "submit",
+ "swap",
+ "transfer",
+ "trash",
+ "uninstall",
+ "update",
+ "upload",
+ "upsert",
+ "write",
];
/// The effect the operation verbs in `name` imply: `Unknown` when it carries
@@ -202,7 +264,11 @@ fn leaf_effect(facts: Option<ToolEffectFacts>, name: &str) -> CallEffect {
/// A dispatcher is judged by its target, unless the dispatcher itself already
/// declares an external effect for these arguments (`composio_execute` does
/// for a mutating action slug).
-pub(crate) fn call_effect(lookup: Option<&ToolFactsLookup>, tool: &str, args: &Value) -> CallEffect {
+pub(crate) fn call_effect(
+ lookup: Option<&ToolFactsLookup>,
+ tool: &str,
+ args: &Value,
+) -> CallEffect {
let facts = lookup.and_then(|lookup| lookup(tool, args));
let Some(target) = dispatch_target(tool, args) else {
return leaf_effect(facts, tool);
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
index 20f6f5117f..66e7184402 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
@@ -121,7 +121,10 @@ fn the_effect_of_a_dispatcher_is_the_effect_of_its_target() {
let list = serde_json::json!({"skill": "composio", "tool": "composio_list_tools", "args": {}});
assert_eq!(call_effect(None, "use_skill", &list), CallEffect::ReadOnly);
let send = serde_json::json!({"skill": "gmail", "tool": "gmail_send_email", "args": {}});
- assert_eq!(call_effect(None, "use_skill", &send), CallEffect::SideEffecting);
+ assert_eq!(
+ call_effect(None, "use_skill", &send),
+ CallEffect::SideEffecting
+ );
let fetch = serde_json::json!({"tool": "GMAIL_FETCH_EMAILS", "arguments": {}});
assert_eq!(
call_effect(None, "composio_execute", &fetch),
@@ -188,7 +191,14 @@ async fn a_read_only_use_skill_timeout_does_not_end_the_turn() {
.await;
assert_eq!(drain_pause_count(&handle), 0, "two retries are allowed");
assert!(slot.lock().unwrap().is_none());
- run_call(&mw, "skill-3", "use_skill", args, &harness_timeout("use_skill")).await;
+ run_call(
+ &mw,
+ "skill-3",
+ "use_skill",
+ args,
+ &harness_timeout("use_skill"),
+ )
+ .await;
assert_eq!(drain_pause_count(&handle), 1, "the budget is still bounded");
let summary = slot.lock().unwrap().clone().unwrap();
assert!(summary.contains("transient"), "{summary}");
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index ce1a58b4ec..11901c2669 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -20,8 +20,8 @@
//! tinyagents harness.
mod compaction_carry;
-mod deadline_wind_down;
pub mod config;
+mod deadline_wind_down;
pub mod discovery;
mod embeddings;
mod harness_assembly;
diff --git a/crates/openhuman-core/src/agent/turn_deadline_tests.rs b/crates/openhuman-core/src/agent/turn_deadline_tests.rs
index ed81ec055f..7c81f40ecd 100644
--- a/crates/openhuman-core/src/agent/turn_deadline_tests.rs
+++ b/crates/openhuman-core/src/agent/turn_deadline_tests.rs
@@ -13,7 +13,9 @@ fn default_deadlines_are_780s_840s_900s() {
/// backstop an operator can configure.
#[test]
fn wind_down_precedes_hard_stop_precedes_backstop_for_every_backstop() {
- for secs in [1_u64, 2, 5, 10, 30, 60, 120, 300, 599, 600, 601, 900, 1_200, 3_600, 86_400] {
+ for secs in [
+ 1_u64, 2, 5, 10, 30, 60, 120, 300, 599, 600, 601, 900, 1_200, 3_600, 86_400,
+ ] {
let deadline = TurnDeadline::starting_now(Duration::from_secs(secs));
assert!(
deadline.wind_down_after() < deadline.hard_stop_after(),
@@ -51,7 +53,10 @@ fn harness_wall_clock_is_always_clamped_below_the_backstop() {
assert_eq!(unbounded, 840_000);
// A configured ceiling that is already tighter is kept.
- assert_eq!(deadline.clamp_wall_clock_ms(Some(10_000), now), Some(10_000));
+ assert_eq!(
+ deadline.clamp_wall_clock_ms(Some(10_000), now),
+ Some(10_000)
+ );
}
#[test]
@@ -80,8 +85,14 @@ fn should_wind_down_flips_at_the_wind_down_point() {
#[test]
fn parse_backstop_defaults_and_disables() {
assert_eq!(parse_backstop(None), Some(Duration::from_secs(900)));
- assert_eq!(parse_backstop(Some("garbage")), Some(Duration::from_secs(900)));
- assert_eq!(parse_backstop(Some(" 120 ")), Some(Duration::from_secs(120)));
+ assert_eq!(
+ parse_backstop(Some("garbage")),
+ Some(Duration::from_secs(900))
+ );
+ assert_eq!(
+ parse_backstop(Some(" 120 ")),
+ Some(Duration::from_secs(120))
+ );
assert_eq!(parse_backstop(Some("0")), None);
}
@@ -92,5 +103,7 @@ async fn task_local_scope_is_visible_inside_and_absent_outside() {
let seen = with_turn_deadline(Some(deadline), async { current() }).await;
assert_eq!(seen, Some(deadline));
assert!(current().is_none());
- assert!(with_turn_deadline(None, async { current() }).await.is_none());
+ assert!(with_turn_deadline(None, async { current() })
+ .await
+ .is_none());
}
diff --git a/crates/openhuman-core/src/flows/builder_tools/tool_contract.rs b/crates/openhuman-core/src/flows/builder_tools/tool_contract.rs
index bf6e9fa6fc..e22f10d48f 100644
--- a/crates/openhuman-core/src/flows/builder_tools/tool_contract.rs
+++ b/crates/openhuman-core/src/flows/builder_tools/tool_contract.rs
@@ -112,7 +112,12 @@ impl Tool for GetToolContractTool {
)));
};
- match catalog.iter().find(|c| c.slug.eq_ignore_ascii_case(&slug)) {
+ // `action_slug_matches` also accepts a separated alias
+ // (`GOOGLE_DRIVE_FIND_FILE` for `GOOGLEDRIVE_FIND_FILE`).
+ match catalog
+ .iter()
+ .find(|c| crate::integrations::composio::contract::action_slug_matches(&c.slug, &slug))
+ {
Some(contract) => {
// B12: a prior real-output probe (get_tool_output_sample) for
// this exact slug is ACTUAL observed data and always wins
diff --git a/crates/openhuman-core/src/flows/ops/catalog.rs b/crates/openhuman-core/src/flows/ops/catalog.rs
index e8194b98c2..b992ac97df 100644
--- a/crates/openhuman-core/src/flows/ops/catalog.rs
+++ b/crates/openhuman-core/src/flows/ops/catalog.rs
@@ -78,7 +78,7 @@ pub async fn flows_get_tool_contract(
};
match catalog
.iter()
- .find(|c| c.slug.eq_ignore_ascii_case(trimmed))
+ .find(|c| crate::integrations::composio::contract::action_slug_matches(&c.slug, trimmed))
{
Some(contract) => {
let contract = crate::flows::tinyflows::caps::apply_probe_override(contract.clone());
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
index 5102c06877..f46abb363b 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
@@ -294,7 +294,10 @@ impl ModuleReplTool {
/// The handle slot held a path: query the persisted artifact it names.
async fn execute_on_artifact(&self, path: String, args: Value) -> anyhow::Result<ToolResult> {
let Some(dir) = self.artifacts_dir.clone() else {
- log::debug!("[tokenjuice][repl] {} artifact path with no workspace", self.name);
+ log::debug!(
+ "[tokenjuice][repl] {} artifact path with no workspace",
+ self.name
+ );
return Ok(ToolResult::error(not_a_handle_message()));
};
let read = tokio::task::spawn_blocking(move || {
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
index 884e097453..ba44effe19 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
@@ -291,7 +291,9 @@ async fn an_artifact_path_in_the_handle_slot_is_read_from_the_tool_results_dir()
// The legacy relative pointer form resolves against the same dir.
let relative = format!(
"artifacts/tool-results/{}",
- file.strip_prefix(dir_of(&file, 3)).unwrap().to_string_lossy()
+ file.strip_prefix(dir_of(&file, 3))
+ .unwrap()
+ .to_string_lossy()
);
let by_relative = tools[tool(&tools, "juice_find")]
.execute(json!({ "handle": relative, "query": "needle" }))
@@ -317,7 +319,12 @@ async fn an_artifact_path_outside_the_tool_results_dir_is_refused() {
let tools = tools_with_artifacts(dir.clone());
let find = &tools[tool(&tools, "juice_find")];
- let traversal = dir.join("sess1").join("..").join("..").join("..").join("secret.txt");
+ let traversal = dir
+ .join("sess1")
+ .join("..")
+ .join("..")
+ .join("..")
+ .join("secret.txt");
for bad in [
secret.to_string_lossy().into_owned(),
traversal.to_string_lossy().into_owned(),
@@ -333,7 +340,11 @@ async fn an_artifact_path_outside_the_tool_results_dir_is_refused() {
!result_text(&res).contains("needle secret"),
"{bad} leaked content"
);
- assert!(result_text(&res).contains("file_read"), "{}", result_text(&res));
+ assert!(
+ result_text(&res).contains("file_read"),
+ "{}",
+ result_text(&res)
+ );
}
}
@@ -366,10 +377,13 @@ fn an_oversized_artifact_is_refused_before_it_is_read() {
#[tokio::test]
async fn a_call_id_or_other_non_handle_gets_an_actionable_message() {
let (_tmp, dir, _file) = artifacts_fixture();
- for tools in [tools_with_artifacts(dir), repl_tools_with(
- Arc::new(MemorySource(Arc::new(MemoryCcrStore::default()))),
- ReplLimits::default(),
- )] {
+ for tools in [
+ tools_with_artifacts(dir),
+ repl_tools_with(
+ Arc::new(MemorySource(Arc::new(MemoryCcrStore::default()))),
+ ReplLimits::default(),
+ ),
+ ] {
let find = &tools[tool(&tools, "juice_find")];
for bad in ["call_abc123", "toolu_01XyZ", "a b"] {
let res = find
diff --git a/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
index 49980a7f2c..3c68304133 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/tools_tests.rs
@@ -51,7 +51,10 @@ async fn retrieve_messages_name_only_the_tool_the_model_can_call() {
.unwrap()
.output();
for msg in [missing, miss_message("deadbeefcafe")] {
- assert!(msg.contains(crate::inference::tokenjuice::RETRIEVE_TOOL_NAME), "{msg}");
+ assert!(
+ msg.contains(crate::inference::tokenjuice::RETRIEVE_TOOL_NAME),
+ "{msg}"
+ );
assert!(!msg.contains("tokenjuice_retrieve"), "{msg}");
assert!(!msg.contains("tinyjuice_retrieve"), "{msg}");
}
diff --git a/crates/openhuman-core/src/integrations/composio/contract/mod.rs b/crates/openhuman-core/src/integrations/composio/contract/mod.rs
index 67618731f4..3da4eeb55f 100644
--- a/crates/openhuman-core/src/integrations/composio/contract/mod.rs
+++ b/crates/openhuman-core/src/integrations/composio/contract/mod.rs
@@ -16,8 +16,8 @@ pub use profile::{
ConnectedIdentity, IdentityKind, ProviderUserProfile,
};
pub use scopes::{
- agent_ready_toolkits, classify_unknown, find_curated, toolkit_from_slug, CuratedTool,
- ToolScope, UserScopePref,
+ action_slug_matches, agent_ready_toolkits, canonical_action_slug, classify_unknown,
+ find_curated, toolkit_from_slug, CuratedTool, ToolScope, UserScopePref,
};
pub use tasks::{GithubFetchMode, NormalizedTask, TaskContainer, TaskFetchFilter, TaskKind};
diff --git a/crates/openhuman-core/src/integrations/composio/contract/scopes_tests.rs b/crates/openhuman-core/src/integrations/composio/contract/scopes_tests.rs
index 57f14b57eb..35bae06c79 100644
--- a/crates/openhuman-core/src/integrations/composio/contract/scopes_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/contract/scopes_tests.rs
@@ -249,7 +249,16 @@ fn a_spaced_alias_is_rewritten_to_the_canonical_action_slug() {
assert_eq!(canonical_action_slug("MICROSOFT_TEAMS_SEND_MESSAGE"), None);
assert_eq!(canonical_action_slug("GMAIL_SEND_EMAIL"), None);
- assert!(action_slug_matches("GOOGLEDRIVE_FIND_FILE", "GOOGLE_DRIVE_FIND_FILE"));
- assert!(action_slug_matches("GOOGLEDRIVE_FIND_FILE", "googledrive_find_file"));
- assert!(!action_slug_matches("GOOGLEDRIVE_FIND_FILE", "GOOGLE_DRIVE_LIST_FILES"));
+ assert!(action_slug_matches(
+ "GOOGLEDRIVE_FIND_FILE",
+ "GOOGLE_DRIVE_FIND_FILE"
+ ));
+ assert!(action_slug_matches(
+ "GOOGLEDRIVE_FIND_FILE",
+ "googledrive_find_file"
+ ));
+ assert!(!action_slug_matches(
+ "GOOGLEDRIVE_FIND_FILE",
+ "GOOGLE_DRIVE_LIST_FILES"
+ ));
}
diff --git a/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs b/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs
index 738ba58e27..8bf3204da1 100644
--- a/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools_direct_mode_routing_tests.rs
@@ -322,7 +322,10 @@ fn composio_connect_outlives_its_approval_park() {
let bound = std::time::Duration::from_secs(DEFAULT_COMPOSIO_CONNECT_TIMEOUT_SECS);
match composio_connect_tool_timeout(Some(bound)) {
tinytools::ToolTimeout::Millis(ms) => {
- assert!(ms > bound.as_millis() as u64, "budget {ms}ms must exceed the park bound");
+ assert!(
+ ms > bound.as_millis() as u64,
+ "budget {ms}ms must exceed the park bound"
+ );
}
other => panic!("expected an explicit budget, got {other:?}"),
}
diff --git a/crates/openhuman-core/src/modules/search/proxy_tests.rs b/crates/openhuman-core/src/modules/search/proxy_tests.rs
index a54bb37d2e..0db278d00e 100644
--- a/crates/openhuman-core/src/modules/search/proxy_tests.rs
+++ b/crates/openhuman-core/src/modules/search/proxy_tests.rs
@@ -110,7 +110,10 @@ async fn execute_tool_outlives_the_bus_default_timeout() {
.clone()
.call::<serde_json::Value>(names::methods::EXECUTE_TOOL, (web_answer_request(),))
.await;
- assert!(cut_off.is_err(), "the default deadline must fire: {cut_off:?}");
+ assert!(
+ cut_off.is_err(),
+ "the default deadline must fire: {cut_off:?}"
+ );
let answered: serde_json::Value = call_execute_tool(proxy, web_answer_request())
.await
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
index eb563df3b0..8b7df8cfa4 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests.rs
@@ -60,10 +60,10 @@ fn test_security_with_env_cmd() -> Arc<SecurityPolicy> {
})
}
-#[path = "shell_tests_runtime_and_sandbox_tests.rs"]
-mod runtime_and_sandbox_tests;
#[path = "shell_tests_platform_tests.rs"]
mod platform_tests;
+#[path = "shell_tests_runtime_and_sandbox_tests.rs"]
+mod runtime_and_sandbox_tests;
#[path = "shell_tests_schema_and_env_tests.rs"]
mod schema_and_env_tests;
#[path = "shell_tests_timeout_tests.rs"]
diff --git a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
index 23392d29d7..d897623116 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell_tests_platform_tests.rs
@@ -17,7 +17,10 @@ fn windows_description_names_cmd_and_its_equivalents_of_posix_commands() {
for equivalent in ["`cd`", "`dir`", "`type`", "`findstr`", "`%VAR%`", "`&&`"] {
assert!(desc.contains(equivalent), "missing {equivalent}: {desc}");
}
- assert!(desc.contains("powershell"), "names the PowerShell escape hatch: {desc}");
+ assert!(
+ desc.contains("powershell"),
+ "names the PowerShell escape hatch: {desc}"
+ );
// No POSIX app-launch examples on Windows.
assert!(!desc.contains("xdg-open"), "{desc}");
assert!(!desc.contains("open -a"), "{desc}");
@@ -47,12 +50,18 @@ fn the_tool_describes_the_shell_this_host_actually_spawns() {
test_runtime(),
test_audit(),
);
- assert_eq!(tool.description(), shell_description(ShellFlavor::current()));
+ assert_eq!(
+ tool.description(),
+ shell_description(ShellFlavor::current())
+ );
let command_desc = tool.parameters_schema()["properties"]["command"]["description"]
.as_str()
.unwrap()
.to_string();
- assert_eq!(command_desc, command_param_description(ShellFlavor::current()));
+ assert_eq!(
+ command_desc,
+ command_param_description(ShellFlavor::current())
+ );
assert!(command_param_description(ShellFlavor::Cmd).contains("cmd.exe"));
}
@@ -132,11 +141,7 @@ fn sandboxed_calls_get_the_same_python_defaults() {
async fn a_spawned_shell_sees_the_python_utf8_defaults() {
// A developer's own setting wins, so expect it when present.
let expected = std::env::var("PYTHONUTF8").unwrap_or_else(|_| "1".to_string());
- let tool = ShellTool::new(
- test_security_with_env_cmd(),
- test_runtime(),
- test_audit(),
- );
+ let tool = ShellTool::new(test_security_with_env_cmd(), test_runtime(), test_audit());
let command = if cfg!(windows) {
"echo %PYTHONUTF8%"
} else {
diff --git a/crates/openhuman-core/src/tools/timeout/mod_tests.rs b/crates/openhuman-core/src/tools/timeout/mod_tests.rs
index 48a9cc5a10..0e5d02ca49 100644
--- a/crates/openhuman-core/src/tools/timeout/mod_tests.rs
+++ b/crates/openhuman-core/src/tools/timeout/mod_tests.rs
@@ -357,7 +357,10 @@ mod harness_install {
elapsed < Duration::from_secs(20),
"the call is cut at its budget, not left to run: {elapsed:?}"
);
- assert!(!finished.load(Ordering::SeqCst), "the hung call never completed");
+ assert!(
+ !finished.load(Ordering::SeqCst),
+ "the hung call never completed"
+ );
let transcript = format!("{:?}", run.messages);
assert!(
transcript.contains("hung_mcp_call") && transcript.contains("timed out after 1000 ms"),
diff --git a/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs b/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs
index 662da9fc6a..6ff95da15b 100644
--- a/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs
+++ b/crates/openhuman-core/src/web_chat/ops/turn_guards_tests.rs
@@ -51,7 +51,9 @@ async fn backstop_firing_yields_a_classified_turn_timeout_error() {
})
.await
.expect_err("backstop fires");
- assert!(super::super::super::web_errors::is_outer_backstop_timeout(&err));
+ assert!(super::super::super::web_errors::is_outer_backstop_timeout(
+ &err
+ ));
let classified = super::super::super::web_errors::classify_inference_error(&err);
assert_eq!(classified.error_type, "turn_timeout");
assert!(!classified.message.trim().is_empty());