fix(composio): surface Gmail scope errors as permissions#2414
Conversation
|
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 (1)
📝 WalkthroughWalkthroughDistinguishes insufficient-scope/permission errors from true auth/connection failures: Composio error formatting, integrations and orchestrator prompts now instruct users to grant missing scopes via Settings → Connections when appropriate, and only show the exact "Connection error, try to authenticate" message for genuine connection/auth failures. ChangesScope vs. Disconnection Error Handling
Sequence Diagram(s)sequenceDiagram
participant User
participant Agent as Integrations Agent
participant ErrorSignal as Error Classification
User->>Agent: Request action (e.g., send email via Gmail)
Agent->>ErrorSignal: Action fails, classify error
alt Insufficient OAuth scopes
ErrorSignal-->>Agent: composio:error:insufficient_scope
Agent->>User: Go to Settings → Connections → Gmail\nto grant required scopes
else True disconnection
ErrorSignal-->>Agent: auth/connection failure
Agent->>User: Connection error, try to authenticate
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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. Comment |
f0e02f8 to
a0f954f
Compare
|
New commit 4156d29 from @aqilaziz adds global cache test serialization — looks good. Still needs review from maintainers. @senamakel assigned. |
graycyrus
left a comment
There was a problem hiding this comment.
Looks good, nice work!
Summary - Keeps Gmail insufficient-scope failures distinct from disconnected/auth failures. - Points missing Gmail permissions to Settings -> Connections -> gmail instead of Settings -> Skills. - Updates integrations/orchestrator prompts so connected-but-missing-scope errors are not collapsed into the generic disconnected flow. - Adds focused regression assertions for prompt wording and Composio error mapping. - Serializes app-state cache tests that mutate global test caches so unrelated CI jobs do not fail nondeterministically. ## Problem When Gmail is connected but a send action fails due to missing permissions/scopes, the agent can treat the failure like a disconnected integration and tell the user to reconnect generically. That makes a connected account look broken and hides the real missing-scope issue. ## Solution - Format
insufficient_scopeComposio errors as missing permissions on a connected account. - Route the user to Settings -> Connections -> gmail for reconnect/scope grant. - Teachintegrations_agentto report scope/permission failures plainly instead of returningConnection error, try to authenticate. - Teach the orchestrator not to apply the disconnected-service rule to[composio:error:insufficient_scope]/ missing-permission messages. ## Submission Checklist - [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy - [x] Diff coverage >= 80% - focused Rust prompt/error-mapping tests added; CI coverage gate will enforce merged diff coverage. - [x] Coverage matrix updated - N/A: connector error/prompt behavior only, no feature row added/removed/renamed - [x] All affected feature IDs from the matrix are listed in the PR description under ## Related - N/A: no matrix feature ID changed - [x] No new external network dependencies introduced (mock/pure prompt and mapping coverage only) - [x] Manual smoke checklist updated if this touches release-cut surfaces - N/A: no release-cut smoke surface changed - [x] Linked issue closed via Closes #NNN in the ## Related section ## Impact - User-facing copy changes when a connected Gmail account lacks send permissions. - True disconnected/auth failures still use the existing authenticate handoff. - No migration or dependency change. ## Related - Closes #2365 - Related tracking issue: #2305 - Follow-up PR(s)/TODOs: N/A --- ## AI Authored PR Metadata (required for Codex/Linear PRs) ### Linear Issue - Key: N/A - URL: N/A ### Commit & Branch - Branch: codex/2365-gmail-scope-error - Commit SHA: 4156d29 ### Validation Run - [x]cargo fmt -- --check- [x]git diff --check- [x] Focused tests attempted locally:cargo test -p openhuman openhuman::composio::error_mapping::tests --lib(blocked by missing Windows libclang; see below) - [x] Focused prompt tests attempted locally:cargo test -p openhuman openhuman::agent::agents::integrations_agent::prompt::tests --lib(blocked by missing Windows libclang; see below) - [x] Focused app-state cache test attempted locally:cargo test --lib openhuman::app_state::ops::tests::runtime_snapshot_cache_hit_within_ttl -- --nocapture(blocked by missing Windows libclang; see below) - [x] Rust fmt/check (if changed):cargo fmt -- --check- [x] Tauri fmt/check (if changed): N/A ### Validation Blocked - command:cargo test -p openhuman openhuman::composio::error_mapping::tests --lib- error: Unable to find libclang: could not findclang.dll/libclang.dll; setLIBCLANG_PATH- impact: Local Windows Rust test run blocked before executing tests; CI Linux Rust jobs should validate the added tests. ### Behavior Changes - Intended behavior change: connected Gmail insufficient-scope failures surface as missing permissions, not as disconnected-account copy. - User-visible effect: users are pointed to Connections to reconnect/grant Gmail scopes instead of being told Gmail is simply disconnected. ### Parity Contract - Legacy behavior preserved: true auth/connection failures still bubble up asConnection error, try to authenticatefor the orchestrator settings handoff. - Guard/fallback/dispatch parity checks: Composio error classification prefix remains[composio:error:insufficient_scope]. ### Duplicate / Superseded PR Handling - Duplicate PR(s): N/A - Canonical PR: this PR - Resolution (closed/superseded/updated): N/ASummary by CodeRabbit
Bug Fixes
Tests