-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fixed metadata injection for local actions #1247
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
LGTM 👍 |
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 29e6856 in 1 minute and 35 seconds
More details
- Looked at
76
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. python/tests/test_tools/test_metadata_injection.py:28
- Draft comment:
The test only checks that the injected metadata contains the key 'api_key'. Consider testing edge cases (e.g. when metadata is None or already set) and verifying that no unintended metadata gets merged. - Reason this comment was not posted:
Confidence changes required:50%
None
2. python/composio/tools/toolset.py:399
- Draft comment:
In the new add_local_action_metadata method, only the metadata for the action type is injected (without app-level metadata as in add_metadata). Consider adding a comment to document this intentional behavior. - Reason this comment was not posted:
Confidence changes required:33%
None
3. python/composio/tools/toolset.py:1817
- Draft comment:
Storing the original action type before conversion ensures correct metadata lookup for local actions. Verify that using the unmodified action as the metadata key aligns with your metadata configuration. - Reason this comment was not posted:
Confidence changes required:33%
None
4. python/tests/test_tools/test_metadata_injection.py:28
- Draft comment:
The test validates metadata injection for local actions. Consider adding additional cases (e.g., non-empty initial metadata) to ensure proper merging behavior. - Reason this comment was not posted:
Confidence changes required:33%
None
Workflow ID: wflow_aSaMY2MMUGWH0f7O
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.
@@ -1836,6 +1842,12 @@ def execute_action( | |||
action=action, |
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 new add_local_action_metadata seems to duplicate parts of add_metadata. In execute_action, local actions get metadata injected first via add_local_action_metadata and then via add_metadata. Is this double injection intentional? Consider conditionally skipping add_metadata for local actions.
class ResponseClass(BaseModel): | ||
pass | ||
|
||
metadata_value = None |
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.
Consider using a more descriptive name for the global variable and adding type hints:
test_captured_metadata: Optional[str] = None # Used to capture metadata in test scenarios
This makes the test code more maintainable and its purpose clearer.
return ResponseClass() | ||
|
||
|
||
def test_metadata_injection() -> None: |
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.
Consider adding more test cases to cover different scenarios:
- Test with None metadata
- Test with existing metadata to ensure proper merging
- Test with different action types
This would improve test coverage and ensure robustness of the metadata injection functionality.
Code Review SummaryOverall, the changes look well-structured and properly implement metadata injection for local actions. Here's a breakdown of the review: Strengths:
Suggestions for Improvement:
The changes are good to merge after addressing the documentation and test improvements. The core functionality appears solid and well-implemented. |
Important
Adds metadata injection support for local actions in
ComposioToolSet
and tests it with a new test case.add_local_action_metadata()
inProcessorHelper
to handle metadata for local actions.execute_action()
inComposioToolSet
to useadd_local_action_metadata()
for local actions.test_metadata_injection.py
to verify metadata injection for local actions usingComposioToolSet
.This description was created by
for 29e6856. It will automatically update as commits are pushed.