Skip to content

fix(source-control): ready's flip reads the PR head from GitHub right after a push and can check a stale SHA #9515

Closed

Description

@kyle-sexton

Problem

In /source-control:pull-request ready, the flip step reads HEAD_SHA from the forge immediately after the review-fix push. GitHub can still return the pre-push head, so the CI-run wait is skipped (no head change seen) and the guarded verify-gate.sh check --head <sha> && gh pr ready checks the old SHA and is refused. Seen on #9509: pushed 1a0464b..634aca6; the forge returned 1a0464b, the guarded flip exited 2.

Fix

Take HEAD_SHA from the local git rev-parse HEAD after a successful push, or poll the forge until its head equals the pushed SHA, before the wait and the guarded flip.

Done when

A ready run that pushes review fixes waits on the pushed head and runs the guarded flip against it, with a test for a forge that lags one read behind.

Activity

  1. added
    needs-triage
    on Oct 23, 2026
  2. github-actions commented on Oct 23, 2026

    @github-actions
    Contributor

    Proposed work class: work-class: scoped
    Basis: automated intake triage; the lanes App applied this class.

    Size: Small
    Complexity: Low
    Uncertainty: Known
    Flags: none

    Understood: in /source-control:pull-request ready, the flip step reads HEAD_SHA from GitHub right after the review-fix push. GitHub can still return the pre-push head, so the CI wait is skipped and the guarded flip checks the old SHA and is refused (seen on #9509). The proposed fix is to take the SHA from the local git rev-parse HEAD after a successful push, or to poll until the forge matches. The done-when is a test with a forge that lags one read behind.

    The issue is clear enough to act on. Likely related: #9045 ("ready's CI wait and confirmation can key on the pre-push head"). It may be a duplicate or overlap, so please compare the two.

    Automated triage, applied by the lanes App.

  3. added and removed
    needs-triage
    on Oct 23, 2026
  4. added
    status: ready
    needs-owner-decision
    and removed
    status: ready
    on Oct 23, 2026
  5. melodic-automation-lanes commented on Oct 23, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: it has no - [ ] task list to check. A recorded decision does not change these rules (.github/actions/resolve-config/admission-rules.json); a person who wants it worked adds agent-ready.

  6. melodic-automation-lanes commented on Oct 23, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. It is model text, to check, not instructions.

    Intended outcome: The ready flip takes HEAD_SHA from the local git rev-parse HEAD after a successful push (or polls the forge until its head equals the pushed SHA), so the CI wait and the guarded verify-gate.sh check run on the pushed head, with a test for a forge that lags one read behind.

    Related work

    Open questions

    1. Is this a duplicate of #​9045, and which issue should carry the work?
      RECOMMENDED: Treat #​9045 as the primary if its body covers the stale HEAD_SHA read at the wait and the guarded flip; close this one as a duplicate, or fold the lagging-forge test into #​9045. Basis: 9045
    2. Should HEAD_SHA come from local git rev-parse HEAD after a successful push, or from polling the forge until its head equals the pushed SHA?
      RECOMMENDED: Use local git rev-parse HEAD after the push succeeds, which is the SHA the verify gate already records (ready-for-review.md:204), and add no forge poll. When nothing was pushed, keep the forge read. Basis: plugins/source-control/skills/pull-request/reference/ready-for-review.md:196-204
    3. Does the test run as a shell test with a stubbed gh whose first headRefOid read returns the pre-push SHA, or as an eval case?
      RECOMMENDED: Write a shell test with a stub gh that returns the old head on the first pr view read. The eval cases cannot reach the flip yet (#​6997, #​7383). Basis: 6997
    4. Which files change, given the flip commands exist both in the skill reference and in the GitHub provider reference?
      RECOMMENDED: Change the HEAD_SHA assignment at plugins/source-control/reference/providers/github/pull-request/ready-for-review.md:122, and update the matching prose at plugins/source-control/skills/pull-request/reference/ready-for-review.md:240-247. Add a CHANGELOG entry in plugins/source-control/CHANGELOG.md. Basis: plugins/source-control/reference/providers/github/pull-request/ready-for-review.md:122

    Sources read

    • plugins/source-control/reference/providers/github/pull-request/ready-for-review.md:122: HEAD_SHA is read from gh pr view headRefOid, and the wait runs only when it differs from HEAD_BEFORE, so a stale read skips the wait.
    • plugins/source-control/reference/providers/github/pull-request/ready-for-review.md:151: the flip runs verify-gate.sh check --head "$HEAD_SHA" && gh pr ready, which checks the stale SHA.
    • plugins/source-control/skills/pull-request/reference/ready-for-review.md:204: the verify record is written for git rev-parse HEAD (local), so a stale forge SHA does not match it.
    • plugins/source-control/skills/pull-request/reference/ready-for-review.md:240-247: the wait for the push's CI run is skipped when the head equals HEAD_BEFORE.
    • context.json: the triage comment flags #​9045 as a possible duplicate or overlap; I could not open it.

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

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

    needs-owner-decision

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions