Repository navigation
Serialize Mergify queue requests in a task worktree #1428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -327,7 +327,11 @@ def markers(repo: str, number: int, head: str, queue: str) -> tuple[bool, bool]: | |
|
|
||
| def request(repo: str, number: int, head: str, queue: str) -> None: | ||
| body = f"@mergifyio queue\n\n{_marker(REQUEST, head, queue)}" # Mergify deprecates naming the queue | ||
| github._api(f"repos/{repo}/issues/{number}/comments", {"body": body}) | ||
| try: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Lost-reply recovery in The fallback treats any existing REQUEST marker for this head and queue as proof that this POST was accepted. That holds only because the caller re-read the markers under |
||
| github._api(f"repos/{repo}/issues/{number}/comments", {"body": body}) | ||
| except (github.GhError, github.ProcTimeout, OSError): | ||
| if not markers(repo, number, head, queue)[0]: | ||
| raise | ||
|
|
||
|
|
||
| def mark_confirmed(repo: str, number: int, head: str, queue: str) -> None: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Worktree lock is held across several GitHub round-trips that other task-state writers share
_lock_task_stateis the same flock that_save_report(cli.py:374) and the other task-state writers (cli.py:544, 675, 860) use. Admission now holds it while it pages issue comments (markers), reads membership, callsmerged_sha, may postmark_confirmed, may build a departure report, and on a lost reply runs a secondmarkerspage read. Each of these can take up to theghtimeout, so a concurrentloopzero checkcan block for several timeouts before it publishes its receipt. This is correct, since it is released before_wait_for_mergifyas the acceptance requires, but it is broader than needed. If contention matters, a smaller fix is to move the lock-free reads (merged_shaand the confirmed/departure handling) outside the lock. The lock would then cover only re-readingmarkers/membershipand therequestPOST. Alternatively, add a comment explaining why the wider scope is intentional.