Skip to content
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: custom action fix #1150

Merged
merged 1 commit into from
Jan 3, 2025
Merged

feat: custom action fix #1150

merged 1 commit into from
Jan 3, 2025

Conversation

himanshu-dixit
Copy link
Collaborator

@himanshu-dixit himanshu-dixit commented Jan 3, 2025

🔍 Review Summary

Minor updates were made to langchain.spec.ts and base.toolset.ts to enhance the efficiency of custom action processing.

Original Description

[!IMPORTANT]
Fixes custom action filtering in ComposioToolSet and adds a test for custom action retrieval.

  • Behavior:
    • Fixes filtering logic for custom actions in getToolsSchema() in base.toolset.ts by removing unnecessary toolName filter.
    • Adds test in langchain.spec.ts to verify custom action retrieval with getTools().
  • Tests:
    • Adds expectation for tools.length to be 1 after retrieving custom action starRepositoryCustomAction in langchain.spec.ts.

This description was created by Ellipsis for 4c4d743. It will automatically update as commits are pushed.

Copy link

vercel bot commented Jan 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 9:03am

Copy link

Walkthrough

Minor changes in langchain.spec.ts and base.toolset.ts to streamline custom action handling.

🔗 Related PRs

Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @bot + *your message*
Example: @bot Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @bot + *feedback*
Example: @bot Do not comment on `save_auth` function !

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 4c4d743 in 37 seconds

More details
  • Looked at 45 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/frameworks/langchain.spec.ts:68
  • Draft comment:
    expect should not be awaited as it is not a promise.
    expect(tools.length).toBe(1);
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_ZYt63caQvjTp4edd


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.

actions: ["starRepositoryCustomAction"],
});

await expect(tools.length).toBe(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

expect should not be awaited as it is not a promise.

Suggested change
await expect(tools.length).toBe(1);
expect(tools.length).toBe(1);

Copy link

github-actions bot commented Jan 3, 2025

This comment was generated by github-actions[bot]!

JS SDK Coverage Report

📊 Coverage report for JS SDK can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/coverage-12595298076/coverage/index.html

📁 Test report folder can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/html-report-12595298076/html-report/report.html

@@ -60,10 +60,11 @@ describe("Apps class tests", () => {
},
});

langchainToolSet.getTools({
const tools = await langchainToolSet.getTools({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good improvement adding proper async/await handling here. This prevents potential race conditions and makes the code more reliable. However, consider adding a test description that better explains what's being tested, e.g.:

it('should return exactly one tool when requesting starRepositoryCustomAction', async () => {
  // ... rest of the test
});

).filter((action) => {
const { name: actionName, toolName } = action.metadata || {};
const customActions = await this.userActionRegistry.getAllActions();
const toolsWithCustomActions = customActions.filter((action) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding null/undefined checks for the action object since you're destructuring it directly. A safer approach would be:

const { name: actionName } = action?.metadata || {};

This prevents potential runtime errors if action is null/undefined.

@shreysingla11
Copy link
Collaborator

Code Review Summary

Overall, the changes look good and improve the codebase in several ways:

Positive Changes:

✅ Added proper async/await handling in test file
✅ Simplified custom actions filtering logic
✅ Improved test coverage for custom actions
✅ Removed redundant filtering conditions

Suggestions for Improvement:

  1. Add better test descriptions for clarity
  2. Add null/undefined checks when destructuring objects
  3. Consider documenting the removal of toolName filtering in case other parts of the system relied on it

Code Quality: 8/10

The changes make the code more maintainable and reliable while maintaining functionality. The removal of redundant filtering improves code clarity.

@himanshu-dixit himanshu-dixit enabled auto-merge (squash) January 3, 2025 09:08
@himanshu-dixit himanshu-dixit merged commit 4012478 into master Jan 3, 2025
16 checks passed
@himanshu-dixit himanshu-dixit deleted the feat-custom-action-fix branch January 3, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants