Skip to content

fix(composio): fail fast for uncurated empty toolkits#2293

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
aqilaziz:codex/2283-uncurated-toolkit-fast-fail
May 20, 2026
Merged

fix(composio): fail fast for uncurated empty toolkits#2293
senamakel merged 1 commit into
tinyhumansai:mainfrom
aqilaziz:codex/2283-uncurated-toolkit-fast-fail

Conversation

@aqilaziz
Copy link
Copy Markdown
Contributor

@aqilaziz aqilaziz commented May 20, 2026

Summary

  • Adds a fast-fail path when composio_list_tools ends up empty for requested or connected toolkits that do not have curated OpenHuman agent catalogs.
  • Returns a clear unsupported-toolkit error instead of a successful empty tools response for uncurated scopes such as OneDrive, Excel, or Todoist.
  • Keeps existing behavior for catalogued toolkits and direct-mode empty responses.
  • Adds focused unit coverage for toolkit normalization and unsupported-toolkit messaging.

Problem

  • Some toolkits can be connected in the UI but do not have curated OpenHuman agent tool catalogs yet.
  • When the agent asks composio_list_tools for those toolkits, it can receive an empty usable tool list and continue trying until max iterations.
  • Users then see a generic agent failure instead of a direct explanation that the connected toolkit is not agent-ready.

Solution

  • Track the explicit toolkits filter, or the active connected toolkits when filtering to connected accounts.
  • If the final tools list is empty and the scoped toolkit set includes uncatalogued toolkits, return a ToolResult::error with a concrete agent-ready support message.
  • Leave catalog creation and UI preview/coming-soon badges as follow-up slices so this PR stays small.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • Diff coverage ≥ 80% — local coverage run is blocked by missing libclang; CI coverage gate will verify changed lines.
  • Coverage matrix updated — N/A: behavior-only Composio tool failure path, no feature row added/removed/renamed.
  • All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no matrix feature ID changed.
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md) — N/A: no release smoke checklist surface changed.
  • Linked issue closed via Closes #NNN in the ## Related section — N/A: partial fix for Uncurated connected toolkits fail through max iterations #2283; catalog/UI work remains.

Impact

  • Runtime: Composio agent tool discovery.
  • User-visible: the agent gets a direct unsupported-toolkit message instead of looping on an empty action list.
  • Compatibility: catalogued toolkits still return tools as before; direct mode still returns success+empty by design.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: codex/2283-uncurated-toolkit-fast-fail
  • Commit SHA: d299c8ae92c690b911647f22746372572f17ff60

Validation Run

  • pnpm --filter openhuman-app format:check — N/A: no frontend changes.
  • pnpm typecheck — N/A: no TypeScript changes.
  • Focused tests: blocked locally; see Validation Blocked.
  • Rust fmt/check (if changed): cargo fmt --check passed.
  • Tauri fmt/check (if changed): N/A: no Tauri shell changes.

Validation Blocked

  • command: cargo test --lib empty_uncurated_toolkits_message --manifest-path Cargo.toml
  • error: whisper-rs-sys build script could not find clang.dll / libclang.dll; LIBCLANG_PATH is unset in this Windows environment.
  • impact: focused Rust tests could not run locally, but the helper tests are included for CI.

Behavior Changes

  • Intended behavior change: empty composio_list_tools results for uncatalogued requested/connected toolkits now fail fast with a useful message.
  • User-visible effect: the agent should stop burning through max iterations when a connected toolkit is not yet agent-ready.

Parity Contract

  • Legacy behavior preserved: catalogued toolkits, scope filtering, connection filtering, and direct-mode short-circuit behavior are unchanged.
  • Guard/fallback/dispatch parity checks: unit tests cover requested toolkit normalization, uncatalogued toolkit messaging, and catalogued toolkit no-op behavior.

Duplicate / Superseded PR Handling

Summary by CodeRabbit

  • Bug Fixes

    • Improved toolkit filtering so empty results now return clear, user-facing guidance when selected toolkits lack curated agent tools, including which toolkits are affected.
  • Tests

    • Added unit tests to validate normalized toolkit filtering and the new uncatalogued-toolkit messaging behavior, including provider-backed cases.

Review Change Stack

@aqilaziz aqilaziz requested a review from a team May 20, 2026 06:52
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b560f91f-4fbb-459d-b978-e3d9f8caa4d7

📥 Commits

Reviewing files that changed from the base of the PR and between c49f9f2 and 80f4980.

📒 Files selected for processing (2)
  • src/openhuman/composio/tools.rs
  • src/openhuman/composio/tools_tests.rs

📝 Walkthrough

Walkthrough

Adds toolkit slug normalization and uncatalogued-toolkit detection to composio_list_tools; when filtering yields no tools, the code returns a targeted error explaining which requested toolkits lack curated agent tool catalogs. Includes unit tests and a test-only provider validating the behavior.

Changes

Toolkit scope filtering and uncatalogued error handling

Layer / File(s) Summary
Toolkit normalization and error message helpers
src/openhuman/composio/tools.rs
Imports HashSet and BTreeSet; adds normalized_scope_toolkits, uncatalogued_toolkits, and empty_uncurated_toolkits_message; updates retain_connected_tools parameter type to &HashSet<String>.
composio_list_tools empty-result handling
src/openhuman/composio/tools.rs
Tracks connected_toolkits: Option<HashSet<String>> during filtering; after filtering, when resp.tools is empty computes the scoped toolkit set and returns ToolResult::error listing uncatalogued toolkits instead of a silent empty success.
Unit tests and test-only provider
src/openhuman/composio/tools_tests.rs
Adds ProviderOnlyCatalog and PROVIDER_ONLY_CURATED test scaffolding plus four unit tests covering normalized_scope_toolkits normalization/preference and empty_uncurated_toolkits_message behaviors (unsupported toolkits, ignored/catalogued toolkits, and provider-curated coverage).

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

working

Suggested reviewers

  • senamakel

Poem

🐇 I trimmed and lowercased every name,
Scoped toolkits found their tidy frame,
When agents roam an empty cart,
I point the catalogs that missed their start,
Hopping home with tests aglow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a fail-fast mechanism for uncurated empty toolkits in Composio tool discovery.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added the working A PR that is being worked on by the team. label May 20, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/openhuman/composio/tools.rs (1)

807-810: ⚡ Quick win

Use debug!/trace! for this diagnostic branch log.

Line 807 currently emits info! for an internal state-transition diagnostic. This should be debug! (or trace!) to match repository logging policy and keep info-level logs focused.

Proposed fix
-                        tracing::info!(
+                        tracing::debug!(
                             toolkits = ?scoped_toolkits,
                             "[composio] list_tools empty for uncurated toolkit scope"
                         );

As per coding guidelines: "Use log / tracing at debug or trace level on RPC entry and exit, error paths, state transitions, and any branch that is hard to infer from tests alone."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openhuman/composio/tools.rs` around lines 807 - 810, Replace the
info-level diagnostic in tools.rs with a debug (or trace) level log: locate the
tracing::info! call that logs " [composio] list_tools empty for uncurated
toolkit scope" with the scoped_toolkits field and change it to tracing::debug!
(or tracing::trace!) so the state-transition diagnostic follows the repository
logging policy and keeps info-level logs reserved for higher-severity messages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/openhuman/composio/tools.rs`:
- Around line 152-157: The uncatalogued_toolkits function currently only checks
catalog_for_toolkit(toolkit) and therefore can misclassify toolkits that are
available via a provider's curated_tools; update uncatalogued_toolkits to mirror
the actual visibility resolution used elsewhere by treating a toolkit as
catalogued if get_provider(toolkit).curated_tools() yields Some(_) or if
catalog_for_toolkit(toolkit) yields Some(_). In other words, for each toolkit
string call get_provider(toolkit).curated_tools().or_else(||
catalog_for_toolkit(toolkit)) and treat it as catalogued when that combined
result is Some(...); only include the toolkit in the returned Vec when that
combined check is None.

---

Nitpick comments:
In `@src/openhuman/composio/tools.rs`:
- Around line 807-810: Replace the info-level diagnostic in tools.rs with a
debug (or trace) level log: locate the tracing::info! call that logs "
[composio] list_tools empty for uncurated toolkit scope" with the
scoped_toolkits field and change it to tracing::debug! (or tracing::trace!) so
the state-transition diagnostic follows the repository logging policy and keeps
info-level logs reserved for higher-severity messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f1b65f0-41d2-4ffb-bb88-3a5e85384795

📥 Commits

Reviewing files that changed from the base of the PR and between 65d92bf and d299c8a.

📒 Files selected for processing (2)
  • src/openhuman/composio/tools.rs
  • src/openhuman/composio/tools_tests.rs

Comment thread src/openhuman/composio/tools.rs
@graycyrus graycyrus self-assigned this May 20, 2026
@aqilaziz aqilaziz force-pushed the codex/2283-uncurated-toolkit-fast-fail branch from d299c8a to c49f9f2 Compare May 20, 2026 09:32
@senamakel senamakel merged commit ec1352f into tinyhumansai:main May 20, 2026
29 checks passed
@senamakel
Copy link
Copy Markdown
Member

huge thanks @aqilaziz, this fast-fail for uncurated toolkits is such a clean fix 🙌 way better than getting a silent empty tools response for stuff like onedrive or todoist. really appreciate you jumping back in on this one ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

working A PR that is being worked on by the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants