Skip to content

chore: argo agent retries on context deadline err - #1117

Merged
adityachoudhari26 merged 2 commits into
mainfrom
argo-retry-handling
May 11, 2026
Merged

adityachoudhari26 merged 2 commits into
mainfrom
argo-retry-handling

Conversation

@adityachoudhari26

@adityachoudhari26 adityachoudhari26 commented May 11, 2026 •

Copy link
Copy Markdown
Member

fixes #1070

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling to properly retry operations when deadline timeouts occur, enhancing the reliability of application deployments during transient timeout failures.

Review Change Stack

Copilot AI review requested due to automatic review settings May 11, 2026 16:10
@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@adityachoudhari26 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 26 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f95212d8-a846-4400-aaad-3d7c4dc56293

📥 Commits

Reviewing files that changed from the base of the PR and between 80dfa7b and 214dd3d.

📒 Files selected for processing (1)
  • apps/workspace-engine/pkg/jobagents/argo/argoapp_test.go
📝 Walkthrough

Walkthrough

The PR adds context deadline exceeded error handling to the ArgoCD application upsert retry logic. The isRetryableError function now explicitly detects deadline-exceeded errors using both native error type checking and string pattern matching, enabling automatic retries when ArgoCD requests timeout.

Changes

Context Deadline Exceeded Retry Handling

Layer / File(s) Summary
Error Classification Logic
apps/workspace-engine/pkg/jobagents/argo/application_upserter.go
isRetryableError adds errors.Is(err, context.DeadlineExceeded) check (lines 80–82) and fallback string match for "context deadline exceeded" (line 92) to classify deadline-exceeded errors as retryable alongside transient failures.
Test Coverage
apps/workspace-engine/pkg/jobagents/argo/argoapp_test.go
TestIsRetryableError test matrix is extended with cases for raw context.DeadlineExceeded and RPC-style wrapped deadline-exceeded errors to validate the new retryable classification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A deadline slipped through ArgoCD's gate,
But now our retry magic won't wait—
With errors caught and wrapped with care,
Each timeout gets a second prayer! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding context deadline error retries to the argo agent.
Linked Issues check ✅ Passed The code changes implement the primary objective from #1070 by detecting context deadline exceeded errors and treating them as retryable.
Out of Scope Changes check ✅ Passed All changes are directly focused on implementing context deadline retry handling as specified in #1070; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch argo-retry-handling

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the workspace-engine ArgoCD job agent retry classification so that context deadline exceeded errors are treated as retryable during application upserts, addressing issue #1070.

Changes:

  • Extend isRetryableError to treat context.DeadlineExceeded (and matching error strings) as retryable.
  • Add unit test coverage for deadline-exceeded retryability detection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
apps/workspace-engine/pkg/jobagents/argo/application_upserter.go Marks deadline-exceeded errors as retryable for ArgoCD application upserts.
apps/workspace-engine/pkg/jobagents/argo/argoapp_test.go Adds test cases verifying context deadline exceeded is considered retryable.

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

Comment on lines 80 to +93
@@ -85,7 +89,8 @@ func isRetryableError(err error) bool {
strings.Contains(errStr, "timeout") ||
strings.Contains(errStr, "temporarily unavailable") ||
strings.Contains(errStr, "EOF") ||
strings.Contains(errStr, "Unavailable")
strings.Contains(errStr, "Unavailable") ||
strings.Contains(errStr, "context deadline exceeded")
{"context deadline exceeded sentinel", context.DeadlineExceeded, true},
{
"context deadline exceeded wrapped",
fmt.Errorf("rpc error: code = DeadlineExceeded desc = context deadline exceeded"),
@adityachoudhari26
adityachoudhari26 merged commit f0da3d6 into main May 11, 2026
10 checks passed
@adityachoudhari26
adityachoudhari26 deleted the argo-retry-handling branch May 11, 2026 16:42
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.

Retry logic for creating argocd applications

2 participants