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
refactor(provider): reorganise imports and module declarations
Steven Enamakel4f72004cdf2c
diff --git a/crates/openhuman-core/src/inference/openai_oauth/flow_tests.rs b/crates/openhuman-core/src/inference/openai_oauth/flow_tests.rsindex 940eac57fd..251abeaf83 100644--- a/crates/openhuman-core/src/inference/openai_oauth/flow_tests.rs+++ b/crates/openhuman-core/src/inference/openai_oauth/flow_tests.rs@@ -77,7 +77,7 @@ fn test_oauth_config(token_url: &'static str) -> OAuthConfig {}}-#[path = "flow_tests_lifecycle_tests.rs"]-mod lifecycle_tests;#[path = "flow_tests_bearer_token_tests.rs"]mod bearer_token_tests;+#[path = "flow_tests_lifecycle_tests.rs"]+mod lifecycle_tests;diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rsindex 4f68569043..e6e785942b 100644--- a/crates/openhuman-core/src/inference/provider/factory.rs+++ b/crates/openhuman-core/src/inference/provider/factory.rs@@ -49,22 +49,24 @@ mod subprocess_providers;mod tiers;mod turn_model;+pub(crate) use access_gates::{+ current_host_requires_session, verify_backend_session_active, verify_session_active,+};+pub(crate) use chat_model::resolves_to_managed_backend;pub use chat_model::{create_chat_model, create_chat_model_from_string, create_chat_model_from_string_with_model_id,create_chat_model_with_model_id, probe_inference_readiness,};-pub(crate) use chat_model::resolves_to_managed_backend;-pub use credentials::{auth_key_for_slug, lookup_key_for_slug, redact_endpoint};pub(crate) use credentials::openai_bearer_is_oauth;-pub use routing::{provider_for_role, role_bypasses_managed_credits};-pub(crate) use routing::role_uses_implicit_cloud_fallback;-pub use tiers::{resolve_model_for_hint, role_for_model_tier};-pub(crate) use tiers::{is_known_openhuman_tier, is_raw_passthrough_model, oh_tier_supports_vision};-pub(crate) use access_gates::{- current_host_requires_session, verify_backend_session_active, verify_session_active,-};+pub use credentials::{auth_key_for_slug, lookup_key_for_slug, redact_endpoint};pub(crate) use local_runtime::create_local_chat_model_from_string;pub(crate) use managed_backend::{make_openhuman_backend_model, summarization_tier_model};+pub(crate) use routing::role_uses_implicit_cloud_fallback;+pub use routing::{provider_for_role, role_bypasses_managed_credits};+pub(crate) use tiers::{+ is_known_openhuman_tier, is_raw_passthrough_model, oh_tier_supports_vision,+};+pub use tiers::{resolve_model_for_hint, role_for_model_tier};pub(crate) use turn_model::{create_turn_chat_model, create_turn_chat_model_from_string,create_turn_chat_model_from_string_with_native_tools,@@ -100,7 +102,9 @@ use primary_cloud::{legacy_custom_inference_provider_string, legacy_inference_slug, looks_like_openhuman_backend,normalize_endpoint_for_compare, redact_inference_url, resolve_primary_cloud_provider_string,};-use routing::{configured_route_for_role, route_has_usable_credentials, split_model_and_temperature};+use routing::{+ configured_route_for_role, route_has_usable_credentials, split_model_and_temperature,+};use subprocess_providers::{claude_agent_sdk_model_from_string, prepare_claude_agent_sdk_chat_model,try_create_claude_agent_sdk_chat_model, try_create_claude_agent_sdk_chat_model_from_string,@@ -109,7 +113,6 @@ use subprocess_providers::{use tiers::is_abstract_tier_model;use turn_model::create_turn_chat_model_with_native_tools_and_route_inner;-/// Test-only seam: inject a mock [`ChatModel`] so e2e tests can drive the/// autonomous run paths (`spawn_workflow_run_background`, the task dispatcher)/// with a scripted LLM and no network. Process-global because those runs arediff --git a/crates/openhuman-core/src/inference/provider/factory/access_gates.rs b/crates/openhuman-core/src/inference/provider/factory/access_gates.rsindex 388226aa9e..c4cc718879 100644--- a/crates/openhuman-core/src/inference/provider/factory/access_gates.rs+++ b/crates/openhuman-core/src/inference/provider/factory/access_gates.rs@@ -170,10 +170,7 @@ pub(crate) fn verify_backend_session_active(config: &Config) -> anyhow::Result<(});let auth = AuthService::new(&state_dir, config.secrets.encrypt);let has_session = auth- .get_provider_bearer_token(- crate::security::credentials::APP_SESSION_PROVIDER,- None,- )?+ .get_provider_bearer_token(crate::security::credentials::APP_SESSION_PROVIDER, None)?.filter(|s| !s.trim().is_empty()).is_some();if !has_session {diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rsindex 7f4dd668b1..39eefbbcb1 100644--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs@@ -292,7 +292,11 @@ pub(super) fn with_default_temperature(/// Successful production routes never reach this function. Keeping error/// resolution separate means `create_chat_model*` no longer constructs a/// legacy `Provider` merely to discover that a route is invalid.-pub(super) fn unresolved_chat_model_error(role: &str, provider: &str, config: &Config) -> anyhow::Error {+pub(super) fn unresolved_chat_model_error(+ role: &str,+ provider: &str,+ config: &Config,+) -> anyhow::Error {let p = provider.trim();if let Err(error) = enforce_local_only_inference(role, p) {diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex 29695d6cc6..3b87085096 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@ -120,9 +120,10 @@ pub(super) fn resolve_cloud_slug<'a>(// their local chat model caused it would be a lie.let implicit_fallback = role_uses_implicit_cloud_fallback(role, config);let local_chat = if implicit_fallback {- config.chat_provider.as_deref().filter(|chat| {- crate::inference::local::profile::is_local_provider_string(chat)- })+ config+ .chat_provider+ .as_deref()+ .filter(|chat| crate::inference::local::profile::is_local_provider_string(chat))} else {None};@@ -199,7 +200,10 @@ pub(super) fn resolve_cloud_slug<'a>(/// `verify_session_active`) runs before building. Temperature rides the per-call/// `ModelRequest` (managed/local parity; the `@<temp>` suffix still bakes a fixed/// override).-pub(super) fn try_create_cloud_slug_chat_model(role: &str, config: &Config) -> OptionalChatModelResult {+pub(super) fn try_create_cloud_slug_chat_model(+ role: &str,+ config: &Config,+) -> OptionalChatModelResult {try_create_cloud_slug_chat_model_with_native_tools(role, config, true)}@@ -379,11 +383,7 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(// gates, so this constructs. Disclose as external. Single cloud chokepoint// for every cloud ChatModel/turn entry.crate::security::egress::emit_external_transfer(- crate::security::egress::EgressDescriptor::inference(- &slug,- &effective_model,- true,- ),+ crate::security::egress::EgressDescriptor::inference(&slug, &effective_model, true),);let unsupported = config.temperature_unsupported_models.clone();diff --git a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rsindex edcae80097..7b7e50b72f 100644--- a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs+++ b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs@@ -22,7 +22,10 @@ pub(super) type ResolvedChatModel = (Arc<dyn ChatModel<()>>, String);pub(super) type OptionalChatModelResult = Option<anyhow::Result<ResolvedChatModel>>;-pub(super) fn try_create_local_runtime_chat_model(role: &str, config: &Config) -> OptionalChatModelResult {+pub(super) fn try_create_local_runtime_chat_model(+ role: &str,+ config: &Config,+) -> OptionalChatModelResult {let resolved = provider_for_role(role, config);try_create_local_runtime_chat_model_from_string(role, &resolved, config, true)}@@ -33,9 +36,7 @@ pub(super) fn try_create_local_runtime_chat_model_from_string(config: &Config,require_session: bool,) -> OptionalChatModelResult {- use crate::inference::local::profile::{- LOCAL_OPENAI_PROFILE, MLX_PROFILE, OMLX_PROFILE,- };+ use crate::inference::local::profile::{LOCAL_OPENAI_PROFILE, MLX_PROFILE, OMLX_PROFILE};let p = provider.trim().to_string();let is_local = p.starts_with(OLLAMA_PROVIDER_PREFIX)diff --git a/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs b/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rsindex 404db45b52..07a42a22d9 100644--- a/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs+++ b/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs@@ -5,7 +5,10 @@ use super::*;/// Build the Claude Agent SDK subprocess directly as a crate model. This is a/// prompt-guided model: TinyAgents owns its text-tool protocol, while the/// provider owns only subprocess transport and NDJSON decoding.-pub(super) fn try_create_claude_agent_sdk_chat_model(role: &str, config: &Config) -> OptionalChatModelResult {+pub(super) fn try_create_claude_agent_sdk_chat_model(+ role: &str,+ config: &Config,+) -> OptionalChatModelResult {let resolved = provider_for_role(role, config);try_create_claude_agent_sdk_chat_model_from_string(role, &resolved, config)}@@ -43,7 +46,10 @@ pub(super) fn prepare_claude_agent_sdk_chat_model(Some(Ok(model))}-pub(super) fn claude_agent_sdk_model_from_string(provider: &str, config: &Config) -> Option<String> {+pub(super) fn claude_agent_sdk_model_from_string(+ provider: &str,+ config: &Config,+) -> Option<String> {let provider = provider.trim();let model = if provider == CLAUDE_AGENT_SDK_PROVIDER {config.claude_agent_sdk.default_model.clone()@@ -71,8 +77,8 @@ pub(super) fn try_create_claude_code_chat_model_from_string(model_override: Option<&str>,) -> OptionalChatModelResult {let provider = provider.trim();- let model_with_temp = provider- .strip_prefix(crate::inference::provider::claude_code::PROVIDER_PREFIX)?;+ let model_with_temp =+ provider.strip_prefix(crate::inference::provider::claude_code::PROVIDER_PREFIX)?;let (configured_model, temperature_override) = split_model_and_temperature(model_with_temp);if temperature_override.is_some() {log::warn!(@@ -95,8 +101,7 @@ pub(super) fn try_create_claude_code_chat_model_from_string(if let Err(error) = verify_session_active(config) {return Some(Err(error));}- let workspace =- crate::inference::provider::claude_code::workspace_dir_from_config(config);+ let workspace = crate::inference::provider::claude_code::workspace_dir_from_config(config);let effective_model = model_override.unwrap_or(&configured_model).to_string();emit_inference_egress(role,@@ -105,14 +110,13 @@ pub(super) fn try_create_claude_code_chat_model_from_string(crate::inference::provider::claude_code::PROVIDER_PREFIX),);- let chat =- match crate::inference::provider::claude_code::ClaudeCodeProvider::from_env(- effective_model,- workspace,- config.action_dir.clone(),- ) {- Ok(model) => Arc::new(model) as Arc<dyn ChatModel<()>>,- Err(error) => return Some(Err(error)),- };+ let chat = match crate::inference::provider::claude_code::ClaudeCodeProvider::from_env(+ effective_model,+ workspace,+ config.action_dir.clone(),+ ) {+ Ok(model) => Arc::new(model) as Arc<dyn ChatModel<()>>,+ Err(error) => return Some(Err(error)),+ };Some(Ok((chat, configured_model)))}diff --git a/crates/openhuman-core/src/inference/provider/factory/tiers.rs b/crates/openhuman-core/src/inference/provider/factory/tiers.rsindex c4550ceed1..4fffb0e281 100644--- a/crates/openhuman-core/src/inference/provider/factory/tiers.rs+++ b/crates/openhuman-core/src/inference/provider/factory/tiers.rs@@ -32,10 +32,7 @@ pub fn resolve_model_for_hint(hint_or_tier: &str, config: &Config) -> String {("burst", crate::config::MODEL_BURST_V1),("coding", crate::config::MODEL_CODING_V1),("vision", crate::config::MODEL_VISION_V1),- (- "summarization",- crate::config::MODEL_SUMMARIZATION_V1,- ),+ ("summarization", crate::config::MODEL_SUMMARIZATION_V1),// Background subconscious workload rides the lightweight chat tier on the// managed backend; its `subconscious` *role* (handled below) still selects// the provider via `subconscious_provider`.@@ -49,10 +46,7 @@ pub fn resolve_model_for_hint(hint_or_tier: &str, config: &Config) -> String {(crate::config::MODEL_BURST_V1, "burst"),(crate::config::MODEL_CODING_V1, "coding"),(crate::config::MODEL_VISION_V1, "vision"),- (- crate::config::MODEL_SUMMARIZATION_V1,- "summarization",- ),+ (crate::config::MODEL_SUMMARIZATION_V1, "summarization"),];let (tier, role) = if let Some(hint_key) = hint_or_tier.strip_prefix("hint:") {diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rsindex ba1c1a8793..88d464d2fa 100644--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs@@ -181,9 +181,9 @@ fn only_library_hosts_are_exempt_from_app_login() {}}-#[path = "factory_route_resolution_tests.rs"]-mod route_resolution_tests;#[path = "factory_crate_native_tests.rs"]mod crate_native_tests;#[path = "factory_egress_fallback_tests.rs"]mod egress_fallback_tests;+#[path = "factory_route_resolution_tests.rs"]+mod route_resolution_tests;diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error/policy_rejection.rs b/crates/openhuman-core/src/inference/provider/ops/http_error/policy_rejection.rsindex a7c2cd0831..b63c8badd7 100644--- a/crates/openhuman-core/src/inference/provider/ops/http_error/policy_rejection.rs+++ b/crates/openhuman-core/src/inference/provider/ops/http_error/policy_rejection.rs@@ -102,8 +102,8 @@ pub fn log_backend_error_code_owned(status: reqwest::StatusCode,body: &str,) {- let code = crate::inference::provider::extract_backend_error_code_token(body)- .unwrap_or_default();+ let code =+ crate::inference::provider::extract_backend_error_code_token(body).unwrap_or_default();tracing::info!(domain = "llm_provider",operation = operation,diff --git a/crates/openhuman-core/src/inference/provider/ops/models.rs b/crates/openhuman-core/src/inference/provider/ops/models.rsindex db741d59f2..5b5b06cfbc 100644--- a/crates/openhuman-core/src/inference/provider/ops/models.rs+++ b/crates/openhuman-core/src/inference/provider/ops/models.rs@@ -29,7 +29,9 @@ mod types;pub use types::ModelInfo;-pub use catalog_listing::{append_query_param, list_configured_models, list_configured_models_from_config};+pub use catalog_listing::{+ append_query_param, list_configured_models, list_configured_models_from_config,+};pub use local_runtime::synthesize_local_runtime_entry;pub use openrouter::is_openrouter_provider;pub use parsing::{merge_openai_codex_model_hints, model_items_from_body, parse_models_response};diff --git a/crates/openhuman-core/src/integrations/composio/client/execute.rs b/crates/openhuman-core/src/integrations/composio/client/execute.rsnew file mode 100644index 0000000000..02b93916af--- /dev/null+++ b/crates/openhuman-core/src/integrations/composio/client/execute.rs@@ -0,0 +1,255 @@+//! [`ComposioClient`]'s tool-discovery and execution surface: `list_tools`,+//! the `execute_tool*` family (including the post-OAuth readiness retry),+//! and the shared `post_execute_tool` HTTP call.++use std::time::Duration;++use anyhow::Result;+use serde_json::Value;++use super::connections::ComposioClient;+use super::super::types::{ComposioExecuteResponse, ComposioToolsResponse};++const POST_OAUTH_ACTION_RETRY_DELAY: Duration = Duration::from_secs(10);+/// Literal error fragments Composio's gateway emits during the post-OAuth+/// readiness gap. Matching is case-insensitive and substring-based so+/// trailing punctuation or wrapper text from the gateway does not silently+/// disable the retry.+const POST_OAUTH_AUTH_ERROR_STRINGS: &[&str] = &["connection error, try to authenticate"];++impl ComposioClient {+ pub async fn list_tools(+ &self,+ toolkits: Option<&[String]>,+ tags: Option<&[String]>,+ ) -> Result<ComposioToolsResponse> {+ let mut params: Vec<String> = Vec::new();+ if let Some(list) = toolkits {+ let joined = list+ .iter()+ .map(|t| t.trim())+ .filter(|t| !t.is_empty())+ .map(|t| urlencoding::encode(t).into_owned())+ .collect::<Vec<_>>()+ .join(",");+ if !joined.is_empty() {+ params.push(format!("toolkits={joined}"));+ }+ }+ if let Some(list) = tags {+ let joined = list+ .iter()+ .map(|t| t.trim())+ .filter(|t| !t.is_empty())+ .map(|t| urlencoding::encode(t).into_owned())+ .collect::<Vec<_>>()+ .join(",");+ if !joined.is_empty() {+ params.push(format!("tags={joined}"));+ }+ }+ let path = if params.is_empty() {+ "/agent-integrations/composio/tools".to_string()+ } else {+ format!("/agent-integrations/composio/tools?{}", params.join("&"))+ };+ tracing::debug!(path = %path, "[composio] list_tools");+ self.inner.get::<ComposioToolsResponse>(&path).await+ }++ // ── Execute ─────────────────────────────────────────────────────++ /// `POST /agent-integrations/composio/execute` — run a Composio+ /// action and return the provider result + cost.+ pub async fn execute_tool(+ &self,+ tool: &str,+ arguments: Option<serde_json::Value>,+ ) -> Result<ComposioExecuteResponse> {+ self.execute_tool_with_connection(tool, arguments, None)+ .await+ }++ /// `POST /agent-integrations/composio/execute` — run a Composio action+ /// against one specific connected account.+ ///+ /// `connection_id = None` preserves [`Self::execute_tool`]'s ambient-account+ /// behavior. A non-empty id is forwarded as `connectionId`; the backend+ /// verifies that the authenticated user owns it before dispatching.+ pub async fn execute_tool_with_connection(+ &self,+ tool: &str,+ arguments: Option<serde_json::Value>,+ connection_id: Option<&str>,+ ) -> Result<ComposioExecuteResponse> {+ let tool = tool.trim();+ if tool.is_empty() {+ anyhow::bail!("composio.execute_tool: tool slug must not be empty");+ }+ // Egress spine (privacy epic S2, #4436): a Composio tool call ships the+ // (already-normalized) arguments to the third-party provider — disclose+ // the transfer before the round-trip. S4 will add an approval arm here.+ let egress = crate::security::egress::EgressDescriptor::composio(tool);+ // Local-only enforcement (privacy epic S7, #4441): refuse the external+ // tool call under LocalOnly BEFORE disclosing or sending it.+ crate::security::egress::enforce_egress(&egress)?;+ crate::security::egress::emit_external_transfer(egress);+ // PR #1827 routes all execute-side argument normalization+ // (including the bare-date → RFC 3339 fix #1802 brought to+ // `normalize_calendar_query_args` on `main`) through the+ // centralized `prepare_execute_arguments` helper. The helper+ // covers the same calendar query case and is the shared entry+ // point for `composio_execute`, per-action tools, and direct-+ // mode dispatch.+ let arguments = super::execute_prepare::prepare_execute_arguments(tool, arguments)+ .map_err(anyhow::Error::msg)?;+ let connection_id = connection_id.map(str::trim).filter(|id| !id.is_empty());+ tracing::debug!(+ tool = %tool,+ connection_id = ?connection_id,+ "[composio] execute_tool"+ );+ let mut body = json!({ "tool": tool, "arguments": arguments });+ if let Some(connection_id) = connection_id {+ body["connectionId"] = json!(connection_id);+ }+ let mut resp = self+ .execute_tool_with_post_oauth_retry(tool, &body, POST_OAUTH_ACTION_RETRY_DELAY)+ .await?;+ if !resp.successful {+ if let Some(ref err) = resp.error {+ resp.error = Some(super::error_mapping::format_provider_error(tool, err));+ }+ }+ Ok(resp)+ }++ /// `POST /agent-integrations/composio/execute` — single, non-retrying+ /// HTTP round-trip. Use this when the caller owns the retry loop+ /// (e.g. `auth_retry`) to avoid double-retry. In particular,+ /// [`super::auth_retry::execute_with_auth_retry`] uses this entry+ /// point so its `must retry exactly once` contract still holds+ /// after PR #1707 introduced the inner retry.+ pub(crate) async fn execute_tool_once(+ &self,+ tool: &str,+ arguments: Option<serde_json::Value>,+ ) -> Result<ComposioExecuteResponse> {+ let tool = tool.trim();+ if tool.is_empty() {+ anyhow::bail!("composio.execute_tool_once: tool slug must not be empty");+ }+ // Egress spine (privacy epic S2, #4436): see `execute_tool`. This is the+ // caller-owns-retry entry point (e.g. `auth_retry`), disjoint from+ // `execute_tool`, so each logical tool call emits exactly once.+ let egress = crate::security::egress::EgressDescriptor::composio(tool);+ // Local-only enforcement (privacy epic S7, #4441): same gate as+ // `execute_tool` — this disjoint entry point must block too.+ crate::security::egress::enforce_egress(&egress)?;+ crate::security::egress::emit_external_transfer(egress);+ let arguments = super::execute_prepare::prepare_execute_arguments(tool, arguments)+ .map_err(anyhow::Error::msg)?;+ tracing::debug!(tool = %tool, "[composio] execute_tool_once (no built-in retry)");+ let body = json!({ "tool": tool, "arguments": arguments });+ let result = self.post_execute_tool(&body).await;+ match &result {+ Ok(resp) => tracing::debug!(+ tool = %tool,+ successful = resp.successful,+ has_error = resp.error.is_some(),+ "[composio] execute_tool_once completed"+ ),+ Err(err) => tracing::warn!(+ tool = %tool,+ error = %err,+ "[composio] execute_tool_once failed"+ ),+ }+ result.map_err(|e| {+ anyhow::Error::msg(super::error_mapping::remap_transport_error(+ tool,+ &e.to_string(),+ ))+ })+ }++ pub(super) async fn execute_tool_with_post_oauth_retry(+ &self,+ tool: &str,+ body: &serde_json::Value,+ retry_delay: Duration,+ ) -> Result<ComposioExecuteResponse> {+ tracing::debug!(+ tool = %tool,+ retry_delay_ms = retry_delay.as_millis() as u64,+ attempt = 1u8,+ "[composio] execute_tool_with_post_oauth_retry attempt"+ );+ let first = self.post_execute_tool(body).await?;+ let should_retry = is_post_oauth_auth_readiness_error(&first);+ tracing::debug!(+ tool = %tool,+ attempt = 1u8,+ successful = first.successful,+ has_error = first.error.is_some(),+ should_retry,+ "[composio] execute_tool_with_post_oauth_retry branch decision"+ );+ if !should_retry {+ return Ok(first);+ }++ tracing::warn!(+ tool = %tool,+ retry_delay_ms = retry_delay.as_millis() as u64,+ "[composio] action returned post-OAuth auth-readiness error; retrying once"+ );+ if !retry_delay.is_zero() {+ tokio::time::sleep(retry_delay).await;+ }+ tracing::debug!(+ tool = %tool,+ retry_delay_ms = retry_delay.as_millis() as u64,+ attempt = 2u8,+ "[composio] execute_tool_with_post_oauth_retry retry dispatch"+ );+ let retry = self.post_execute_tool(body).await;+ match &retry {+ Ok(resp) => tracing::debug!(+ tool = %tool,+ attempt = 2u8,+ successful = resp.successful,+ has_error = resp.error.is_some(),+ "[composio] execute_tool_with_post_oauth_retry retry completed"+ ),+ Err(err) => tracing::debug!(+ tool = %tool,+ attempt = 2u8,+ error = %err,+ "[composio] execute_tool_with_post_oauth_retry retry failed"+ ),+ }+ retry+ }++ async fn post_execute_tool(&self, body: &serde_json::Value) -> Result<ComposioExecuteResponse> {+ self.inner+ .post::<ComposioExecuteResponse>("/agent-integrations/composio/execute", body)+ .await+ }++ /// `GET /agent-integrations/composio/github/repos` — list repositories+ /// available via the user's authorized GitHub connected account.++fn is_post_oauth_auth_readiness_error(resp: &ComposioExecuteResponse) -> bool {+ if resp.successful {+ return false;+ }+ let Some(error) = resp.error.as_deref() else {+ return false;+ };+ let normalized = error.trim().to_ascii_lowercase();+ POST_OAUTH_AUTH_ERROR_STRINGS+ .iter()+ .any(|needle| normalized.contains(needle))+}