Skip to content

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

chore: files changed src/openhuman/agent/harness/subagent_runner/ops/runner.rs\n\nAuto-committed-on: dragonfly\n

Steven Enamakelc4bb9d7cfb0e
diff --git a/src/openhuman/agent/harness/subagent_runner/ops/runner.rs b/src/openhuman/agent/harness/subagent_runner/ops/runner.rs
index 2c112fa97f..e85cc7acf6 100644
--- a/src/openhuman/agent/harness/subagent_runner/ops/runner.rs
+++ b/src/openhuman/agent/harness/subagent_runner/ops/runner.rs
@@ -109,6 +109,37 @@ pub(super) fn tier_gate_decision(
Ok(())
}
+async fn filter_cached_toolkit_actions_with_current_scope(
+ agent_id: &str,
+ toolkit: &str,
+ actions: &[crate::openhuman::agent::context::prompt::ConnectedIntegrationTool],
+) -> Vec<crate::openhuman::agent::context::prompt::ConnectedIntegrationTool> {
+ let pref = crate::openhuman::integrations::composio::providers::load_user_scope_or_default(toolkit).await;
+ let before = actions.len();
+ let filtered: Vec<_> = actions
+ .iter()
+ .filter(|action| {
+ crate::openhuman::integrations::composio::providers::is_action_visible_with_pref(
+ &action.name,
+ &pref,
+ )
+ })
+ .cloned()
+ .collect();
+ tracing::debug!(
+ agent_id = %agent_id,
+ toolkit = %toolkit,
+ cached_actions = before,
+ visible_actions = filtered.len(),
+ hidden_actions = before.saturating_sub(filtered.len()),
+ read = pref.read,
+ write = pref.write,
+ admin = pref.admin,
+ "[subagent_runner:typed] re-filtered cached toolkit catalogue with current user scope"
+ );
+ filtered
+}
+
/// Definition id of the pure-retrieval memory agent, reached from chat as the
/// `retrieve_memory` delegate and from other agents as `call_memory_agent`.
const AGENT_MEMORY_ID: &str = "agent_memory";
@@ -1005,53 +1036,68 @@ async fn run_typed_mode(
.iter()
.find(|ci| ci.connected && ci.toolkit.eq_ignore_ascii_case(tk))
{
- let fresh_actions = match &client_kind {
- Some(ComposioClientKind::Backend(client)) => {
- match crate::openhuman::integrations::composio::fetch_toolkit_actions(
- arc_config.as_ref(),
- client,
- tk,
- None,
- )
- .await
- {
- Ok(actions) if !actions.is_empty() => actions,
- Ok(_) => {
- tracing::debug!(
- agent_id = %definition.id,
- toolkit = %tk,
- "[subagent_runner:typed] fresh list_tools returned empty; falling back to cached catalogue"
- );
- cached_integration.tools.clone()
- }
- Err(e) => {
- tracing::warn!(
- agent_id = %definition.id,
- toolkit = %tk,
- error = %e,
- "[subagent_runner:typed] fresh list_tools failed; falling back to cached catalogue"
- );
- cached_integration.tools.clone()
+ let fresh_actions = if !cached_integration.tools.is_empty() {
+ tracing::debug!(
+ agent_id = %definition.id,
+ toolkit = %tk,
+ cached_actions = cached_integration.tools.len(),
+ "[subagent_runner:typed] using cached toolkit catalogue"
+ );
+ filter_cached_toolkit_actions_with_current_scope(
+ &definition.id,
+ tk,
+ &cached_integration.tools,
+ )
+ .await
+ } else {
+ match &client_kind {
+ Some(ComposioClientKind::Backend(client)) => {
+ match crate::openhuman::integrations::composio::fetch_toolkit_actions(
+ arc_config.as_ref(),
+ client,
+ tk,
+ None,
+ )
+ .await
+ {
+ Ok(actions) if !actions.is_empty() => actions,
+ Ok(_) => {
+ tracing::debug!(
+ agent_id = %definition.id,
+ toolkit = %tk,
+ "[subagent_runner:typed] fresh list_tools returned empty; falling back to cached catalogue"
+ );
+ cached_integration.tools.clone()
+ }
+ Err(e) => {
+ tracing::warn!(
+ agent_id = %definition.id,
+ toolkit = %tk,
+ error = %e,
+ "[subagent_runner:typed] fresh list_tools failed; falling back to cached catalogue"
+ );
+ cached_integration.tools.clone()
+ }
}
}
- }
- Some(ComposioClientKind::Direct(_)) => {
- tracing::info!(
- agent_id = %definition.id,
- toolkit = %tk,
- cached_actions = cached_integration.tools.len(),
- "[composio-direct] subagent_runner:typed: direct mode active — using cached catalogue, skipping backend list_tools refresh"
- );
- cached_integration.tools.clone()
- }
- None => {
- tracing::debug!(
- agent_id = %definition.id,
- toolkit = %tk,
- cached_actions = cached_integration.tools.len(),
- "[subagent_runner:typed] composio client unavailable; using cached catalogue"
- );
- cached_integration.tools.clone()
+ Some(ComposioClientKind::Direct(_)) => {
+ tracing::info!(
+ agent_id = %definition.id,
+ toolkit = %tk,
+ cached_actions = cached_integration.tools.len(),
+ "[composio-direct] subagent_runner:typed: direct mode active — using cached catalogue, skipping backend list_tools refresh"
+ );
+ cached_integration.tools.clone()
+ }
+ None => {
+ tracing::debug!(
+ agent_id = %definition.id,
+ toolkit = %tk,
+ cached_actions = cached_integration.tools.len(),
+ "[subagent_runner:typed] composio client unavailable; using cached catalogue"
+ );
+ cached_integration.tools.clone()
+ }
}
};
let integration = crate::openhuman::agent::context::prompt::ConnectedIntegration {