Skip to content

[Bug]: Re-review covers commits pushed mid-run, but the pullfrog check stays on the old head, so a required check never reaches the new head #136

Open

Description

@ThomasKientz

Summary

When commits are pushed while a re-review is running, Pullfrog reviews and approves them in the same run, but the pullfrog check run stays on the SHA the run started from. The new head gets no pullfrog check, and no new run starts for it. With pullfrog required by branch protection, the PR is approved yet cannot merge until someone re-runs Pullfrog by hand. It happens to us regularly.

Timeline (private repo, times UTC, 2026-11-23)

Time Event
12:12:26 Commit A pushed
12:12:36 Pullfrog dispatches "Review new commits on #… " (workflow_dispatch), pullfrog check run created on A
12:15:04 Commit B pushed
12:23:12 Commit C pushed (new head)
12:34:24 Review COMMENTED on A (one inline issue)
12:34:47 Review COMMENTED on C (resolves the inline thread)
12:55:46 Review APPROVED on C: "This run covered B and C, the two commits pushed while the review at A was being written."
12:56 pullfrog check: in_progress on A, absent on C
15:10 Still no pullfrog check on C: the PR has been mergeable but blocked for over two hours
15:12 Workaround: we re-ran that workflow run by hand (attempt 2)

So the agent knows it reviewed the new head and approves it there, but the check run that branch protection reads is still bound to A. CI and the other required review (CodeRabbit) were green on C from 12:28.

Setup: pullfrog/pullfrog@v0 via the generated pullfrog.yml (workflow_dispatch only), re-review on, pullfrog in main's required status checks.

Expected

When a run ends with a review on a head other than the one it started from, the pullfrog check is (also) completed on the head it reviewed. Alternatively, a push during a run queues a follow-up run on the new head instead of being folded into the current one without a check.

Ask

  • Post the pullfrog check run on the commit the final review was submitted on (the PR's head at the end of the run), not only on the dispatch SHA.
  • Or, if the run must stay bound to its starting SHA, start a run for the new head once it finishes.

Related: #107 (same symptom, a required Pullfrog check missing on the new head, from a different cause).

Activity

  1. pullfrog commented on Nov 23, 2026

    @pullfrog
    Contributor

    Analysis

    The bug is real, and the cause is in this repo. It is not a duplicate. #107 had the same symptom from a different path (the pullfrog-approval carry-forward), and that fix is already merged.

    What happens in the reported timeline:

    1. At dispatch the server seeds the pullfrog check in_progress on A. The payload carries only its id (payload.checkRun: { id }), so the check is bound to A for good.
    2. The first create_pull_request_review sees that HEAD moved (mcp/review.ts:911). It returns newCommits and moves primary.checkoutSha forward, and the agent then reviews B..C inline. This is by design: it avoids a second run.
    3. recordSubmittedReview pins toolState.review.reviewedSha and toolState.approval.sha to C.
    4. postReviewCleanup (utils/reviewCleanup.ts:46) tells the server C was reviewed. dispatchFollowUpReReview then returns early because pr.head.sha === reviewedSha. This is correct: C was already reviewed, so no follow-up run starts.
    5. reportStatusChecks (utils/statusChecks.ts:58) PATCHes only the seeded check on A. pullfrog-approval already goes to approval.sha (C), but the pullfrog run check has no equivalent. The terminal-create fallback at line 95 does use checkoutSha, so it would have landed on C. It just never runs when a seeded check exists.

    The result: C ends up with an approving review and no pullfrog row. Branch protection waits forever, because nothing will ever dispatch for C.

    Which fix: I recommend the issue's first option: post pullfrog on the head the run reviewed. The second option, a follow-up run, would spend a full run re-reviewing code that was just reviewed, and the safety net rightly refuses to do that.

    Plan

    1. Mirror the run check onto the reviewed head (utils/statusChecks.ts)

    After finalizeRunStatusCheck, when a seeded check exists:

    • Find the covered SHA. Use approval?.sha ?? primary.checkoutSha, and only for runs whose selectedMode is Review or IncrementalReview. Build or Fix runs that push their own commits are out of scope: their push triggers its own re-review, which gets its own check.
    • Only on a clean run. Gate on params.runSucceeded. A failed run has not proven it covered the new head, and the absent check still tells the user to re-run.
    • Compare against the seeded head. Call checks.get on the seeded id and read head_sha. Stop if it equals the covered SHA, which is the normal case and costs one extra GET only on review runs. This means adding head_sha to RunStatusCheckOctokit's get response type in utils/runStatusCheck.ts.
    • Never duplicate a row. Call checks.listForRef(coveredSha, check_name: "pullfrog"), filtered by app.slug !== GITHUB_ACTIONS_APP_SLUG. If any Pullfrog-owned row exists, whether in_progress from a concurrent run or already completed, skip it and leave that row to its owner.
    • Create it already terminal. Otherwise call createTerminalRunStatusCheck on the covered SHA with the same conclusion, detailsUrl, reviewUrl and note. It must be created as completed, because the webhook and reaper backstops only know the seeded checkRunId and could never close a second in_progress row.
    • Keep it best-effort. Use .catch(log.debug), like every other post in this function.

    Optionally, add a sentence to the mirrored row's summary such as "This run started on A and also reviewed the commits through C." That would need an optional extraLine param on terminalOutput and createTerminalRunStatusCheck.

    2. Docs and comments

    • Update the header comment of reportStatusChecks. It currently says Pullfrog is only a PATCH of the seeded check.
    • Update the header of runStatusCheck.ts to say the action may also post one terminal row on the head the run reviewed.

    3. Tests (new utils/statusChecks.test.ts, using vitest)

    There is no unit test for reportStatusChecks today. Build a structural fake octokit (checks.get/update/create/listForRef, pulls.get) and cover these cases:

    • seeded on A, review on C, success → update on A, plus one create on C (completed, success)
    • seeded on A, review on A → no extra create
    • seeded on A, review on C, but a Pullfrog pullfrog row already on C → no create
    • a github-actions-owned pullfrog row on C is ignored → create still happens
    • runSucceeded: false → no mirror
    • no seeded check (fallback) → exactly one create, on checkoutSha (unchanged behaviour)
    • a Build-mode run → no mirror

    Verification

    Run pnpm vitest run utils/statusChecks.test.ts, then the typecheck and lint commands from the repo learnings.

    Out of scope / follow-ups

    • The timeline's "12:56 in_progress on A" is most likely the run still finishing after the 12:55 review, since cleanup and finalize run after the agent exits. If A stays in_progress after the workflow ends, that is a separate server-side backstop problem (the webhook or reaper).
    • Until this ships, the workaround remains re-running the workflow run by hand, as the reporter did.
    Task list (3/3 completed)
    • Read status-check code paths (statusChecks, runLifecycle, review)
    • Determine where head SHA is bound and how mid-run pushes are handled
    • Write plan and report

    Pullfrog  | Implement plan ➔ | View workflow run | via Pullfrog | Using claude-opus-5-5 (free via Pullfrog for OSS) | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions