feat(worker): add upload_finisher sweep for pending uploads#758
Merged
thomasrockhu-codecov merged 6 commits intotomhu/single-finisher-gatefrom Mar 11, 2026
Merged
Conversation
3 tasks
bebfe63 to
c07692a
Compare
ead0d67 to
0b6177f
Compare
c07692a to
fea2836
Compare
0b6177f to
a4761d3
Compare
a4761d3 to
14d4299
Compare
73b8ff6 to
44de224
Compare
14d4299 to
ef23608
Compare
44de224 to
bf5da1c
Compare
ef23608 to
ee8bf7c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
ad194c8 to
673b32c
Compare
5651fd6 to
b508cb4
Compare
c7ce723 to
0315a23
Compare
7e12f77 to
c1c5f19
Compare
f0713fe to
166f59a
Compare
c1c5f19 to
e9dbaec
Compare
166f59a to
4d971bd
Compare
71b0bf0 to
4907ad9
Compare
9bce158 to
2d657c4
Compare
9b070fe to
927b5d3
Compare
When coverage uploads are still pending, upload_finisher now schedules a delayed sweep instead of exiting, and it clears the commit gate key once finishing work is complete. Made-with: Cursor
Reuse the canonical finisher gate key helper, cap sweep reschedules, preserve flow breadcrumbs during deferred sweeps, and clear gate keys on terminal failures. Made-with: Cursor
Delete the gate and return an accurate sweep_scheduled flag when max sweep attempts are exhausted, so commits are not blocked behind stale gate keys. Made-with: Cursor
Only clear the gate after successful finisher-lock completion so terminal lock failures do not silently drop pending commit post-processing. Made-with: Cursor
Extend the commit gate expiration whenever a sweep is scheduled so the gate remains valid throughout long-running sweep recovery loops. Made-with: Cursor
…ustion Delete the finisher gate even when _handle_finisher_lock returns None (terminal lock exhaustion) and add coverage to prevent gate stalling regressions. Made-with: Cursor
927b5d3 to
0f777f4
Compare
0f777f4
into
tomhu/single-finisher-gate
20 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UPLOADEDTest plan
ruff check --fix apps/worker/tasks/upload_finisher.py apps/worker/tasks/tests/unit/test_upload_finisher_task.pyruff format apps/worker/tasks/upload_finisher.py apps/worker/tasks/tests/unit/test_upload_finisher_task.pyStacked on #757.
Made with Cursor
Note
Medium Risk
Adds retry/sweep scheduling and Redis gate lifecycle management to the upload finisher, which changes task orchestration and could affect notification timing or leave commits stuck if misconfigured. Risk is mitigated by explicit max-attempt bounds and expanded unit coverage for terminal/exception paths.
Overview
Adds a delayed finisher “sweep” retry loop when coverage uploads are still in
UPLOADED, reschedulingupload_finisherwith a boundedsweep_attemptcounter and returning structured sweep status instead of silently exiting.Introduces explicit Redis finisher-gate lifecycle management: sweeps
expirethe gate to keep it alive while pending work remains, and terminal outcomes nowdeletethe gate on success, idempotent early-exit, max-sweep exhaustion, and exception/timeout paths.Refactors pending-upload detection into
_count_remaining_coverage_uploadsand expands unit tests to cover sweep scheduling, max-attempt behavior, and gate cleanup across success and error scenarios.Written by Cursor Bugbot for commit 0f777f4. This will update automatically on new commits. Configure here.