Skip to content

Save new request body when retrying the request to save progress#1732

Merged
MarceloRGonc merged 6 commits intomainfrom
mg/OPS-3194
Dec 4, 2025
Merged

Save new request body when retrying the request to save progress#1732
MarceloRGonc merged 6 commits intomainfrom
mg/OPS-3194

Conversation

@MarceloRGonc
Copy link
Copy Markdown
Contributor

@MarceloRGonc MarceloRGonc commented Dec 4, 2025

Fixes OPS-3194.

@linear
Copy link
Copy Markdown

linear Bot commented Dec 4, 2025

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 4, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mg/OPS-3194

Comment @coderabbitai help to get the list of available commands and usage tips.

@MarceloRGonc MarceloRGonc marked this pull request as ready for review December 4, 2025 14:53
Copilot AI review requested due to automatic review settings December 4, 2025 14:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modifies the retry logic for flow run update requests to regenerate the request body access key on each retry attempt, ensuring that retries use fresh credentials rather than potentially expired ones.

Key Changes:

  • Modified retryCondition to be async and regenerate the body access key before each retry
  • Added logic to update the Axios request config with the new body access key when a retry is triggered

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/engine/src/lib/services/progress.service.ts Outdated
Comment thread packages/engine/src/lib/services/progress.service.ts Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Dec 4, 2025

Greptile Overview

Greptile Summary

Fixed retry logic to regenerate and save request body with new cache key before each retry attempt, since the original body is deleted from cache after first request processing.

  • Changed retryCondition from synchronous to async to support saveRequestBody calls
  • Added logic to save new request body and update error.config.data with new bodyAccessKey before retry
  • Ensures retries have valid cache keys after original is consumed by getBufferAndDelete

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix correctly addresses the retry issue where cached request bodies are deleted after first use, implementation follows axios-retry patterns correctly, and the change is isolated to retry logic
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/engine/src/lib/services/progress.service.ts 5/5 Modified retryCondition to save new request body and update axios config data with new bodyAccessKey before each retry attempt

Sequence Diagram

sequenceDiagram
    participant Engine as Progress Service
    participant Cache as Redis Cache
    participant API as Internal API
    
    Note over Engine: Initial Request
    Engine->>Cache: saveRequestBody(request)
    Cache-->>Engine: bodyAccessKey (req:xxx)
    Engine->>API: POST /update-run (bodyAccessKey)
    API->>Cache: getBufferAndDelete(bodyAccessKey)
    Cache-->>API: request body (deleted from cache)
    
    Note over API: Request fails (network/server error)
    
    Note over Engine: Retry Attempt
    Engine->>Engine: retryCondition called
    Engine->>Cache: saveRequestBody(request)
    Cache-->>Engine: newBodyAccessKey (req:yyy)
    Engine->>Engine: Update error.config.data
    Engine->>API: POST /update-run (newBodyAccessKey)
    API->>Cache: getBufferAndDelete(newBodyAccessKey)
    Cache-->>API: request body (deleted from cache)
    
    Note over API: Request succeeds
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Dec 4, 2025

@MarceloRGonc MarceloRGonc changed the title Save new request body when retrying request Save new request body when retrying the request to save progress. Dec 4, 2025
@MarceloRGonc MarceloRGonc changed the title Save new request body when retrying the request to save progress. Save new request body when retrying the request to save progress Dec 4, 2025
@MarceloRGonc MarceloRGonc merged commit 5426885 into main Dec 4, 2025
24 checks passed
@MarceloRGonc MarceloRGonc deleted the mg/OPS-3194 branch December 4, 2025 16:34
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