Skip to content

feat: add lock lifecycle breadcrumbs and task tracking to coverage tasks#718

Open
thomasrockhu-codecov wants to merge 1 commit intomainfrom
tomhu/coverage-lock-breadcrumbs
Open

feat: add lock lifecycle breadcrumbs and task tracking to coverage tasks#718
thomasrockhu-codecov wants to merge 1 commit intomainfrom
tomhu/coverage-lock-breadcrumbs

Conversation

@thomasrockhu-codecov
Copy link
Contributor

@thomasrockhu-codecov thomasrockhu-codecov commented Feb 19, 2026

Summary

  • Adds lock lifecycle breadcrumbs (LOCK_ACQUIRING, LOCK_ACQUIRED, LOCK_RELEASED) around all lock acquisitions in upload_finisher (both UPLOAD_PROCESSING and UPLOAD_FINISHER locks) and notify (NOTIFICATION lock)
  • Adds task_name and parent_task_id to all existing _call_upload_breadcrumb_task calls across upload_processor, upload_finisher, and notify for pipeline traceability
  • Depends on PR feat: add BundleAnalysisFlow checkpoint logger #714 for the new Milestones values and BreadcrumbData fields

Test plan

  • Verify lock lifecycle breadcrumbs appear in upload_finisher processing lock path
  • Verify lock lifecycle breadcrumbs appear in upload_finisher finisher lock path
  • Verify lock lifecycle breadcrumbs appear in notify notification lock path
  • Verify task_name and parent_task_id are present in all breadcrumb records
  • Verify existing breadcrumb behavior is unchanged (just enriched with task info)

Made with Cursor


Note

Low Risk
Observability-only changes that add breadcrumb calls/metadata around existing locking and error paths, with minimal impact on business logic aside from potential noise/perf from extra breadcrumb writes.

Overview
Adds lock lifecycle breadcrumbing to coverage worker tasks by emitting LOCK_ACQUIRING/LOCK_ACQUIRED/LOCK_RELEASED milestones around lock usage in notify (notification lock) and upload_finisher (both processing and finisher locks).

Enriches all upload-breadcrumb emissions in upload_processor, upload_finisher, and notify with consistent task metadata (task_name, parent_task_id, and relevant upload_ids), primarily via shared bc_kwargs passed into _call_upload_breadcrumb_task for improved pipeline traceability and debugging.

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

Add lock lifecycle breadcrumbs (LOCK_ACQUIRING, LOCK_ACQUIRED,
LOCK_RELEASED) around all lock acquisitions in upload_finisher and
notify tasks.

Add task_name and parent_task_id to all existing breadcrumb calls
across upload_processor, upload_finisher, and notify tasks for
pipeline traceability.

upload_processor:
- Add task_name/parent_task_id to all existing breadcrumb calls
  (no locks in this task)

upload_finisher:
- Lock lifecycle breadcrumbs around UPLOAD_PROCESSING lock
- Lock lifecycle breadcrumbs around UPLOAD_FINISHER lock
- task_name/parent_task_id on all breadcrumb calls

notify:
- Lock lifecycle breadcrumbs around NOTIFICATION lock
- task_name/parent_task_id on all breadcrumb calls

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines +66 to +71
bc_kwargs = {
"commit_sha": commitid,
"repo_id": repoid,
"upload_ids": [arguments["upload_id"]],
"task_name": self.name,
"parent_task_id": self.request.parent_id,
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 code passes unexpected arguments task_name and parent_task_id to _call_upload_breadcrumb_task and references undefined Milestones enum values like LOCK_ACQUIRING, causing runtime errors.
Severity: CRITICAL

Suggested Fix

Merge the dependency PR that adds the missing values (LOCK_ACQUIRING, etc.) to the Milestones enum. Also, update the _call_upload_breadcrumb_task function signature or the underlying BreadcrumbData model to accept task_name and parent_task_id arguments, as intended by the dependency.

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_processor.py#L66-L71

Potential issue: The function `_call_upload_breadcrumb_task` is called with `task_name`
and `parent_task_id` arguments, but its signature does not include these parameters,
which will result in a `TypeError`. Additionally, the code references `Milestones` enum
members such as `Milestones.LOCK_ACQUIRING`, `Milestones.LOCK_ACQUIRED`, and
`Milestones.LOCK_RELEASED`, which are not defined in the `Milestones` enum class. This
will cause an `AttributeError` at runtime. Both issues appear to stem from a dependency
that has not been merged, which was intended to introduce these changes.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

repo_id=repoid,
milestone=Milestones.PROCESSING_UPLOAD,
upload_ids=[arguments["upload_id"]],
error=Errors.INTERNAL_RETRYING,
Copy link

Choose a reason for hiding this comment

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

Missing milestone parameter in breadcrumb calls after refactoring

Medium Severity

The refactoring to use bc_kwargs accidentally dropped the milestone parameter from nine _call_upload_breadcrumb_task calls across upload_processor.py (3 calls) and upload_finisher.py (6 calls in _process_reports_with_lock and _handle_finisher_lock). The original code always passed milestone (e.g., Milestones.PROCESSING_UPLOAD or the local milestone variable), but it was neither added to bc_kwargs nor passed explicitly in the error-handling paths. Since milestone defaults to None, these breadcrumbs will be recorded without any milestone value, losing important pipeline stage tracking for all error and retry scenarios.

Additional Locations (2)

Fix in Cursor Fix in Web

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