Fix: GitHub composeio#543
Conversation
- Enhanced the ComposioConnectModal component to support loading and selecting GitHub repositories for connected users. - Introduced new API functions for listing GitHub repositories and creating triggers, improving integration capabilities with GitHub. - Added state management for repository loading, selection, and trigger action feedback, enhancing user experience during GitHub integration. - Updated types to include GitHub repository structures and responses, ensuring type safety and clarity in the codebase.
- Implemented new API endpoints for listing GitHub repositories and creating triggers, enhancing integration capabilities with GitHub. - Updated types to include responses for GitHub repositories and trigger creation, ensuring type safety and clarity. - Added corresponding handler functions and schemas to support the new operations, improving overall functionality and user experience in the Composio integration.
📝 WalkthroughWalkthroughThe PR adds GitHub-specific trigger management capabilities to the Composio integration. It introduces UI and state management in the ComposioConnectModal component for repository selection and trigger enablement, adds frontend API wrappers for listing GitHub repositories and creating triggers, and implements corresponding backend HTTP client methods, RPC operations, and controller schemas to expose this functionality. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant UI as ComposioConnectModal
participant API as Frontend API
participant RPC as RPC Server
participant Client as Composio Client
rect rgba(100, 150, 200, 0.5)
Note over User,Client: GitHub Repository Loading
User->>UI: Modal enters connected phase
UI->>API: loadGithubRepos(connectionId)
API->>RPC: composio_list_github_repos
RPC->>Client: list_github_repos()
Client-->>RPC: ComposioGithubReposResponse
RPC-->>API: repos with count
API-->>UI: populate githubRepos state
UI->>User: display repo selection dropdown
end
rect rgba(150, 100, 200, 0.5)
Note over User,Client: GitHub Trigger Enablement
User->>UI: click "Enable Push Trigger"
UI->>API: createTrigger(slug, selectedRepo)
API->>RPC: composio_create_trigger
RPC->>Client: create_trigger(slug, triggerConfig)
Client-->>RPC: ComposioCreateTriggerResponse
RPC-->>API: triggerId + status
API-->>UI: update success state
UI->>User: display success message
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
app/src/components/composio/ComposioConnectModal.tsx (1)
229-242: Consider guarding against persistent errors to avoid retry loops.The effect guard at line 233 only checks
githubRepos.length > 0 || githubReposLoading. IfloadGithubReposfails with an error, the guard will pass again on the next render, potentially causing repeated failed API calls.♻️ Suggested fix: include error state in guard
useEffect(() => { if (phase !== 'connected') return; if (toolkit.slug.toLowerCase() !== 'github') return; if (!activeConnection) return; - if (githubRepos.length > 0 || githubReposLoading) return; + if (githubRepos.length > 0 || githubReposLoading || githubRepoError) return; void loadGithubRepos(); }, [ phase, toolkit.slug, activeConnection, githubRepos.length, githubReposLoading, + githubRepoError, loadGithubRepos, ]);This prevents retry loops on persistent errors. Users can still manually reload via the "Reload repositories" button.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/components/composio/ComposioConnectModal.tsx` around lines 229 - 242, The effect that auto-loads GitHub repos (useEffect watching phase, toolkit.slug, activeConnection, githubRepos.length, githubReposLoading, loadGithubRepos) can re-trigger loadGithubRepos on every render after a failed fetch; update the guard to also check the repository error state (e.g., githubReposError or similar) and return early if an error exists, and add that error state to the dependency array so the effect won't loop on persistent failures; keep the existing manual "Reload repositories" button for retries.src/openhuman/socket/event_handlers.rs (1)
130-136: Minor: Duplicate log statements.There are now two
log::info!statements for the same event: one at line 120 and this more detailed one at lines 130-136. Consider removing the generic log at line 120 or consolidating them to avoid redundant output.♻️ Suggested consolidation
"composio:trigger" => { - log::info!("[socket] Publishing composio:trigger to event bus"); match serde_json::from_value::<crate::openhuman::composio::ComposioTriggerEvent>( data.clone(), ) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openhuman/socket/event_handlers.rs` around lines 130 - 136, There are duplicate log::info! calls emitting the same composio:trigger event; remove the earlier generic log or consolidate them into a single detailed log that uses event.toolkit, event.trigger, event.metadata.id and event.metadata.uuid (the detailed log currently shown) so only one info-level message is produced in the event handler in src/openhuman/socket/event_handlers.rs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/src/components/composio/ComposioConnectModal.tsx`:
- Around line 229-242: The effect that auto-loads GitHub repos (useEffect
watching phase, toolkit.slug, activeConnection, githubRepos.length,
githubReposLoading, loadGithubRepos) can re-trigger loadGithubRepos on every
render after a failed fetch; update the guard to also check the repository error
state (e.g., githubReposError or similar) and return early if an error exists,
and add that error state to the dependency array so the effect won't loop on
persistent failures; keep the existing manual "Reload repositories" button for
retries.
In `@src/openhuman/socket/event_handlers.rs`:
- Around line 130-136: There are duplicate log::info! calls emitting the same
composio:trigger event; remove the earlier generic log or consolidate them into
a single detailed log that uses event.toolkit, event.trigger, event.metadata.id
and event.metadata.uuid (the detailed log currently shown) so only one
info-level message is produced in the event handler in
src/openhuman/socket/event_handlers.rs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 495ada3b-ef0e-4d62-8502-fac5341aeba2
📒 Files selected for processing (8)
app/src/components/composio/ComposioConnectModal.tsxapp/src/lib/composio/composioApi.tsapp/src/lib/composio/types.tssrc/openhuman/composio/client.rssrc/openhuman/composio/ops.rssrc/openhuman/composio/schemas.rssrc/openhuman/composio/types.rssrc/openhuman/socket/event_handlers.rs
|
creating of composio triggers should happen at the backend level.. not at the frontend. @YellowSnnowmann |
…rom ComposioConnectModal - Eliminated GitHub repository loading and trigger creation logic from the ComposioConnectModal component, streamlining its functionality. - Removed associated state management and API calls for GitHub repositories and triggers, enhancing code clarity and maintainability. - Updated types to reflect the removal of GitHub-related structures, ensuring consistency across the codebase.
* feat(composio): add GitHub repository management and trigger creation - Enhanced the ComposioConnectModal component to support loading and selecting GitHub repositories for connected users. - Introduced new API functions for listing GitHub repositories and creating triggers, improving integration capabilities with GitHub. - Added state management for repository loading, selection, and trigger action feedback, enhancing user experience during GitHub integration. - Updated types to include GitHub repository structures and responses, ensuring type safety and clarity in the codebase. * feat(composio): add GitHub repository listing and trigger creation APIs - Implemented new API endpoints for listing GitHub repositories and creating triggers, enhancing integration capabilities with GitHub. - Updated types to include responses for GitHub repositories and trigger creation, ensuring type safety and clarity. - Added corresponding handler functions and schemas to support the new operations, improving overall functionality and user experience in the Composio integration. * refactor(composio): remove GitHub repository and trigger management from ComposioConnectModal - Eliminated GitHub repository loading and trigger creation logic from the ComposioConnectModal component, streamlining its functionality. - Removed associated state management and API calls for GitHub repositories and triggers, enhancing code clarity and maintainability. - Updated types to reflect the removal of GitHub-related structures, ensuring consistency across the codebase. * format: ran format
Summary
openhuman.composio_list_github_reposandopenhuman.composio_create_trigger.composio:triggerevents (toolkit, trigger, metadata ids) to improve end-to-end debugging.Problem
Solution
connection_idandtrigger_configComposioConnectModalfor GitHub toolkits:GITHUB_PULL_REQUEST_EVENTandGITHUB_PUSH_EVENTwith inline success/error UXcomposio:triggerevents.Submission Checklist
app/) and/orcargo test(core) for logic you add or changeapp/test/e2e, mock backend,tests/json_rpc_e2e.rsas appropriate)(Any feature related checklist can go in here)
Impact
Related
Summary by CodeRabbit