Skip to content

Conversation

@drazisil-codecov
Copy link
Contributor

@drazisil-codecov drazisil-codecov commented Dec 29, 2025

Description

Fixes the infinite retry loop bug in BundleAnalysisProcessorTask that was causing tasks to retry indefinitely. This is a minimal atomic change extracted from PR #608.

Root Cause:
The task was using self.attempts instead of self.request.retries when calling LockManager.locked(). The self.attempts property can be inconsistent with self.request.retries due to visibility timeout re-deliveries, causing the max retries check to fail and allowing infinite retries.

Changes:

  • Changed retry_num=self.attempts to retry_num=self.request.retries in LockManager.locked() call
  • Removed max_retries parameter (no longer accepted by LockManager)
  • Simplified exception handler to use centralized self.retry() method which properly checks max retries

Impact:

  • Prevents infinite retries when max retries are exceeded
  • Uses consistent retry counting via self.request.retries
  • Leverages centralized retry logic in BaseCodecovTask.retry()

Related:


Note

Resolves runaway retries in bundle analysis processing and hardens retry behavior.

  • In bundle_analysis_processor.py, pass retry_num=self.request.retries to LockManager.locked() and handle LockRetry by checking self.request.retries >= max_retries; on exceed, return previous_result, otherwise call self.retry() with backoff
  • Preserve chain behavior by returning previous_result when lock retries are exhausted; remove legacy safe_retry usage in favor of centralized self.retry()
  • Add integration tests validating processor→notify chain success and max-retries handling (test_bundle_analysis_e2e.py)
  • Update unit tests to assert new retry semantics (raising Retry below max, returning previous_result at/above max) and error-state persistence on processing failures (test_bundle_analysis_processor_task.py)

Written by Cursor Bugbot for commit 78a77b5. This will update automatically on new commits. Configure here.

- Change retry_num from self.attempts to self.request.retries to ensure consistent retry counting
- Remove max_retries parameter from LockManager.locked() call (no longer accepted)
- Simplify exception handler to use centralized self.retry() which properly checks max retries

This fixes the looping retry issue seen in task logs where tasks would retry indefinitely
due to inconsistent retry counting between self.attempts and self.request.retries.
@drazisil-codecov drazisil-codecov marked this pull request as draft December 29, 2025 17:23
- Introduced a check for max retries in the retry logic to avoid infinite loops.
- Updated exception handling to raise MaxRetriesExceededError when max retries are exceeded.
- Enhanced unit tests to verify correct behavior when max retries are reached and ensure proper retry logic.
…lts on max retries exceeded

- Removed MaxRetriesExceededError raising and instead return previous_result when max retries are exceeded.
- Enhanced logging to capture relevant details when max retries are exceeded.
- Updated unit tests to verify that previous results are returned, preserving chain behavior and preventing infinite retry loops.
@sentry
Copy link

sentry bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.90%. Comparing base (aca0c54) to head (78a77b5).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #631      +/-   ##
==========================================
+ Coverage   93.89%   93.90%   +0.01%     
==========================================
  Files        1286     1286              
  Lines       46807    46802       -5     
  Branches     1517     1517              
==========================================
  Hits        43951    43951              
+ Misses       2547     2542       -5     
  Partials      309      309              
Flag Coverage Δ
workerintegration 59.10% <50.00%> (+0.83%) ⬆️
workerunit 91.30% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- Introduced integration tests for the complete bundle analysis process, verifying the execution of the processor and notify tasks.
- Ensured correct handling of database state and previous results during task execution.
- Added tests to check behavior when maximum retries are exceeded, confirming that the chain does not crash and returns previous results.
@drazisil-codecov drazisil-codecov marked this pull request as ready for review December 29, 2025 18:17
@drazisil-codecov drazisil-codecov requested a review from a team December 29, 2025 18:18
@drazisil-codecov drazisil-codecov added this pull request to the merge queue Jan 5, 2026
Merged via the queue into main with commit 367d3f1 Jan 5, 2026
40 checks passed
@drazisil-codecov drazisil-codecov deleted the fix/bundle-analysis-retry-loop branch January 5, 2026 14:50
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