Skip to content

fix(comment-triggered-check): draw the newest attempt after a re-run on a newer commit - #362

Merged
vcauesantos merged 3 commits into
mainfrom
devops-1847/reply-follow-pr-head
Nov 9, 2026
Merged

vcauesantos merged 3 commits into
mainfrom
devops-1847/reply-follow-pr-head

Conversation

@vcauesantos

@vcauesantos vcauesantos commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What happened

The /test-e2e reply from #360 is drawn from the checks, newest attempt first. Each redraw lists the checks on two commits: the one stored in the reply and the caller's own.

A re-run after the pull request moved to a new commit breaks that. Say an old run's finish reads the reply while it still points at the old commit. A re-run on the new commit then writes the reply. The old finish resumes and writes its view on top, because its own check just closed. Its read-back lists only the old commit, sees its own view, and stops. The reply now shows the old run as cancelled. It stays that way until a writer from the new attempt redraws it, and if none comes later, it stays wrong.

What this PR changes

Every redraw also lists the checks on the pull request's current head. The reply comment names its pull request, so one extra read gives the head commit. A re-run after the pull request moved runs on that head, so even a writer from an older attempt now finds the newer attempt and draws it. If the pull request cannot be read, the redraw works as before.

One case is still open. If the pull request moves again after the re-run, with no further re-run, a late writer from the older attempt reads its own commit and the new head. It misses the re-run's commit and can draw the older attempt. A later writer from the re-run corrects it, but none is guaranteed to come. Covering it would mean listing the checks on every commit of the pull request.

There is no lock. GitHub has no conditional comment edit, and a check right before the write would still race. Letting every writer find the newer attempt on the current head means the last writer draws it in the case above, and a stale write is corrected by the read-back that follows it.

The cost is one more API call per redraw. It needs read access to pull requests, which every caller already has.

How it was tested

  • bats .github/actions/comment-triggered-check/test/*.bats on the branch merged with main: 266 tests pass. In Docker on ubuntu 22.04 with jq 1.6, which callers use, 262 pass; the 4 that fail need yq, which the container lacks, and they fail the same way on main. CI's ubuntu-22.04 job runs the full set with yq. Two tests are new:
    • The paused old writer: attempt 1's finish reads the reply, a re-run on a newer commit writes it, and the finish resumes with its stale copy. The final reply shows the newer attempt on the newer commit. Without the head lookup this test fails, which I checked.
    • A pull request that cannot be read: the redraw still works. This one covers the fallback path and passes with or without the fix.
  • Same-commit re-runs and multiple rows keep their existing tests.
  • shellcheck and make lint are clean, and make check-docs passes.
  • After merge, comment-triggered-check/v1 advances and the experiment repo uses it directly. There I will push a new commit to a test pull request, re-run a command, and check the reply settles on the newer attempt.

Closes DEVOPS-1847

@vcauesantos
vcauesantos requested a review from a team as a code owner November 6, 2026 21:22
@vcauesantos
vcauesantos merged commit 8e5976c into main Nov 9, 2026
8 checks passed
Piotr1215 added a commit that referenced this pull request Nov 9, 2026
Main gained --timeout parsing (7ac6b02, #358) and the newest-attempt reply fix (8e5976c, #362), which touched the same lines as the per-caller caps in action.yml, start.sh and the README.

Kept both sides: parse-timeout and INPUT_PARSE_TIMEOUT from main, the max-repeat and max-runs inputs, their env wiring and the start.sh validation from this branch. The README input table was regenerated with make generate-docs. The result against main equals the branch's original diff (5 files, +127/-7).

Claude-Session: https://claude.ai/code/session_017edg9kEEKEqFFnrxvaVz3T
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