Skip to content

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

test(composio): cover tag forwarding policy and ingest validation

Steven Enamakel2627582deef4
diff --git a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
index 1307eff1cf..466672a68f 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_profile_tools_execute_mock_tests.rs
@@ -77,32 +77,57 @@ async fn composio_get_user_profile_via_mock_returns_provider_profile() {
}
#[tokio::test]
-async fn composio_list_tools_via_mock_with_filter() {
+async fn composio_list_tools_via_mock_filters_tags_by_toolkit() {
let _serialised = module_guard().await;
+ let observed_queries = std::sync::Arc::new(std::sync::Mutex::new(Vec::new()));
+ let handler_queries = std::sync::Arc::clone(&observed_queries);
let app = Router::new().route(
"/agent-integrations/composio/tools",
- get(|Query(_q): Query<HashMap<String, String>>| async move {
- Json(json!({
- "success": true,
- "data": {"tools": [
- {"type":"function","function":{"name":"GMAIL_SEND_EMAIL"}},
- {"type":"function","function":{"name":"GMAIL_FETCH_EMAILS"}}
- ]}
- }))
+ get(move |Query(query): Query<HashMap<String, String>>| {
+ let observed = std::sync::Arc::clone(&handler_queries);
+ async move {
+ observed.lock().unwrap().push(query);
+ Json(json!({
+ "success": true,
+ "data": {"tools": [
+ {"type":"function","function":{"name":"GMAIL_SEND_EMAIL"}},
+ {"type":"function","function":{"name":"GMAIL_FETCH_EMAILS"}}
+ ]}
+ }))
+ }
}),
);
let base = start_mock_backend(app).await;
let tmp = tempfile::tempdir().unwrap();
let config = config_with_backend(&tmp, base);
- let outcome = composio_list_tools(
+
+ let gmail = composio_list_tools(
&crate::core::runtime::DispatchCtx::ambient(),
&config,
Some(vec!["gmail".into()]),
- None,
+ Some(vec!["stars".into()]),
+ )
+ .await
+ .unwrap();
+ assert_eq!(gmail.value.tools.len(), 2);
+
+ composio_list_tools(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ Some(vec!["github".into()]),
+ Some(vec!["stars".into()]),
)
.await
.unwrap();
- assert_eq!(outcome.value.tools.len(), 2);
+
+ let queries = observed_queries.lock().unwrap();
+ assert_eq!(queries.len(), 2);
+ assert!(
+ !queries[0].contains_key("tags"),
+ "non-GitHub toolkit must not forward tags: {:?}",
+ queries[0]
+ );
+ assert_eq!(queries[1].get("tags").map(String::as_str), Some("stars"));
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/integrations/composio/ops_tests.rs b/crates/openhuman-core/src/integrations/composio/ops_tests.rs
index 0e3d5c02f4..0c7a15b9fd 100644
--- a/crates/openhuman-core/src/integrations/composio/ops_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/ops_tests.rs
@@ -12,6 +12,26 @@ fn test_config(tmp: &tempfile::TempDir) -> Config {
c
}
+#[test]
+fn list_tools_tag_filter_policy_matches_supported_toolkits() {
+ let cases: Vec<(Option<Vec<String>>, bool)> = vec![
+ (None, true),
+ (Some(vec![]), true),
+ (Some(vec!["GitHub".into()]), true),
+ (Some(vec![" \tGiThUb\n ".into()]), true),
+ (Some(vec!["gmail".into()]), false),
+ (Some(vec!["gmail".into(), "github".into()]), true),
+ ];
+
+ for (toolkits, expected) in cases {
+ assert_eq!(
+ should_forward_tags(toolkits.as_deref()),
+ expected,
+ "toolkits={toolkits:?}"
+ );
+ }
+}
+
// ── cache_key / invalidate_connected_integrations_cache ───────
/// Per-module alias so call sites don't need to spell out the path.
diff --git a/crates/openhuman-core/src/memory/brain_tests.rs b/crates/openhuman-core/src/memory/brain_tests.rs
index ea7391bfa3..49c2ab6fc4 100644
--- a/crates/openhuman-core/src/memory/brain_tests.rs
+++ b/crates/openhuman-core/src/memory/brain_tests.rs
@@ -205,6 +205,37 @@ async fn ingest_refuses_bad_input() {
.is_err());
}
+
+#[tokio::test]
+async fn ingest_rejects_path_and_text_together_without_ingesting() {
+ let tmp = tempfile::tempdir().unwrap();
+ let config = config_in(&tmp);
+ let engine = bind_reference(&config);
+ let path = tmp.path().join("valid.md");
+ std::fs::write(&path, "valid file content").unwrap();
+
+ let error = ingest(
+ &config,
+ &MemoryIdentity::root(),
+ BrainIngestParams {
+ path: Some(path.display().to_string()),
+ text: Some("valid text content".into()),
+ source: Some("files".into()),
+ title: None,
+ },
+ )
+ .await
+ .unwrap_err();
+ assert!(matches!(
+ error,
+ MemoryError::InvalidRequest(message)
+ if message == "pass exactly one of `path` or `text`"
+ ));
+ assert!(stored(&engine, MetaFilter::kinds([ItemKind::Document]))
+ .await
+ .is_empty());
+}
+
#[tokio::test]
async fn a_file_is_converted_and_filed_under_files() {
let tmp = tempfile::tempdir().unwrap();
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index ff69bca4da..5ebb4a5030 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -257,7 +257,7 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| ID | Feature | Layer | Test path(s) | Status | Notes |
| ----- | -------------------------- | ----- | --------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------- |
| 5.2.1 | Persona Name & Description | VU | `app/src/store/personaSlice.test.ts`, `app/src/components/settings/panels/PersonaPanel.test.tsx` | ✅ | Slice validation + persist REHYDRATE scrub; Settings identity fields persist on save (#2345) |
-| 5.2.2 | SOUL.md Edit & Reset | RU+VU | `crates/openhuman-core/src/config/workspace/rpc.rs`, `app/src/components/settings/panels/PersonaPanel.test.tsx` | ✅ | Core read/write/reset with allowlist + size cap; panel loads, saves, resets over RPC (#2345) |
+| 5.2.2 | SOUL.md Edit & Reset | RU+VU | `crates/openhuman-core/src/config/workspace/rpc_tests.rs`, `app/src/components/settings/panels/PersonaPanel.test.tsx` | ✅ | Core read/write/reset with allowlist + size cap; panel loads, saves, resets over RPC (#2345) |
| 5.2.3 | Persona Settings Surface | VU | `app/src/components/settings/panels/PersonaPanel.test.tsx` | ✅ | Bundles identity + SOUL.md + link to Mascot avatar/voice (#2345) |
---
@@ -268,9 +268,9 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| ID | Feature | Layer | Test path(s) | Status | Notes |
| ----- | ---------------------------- | ----- | ------------------------------------------------------------------------------------------------------ | ------ | -------------------------------------------------------------------- |
-| 6.1.1 | File Read Access | RU | `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_read/mod_tests.rs`, `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_read/extra_tests.rs` | ✅ | Tinytools tests cover file reads and byte-offset paging (`file_read_offset_continues_from_the_given_byte`, #6284). |
-| 6.1.2 | File Write Access | RU | `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_write/mod_tests.rs` | ✅ | Tinytools tests exercise file-write behavior. |
-| 6.1.3 | Path Restriction Enforcement | RU | `crates/openhuman-core/src/tools/impl/filesystem/gate_tests.rs` | ✅ | Core tests cover traversal, absolute paths, symlinks, and read-only policy. |
+| 6.1.1 | File Read Access | RU | `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_read/mod_tests.rs`, `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_read/extra_tests.rs`, `crates/openhuman-core/src/config/workspace/rpc_tests.rs` | ✅ | Tinytools read tools and workspace persona RPC cover file reads; Tinytools also covers byte-offset paging (`file_read_offset_continues_from_the_given_byte`, #6284). |
+| 6.1.2 | File Write Access | RU | `vendor/tinyagents/vendor/tinytools/crates/tinytools-std/src/filesystem/file_write/mod_tests.rs`, `crates/openhuman-core/src/config/workspace/rpc_tests.rs` | ✅ | Tinytools tests exercise file-write behavior; workspace persona RPC covers allowlisted writes and reset. |
+| 6.1.3 | Path Restriction Enforcement | RU | `crates/openhuman-core/src/tools/impl/filesystem/gate_tests.rs`, `crates/openhuman-core/src/config/workspace/rpc_tests.rs` | ✅ | Core tests cover tool path gates and workspace RPC filename allowlisting, including traversal rejection. |
| 6.1.4 | Agent deliverables in the visible Files folder | RU+VU | `crates/openhuman-core/src/artifacts/files_tests.rs`, `crates/openhuman-core/src/artifacts/migrate_tests.rs`, `crates/openhuman-core/src/artifacts/ops_tests.rs`, `crates/openhuman-app/src/artifact_commands_tests.rs`, `app/src/services/__tests__/artifactDownloadService.test.ts`, `crates/openhuman-core/src/config/ops_files_dir_tests.rs`, `app/src/components/settings/panels/__tests__/FilesFolderSection.test.tsx`, `app/src/features/conversations/aui/MessageArtifactCards.test.tsx`, `app/src/features/conversations/aui/ArtifactPreviewPanel.refresh.test.tsx` | ✅ | Files land in `~/OpenHuman/projects/Files` with human names (`create_new`, ` (2)` on collision, shared across accounts without clobbering; per-account listing); escape guard on the recorded file; "file missing" for a file removed outside OpenHuman; crash-safe idempotent migration of legacy files; Download resolves an artifact id through the core; the folder is chosen in Settings → Agent OS access and validated (absolute, not protected, not inside the data folder); Show in folder on the settings row (#5505); in chat, each ready file is a card in the reply that made it and opens in the preview panel, whose Download saves it through the OS save dialog (the chat Files panel was removed in #7888) |
### 6.2 Shell & Git