Skip to content

fix(pr-status): hold --watch when a queued PR reads OPEN without an entry - #482

Merged
CybotTM merged 1 commit into
mainfrom
fix/watch-queue-exit-window
Nov 22, 2026
Merged

CybotTM merged 1 commit into
mainfrom
fix/watch-queue-exit-window

Conversation

@CybotTM

@CybotTM CybotTM commented Nov 22, 2026

Copy link
Copy Markdown
Member

After this merges, pr-status.sh --watch no longer returns ACTIONABLE: merge on the read where a PR that was in the merge queue now reads OPEN without a queue entry. It re-reads until the PR is MERGED or queued again, for at most PR_STATUS_QUEUE_EXIT_GRACE seconds (default 120), and then reports what it sees with a pr-status: line saying the queue did not merge the PR.

What was observed

On netresearch/typo3-ai-edition#13 (2026-11-22), --watch printed four waiting: already in the merge queue at position 1 (AWAITING_CHECKS) polls, then ACTIONABLE: merge with state: OPEN mergeable=MERGEABLE mergeState=CLEAN and NEXT: merge — clean. The PR timeline shows added_to_merge_queue at 21:07:28Z, then merged and removed_from_merge_queue (reason merged) at 21:09:12Z, with nothing in between. A caller acting on that line would enqueue again or try to merge a PR that is merging.

The NEXT ladder reaches merge only when queue_entry is null (the queue_entry != null rung returns wait before it), so that read had state OPEN and no entry. Whether GitHub drops the entry just before it records the merge, or the entry read transiently null mid-queue, is not established. The hold covers both.

Known limits
  • Only a PR seen queued on an earlier poll of the same watch is held. A watch started while the PR is already outside the queue has nothing to compare with and reports the read as before.
  • During the hold, the watch does not return on a newly failing check; the hold is bounded by the grace period and --max-wait.
Testing

tests/test_pr_status_watch_queue_exit.sh drives the watch through stubbed GraphQL reads, one phase per poll: queued → open → open → merged (no merge, returns on MERGED), queued → open → queued (keeps waiting), queued → open past the grace (returns merge with the caveat line, which the documented Monitor filter keeps), the TIMEOUT inside the hold, and a PR never seen queued (returns merge at once). With pr-status.sh reverted to main, the first two cases and the caveat/TIMEOUT cases fail and the output reproduces the reported NEXT: merge — clean.

…ntry

On netresearch/typo3-ai-edition#13, --watch printed four "waiting:
already in the merge queue" polls and then "ACTIONABLE: merge" on
state OPEN, CLEAN and no queue entry. The queue merged the PR about a
minute later, and the timeline records no drop before the merge. A
caller acting on that line enqueues again or merges a PR that is
merging.

The NEXT ladder only reaches merge when queue_entry is null, and the
watch loop kept no memory of the previous poll. It now remembers that
the PR was queued. When a later read shows it OPEN without an entry,
the watch re-reads until the PR is MERGED or queued again, for at most
PR_STATUS_QUEUE_EXIT_GRACE seconds (default 120). After that it
reports what it sees, preceded by a pr-status: line saying the queue
did not merge the PR. A TIMEOUT inside the hold says the same.

Whether GitHub drops the entry just before recording the merge, or
the entry read transiently null mid-queue, is not established; the
hold covers both. merge-gate-watcher.md no longer calls the GraphQL
read the settled verdict and records the observation.

Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 752beeb4-3ffc-4df2-83e6-d0c7511c85ec
Commits

Reviewing files that changed from the base of the PR and between 1c35ad9 and 1268e3f.

Files selected for processing: 3

  • skills/git-workflow/references/merge-gate-watcher.md
  • skills/git-workflow/scripts/pr-status.sh
  • tests/test_pr_status_watch_queue_exit.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot added documentation Improvements or additions to documentation skill labels Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@CybotTM
CybotTM marked this pull request as ready for review November 22, 2026 22:06
Copilot AI balanced review requested due to automatic review settings November 22, 2026 22:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@CybotTM

CybotTM commented Nov 22, 2026 •

Copy link
Copy Markdown
Member Author

Review of 1268e3f (author's own review; Copilot is out of review quota and CodeRabbit refused this head as rate limited, so no bot review ran).

Correctness: the hold sits after a successful snapshot and before every exit, so no ACTIONABLE line (including the check-failed exit) is printed while a PR that was queued on an earlier poll reads OPEN without an entry. It ends on a read with an entry (was_queued stays 1, left_queue_at resets), on a non-OPEN read (MERGED or CLOSED take the existing path; pr-status.sh --json on the merged netresearch/typo3-ai-edition#13 returns state: MERGED, next: none), after PR_STATUS_QUEUE_EXIT_GRACE seconds (caveat line, then the normal path), or at --max-wait (TIMEOUT that says the PR is not merged). A GitLab snapshot has no queue entry, so it never enters the hold. The env knob is validated like PR_STATUS_RATE_LIMIT_WAIT.

Tests: tests/test_pr_status_watch_queue_exit.sh advances one fixture per main GraphQL query and asserts the consumed sequence. With pr-status.sh reverted to main, 15 of 24 assertions fail, all in the four queue cases, and the output reproduces the reported NEXT: merge — clean; the never-queued case passes on both. Full local run: all 45 tests/*.sh, the Python tests, pre-commit run --all-files, scripts/verify-harness.sh; CI green.

Sonar: 6 new S7688 findings ("use [[") on the new lines. The surrounding watch loop uses [ throughout, so the change matches the file's style; not changed.

Known limits are in the PR body: only a PR seen queued under the same watch is held, and a newly failing check is not reported during the bounded hold. pr-merge.sh --wait reads the same signal and already requires two consecutive outside-queue reads before reporting a drop; it is not changed here.

@CybotTM

CybotTM commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Self-review: 1268e3f

The bot review this pull request demands is unsatisfiable (Copilot quota wall or repeated bot failures on this head). The diff on this head was reviewed by the PR author; this comment is the on-the-record attestation the merge gate reads back. It stops matching on the next push.

@CybotTM
CybotTM added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit f15783f Nov 22, 2026
26 of 27 checks passed
@CybotTM
CybotTM deleted the fix/watch-queue-exit-window branch November 22, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants