Skip to content

Conversation

@amindadgar
Copy link
Member

@amindadgar amindadgar commented Jul 17, 2025

Summary by CodeRabbit

  • Improvements
    • Enhanced workflow reliability by adding automatic retry support for certain operations, allowing up to three attempts in case of failures.

@coderabbitai
Copy link

coderabbitai bot commented Jul 17, 2025

Walkthrough

A retry policy was added to the workflow execution within the query method of the QueryDataSources class. This change configures the workflow to automatically retry up to three times upon failure, modifying the internal behavior without altering any public interfaces.

Changes

File(s) Change Summary
tasks/hivemind/query_data_sources.py Added a retry policy (max 3 attempts) to client.execute_workflow in the query method.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant QueryDataSources
    participant TemporalClient

    Caller->>QueryDataSources: query()
    QueryDataSources->>TemporalClient: execute_workflow(..., retry_policy=RetryPolicy(max_attempts=3))
    alt Success
        TemporalClient-->>QueryDataSources: Workflow result
    else Failure (up to 3 attempts)
        TemporalClient-->>QueryDataSources: Retry execution (up to 3 times)
        TemporalClient-->>QueryDataSources: Final failure or result
    end
    QueryDataSources-->>Caller: Return result or raise error
Loading

Possibly related PRs

  • fix: missing workflow_id! #38: Also modifies the internal implementation of the query method in the QueryDataSources class, focusing on workflow execution parameters.

Poem

Three hops for a query, a retry or two,
If workflows should stumble, we’ll see it right through.
With patience and policy, results we shall find—
A rabbit’s persistence, with retries in mind!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a2d483 and ad584db.

📒 Files selected for processing (1)
  • tasks/hivemind/query_data_sources.py (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#2
File: tasks/hivemind/query_data_sources.py:27-31
Timestamp: 2025-02-26T15:41:54.631Z
Learning: In the agents-workflow project, "HivemindWorkflow" and "AgenticHivemindTemporalWorkflow" are two distinct workflows. The QueryDataSources class in tasks/hivemind/query_data_sources.py is designed to interact with "HivemindWorkflow", which is separate from "AgenticHivemindTemporalWorkflow" defined in tasks/agent.py.
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#6
File: tasks/hivemind/query_data_sources.py:73-79
Timestamp: 2025-03-04T09:11:26.359Z
Learning: In the TogetherCrew/agents-workflow project, the `QueryDataSourcesTool` class uses a class method `setup_tools` that returns the class itself rather than an instance, as it's designed to be instantiated later in the code after configuration is set.
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#6
File: tasks/hivemind/query_data_sources.py:73-79
Timestamp: 2025-03-04T09:11:26.359Z
Learning: In the TogetherCrew/agents-workflow project, the `QueryDataSourcesTool` class uses a class method `setup_tools` that returns the class itself rather than an instance, as it's designed to be instantiated later in the code after configuration is set. This pattern is common in LangChain and similar frameworks.
tasks/hivemind/query_data_sources.py (2)
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#2
File: tasks/hivemind/query_data_sources.py:27-31
Timestamp: 2025-02-26T15:41:54.631Z
Learning: In the agents-workflow project, "HivemindWorkflow" and "AgenticHivemindTemporalWorkflow" are two distinct workflows. The QueryDataSources class in tasks/hivemind/query_data_sources.py is designed to interact with "HivemindWorkflow", which is separate from "AgenticHivemindTemporalWorkflow" defined in tasks/agent.py.
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#37
File: tasks/hivemind/query_data_sources.py:40-43
Timestamp: 2025-06-17T13:03:41.479Z
Learning: The HivemindQueryPayload schema in tc-temporal-backend package version 1.1.3 includes support for the workflow_id field, so assignments like payload.workflow_id = self.workflow_id are valid and won't cause ValidationError.
🔇 Additional comments (2)
tasks/hivemind/query_data_sources.py (2)

10-10: LGTM! Correct import for retry functionality.

The import statement is properly placed and uses the correct module path for RetryPolicy from the Temporal Python SDK.


50-50: Good addition of retry policy for resilience.

The retry policy with maximum_attempts=3 is a reasonable configuration for handling transient failures in workflow execution. This will improve the robustness of the query operation without being overly aggressive.

The implementation correctly applies the retry policy at the workflow level, which is appropriate for this use case.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@amindadgar amindadgar merged commit 6bff1c6 into main Jul 17, 2025
3 checks passed
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