Skip to content

babysit_copr_build skips when DB shows success but status check may not be updated #3170

Description

@majamassarini

Problem

The babysit_copr_build task skipped processing when it found the DB already showed success, but the GitHub status check for the SRPM build was never updated, leaving it stuck in "pending" state.

Observed Symptoms

Build ID: 10897621
PR: eclipse-bluechi/bluechi#1127
Issue: SRPM build status check remained pending on GitHub despite successful build

Evidence from Logs

The babysit task shows a race condition:

[2026-08-24 15:23:20,893] task.babysit_copr_build[...] The status of 10897621 is 'running'.
[2026-08-24 15:23:21,038] task.babysit_copr_build[...] Task retry: Retry in 60s: 
    PackitCoprBuildTimeoutException('No feedback for copr build id=10897621 yet')

[2026-08-24 15:24:21,088] task.babysit_copr_build[...] The status of 10897621 is 'succeeded'.
[2026-08-24 15:24:21,090] task.babysit_copr_build[...] DB state of 10897621 says 
    <BuildStatus.success: 'success'>, things were taken care of already, skipping.

What happened:

  1. At 15:23:20 - Copr API says build is "running", babysit retries in 60s
  2. Between 15:23:21 and 15:24:21 - Something else updated the DB to "success"
  3. At 15:24:21 - Babysit finds DB already shows success and skips with "things were taken care of already"

Result: Status check was never updated

What Updated the DB?

Between the two babysit runs, three copr_build_end tasks executed for the individual chroots:

[15:23:56] TaskName.copr_build_end[873692d4...] fedora-rawhide-x86_64
[15:24:09] TaskName.copr_build_end[d9ca6964...] fedora-rawhide-aarch64  
[15:24:17] TaskName.copr_build_end[1aa436fa...] epel-10-x86_64

These tasks successfully:

  • Updated their respective RPM build targets in the DB
  • Set status checks for their chroots (e.g., rpm-build:fedora-rawhide-x86_64)

Hypothesis: One of these tasks likely also updated the SRPM build row in the DB to "success" (perhaps as a side effect), but did not update the SRPM build's GitHub status check.

However, we cannot confirm from the logs alone:

  • Which task updated the SRPM build DB row
  • Why the SRPM status check was not updated at that time
  • Whether this was expected behavior or a separate bug

The Code

In packit_service/worker/helpers/build/babysit.py lines 326-331:

if build.status not in (BuildStatus.pending, BuildStatus.waiting_for_srpm):
    logger.info(
        f"DB state of {build_id} says {build.status!r}, "
        "things were taken care of already, skipping.",
    )
    continue

When the babysit task finds the DB already shows a non-pending status, it assumes "things were taken care of already" and skips all further processing - without verifying that the GitHub status check was actually updated.

Questions

  1. Who should update the SRPM status check?

    • Should it be the copr_build_end handlers?
    • Or should babysit be the fallback that ensures it gets set?
  2. Should babysit verify the status check before skipping?

    • Currently it trusts that if DB is updated, the status check was too
    • But this assumption appears to be incorrect
  3. Is there a legitimate scenario where:

    • The DB gets updated to success
    • But the status check should intentionally not be set?

Impact

User-visible: PR status checks stuck in "pending" state even though the build completed successfully.

This appears to happen when:

  • A handler successfully updates the DB
  • But fails to update (or is not responsible for updating) the GitHub status check
  • And the babysit task runs after the DB is already updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions