fix(composio): empty connections in direct mode without api key (TAURI-RUST-R4)#3198
Conversation
…y (TAURI-RUST-R4) Direct mode selected with no API key configured is a valid, user-controlled setup state, not an operation failure. The desktop UI polls list_connections every 5s; without a key the mode-aware factory bailed on every tick and the error funnelled to Sentry until the user pasted a key (~3.2k events, single user). Mirror periodic.rs's graceful skip: short-circuit to a truthful empty list (no key -> no tenant -> no connections) before the factory and cache sync. Key presence mirrors the factory's own keychain-or-config.toml check so a config.toml key is never wrongly treated as absent.
…ing (TAURI-RUST-R4) Defense-in-depth for direct-mode composio ops the user invokes explicitly (execute/authorize) that can still surface the factory's no-key bail. Same user-config state with no Sentry-actionable signal; demote to ApiKeyMissing (warn!, still logged). Guard test pins that a genuine invalid_api_key 401 stays actionable (None -> Sentry).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR hardens Composio Direct mode handling by recognizing additional "API key not configured" message patterns in error classification, then adding an early-return guard in ChangesComposio Direct Mode Missing Key Guard
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
graycyrus
left a comment
There was a problem hiding this comment.
Clean fix. The root cause is correctly identified — the 5 s poll was treating a valid setup state as an operation failure, and the fix addresses that at the source rather than suppressing symptoms.
A few things I verified:
direct_mode_without_keymirrors the factory's own key resolution (keychain-or-config.toml) correctly. The config.toml fallback test catches the subtle case where a user configured their key outside the keychain — good edge case coverage.- The error propagation from
get_composio_api_keyis right: if the keychain is locked or errors, we propagate rather than silently returning empty, which is the correct semantic (genuine keychain failure != "no key configured"). - The
expected_error_kindclassifier addition is defense-in-depth for explicit execute/authorize invocations — those can still surface the error, and classifying it asApiKeyMissingkeeps Sentry clean without dropping the signal. The over-suppression guard test (invalid 401 staysNone) is exactly what I'd want to see. - Short-circuiting before
create_composio_clientandsync_cache_with_connectionsmeans no error object is constructed and the integrations cache is left untouched — correct ordering. - Backend mode is fully unaffected (guard returns
falseimmediately). Confirmed by test.
Coverage is solid: 4 unit cases on the helper (backend mode, no-key, config.toml key, keychain key) plus the async integration test on composio_list_connections itself. The periodic.rs parity is now explicit and symmetric.
Approved.
Dismissing approval — this repo's review automation does not auto-approve. Re-posting the same analysis as a comment; final approval is done manually by a maintainer.
Summary
composio_list_connectionsnow returns an empty list (not an error) when the user has selected Composio direct mode but not yet configured an API key — a valid setup state, not a failure.config.tomlresolution, so a key supplied viaconfig.tomlis never wrongly treated as absent.expected_error_kindnow classifies "no api key is configured" asApiKeyMissingfor the direct-mode ops a user invokes explicitly (execute/authorize).Problem
When a user toggles Composio to direct mode but hasn't pasted their API key yet, the mode-aware factory (
composio/client.rs) bails withcomposio direct mode selected but no api key is configured. The desktop UI pollscomposio_list_connectionsevery 5 s, so this error was constructed on every tick and propagated through the central RPC dispatcher (core/jsonrpc.rs) into Sentry — until the user finally entered a key. The result was a single user generating thousands of error events for an expected, user-controlled configuration state with no actionable signal.The background sync tick (
memory_sync/composio/periodic.rs) already handled this gracefully (skip). The UI-poll path never got the symmetric treatment.Solution
direct_mode_without_key(config)incomposio/ops.rs: true only whenconfig.composio.mode == "direct"and no key resolves from either the keychain (credentials::get_composio_api_key) orconfig.composio.api_key. This deliberately mirrors the factory's own resolution to avoid hiding aconfig.toml-supplied key.composio_list_connectionsshort-circuits toOk(ComposioConnectionsResponse { connections: vec![] })before the factory call and beforesync_cache_with_connections, so no error is constructed and the integrations cache is left untouched.HTTP 401: Invalid API keypath, classified separately).api_key_setstatus, so the user is still told exactly what to do — nothing is hidden.expected_error_kindgains a"no api key is configured"substring under the existingApiKeyMissingarm, demoting any residual explicit-invoke emit towarn!(logged, not Sentry). A guard test pins that a genuineinvalid_api_key401 stays actionable.Submission Checklist
composio_list_connections_returns_empty_when_direct_mode_no_key), and the classifier arm (+ over-suppression guard).Sentry-Issue: TAURI-RUST-R4(see Related).Impact
api_key_set).Related
Sentry-Issue: TAURI-RUST-R4AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/tauri-rust-r4-composio-listconns-empty-on-no-key50e1170e,d16fd54fValidation Run
pnpm --filter openhuman-app format:check— no frontend (app/) changes.pnpm typecheck— no frontend changes.cargo test --lib openhuman::composio::ops(74 passed),cargo test --lib core::observability(135 passed)cargo fmt --checkclean;cargo check --workspaceclean;cargo clippy --libno new findingsapp/src-taurichanges.Validation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
composio_list_connectionsreturns an empty list instead of erroring when direct mode is selected with no API key configured.Parity Contract
config.toml-supplied key is honoured (guard helper mirrors the factory's keychain-or-config resolution).direct_mode_without_keyreturns false for backend mode and for any present key.Duplicate / Superseded PR Handling
Summary by CodeRabbit