Skip to content

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

chore(composio): remove deprecated trigger history and argument preparation tests

Steven Enamakelddff92cef40c
diff --git a/crates/openhuman-core/src/agent/harness/task_recency_context.rs b/crates/openhuman-core/src/agent/harness/task_recency_context.rs
index 7a23c230e3..ee9134b36a 100644
--- a/crates/openhuman-core/src/agent/harness/task_recency_context.rs
+++ b/crates/openhuman-core/src/agent/harness/task_recency_context.rs
@@ -6,7 +6,7 @@
//! concept. `CURRENT_AGENT_SANDBOX_MODE` carries the calling agent's sandbox
//! mode; [`TASK_RECENCY_WINDOW`] carries an optional "only data newer than
//! `now - window`" hint that the `composio_execute` handler applies to a
-//! curated set of task-fetch slugs (see `composio::task_window`).
+//! curated set of task-fetch slugs (see `tinyconnectors::execute::apply_window_args`).
//!
//! Why a task-local instead of a `Tool::execute` argument: the tool trait is
//! invoked from many call sites (CLI, JSON-RPC, tests, agent loops). A
diff --git a/tests/raw_coverage/composio_raw_coverage_e2e.rs b/tests/raw_coverage/composio_raw_coverage_e2e.rs
index 55563afb30..12836a4bef 100644
--- a/tests/raw_coverage/composio_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/composio_raw_coverage_e2e.rs
@@ -18,10 +18,6 @@ use openhuman_core::agent::prompts::ConnectedIntegration;
use openhuman_core::config::Config;
use openhuman_core::core::all::RegisteredController;
use openhuman_core::integrations::composio::client::{resolve_composio_route, ComposioRoute};
-use openhuman_core::integrations::composio::error_mapping::{
- classify_composio_error, format_provider_error, remap_transport_error, ComposioErrorClass,
-};
-use openhuman_core::integrations::composio::execute_prepare::prepare_execute_arguments;
use openhuman_core::integrations::composio::providers::{
classify_unknown, find_curated, toolkit_from_slug, CuratedTool, ToolScope, UserScopePref,
};
@@ -29,7 +25,6 @@ use openhuman_core::integrations::composio::tools::{
ComposioAuthorizeTool, ComposioConnectedAccount, ComposioExecuteTool,
ComposioListConnectionsTool, ComposioListToolkitsTool, ComposioListToolsTool,
};
-use openhuman_core::integrations::composio::trigger_history::ComposioTriggerHistoryStore;
use openhuman_core::integrations::composio::types::{
ComposioActiveTrigger, ComposioActiveTriggersResponse, ComposioAgentReadyToolkitsResponse,
ComposioAuthorizeResponse, ComposioAvailableTrigger, ComposioAvailableTriggerRepo,
@@ -56,196 +51,6 @@ use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolCategory};
static ENV_LOCK: &OnceLock<Mutex<()>> = &crate::SHARED_ENV_LOCK;
-#[test]
-fn composio_prepare_execute_arguments_normalizes_calendar_and_notion_payloads() {
- crate::tinyhumans_boot::boot();
- let calendar = prepare_execute_arguments(
- " GOOGLECALENDAR_EVENTS_LIST ",
- Some(json!({
- "timeMin": "2026-05-29",
- "time_max": "2026-05-30T15:00:00-07:00"
- })),
- )
- .expect("calendar args should normalize");
- assert_eq!(
- calendar.get("timeMin").and_then(Value::as_str),
- Some("2026-05-29T00:00:00Z")
- );
- assert_eq!(
- calendar.get("time_max").and_then(Value::as_str),
- Some("2026-05-30T15:00:00-07:00")
- );
-
- let invalid_date = prepare_execute_arguments(
- "GOOGLECALENDAR_FIND_EVENT",
- Some(json!({ "timeMax": "2026-99-99" })),
- )
- .expect_err("invalid bare dates should be rejected");
- assert!(invalid_date.contains("RFC 3339 timestamp"));
-
- let notion_pages = prepare_execute_arguments(
- "NOTION_FETCH_DATA",
- Some(json!({ "filter": { "value": "page" } })),
- )
- .expect("notion page filter should infer fetch type");
- assert_eq!(
- notion_pages.get("fetch_type").and_then(Value::as_str),
- Some("pages")
- );
-
- let notion_database = prepare_execute_arguments(
- "NOTION_FETCH_DATA",
- Some(json!({
- "fetchType": "databases",
- "filter": { "property": "page" }
- })),
- )
- .expect("explicit fetch type should win");
- assert_eq!(notion_database.get("fetch_type"), None);
- assert_eq!(
- notion_database.get("fetchType").and_then(Value::as_str),
- Some("databases")
- );
-}
-
-#[test]
-fn composio_prepare_execute_arguments_validates_gmail_mutations() {
- crate::tinyhumans_boot::boot();
- let empty = prepare_execute_arguments("GMAIL_SEND_EMAIL", None)
- .expect_err("gmail send needs a recipient");
- assert!(empty.contains("recipient"));
-
- let send = prepare_execute_arguments(
- "GMAIL_SEND_EMAIL",
- Some(json!({ "recipientEmail": "[email protected]", "subject": "Hi" })),
- )
- .expect("recipientEmail alias should be accepted");
- assert_eq!(
- send.get("recipientEmail").and_then(Value::as_str),
- );
-
- let missing_message = prepare_execute_arguments(
- "GMAIL_ADD_LABEL_TO_EMAIL",
- Some(json!({ "addLabelIds": ["Label_1"] })),
- )
- .expect_err("gmail add label needs a message id");
- assert!(missing_message.contains("message_id"));
-
- let missing_labels = prepare_execute_arguments(
- "GMAIL_ADD_LABEL_TO_EMAIL",
- Some(json!({ "messageId": "msg-1", "addLabelIds": [" "] })),
- )
- .expect_err("gmail add label needs at least one non-empty label");
- assert!(missing_labels.contains("at least one"));
-
- let labeled = prepare_execute_arguments(
- "GMAIL_ADD_LABEL_TO_EMAIL",
- Some(json!({ "messageId": "msg-1", "remove_label_ids": "Label_2" })),
- )
- .expect("string label alias should be accepted");
- assert_eq!(
- labeled.get("messageId").and_then(Value::as_str),
- Some("msg-1")
- );
-
- let non_object = prepare_execute_arguments("GMAIL_SEND_EMAIL", Some(json!("bad")))
- .expect_err("arguments must be an object");
- assert!(non_object.contains("must be a JSON object"));
-}
-
-#[test]
-fn composio_error_mapping_classifies_and_formats_provider_failures() {
- crate::tinyhumans_boot::boot();
- assert_eq!(ComposioErrorClass::Validation.as_str(), "validation");
- assert_eq!(
- ComposioErrorClass::InsufficientScope.as_str(),
- "insufficient_scope"
- );
- assert_eq!(ComposioErrorClass::RateLimited.as_str(), "rate_limited");
- assert_eq!(
- ComposioErrorClass::UpstreamProvider.as_str(),
- "upstream_provider"
- );
- assert_eq!(
- ComposioErrorClass::ComposioPlatform.as_str(),
- "composio_platform"
- );
- assert_eq!(ComposioErrorClass::Gateway.as_str(), "gateway");
- assert_eq!(ComposioErrorClass::Other.as_str(), "other");
-
- assert_eq!(
- classify_composio_error("GMAIL_SEND_EMAIL", "missing required field to"),
- ComposioErrorClass::Validation
- );
- assert_eq!(
- classify_composio_error(
- "GMAIL_FETCH_EMAILS",
- "403 insufficient authentication scopes for Gmail"
- ),
- ComposioErrorClass::InsufficientScope
- );
- assert_eq!(
- classify_composio_error("SLACK_POST_MESSAGE", "429 too many requests"),
- ComposioErrorClass::RateLimited
- );
- assert_eq!(
- classify_composio_error("GMAIL_FETCH_EMAILS", "Mailbox provider exploded"),
- ComposioErrorClass::UpstreamProvider
- );
- assert_eq!(
- classify_composio_error("CUSTOM_ACTION", "connection error, try to authenticate"),
- ComposioErrorClass::ComposioPlatform
- );
- assert_eq!(
- classify_composio_error("CUSTOM_ACTION", "502 Bad Gateway"),
- ComposioErrorClass::Gateway
- );
- assert_eq!(
- classify_composio_error("CUSTOM_ACTION", "plain unknown failure"),
- ComposioErrorClass::Other
- );
-
- let scope = format_provider_error(
- "GMAIL_FETCH_EMAILS",
- "insufficient authentication scopes: gmail.readonly",
- );
- assert!(scope.starts_with("[composio:error:insufficient_scope]"));
- assert!(scope.contains("Reconnect the integration"));
-
- let gateway = remap_transport_error(
- "GMAIL_FETCH_EMAILS",
- "Backend returned 502 Bad Gateway for POST: {\"error\":\"insufficient scope\"}",
- );
- assert!(
- gateway.starts_with("[composio:error:insufficient_scope]"),
- "embedded provider errors should not be bucketed as gateway: {gateway}"
- );
-
- let summarized_gateway = remap_transport_error(
- "CUSTOM_ACTION",
- "request failed: Backend returned 504 Gateway Timeout for POST /execute: edge timeout",
- );
- assert!(summarized_gateway.starts_with("[composio:error:gateway]"));
- assert!(summarized_gateway.contains("edge timeout"));
-
- let raw_gateway = remap_transport_error("CUSTOM_ACTION", "502 Bad Gateway");
- assert!(raw_gateway.contains("502 Bad Gateway"));
-
- let rate_limited = format_provider_error("SLACK_FETCH_CONVERSATION_HISTORY", "429");
- assert!(rate_limited.starts_with("[composio:error:rate_limited]"));
- assert!(rate_limited.contains("not an OpenHuman gateway outage"));
-
- let platform = format_provider_error("CUSTOM_ACTION", "token revoked");
- assert!(platform.starts_with("[composio:error:composio_platform]"));
-
- let validation_transport = remap_transport_error(
- "GMAIL_SEND_EMAIL",
- "Backend returned 502 Bad Gateway: missing required field `to`",
- );
- assert!(validation_transport.starts_with("[composio:error:validation]"));
-}
-
#[tokio::test]
async fn composio_connected_integrations_public_helpers_handle_empty_auth_and_identity_edges() {
crate::tinyhumans_boot::boot();
@@ -1305,56 +1110,6 @@ fn composio_direct_public_types_deserialize_polymorphic_toolkits() {
assert_eq!(missing.toolkit_slug(), None);
}
-#[test]
-fn composio_trigger_history_store_handles_limits_and_bad_archive_lines() {
- crate::tinyhumans_boot::boot();
- let dir = tempdir().expect("tempdir");
- let store = ComposioTriggerHistoryStore::new(dir.path()).expect("history store");
- let empty = store.list_recent(0).expect("empty history");
- assert!(empty.entries.is_empty());
- assert!(empty.archive_dir.ends_with("state/triggers"));
-
- let first = store
- .record_trigger(
- "gmail",
- "GMAIL_NEW_GMAIL_MESSAGE",
- "metadata-1",
- "uuid-1",
- &json!({ "subject": "first" }),
- )
- .expect("record first");
- assert_eq!(first.toolkit, "gmail");
- let second = store
- .record_trigger(
- "slack",
- "SLACK_NEW_MESSAGE",
- "metadata-2",
- "uuid-2",
- &json!({ "text": "second" }),
- )
- .expect("record second");
- assert!(second.received_at_ms >= first.received_at_ms);
-
- let one = store.list_recent(1).expect("limited history");
- assert_eq!(one.entries.len(), 1);
- assert_eq!(one.entries[0].metadata_id, "metadata-2");
-
- std::fs::write(
- dir.path()
- .join("state")
- .join("triggers")
- .join("1999-01-01.jsonl"),
- "\nnot-json\n{\"received_at_ms\":1,\"toolkit\":\"old\",\"trigger\":\"OLD\",\"metadata_id\":\"m\",\"metadata_uuid\":\"u\",\"payload\":{}}\n",
- )
- .expect("write legacy archive");
- let all = store.list_recent(10).expect("history skips bad lines");
- assert!(all.entries.iter().any(|entry| entry.toolkit == "old"));
- assert!(all
- .entries
- .iter()
- .any(|entry| entry.metadata_id == "metadata-1"));
-}
-
async fn start_composio_round8_backend(app: Router) -> String {
let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
.await
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 e43095aa0b..df9aa106aa 100644
--- a/tests/raw_coverage/composio_tools_direct_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/composio_tools_direct_raw_coverage_e2e.rs
@@ -15,7 +15,6 @@ use serde_json::{json, Value};
use tempfile::tempdir;
use openhuman_core::integrations::composio::client::direct_list_connections;
-use openhuman_core::integrations::composio::trigger_history::ComposioTriggerHistoryStore;
use openhuman_core::tools::DirectComposioClient;
#[derive(Clone, Default)]
@@ -78,54 +77,6 @@ async fn direct_composio_client_uses_loopback_for_connected_accounts() {
}));
}
-#[test]
-fn trigger_history_lists_newest_entries_and_skips_bad_jsonl_lines() {
- let dir = tempdir().expect("tempdir");
- let store = ComposioTriggerHistoryStore::new(dir.path()).expect("history store");
-
- let first = store
- .record_trigger(
- "gmail",
- "GMAIL_NEW_GMAIL_MESSAGE",
- "meta-1",
- "uuid-1",
- &json!({ "message": { "id": "msg-1" } }),
- )
- .expect("first trigger");
- let second = store
- .record_trigger(
- "github",
- "GITHUB_PULL_REQUEST_EVENT",
- "meta-2",
- "uuid-2",
- &json!({ "repo": "openhuman" }),
- )
- .expect("second trigger");
-
- let current_file = store.list_recent(10).expect("history").current_day_file;
- std::fs::write(
- dir.path().join("state").join("triggers").join("2000-01-01.jsonl"),
- "\nnot-json\n{\"received_at_ms\":1,\"toolkit\":\"slack\",\"trigger\":\"SLACK_EVENT\",\"metadata_id\":\"meta-0\",\"metadata_uuid\":\"uuid-0\",\"payload\":{\"ok\":true}}\n",
- )
- .expect("old jsonl");
- std::fs::write(
- dir.path().join("state").join("triggers").join("ignore.txt"),
- "{\"toolkit\":\"ignored\"}\n",
- )
- .expect("ignored extension");
-
- let recent = store.list_recent(2).expect("limited history");
- assert_eq!(recent.entries.len(), 2);
- assert_eq!(recent.entries[0].metadata_id, second.metadata_id);
- assert_eq!(recent.entries[1].metadata_id, first.metadata_id);
- assert_eq!(recent.current_day_file, current_file);
- assert!(recent.archive_dir.ends_with("state/triggers"));
-
- let all = store.list_recent(0).expect("limit zero coerces to one");
- assert_eq!(all.entries.len(), 1);
- assert_eq!(all.entries[0].metadata_uuid, second.metadata_uuid);
-}
-
async fn composio_direct_handler(State(state): State<MockState>, request: Request) -> Response {
let method = request.method().clone();
let uri = request.uri().clone();