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: Add retry support in Action postprocessor #1017

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tushar-composio
Copy link
Collaborator

@tushar-composio tushar-composio commented Dec 16, 2024

🔍 Review Summary

Purpose

Introduce retry support in the Action postprocessor to enhance the Composio toolset.

Key Changes

  • New Feature

    • Added _Retry class and max_retries parameter to ComposioToolSet constructor.
  • Enhancement

    • Updated methods in ComposioToolSet to incorporate retry logic.
  • Documentation

    • Added RETRY to import list and __all__ declaration in __init__.py files.

Impact

Improves error handling and resilience in Composio toolset by allowing retry attempts in the Action postprocessor, enhancing overall user experience.

Original Description

No existing description found

Copy link

vercel bot commented Dec 16, 2024

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 Dec 19, 2024 0:02am

Copy link

Walkthrough

This update enhances the Composio toolset by introducing retry support in the Action postprocessor. A new _Retry class is added to manage retry attempts, with a max_retries parameter set to three by default. Key methods in the ComposioToolSet class have been updated to incorporate retry logic, ensuring errors are raised when retries are not permissible. The execute_action method now includes a retry loop, logging attempts and raising an error if the maximum retries are exceeded.

Changes

File(s) Summary
python/composio/__init__.py Added RETRY to the import list and __all__ declaration to expose retry functionality.
python/composio/tools/__init__.py Updated imports to include RETRY and added it to the __all__ list for module exports.
python/composio/tools/toolset.py Introduced _Retry class and RETRY instance for retry signaling. Added max_retries parameter to ComposioToolSet constructor. Updated methods to handle retry logic and implemented retry loop in execute_action method.

🔗 Related PRs

  • Fix all tags #911: A pull request adds an allow_all variable to the get() function in collections.py to check for "all" in the tags list, with no other changes made.
  • chore: add codeowners #913: The pull request adds a .github/CODEOWNERS file designating specific code owners for the /python and /js directories and modifies the test_add_github test case input.
  • feat: add error message details #922: The update enhances CEG.handleError() by adding detailed error messages for unknown backend errors using axiosError data, along with a default fix suggestion.
  • feat: mint json #915: The pull request updates the path for execute-action in docs/mint.json to ensure correct API reference navigation.
Instructions

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 !

Execute a command using the format:

@bot + */command*

Example: @bot /updateCommit

Available Commands:

  • /updateCommit ✨: Apply the suggested changes and commit them (or Click on the Github Action button to apply the changes !)
  • /updateGuideline 🛠️: Modify an existing guideline.
  • /addGuideline ➕: Introduce a new guideline.

Tips for Using @bot Effectively:

  • Specific Queries: For the best results, be specific with your requests.
    🔍 Example: @bot summarize the changes in this PR.
  • Focused Discussions: Tag @bot directly on specific code lines or files for detailed feedback.
    📑 Example: @bot review this line of code.
  • Managing Reviews: Use review comments for targeted discussions on code snippets, and PR comments for broader queries about the entire PR.
    💬 Example: @bot comment on the entire PR.

Need More Help?

📚 Visit our documentation for detailed guides on using Entelligence.AI.
🌐 Join our community to connect with others, request features, and share feedback.
🔔 Follow us for updates on new features and improvements.

Comment on lines 649 to 655
key: _KeyType,
data: t.Dict,
type_: te.Literal["pre", "post", "schema"],
) -> t.Dict:
) -> t.Union[t.Dict, _Retry]:
processor = self._get_processor(key=key, type_=type_)
if processor is not None:
self.logger.info(

Choose a reason for hiding this comment

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

🤖 Bug Fix:

Ensure Compatibility with New Return Type
The change in the return type from t.Dict to t.Union[t.Dict, _Retry] is significant and requires careful handling to avoid runtime errors.

  • Review Calling Code: Ensure all parts of the codebase that call this function are updated to handle both t.Dict and _Retry types appropriately.
  • Update Documentation: Reflect the new return type in the function's documentation to inform other developers of the change.
  • Enhance Testing: Add or update tests to cover scenarios where _Retry is returned, ensuring robust handling of this type.

This change is critical and should be managed with thorough testing and documentation updates to prevent logical errors. 🛠️


"Received RETRY from App schema processor function."
" Schema pprocessors cannot be retried."
)
assert not isinstance(processed, _Retry)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert not isinstance(processed, _Retry)

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.

👍 Looks good to me! Reviewed everything up to 3939a0d in 10 minutes and 19 seconds

More details
  • Looked at 238 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. python/composio/tools/toolset.py:724
  • Draft comment:
    Typo in error message: 'pprocessors' should be 'processors'.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a retry mechanism for action postprocessors. However, there is a typo in the error message for schema processors that should be corrected.
2. python/composio/tools/toolset.py:736
  • Draft comment:
    Typo in error message: 'preprocessor' should be 'schema processor'.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a retry mechanism for action postprocessors. However, there is a typo in the error message for schema processors that should be corrected.
3. python/composio/tools/toolset.py:694
  • Draft comment:
    Typo in function name: '_process_respone' should be '_process_response'.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR introduces a retry mechanism for action postprocessors. However, there is a typo in the error message for schema processors that should be corrected.

Workflow ID: wflow_RgJp76D74M3IviRL


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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.

2 participants