Skip to content

Report Mergify departures for the current queue attempt - #1357

Merged
mergify[bot] merged 2 commits into
mainfrom
lean178/980-982-departure-replacement
Nov 26, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
lean178/980-982-departure-replacement

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Report Mergify departures for the current queue attempt

Context and goal

  • Goal: Report the departure and give recovery guidance based on whether Mergify tested the PR alone or with earlier PRs.
  • Problem: A PR can enter and leave the queue between polls. The command then times out on admission or prints generic recovery guidance.
  • Context: Mergify reports the source commit, triggering command and candidate failure in a PR comment.

Closes #980
Closes #982

Acceptance

  • An authenticated report tying a departure to the current PR head, queue, and latest queue command yields a dequeue outcome even without a positive membership sample.
  • A stale, unverifiable or unavailable report preserves the existing wait or generic confirmed-departure message.
  • The command verifies landing before reporting a departure and preserves unmerged work.
  • Confirmed departures include the current report link and recognized failing checks, with distinct guidance for isolated and stacked failures.

Notes

GitHub's bot identity authenticates the report. Its command link and reported source SHA tie it to the latest attempt. The existing membership and merge verification remain authoritative.

Base

main @ bafb356
Base: bafb356

Before the fix the replay timed out before admission and omitted the report
and attribution after confirmation. The stale-head, stale-command, and
untrusted-author controls stayed on the admission path.

Supersedes #1009 after the test cap required consolidating admission and departure cases around one fixture.

Validation

Recorded for 929cbc812c93

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

Architecture-Review: unchanged; departure diagnostics use the existing authenticated report and still verify the exact head before a verdict.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot 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.

loopzero primary review by claude on b6a7527bb5c8ba31e505841a9452c5a78a93c668, 54.4s: approve (0 critical, 0 important, 2 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/cli.py
print(f"PR #{pr.number} confirmed in Mergify queue {queue}; waiting")
elif state is None and confirmed:
if sha := _mergify_departure(config, pr, queue, closed):
elif state is None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Every admission-wait tick now reads the full PR comment list

Before this change, a tick where state is None and not confirmed made no extra calls. Now each such tick calls mergify.departure_report, which reads every page of issues/{n}/comments through github._paged. That call comes on top of the merged_sha, configured and membership reads the tick already makes. On a long --wait with a PR that has many comments, this uses up GitHub rate limit while Mergify is only waiting on preflight checks. It is not wrong, since GhError falls back to None. Smallest fix: before fetching the comments, check something cheap that shows a departure could have happened, for example that the request marker exists and the latest Mergify comment's updated_at has changed. Or fetch comments every Nth tick and once before timing out.

Comment thread tests/test_cli.py

@pytest.mark.parametrize("report", ["current", "stale", None])
def test_mergify_reports_admission_wait(wt, gh, capsys, monkeypatch, report):
@pytest.mark.parametrize("confirmed,kind", [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Consolidated test moves assertion logic into fixture data

test_mergify_reports_current_queue_attempt runs 11 cases through one body. The body branches on kind in fixture["admission"], kind in fixture["expected"] and kind == "landed". The expected messages, attribution sentences and requeue guidance are stored in mergify-departure.json instead of next to the assertions. The task says this was done to fit under the test line cap. The cost is that a failure is hard to map back to the acceptance item it covers. It also makes it easy for a new kind to fall silently into the wrong branch: any kind that is not in expected and not landed is treated as an admission wait. Consider splitting it into two parametrized tests, one for admission/stale controls and one for confirmed/unconfirmed departure guidance. Or keep the expected outcome per case in the parametrize tuple. Not blocking.

Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot 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.

loopzero delta review by claude on 929cbc812c930eb85811dc8e92525c4a1039bf08, 14.7s: approve (0 critical, 0 important, 0 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

@eowca
eowca marked this pull request as ready for review November 26, 2026 02:33
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 25ad050 at 02:43 UTC

10 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 02:33 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1412
  • ✅ Merged 02:43 · 25ad050 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 25ad050 into main Nov 26, 2026
14 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/980-982-departure-replacement branch November 26, 2026 02:44
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.

Show which candidate failed when Mergify removes a confirmed PR Detect Mergify dequeues before membership is observed

1 participant