-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: pick active connection only #1152
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe PR introduces a minor change by adding two lines to filter active connections in 🔗 Related PRs
Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts belowEmoji Descriptions:
Interact with the Bot:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 9c07c50 in 50 seconds
More details
- Looked at
13
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_ype1LxFe5WAzp85D
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@@ -236,6 +236,8 @@ export class ComposioToolSet { | |||
// fetch connected account id | |||
const connectedAccounts = await this.client.connectedAccounts.list({ | |||
user_uuid: entityId, | |||
status: "ACTIVE", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The status: "ACTIVE"
parameter is redundant when showActiveOnly: true
is used. Consider removing status: "ACTIVE"
.
This comment was generated by github-actions[bot]! JS SDK Coverage Report📊 Coverage report for JS SDK can be found at the following URL: 📁 Test report folder can be found at the following URL: |
@@ -236,6 +236,8 @@ export class ComposioToolSet { | |||
// fetch connected account id | |||
const connectedAccounts = await this.client.connectedAccounts.list({ | |||
user_uuid: entityId, | |||
status: "ACTIVE", | |||
showActiveOnly: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be redundancy in the parameters. Both status: "ACTIVE"
and showActiveOnly: true
seem to serve the same purpose. Consider using just one of these parameters to maintain cleaner code. Additionally, the string literal "ACTIVE" should be defined as a constant for better maintainability.
@@ -236,6 +236,8 @@ export class ComposioToolSet { | |||
// fetch connected account id | |||
const connectedAccounts = await this.client.connectedAccounts.list({ | |||
user_uuid: entityId, | |||
status: "ACTIVE", | |||
showActiveOnly: true, | |||
}); | |||
accountId = connectedAccounts?.items[0]?.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code assumes there will be active accounts by directly accessing items[0]
. Consider adding explicit error handling for cases where no active accounts are found. For example:
if (!connectedAccounts?.items?.length) {
throw CEG.getCustomError(
COMPOSIO_SDK_ERROR_CODES.SDK.NO_ACTIVE_ACCOUNT_FOUND,
{
message: "No active connected account found for the user",
description: "Please ensure user has at least one active connected account",
}
);
}
Code Review SummaryThe changes introduce filtering for active accounts, which is a good addition, but there are a few areas that could be improved:
Suggested implementation: const ACCOUNT_STATUS = {
ACTIVE: 'ACTIVE'
} as const;
// Fetch connected account id, prioritizing active accounts
const connectedAccounts = await this.client.connectedAccounts.list({
user_uuid: entityId,
status: ACCOUNT_STATUS.ACTIVE,
});
if (!connectedAccounts?.items?.length) {
throw CEG.getCustomError(
COMPOSIO_SDK_ERROR_CODES.SDK.NO_ACTIVE_ACCOUNT_FOUND,
{
message: "No active connected account found for the user",
description: "Please ensure user has at least one active connected account",
}
);
} Overall, while the changes are moving in the right direction, addressing these points would make the code more robust and maintainable. |
🔍 Review Summary
The update involves a minor enhancement in
base.toolset.ts
by adding a filter for active connections, ensuring minimal impact on the overall codebase.Original Description
None
Important
Enhance
ComposioToolSet.executeAction
to filter and use only active connected accounts.ComposioToolSet.executeAction
, filters connected accounts bystatus: "ACTIVE"
andshowActiveOnly: true
to ensure only active accounts are considered.This description was created by for 9c07c50. It will automatically update as commits are pushed.