Skip to content

fix: add schedule followup#775

Open
thomasrockhu-codecov wants to merge 2 commits intomainfrom
th/create-followup-scheduler
Open

fix: add schedule followup#775
thomasrockhu-codecov wants to merge 2 commits intomainfrom
th/create-followup-scheduler

Conversation

@thomasrockhu-codecov
Copy link
Contributor

@thomasrockhu-codecov thomasrockhu-codecov commented Mar 17, 2026

This adds a scheduler method to re-run another task

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Note

Medium Risk
Changes upload finishing task scheduling by introducing self-rescheduling follow-ups with Redis gate TTL refresh, which could create unexpected retry/loop behavior if misconfigured.

Overview
Adds a follow-up scheduling mechanism to UploadFinisherTask so the finisher can re-queue itself as a sweep, watchdog, or immediate continuation run.

This introduces UploadFinisherFollowUpTaskType, a new FINISHER_SWEEP_DELAY, and a _schedule_followup helper that refreshes a finisher gate TTL and re-enqueues upload_finisher with an explicit trigger and type-specific countdown (including a watchdog delay based on FINISHER_GATE_TTL_SECONDS).

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

@thomasrockhu-codecov thomasrockhu-codecov requested a review from a team March 17, 2026 20:02
@sentry
Copy link
Contributor

sentry bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.25%. Comparing base (ec58642) to head (9fb7bd6).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/worker/tasks/upload_finisher.py 72.72% 3 Missing ⚠️

❌ Your patch check has failed because the patch coverage (72.72%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #775      +/-   ##
==========================================
- Coverage   92.25%   92.25%   -0.01%     
==========================================
  Files        1305     1305              
  Lines       47957    47967      +10     
  Branches     1636     1636              
==========================================
+ Hits        44245    44252       +7     
- Misses       3401     3404       +3     
  Partials      311      311              
Flag Coverage Δ
workerintegration 58.56% <72.72%> (+<0.01%) ⬆️
workerunit 90.38% <72.72%> (-0.02%) ⬇️

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-notifications bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/worker/tasks/upload_finisher.py 72.72% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

SWEEP = "sweep"
WATCHDOG = "watchdog"
CONTINUATION = "continuation"

Copy link

Choose a reason for hiding this comment

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

Newly added method and enum are unused dead code

Low Severity

Both _schedule_followup and UploadFinisherFollowUpTaskType are added in this PR but have no callers anywhere in the codebase. The enum is only referenced inside _schedule_followup, and _schedule_followup itself is never invoked. This lands as dead code, which can confuse future readers and adds maintenance burden without delivering the intended behavior.

Additional Locations (1)
Fix in Cursor Fix in Web


return processing_results

def _schedule_followup(
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: The new _schedule_followup method is defined but never called, rendering the follow-up scheduling feature for the upload finisher completely non-functional.
Severity: MEDIUM

Suggested Fix

Identify the appropriate conditions within the run_impl method of the UploadFinisherTask to call _schedule_followup. This will likely involve checking for specific states or triggers to determine when a follow-up run should be scheduled.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: apps/worker/tasks/upload_finisher.py#L239

Potential issue: The `_schedule_followup` method, introduced to re-enqueue
`upload_finisher` runs for reasons like `sweep` or `watchdog`, is defined but never
invoked. As a result, the entire follow-up scheduling feature is non-functional dead
code. The logic within this method, including the call to `refresh_finisher_gate_ttl`,
is never executed. This means the intended behavior of periodically re-running the
finisher task to handle pending uploads will not occur, defeating a primary purpose of
the pull request.

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.

1 participant