Skip to content

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

chore(tests): remove unused composio raw coverage test files

Steven Enamakela62233a5fd76
diff --git a/tests/raw_coverage/composio_tools_direct_raw_coverage_e2e.rs b/tests/raw_coverage/composio_tools_direct_raw_coverage_e2e.rs
index c41e187746..1eaac2fafb 100644
--- a/tests/raw_coverage/composio_tools_direct_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/composio_tools_direct_raw_coverage_e2e.rs
@@ -16,9 +16,7 @@ use tempfile::tempdir;
use openhuman_core::integrations::composio::client::direct_list_connections;
use openhuman_core::integrations::composio::trigger_history::ComposioTriggerHistoryStore;
-use openhuman_core::security::{AutonomyLevel, SecurityPolicy};
-use openhuman_core::tools::ComposioTool;
-use tinytools::Tool;
+use openhuman_core::tools::DirectComposioClient;
#[derive(Clone, Default)]
struct MockState {
@@ -35,99 +33,21 @@ struct RecordedRequest {
}
#[tokio::test]
-async fn direct_composio_tool_uses_loopback_for_list_execute_connect_and_accounts() {
+async fn direct_composio_client_uses_loopback_for_connected_accounts() {
let state = MockState::default();
let app = Router::new()
.fallback(any(composio_direct_handler))
.with_state(state.clone());
let base = start_loopback(app).await;
let tool = Arc::new(
- ComposioTool::new_with_base_urls_for_loopback(
+ DirectComposioClient::new_with_base_urls_for_loopback(
" ck_round16 ",
- Some(" entity-round16 "),
- writable_security(),
format!("{base}/api/v2"),
format!("{base}/api/v3"),
)
- .expect("loopback direct tool"),
+ .expect("loopback direct client"),
);
- let actions = tool
- .list_actions(Some(" gmail "))
- .await
- .expect("v3 actions");
- assert_eq!(actions.len(), 2);
- assert!(actions
- .iter()
- .any(|action| action.name == "gmail-fetch-emails"
- && action.app_name.as_deref() == Some("gmail")));
- assert!(actions
- .iter()
- .any(|action| action.name == "gmail-send-email"
- && action.description.as_deref() == Some("Send Gmail")));
-
- let listed = tool
- .execute(json!({ "action": "list", "app": "gmail" }))
- .await
- .expect("tool list action");
- assert!(!listed.is_error);
- assert!(listed.output().contains("Found 2 available actions"));
-
- let raw_execute = tool
- .execute_action(
- " GMAIL_FETCH_EMAILS ",
- json!({ "query": "label:INBOX" }),
- Some(" entity-override "),
- Some(" acct-gmail "),
- )
- .await
- .expect("v3 execute action");
- assert_eq!(
- raw_execute.pointer("/data/messages/0/id"),
- Some(&json!("msg-direct"))
- );
-
- let fallback_execute = tool
- .execute_action("FALLBACK_ACTION", json!({ "ok": true }), None, None)
- .await
- .expect("v2 execute fallback");
- assert_eq!(fallback_execute.pointer("/legacy"), Some(&json!(true)));
-
- let failed = tool
- .execute_action(
- "BROKEN_ACTION",
- json!({ "connected_account_id": "acct-secret" }),
- Some("entity-secret"),
- Some("acct-secret"),
- )
- .await
- .expect_err("both v3 and v2 fail");
- let failed = failed.to_string();
- assert!(failed.contains("Composio execute failed on v3"));
- assert!(failed.contains("[redacted]"));
-
- let linked_by_toolkit = tool
- .get_connection_url(Some("gmail"), None, "entity-round16")
- .await
- .expect("connect via resolved auth config");
- assert_eq!(linked_by_toolkit, "https://connect.example/from-data");
-
- let linked_by_auth_config = tool
- .get_connection_url(None, Some("auth-explicit"), "entity-round16")
- .await
- .expect("connect via explicit auth config");
- assert_eq!(
- linked_by_auth_config,
- "https://connect.example/from-redirect-url"
- );
-
- let missing_connect = tool
- .get_connection_url(None, None, "entity-round16")
- .await
- .expect_err("connect needs app or auth config")
- .to_string();
- assert!(missing_connect.contains("Missing 'app' or 'auth_config_id'"));
-
let accounts = tool
.list_connected_accounts()
.await
@@ -147,58 +67,15 @@ async fn direct_composio_tool_uses_loopback_for_list_execute_connect_and_account
.iter()
.any(|conn| conn.id == "acct-github" && conn.toolkit == "github"));
- let execute_result = tool
- .execute(json!({
- "action": "execute",
- "tool_slug": "GMAIL_FETCH_EMAILS",
- "params": { "query": "newer_than:1d" },
- "connected_account_id": "acct-gmail"
- }))
- .await
- .expect("tool execute action");
- assert!(!execute_result.is_error);
- assert!(execute_result.output().contains("msg-direct"));
-
- let connect_result = tool
- .execute(json!({ "action": "connect", "auth_config_id": "auth-explicit" }))
- .await
- .expect("tool connect action");
- assert!(!connect_result.is_error);
- assert!(connect_result
- .output()
- .contains("https://connect.example/from-redirect-url"));
-
- let unknown = tool
- .execute(json!({ "action": "unknown" }))
- .await
- .expect("unknown action returns tool error");
- assert!(unknown.is_error);
- assert!(unknown.output().contains("Unknown action"));
-
- let missing_action = tool.execute(json!({})).await.expect_err("missing action");
- assert!(missing_action.to_string().contains("Missing 'action'"));
-
let requests = state.requests.lock().expect("requests").clone();
assert!(requests.iter().all(|request| {
request.api_key.as_deref() == Some("ck_round16") || request.path == "/health"
}));
assert!(requests.iter().any(|request| {
request.method == "GET"
- && request.path == "/api/v3/tools"
- && request.query.contains("toolkits=gmail")
+ && request.path == "/api/v3/connected_accounts"
&& request.query.contains("limit=200")
}));
- assert!(requests.iter().any(|request| {
- request.method == "POST"
- && request.path == "/api/v3/tools/execute/GMAIL_FETCH_EMAILS"
- && request.body.pointer("/user_id") == Some(&json!(" entity-override "))
- && request.body.pointer("/connected_account_id") == Some(&json!("acct-gmail"))
- }));
- assert!(requests.iter().any(|request| {
- request.method == "POST"
- && request.path == "/api/v2/actions/FALLBACK_ACTION/execute"
- && request.body.pointer("/input/ok") == Some(&json!(true))
- }));
}
#[test]
diff --git a/tests/raw_coverage/tools_composio_round24_raw_coverage_e2e.rs b/tests/raw_coverage/tools_composio_round24_raw_coverage_e2e.rs
deleted file mode 100644
index 9ed64c3384..0000000000
--- a/tests/raw_coverage/tools_composio_round24_raw_coverage_e2e.rs
+++ /dev/null
@@ -1,197 +0,0 @@
-//! Round24 raw coverage for broad tools/composio cold branches.
-//!
-//! All HTTP traffic stays on loopback mocks. These tests drive public tool
-//! APIs so coverage lands on the same paths an agent/tool call uses.
-
-use std::sync::{Arc, Mutex};
-
-use axum::body::to_bytes;
-use axum::extract::{Request, State};
-use axum::http::{Method, StatusCode};
-use axum::response::{IntoResponse, Response};
-use axum::routing::any;
-use axum::{Json, Router};
-use serde_json::{json, Value};
-
-use openhuman_core::security::{AutonomyLevel, SecurityPolicy};
-use tinytools::{Tool};
-use openhuman_core::tools::{ComposioTool};
-
-#[derive(Clone, Debug)]
-struct RecordedRequest {
- method: Method,
- path: String,
- query: String,
- body: Value,
-}
-
-#[derive(Clone, Default)]
-struct MockState {
- requests: Arc<Mutex<Vec<RecordedRequest>>>,
- market_failures_left: Arc<Mutex<usize>>,
-}
-
-#[tokio::test]
-async fn round24_composio_direct_covers_v3_v2_fallbacks_and_account_shapes() {
- crate::tinyhumans_boot::boot();
- let state = MockState::default();
- let base = start_loopback(
- Router::new()
- .fallback(any(composio_handler))
- .with_state(state.clone()),
- )
- .await;
- let tool = ComposioTool::new_with_base_urls_for_loopback(
- " ck_round24 ",
- Some(" entity-round24 "),
- Arc::new(SecurityPolicy::default()),
- format!("{base}/api/v2"),
- format!("{base}/api/v3"),
- )
- .expect("loopback composio tool");
-
- let connected = tool
- .list_connected_accounts()
- .await
- .expect("connected accounts");
- assert_eq!(connected.len(), 3, "blank id row should be dropped");
- assert_eq!(
- connected
- .iter()
- .map(|account| account.toolkit_slug().unwrap())
- .collect::<Vec<_>>(),
- vec!["gmail", "github", "slack"]
- );
-
- let execute = tool
- .execute(json!({
- "action": "execute",
- "tool_slug": "GMAIL_SEND_EMAIL",
- "params": { "to": "[email protected]" },
- "connected_account_id": "conn-secret"
- }))
- .await
- .expect("execute falls back to v2");
- assert!(!execute.is_error, "{}", execute.output());
- assert!(execute.output().contains("v2-fallback-ok"));
-
- let connect = tool
- .execute(json!({
- "action": "connect",
- "app": "gmail"
- }))
- .await
- .expect("connect resolves auth config");
- assert!(!connect.is_error, "{}", connect.output());
- assert!(connect
- .output()
- .contains("https://connect.example.test/round24"));
-
- let requests = state.requests.lock().expect("requests").clone();
- let v3_execute = requests
- .iter()
- .find(|request| {
- request.method == Method::POST
- && request.path == "/api/v3/tools/execute/GMAIL_SEND_EMAIL"
- })
- .expect("v3 execute request");
- assert_eq!(v3_execute.body["connected_account_id"], "conn-secret");
- assert_eq!(v3_execute.body["user_id"], "entity-round24");
-
- let v2_execute = requests
- .iter()
- .find(|request| {
- request.method == Method::POST
- && request.path == "/api/v2/actions/GMAIL_SEND_EMAIL/execute"
- })
- .expect("v2 execute fallback request");
- assert_eq!(v2_execute.body["entityId"], "entity-round24");
-
- assert!(requests.iter().any(|request| {
- request.method == Method::GET
- && request.path == "/api/v3/auth_configs"
- && request.query.contains("toolkit_slug=gmail")
- && request.query.contains("show_disabled=true")
- }));
- assert!(requests.iter().any(|request| {
- request.method == Method::POST
- && request.path == "/api/v3/connected_accounts/link"
- && request.body["auth_config_id"] == "auth-enabled"
- && request.body["user_id"] == "entity-round24"
- }));
-}
-
-async fn start_loopback(app: Router) -> String {
- let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
- .await
- .expect("bind loopback");
- let addr = listener.local_addr().expect("local addr");
- tokio::spawn(async move {
- axum::serve(listener, app).await.expect("loopback server");
- });
- format!("http://127.0.0.1:{}", addr.port())
-}
-
-async fn composio_handler(State(state): State<MockState>, request: Request) -> Response {
- let (parts, body) = request.into_parts();
- let method = parts.method;
- let path = parts.uri.path().to_string();
- let query = parts.uri.query().unwrap_or_default().to_string();
- let body_bytes = to_bytes(body, 1024 * 1024).await.expect("body bytes");
- let body_json = if body_bytes.is_empty() {
- Value::Null
- } else {
- serde_json::from_slice(&body_bytes).unwrap_or_else(|_| Value::Null)
- };
-
- state
- .requests
- .lock()
- .expect("requests")
- .push(RecordedRequest {
- method: method.clone(),
- path: path.clone(),
- query,
- body: body_json,
- });
-
- match (method, path.as_str()) {
- (Method::GET, "/api/v3/connected_accounts") => Json(json!({
- "items": [
- { "id": "conn-gmail", "status": "ACTIVE", "toolkit": { "slug": "gmail" }, "created_at": "2026-05-30T00:00:00Z" },
- { "id": "", "status": "ACTIVE", "toolkit": "dropme" },
- { "id": "conn-github", "status": "INITIATED", "toolkit": "github", "createdAt": "2026-05-30T00:00:00Z" },
- { "id": "conn-slack", "status": "ACTIVE", "appName": "slack" }
- ]
- }))
- .into_response(),
- (Method::POST, "/api/v3/tools/execute/GMAIL_SEND_EMAIL") => (
- StatusCode::BAD_REQUEST,
- Json(json!({
- "error": {
- "message": "bad connected_account_id conn-secret for entity_id entity-round24"
- }
- })),
- )
- .into_response(),
- (Method::POST, "/api/v2/actions/GMAIL_SEND_EMAIL/execute") => Json(json!({
- "successful": true,
- "data": { "message": "v2-fallback-ok" }
- }))
- .into_response(),
- (Method::GET, "/api/v3/auth_configs") => Json(json!({
- "items": [
- { "id": "auth-disabled", "status": "disabled", "enabled": false },
- { "id": "auth-enabled", "status": "enabled", "enabled": true }
- ]
- }))
- .into_response(),
- (Method::POST, "/api/v3/connected_accounts/link") => Json(json!({
- "data": {
- "redirect_url": "https://connect.example.test/round24"
- }
- }))
- .into_response(),
- _ => (StatusCode::NOT_FOUND, Json(json!({ "message": "not found" }))).into_response(),
- }
-}
diff --git a/tests/raw_coverage/tools_composio_round26_raw_coverage_e2e.rs b/tests/raw_coverage/tools_composio_round26_raw_coverage_e2e.rs
deleted file mode 100644
index 14141a2012..0000000000
--- a/tests/raw_coverage/tools_composio_round26_raw_coverage_e2e.rs
+++ /dev/null
@@ -1,306 +0,0 @@
-//! Round26 raw/E2E coverage for tools + Composio cold network paths.
-//!
-//! All outbound HTTP is routed to loopback mocks. The tests drive the public
-//! tool surfaces so coverage lands on the same paths used by agent calls.
-
-use std::sync::{Arc, Mutex};
-
-use axum::body::to_bytes;
-use axum::extract::{Request, State};
-use axum::http::{Method, StatusCode};
-use axum::response::{IntoResponse, Response};
-use axum::routing::any;
-use axum::{Json, Router};
-use serde_json::{json, Value};
-
-use openhuman_core::security::{AutonomyLevel, SecurityPolicy};
-use tinytools::{PermissionLevel, Tool};
-use openhuman_core::tools::{ComposioTool};
-
-#[derive(Clone, Debug)]
-struct RecordedRequest {
- method: Method,
- path: String,
- query: String,
- body: Value,
-}
-
-#[derive(Clone, Default)]
-struct MockState {
- requests: Arc<Mutex<Vec<RecordedRequest>>>,
-}
-
-#[tokio::test]
-async fn round26_composio_direct_tool_covers_connect_execute_and_error_fallbacks() {
- crate::tinyhumans_boot::boot();
- let state = MockState::default();
- let base = start_loopback(
- Router::new()
- .fallback(any(composio_handler))
- .with_state(state.clone()),
- )
- .await;
- let tool = ComposioTool::new_with_base_urls_for_loopback(
- " ck_round26 ",
- Some(" entity-round26 "),
- Arc::new(SecurityPolicy {
- autonomy: AutonomyLevel::Supervised,
- ..SecurityPolicy::default()
- }),
- format!("{base}/api/v2"),
- format!("{base}/api/v3"),
- )
- .expect("loopback composio");
-
- assert_eq!(tool.name(), "composio");
- assert!(tool.external_effect());
- assert!(!tool.external_effect_with_args(&json!({ "action": "list" })));
- assert!(!tool.external_effect_with_args(&json!({ "action": "connect" })));
- assert!(tool.external_effect_with_args(&json!({ "action": "execute" })));
-
- let missing_action = tool
- .execute(json!({}))
- .await
- .expect_err("missing action is an anyhow validation error");
- assert!(missing_action.to_string().contains("Missing 'action'"));
-
- let unknown = tool
- .execute(json!({ "action": "inspect" }))
- .await
- .expect("unknown action returns tool result");
- assert!(unknown.is_error);
- assert!(unknown.output().contains("Unknown action"));
-
- let listed = tool
- .execute(json!({ "action": "list", "app": "fallback-list" }))
- .await
- .expect("list with v2 fallback");
- assert!(!listed.is_error, "{}", listed.output());
- assert!(listed.output().contains("LEGACY_ROUND26_ACTION"));
-
- let executed = tool
- .execute(json!({
- "action": "execute",
- "tool_slug": "ROUND26_ACTION",
- "params": { "value": 42 },
- "connected_account_id": " account-round26 "
- }))
- .await
- .expect("execute v3 success");
- assert!(!executed.is_error, "{}", executed.output());
- assert!(executed.output().contains("v3-execute-round26"));
-
- let v2_execute = tool
- .execute(json!({
- "action": "execute",
- "action_name": "ROUND26_V2_ONLY",
- "params": { "value": "fallback" }
- }))
- .await
- .expect("execute v2 fallback");
- assert!(!v2_execute.is_error, "{}", v2_execute.output());
- assert!(v2_execute.output().contains("v2-execute-round26"));
-
- let direct_auth_config = tool
- .execute(json!({
- "action": "connect",
- "auth_config_id": "auth-direct-round26"
- }))
- .await
- .expect("connect via auth_config_id");
- assert!(
- !direct_auth_config.is_error,
- "{}",
- direct_auth_config.output()
- );
- assert!(direct_auth_config
- .output()
- .contains("https://connect.example.test/direct-round26"));
-
- let v2_connect = tool
- .execute(json!({
- "action": "connect",
- "app": "fallback-connect"
- }))
- .await
- .expect("connect v2 fallback");
- assert!(!v2_connect.is_error, "{}", v2_connect.output());
- assert!(v2_connect
- .output()
- .contains("https://connect.example.test/v2-round26"));
-
- let missing_auth = tool
- .execute(json!({
- "action": "connect",
- "app": "missing-auth"
- }))
- .await
- .expect("missing auth config returns tool result");
- assert!(missing_auth.is_error);
- assert!(missing_auth.output().contains("No auth config found"));
-
- let failed_no_app_fallback = tool
- .execute(json!({
- "action": "connect",
- "auth_config_id": "auth-link-fails-round26"
- }))
- .await
- .expect("v3 failure without app returns tool result");
- assert!(failed_no_app_fallback.is_error);
- assert!(failed_no_app_fallback
- .output()
- .contains("v2 fallback requires 'app'"));
-
- let requests = state.requests.lock().expect("requests").clone();
- let v3_execute = requests
- .iter()
- .find(|request| {
- request.method == Method::POST && request.path == "/api/v3/tools/execute/ROUND26_ACTION"
- })
- .expect("v3 execute request");
- assert_eq!(v3_execute.body["user_id"], "entity-round26");
- assert_eq!(v3_execute.body["connected_account_id"], "account-round26");
-
- assert!(requests.iter().any(|request| {
- request.method == Method::GET
- && request.path == "/api/v3/tools"
- && request.query.contains("toolkits=fallback-list")
- }));
- assert!(requests.iter().any(|request| {
- request.method == Method::POST
- && request.path == "/api/v2/connectedAccounts"
- && request.body["integrationId"] == "fallback-connect"
- && request.body["entityId"] == "entity-round26"
- }));
-}
-
-async fn start_loopback(app: Router) -> String {
- let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
- .await
- .expect("bind loopback");
- let addr = listener.local_addr().expect("local addr");
- tokio::spawn(async move {
- axum::serve(listener, app).await.expect("loopback server");
- });
- format!("http://127.0.0.1:{}", addr.port())
-}
-
-async fn composio_handler(State(state): State<MockState>, request: Request) -> Response {
- let (method, path, query, body_json) = record_request_parts(request).await;
- state
- .requests
- .lock()
- .expect("requests")
- .push(RecordedRequest {
- method: method.clone(),
- path: path.clone(),
- query: query.clone(),
- body: body_json,
- });
-
- match (method, path.as_str()) {
- (Method::GET, "/api/v3/tools") if query.contains("toolkits=fallback-list") => (
- StatusCode::INTERNAL_SERVER_ERROR,
- Json(json!({ "error": { "message": "v3 list unavailable" } })),
- )
- .into_response(),
- (Method::GET, "/api/v2/actions") => Json(json!({
- "items": [
- {
- "name": "LEGACY_ROUND26_ACTION",
- "appName": "legacy",
- "description": "legacy list fallback",
- "enabled": true
- }
- ]
- }))
- .into_response(),
- (Method::POST, "/api/v3/tools/execute/ROUND26_ACTION") => Json(json!({
- "successful": true,
- "data": { "message": "v3-execute-round26" }
- }))
- .into_response(),
- (Method::POST, "/api/v3/tools/execute/ROUND26_V2_ONLY") => (
- StatusCode::BAD_GATEWAY,
- Json(json!({ "message": "v3 execute unavailable" })),
- )
- .into_response(),
- (Method::POST, "/api/v2/actions/ROUND26_V2_ONLY/execute") => Json(json!({
- "successful": true,
- "data": { "message": "v2-execute-round26" }
- }))
- .into_response(),
- (Method::POST, "/api/v3/connected_accounts/link")
- if path.as_str() == "/api/v3/connected_accounts/link" =>
- {
- match state.requests.lock().expect("requests").last() {
- Some(record) if record.body["auth_config_id"] == "auth-direct-round26" => {
- Json(json!({
- "redirectUrl": "https://connect.example.test/direct-round26"
- }))
- .into_response()
- }
- Some(record) if record.body["auth_config_id"] == "auth-link-fails-round26" => (
- StatusCode::BAD_REQUEST,
- Json(json!({ "message": "link failed for round26" })),
- )
- .into_response(),
- Some(record) if record.body["auth_config_id"] == "auth-fallback-round26" => (
- StatusCode::BAD_GATEWAY,
- Json(json!({ "message": "force v2 connect fallback" })),
- )
- .into_response(),
- _ => (
- StatusCode::BAD_REQUEST,
- Json(json!({ "message": "unexpected auth config" })),
- )
- .into_response(),
- }
- }
- (Method::GET, "/api/v3/auth_configs") if query.contains("toolkit_slug=missing-auth") => {
- Json(json!({ "items": [] })).into_response()
- }
- (Method::GET, "/api/v3/auth_configs")
- if query.contains("toolkit_slug=fallback-connect") =>
- {
- Json(json!({
- "items": [
- { "id": "auth-fallback-round26", "status": "enabled" }
- ]
- }))
- .into_response()
- }
- (Method::POST, "/api/v2/connectedAccounts") => {
- match state.requests.lock().expect("requests").last() {
- Some(record) if record.body["integrationId"] == "missing-auth" => (
- StatusCode::BAD_REQUEST,
- Json(json!({ "message": "v2 missing auth config" })),
- )
- .into_response(),
- _ => Json(json!({
- "redirectUrl": "https://connect.example.test/v2-round26"
- }))
- .into_response(),
- }
- }
- _ => (
- StatusCode::NOT_FOUND,
- Json(json!({ "message": "not found" })),
- )
- .into_response(),
- }
-}
-
-async fn record_request_parts(request: Request) -> (Method, String, String, Value) {
- let (parts, body) = request.into_parts();
- let method = parts.method;
- let path = parts.uri.path().to_string();
- let query = parts.uri.query().unwrap_or_default().to_string();
- let body_bytes = to_bytes(body, 1024 * 1024).await.expect("body bytes");
- let body_json = if body_bytes.is_empty() {
- Value::Null
- } else {
- serde_json::from_slice(&body_bytes).unwrap_or_else(|_| Value::Null)
- };
- (method, path, query, body_json)
-}