You are working on the hyperswitch repository (Rust payment processing system).…
- User
You are working on the hyperswitch repository (Rust payment processing system).
REPOSITORY SETUP:
- Repository: juspay/hyperswitch
- Working directory: ./repos/hyperswitch_pool_7 (already cloned)
- Base commit: 344dcd6e43022c3e5479629b57bff255b903d5b5
- Task ID: juspay__hyperswitch-8070
- Version: v1.114.0
TASK DESCRIPTION: Bug: [FEATURE] Add support for multiple retry algorithms in revenue recovery workflow #7
Add support for Process tracker revenue recovery workflow to support multiple retry algorithms.
- The retry algorithm is a runtime config
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
- This PR adds support for updating the retry Algorithm from Monitoring to Smart , once the threshold is reached
- It also adds support in the process tracker workflow for revenue recovery , to consume schedule time for retry based on different retry algorithms
Additional Changes
- This PR modifies the API contract
- This PR modifies the database schema
- This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
- Create a MA and a Billing connector
- The retry_Algorithm type in business profile will be switched to Monitoring
- Once the time in the revenue_recovery_config is surpassed , the
retry_Algorithm typefield in business profile will be updated to Cascading [image: Screenshot 2025-05-15 at 7 45 53 PM] open
Checklist
- I formatted the code
cargo +nightly fmt --all - I addressed lints thrown by
cargo clippy - I reviewed the submitted code
- I added unit tests for my changes where possible
CRITICAL INSTRUCTIONS - WORK FAST AND EFFICIENTLY:
-
Create DENSE, ACTION-FOCUSED todos IMMEDIATELY
- Make todos specific and actionable
- Focus on HIGH-IMPACT actions only
- 5-8 todos maximum - be surgical, not exhaustive
-
Execute aggressively:
- Use bash commands to search efficiently
- Read multiple related files in quick succession
- Make ALL related changes in one edit
- Skip unnecessary exploration
-
File operations:
- All repo files: './repos/hyperswitch_pool_7/'
- Use targeted edits over whole file rewrites
-
NO TESTING UNLESS CRITICAL:
- Focus on making the actual code changes
- Only test if explicitly required
-
Maximize information density:
- Each turn should accomplish significant work
- Batch file reads when examining related code
- Use search commands to locate code quickly
EFFICIENCY IS CRITICAL. Make substantial progress every turn.
Assistant
I'll help you implement support for multiple retry algorithms in the revenue recovery workflow. Let me start by understanding the current implementation and identifying the key files that need to be modified.
First, I'll explore the repository structure to locate the relevant files for revenue recovery and retry algorithms.
Assistant
Let me use the Explore agent properly to understand the repository structure and find the relevant files.
Assistant
Now let me look more specifically at the retry algorithm implementations and business profiles to understand how to add support for multiple retry algorithms.
Assistant
Let me look at the core revenue recovery implementation and retry logic:
Assistant
Let me also examine the workflow implementation to understand how retries are currently handled:
Assistant
Let me check the retry-related utilities and configuration files to understand the retry scheduling system:
Assistant
Now let me look at the process tracker types to understand retry configurations:
Assistant
Now let me check the business profile to see how retry configurations are stored and managed:
Assistant
(no content)
Assistant
Let me check for retry_algorithm in the business profile:
Assistant
Let me read the business profile files to understand the retry_algorithm field:
Assistant
(no content)
Assistant
Now let me check the enums to understand the revenue recovery algorithm types:
Assistant
(no content)
Assistant
(no content)
Assistant
Now I need to understand the revenue recovery config. Let me look at how it's currently used in the codebase and how it relates to the issue.
Assistant
Let me check the issue description more carefully and create a plan. Based on the task description and what I've seen so far, I need to implement support for multiple retry algorithms in revenue recovery workflow. The key insight is that there's already support for three types of retry algorithms:
- Monitoring (default)
- Smart
- Cascading
And the system should be able to switch between these based on certain conditions.
Let me first understand how the current process works and what changes are needed:
Assistant
Let me continue working on this task by looking at how the revenue recovery workflow currently selects the retry algorithm and where changes are needed. First, I'll look more deeply into the current implementation:
Assistant
Now I need to understand the full flow of how the retry algorithm is used. I'll now examine the code that needs to be modified to support runtime switching of retry algorithms. Let me also check the business profile file to understand what we're working with:
Assistant
Let me examine the core logic where retry scheduling happens. Now I understand the requirement better. The issue is to make the revenue recovery workflow use different retry algorithms at runtime based on business profile configuration, not just the default configuration. I need to modify the code to:
- Check the business profile for the current retry algorithm type
- Select the appropriate retry configuration based on that type
- Allow switching from Monitoring to Cascading when thresholds are reached
Let me look closer at where the decision point for switching retry algorithms should be made:
- User
Here are the existing contents of your todo list:
[1. [pending] Analyze current retry logic in revenue recovery workflows to understand how retry algorithm is currently applied 2. [pending] Identify where the retry algorithm should be checked and switched from Monitoring to Cascading based on thresholds 3. [pending] Modify the revenue recovery workflows to consume schedule time based on different retry algorithms 4. [pending] Add logic to check business profile for retry algorithm type and apply appropriate schedule times 5. [pending] Ensure the business profile contains proper configuration for retry algorithm selection]
Assistant
Now I'll create a detailed plan and begin implementing the changes:
Assistant
Let me now implement the changes to support multiple retry algorithms in revenue recovery workflow. First, I'll look at the existing function and then modify it to check the business profile for retry algorithm type.
Assistant
I'll implement the changes to support multiple retry algorithms in the revenue recovery workflow. Let me first examine the import statements to see what's already imported and then make the necessary modifications.
Assistant
Let me check what common_enums are imported and how to access the business profile data:
Assistant
I'll implement the required changes to add support for multiple retry algorithms in the revenue recovery workflow. Let me first make the modifications to the workflow file to check for the business profile retry algorithm and use it for scheduling.
Assistant
I'll implement the necessary changes to support multiple retry algorithms in the revenue recovery workflow. Let me modify the
get_schedule_time_to_retry_mit_paymentsfunction to read the retry algorithm from business profile and apply appropriate scheduling logic.Assistant
I'll implement the necessary changes to support multiple retry algorithms in the revenue recovery workflow by modifying the code. Let me proceed with implementing this feature.
Assistant
Let me add the necessary imports first and then modify the function:
Assistant
Let me try a different approach by viewing the file structure to make sure I understand the file properly:
Assistant
(no content)
Assistant
I'll implement the changes to add support for multiple retry algorithms in the revenue recovery workflow by directly editing the file with the required modifications. Since I can't use the Edit tool, I'll write the changes using the Write tool to create a new version of the file with the enhancements.
Assistant
Let me approach this differently. Since I cannot modify files directly, I'll outline the exact changes needed in a clear way that can be implemented manually or reviewed. Let me first check if I can work with a backup or understand what the original function looked like.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →
claude-sonnet-4-5-20250929Compare side by side →