Skip to content

ADR-0046: The failed review check of a stopped holder while the lock is held

  • Status: Accepted
  • Date: 2026-11-21 (proposed 2026-11-20)

Context

Issue #925, built in pull request #939. ADR-0045 lists the exact cases where the executor writes the failed check run shadewright/review on a pull request on another base. Its case 4 covers a stopped request that holds the target lock: it writes at a look only while its own pull request is not open, another open pull request from its branch keeps the lock, and condition ReviewCheckNotFailed says the check is still owed. A stale plan, a cancel or a stop that reads the pull request merged on another base writes nothing, and nothing is written through a new installation of the repository for a pull request read gone.

Four review passes on #925 each found another verdict of the request's own pull request that left a passing check, written before the stop, as the last check on the recorded head while a pull request from the request's branch could still merge that head: read gone, the stop on gone, the gone write without a gate, and the request's own pull request closed while another one holds the lock. A fifth pass found that a look that settles nothing yet left the check for the next look, ten minutes later (seed 1456 of the Git waits model, which the fixed seed set now holds). A rule that reads the verdict can miss the next verdict. The decision of 2026-11-20 on #925 replaced the per-verdict rows with one rule that reads the lock and the check on the head instead.

That rule still had an exception for a new installation of the App (#290). A settled look through one wrote nothing while the pull request chosen as holding the lock was not the recorded one, but a look that settled nothing yet wrote the check, so two looks at the same head through the same installation decided differently. The choice of the holding pull request follows the Git host's listing order, so an unmarked open pull request from the branch, listed first, also dropped the write owed for the recorded one when it was open too. A sixth review pass found these cases. The decision of 2026-11-21 on #925 removed the exception: one rule with no installation exception. A stopped holder reaches a new installation only where the code already allows it (see widening 4), so the rule does not make a new installation reachable for any other stopped holder.

Four writes of that rule are not in ADR-0045 as accepted, so the rule widens a Git write. ADR-0021 says an amendment does not widen on its own authority: another accepted ADR has to decide it. The decisions of 2026-11-20 and 2026-11-21 by the maintainer record them in this ADR, not in an amendment of ADR-0045. ADR-0045 keeps its decision; its text changes only where it names these writes, each time with a link here, and its dated amendment points to this ADR. #939 does not merge before this ADR is accepted.

Decision

A stopped request that holds the target lock, with reviewer hints on: after each look that leaves the lock held, by its own pull request on any base or by another open pull request from its branch, the executor writes the stop's failed check run shadewright/review on the recorded head commit, unless the Git host already shows it last. Four writes are new against ADR-0045: the look writes without waiting for condition ReviewCheckNotFailed, it writes when its own pull request was merged on another base, it writes at a look that settles nothing yet, and, after a stale cleanup stopped on a refusal, it writes through a new installation of the repository, settled or not, whichever pull request keeps the lock, and so does the stop for a pull request read gone that a waiting request with the stale mark makes. The check can only block a merge of that commit. Not covered: a deleted request (issue 984), reads that keep failing (issue 979), a look a stop exception takes over, a request with hints off or a handoff, a pause, a target branch change or a repository gone, which leave a pass in place while the lock is held, a pass on an earlier head of the branch, a stopped holder whose installation changed after another stop, and a request whose lock nothing holds. No new read and no new grant.

The rule. With reviewer hints on, a stopped request that holds the target lock writes the stop's failed check run on its recorded head commit after each look that leaves the lock held, by its own pull request on any base or by another open pull request from its branch, marked or not, through the installation the look opened, and whether the look settled the lock or not. The installation is the one the settings name for the plan's repository; the looks reach a new installation of the same URL only after staleCleanupStopped, and the stop for a pull request read gone only while the request still waits with the stale mark (widening 4); a stopped holder never carries the stale mark, which needs a phase before the merge. The look reads which pull request keeps the lock and the latest shadewright/review check of the head (once state Stale is recorded for that head; before that it writes without a read). It writes when the Git host does not show the failed check last. It never reads the verdict of its own pull request for this: open on another base, closed on any base, merged on another base or gone, the rule is the same, so a new verdict cannot reopen the gap. Nor does it ask which pull request keeps the lock, nor treat a new installation as an exception when the look reaches one, so the order in which the Git host lists the open pull requests decides nothing. On the target branch the same write is the check run of ADR-0028 section 5; this ADR decides it where the pull request is on another base, merged there, or gone.

What it widens. Four writes, each the same failed check run on the same recorded head:

  1. The look no longer waits for condition ReviewCheckNotFailed. ADR-0045 case 4 wrote at a look only while that condition said the check was still owed, so a request that stopped for another reason, whose own pull request was already closed or gone at its first look, wrote nothing. Now every look that leaves the lock held writes unless the failed check shows last.
  2. It writes when the request's own pull request was merged on another base. ADR-0045 refused that write (case 5, its conditions, limit (d) and a rejected alternative). Now a look writes it while the lock is still held, which means another open pull request from the branch keeps it.
  3. A look that settles nothing yet writes, through whichever installation it opened. ADR-0045 case 4 needs two reads that such a look does not have: that the request's own pull request is not open, and that another open pull request keeps the lock. A look that settles nothing yet (the first look that finds the recorded number missing, reads that disagree, a 404 the branch does not confirm, or an answer about another pull request than the one asked for) leaves the lock held as well, and writes like any other (failCheckAfterUnsettledLook). This holds through the ordinary installation too: no read shows that an open pull request keeps the lock, and the state of the request's own pull request is unknown.
  4. Through a new installation of the repository, every look that leaves the lock held writes, whether it settled the lock or not and whichever pull request keeps it, and so does the stop for a pull request read gone. ADR-0045 wrote nothing through a new installation for a pull request read gone, and the decision of 2026-11-20 wrote nothing at a settled look there while a pull request other than the recorded one kept the lock. A stopped holder reaches a new installation only after its stale cleanup stopped on a refusal of the Git host (staleCleanupStopped, phase NeedsIntervention with PlanFresh False and reason GitForbidden or GitRejected), and the stop for a pull request read gone only while a waiting request carries the stale mark (staleMark needs a phase before the merge). cleanupRepository gets stale from staleMark(rr) != nil || staleCleanupStopped(rr) and nothing else.

This write also skips a safeguard of design 6.6.1 (#290): there every failed check written through a new installation is preceded by a read of the pull request by its number with the request's marker. No read ties the pull request that keeps the lock to the request, so the write follows none, and it names only the recorded head. The new installation applies only while the stale mark or staleCleanupStopped holds (planEntry, cleanupRepository), and the provider opened through it writes only the close and a failed check run shadewright/review: the gate (gatedGit.CreateCheckRun) checks the name and the status, not the head, and its two callers write only on the recorded head: failStoppedCheck for a stopped holder and failCheck for a stale plan (#713). This ADR decides that one exception, and design 6.6.1 and the comment of cleanupRepository name it.

Why each fails closed. Every one is the same failed check run shadewright/review on the request's recorded head commit, which the executor pushed or adopted, with the stop's fixed summary. A failed check can only keep that commit from merging: it approves nothing, pushes nothing and closes nothing (invariant 3).

  • Without the gate on ReviewCheckNotFailed, the worst case is one more failed check on a head that already has one, which changes nothing, or a failed check over a pending or passing one written after the stop, which is the defect ADR-0045 exists for.
  • After a merge on another base, the merged pull request cannot be stopped, but the pull request that holds the lock has the same head and can still merge it on a pass written before the stop. The check blocks that one; on the merged one it shows and decides nothing.
  • Unsettled look: the write is the same run on the same recorded head, so it can only block that commit, and nothing needs to be read for it.
  • Through a new installation, the write names the commit by its full object ID from the request's status, or from a listing of the request's own branch when the same look adopts its lost pull request (recordFound records HeadSHA from the listing while no pull request is recorded, and failCheckAfterLook then writes on it). Either way it is a commit on the request's branch in the same repository (FindChangeRequest takes the head branch), so the write can only block it. No test covers an adopting look through a new installation. A repository without that commit refuses the write, and ReviewCheckNotFailed says so; a repository with it can only have that commit blocked. An answer about another pull request changes no part of the write. An answer of the Git host can start the write, but it never changes its content or its target.

What it carries. The stop's fixed title "The request stopped" and one fixed summary: Shadewright stopped the request of this pull request, with the stop's reason (ChangeRequestOnOtherBase, ChangeRequestGone) or the phase it stopped in as the only variable part, a fixed constant of the executor, no longer checks its plan, so it must not be merged on an earlier check, and the check stays failed. It promises no close on any base, so it is the same on every base, and it holds no base name, branch name, hint, comment or other text from the code host (invariant 4).

When the write fails. A refused or failed write sets ReviewCheckNotFailed with its cause and a Warning Event when it is set or its cause changes, and the next look tries again while the lock is held. The write that records Stale removes the condition, and so does a look that finds the failed check last. A release of the lock ends the condition, and so does the write that records a merge of the request's pull request (also while a verification keeps the lock); each logs at Info that a check written before the stop may stay the latest on the head. A look of a request that owns no review check any more (hints off, a handoff, limit (f)) writes nothing and ends the condition, with the same Info line.

What is read and granted. Nothing new. The read of the pull request by its number, the listing of the branch on every base and the read of the latest check of the head are those of ADR-0043 and ADR-0045. The write uses the App permission checks: write that every token request already names. The looks run at heldRecheckInterval (10 minutes) while the request holds the lock, and each reads the check once and writes at most once, with no polling of its own. One case is faster, limit (g): a failed status write after the check write.

Further points of the same decision, which widen nothing.

  • With no pull request from the branch holding the lock, no look follows: only the stop's own write remains where ADR-0045 has one (case 2, the stop for a pull request open on another base, and case 5, the stop for one read gone).
  • A failed check written by a stale plan or a cancel for a pull request read gone has its own fixed summary, which says the pull request cannot be found and that nothing is closed, instead of the summary for another base.

How the invariants hold. Invariant 3: a failed check only blocks. Invariant 4: no host text goes into the check run, and the head is a full object ID from status. Invariant 5: the recorded Stale state and the head find the work again; a lost status write makes the next look write the same failed run again (limit (g)). Invariant 6: the executor alone writes it, with the permission it has. Invariants 1 and 2 are not touched.

Consequences

A pass written before the stop on the request's recorded head no longer decides the merge of a pull request from the request's branch at that head while the request holds the lock, whatever happened to the request's own pull request, except in the known limits below. The cost is a failed check written on a few more looks, and possibly on a commit that a pull request merged on another base already carries, where it decides nothing.

Not covered, known limits:

  • (a) Deletion (#984). Deleting a stopped request ends ReviewCheckNotFailed in the first write of the deletion and writes no check; the finalizer closes only the pull requests with the request's marker and releases the lock. An unmarked open pull request from the same branch keeps a pass written before the stop, which can decide its merge. The first write of the deletion logs at Info, once per deletion, that a check written before the stop may stay on the head whenever the recorded head is not known to show the failed check: the condition was set, or no state Stale is recorded for that head while the request owns its review check and holds the lock. Writing the check at a deletion would widen a write again and needs its own decision.
  • (b) Reads that keep failing (#979). A look whose reads failed writes nothing; the next look tries. While the reads keep failing (condition GitReadRetry says so) no look writes the check, and ReviewCheckNotFailed does not say it is owed. On a head already recorded Stale, a look that cannot read the check records only the Warning Event StoppedCheckUnread once, which goes when the Event expires.
  • © A look a stop exception takes over: a look that settles the lock but goes to a step of its own before the rule runs writes nothing in that look: the cleanup of an expired request whose own pull request is open, the retried close after a stale cleanup stopped on a refusal, a cancel settled for its Incident, the record of a merge, and a failed read of who records a merge after a handoff. The next look that reaches the rule writes. Closing this limit is #1008.
  • (d) A new installation writes with no read that ties a pull request to the request. A repository reached through it that does not have the recorded commit refuses the write, and ReviewCheckNotFailed says so at each look while the lock is held. A repository that has it can only have that commit blocked.
  • (e) ADR-0045 limits (a), (b), ©, (e) and (f) hold for these writes too: the check blocks only where the base's ruleset requires it from the App, a new commit on the pull request has no run, a move between read and write can only block, and the failed check is final for the request. Limit ©, a late or missing write, says differently which condition shows it in each case, and each leaves a pass in place for as long as it lasts:
  • writes paused: on a head not recorded Stale, the look of a stopped holder waits and condition WritesPaused says so, not ReviewCheckNotFailed, and a stop's own write sets ReviewCheckNotFailed with reason WritesPaused. On a head already recorded Stale (failStaleCheck can record it before the stop for a pull request read gone), the look and the stop's own write alike only record the Warning Event StoppedCheckUnread once and do not set ReviewCheckNotFailed, as limit (b) says for a failed read;
  • the settings entry names another target branch (reads only): the look writes nothing and ReviewCheckNotFailed carries reason TargetBranchChanged; on a head already recorded Stale the look leaves the condition as it is and only records StoppedCheckUnread once;
  • the repository is gone from the settings: the look cannot read, and condition PullRequestUnreadable says so;
  • the Git host refuses or fails the write: ReviewCheckNotFailed carries the cause.
  • an installation change after a stop other than a refused stale cleanup: the settings entry of the plan's repository then has another installation, staleMark and staleCleanupStopped do not hold (a stopped holder is in a phase after the merge or Expired, Cancelled, ChangeRequestGone or another NeedsIntervention), so planEntry returns errRepositoryGone (PullRequestUnreadable and RepositoryUnavailable say so), the look writes nothing and a pass written before the stop stays while the lock is held. The rotation runbook (identity rotation) closes the waiting requests' pull requests only. Writing through a new installation for these holders would widen the write again and needs its own decision.
  • (f) Hints off, or a handoff. With reviewer hints off the executor owns no review check (ADR-0043 limit (e), second half), and while a handoff intent stands or the pull request is handed off the check is the replacement's (the handoff rule of ADR-0028, amendment of 2026-11-15). The look then writes nothing, so a pass written before the stop stays required while the lock is held. It removes ReviewCheckNotFailed and, when it was set, logs at Info that a check written before the stop may stay the latest on the head, as the other ends do.
  • (g) A failed status write after the check write. When the status write that records Stale or the condition fails (failCheckAfterUnsettledLook, the last status update of checkHeld), the error goes to the controller's rate limiter and Stale is not recorded. Each retry looks again at the error backoff pace, from milliseconds, and writes the same failed run again without reading the check first. The runs are harmless as a check, but they are more than one write per ten minutes. No test covers repeated status write failures.
  • (h) A pass on an earlier head of the branch. The rule writes only on the recorded head (failStoppedCheck). A request that took a pull request over by handoff (ADR-0028 step 3) records the head it pushed, H1, while the predecessor's head H0 may still carry the App's success from its approved review. A person with push access who resets the branch to H0 (ADR-0028 point 9 allows it) gets an open pull request at H0, which meets a required shadewright/review that passes, and it can merge on it; each later look of the stopped request writes the failed check on H1 only, and the request has stopped for the move (HeadMoved, #524). Invariant 3 is not broken (the executor bypasses nothing). design 6 records such a merge only after it happens. Writing the failed check on the head the holding pull request shows would be a new widening and needs its own decision. No test covers it: it rests on GitHub's per-commit checks, which the fake provider does not model.

Alternatives considered

  • Amend ADR-0045. It would widen a write on the authority of an amendment, which ADR-0021 refuses.
  • Keep the rows per verdict of the request's own pull request. Four review passes each found a verdict the rows missed; a rule that reads the lock and the head does not depend on the list of verdicts.
  • Keep the gate on ReviewCheckNotFailed. A request that stopped for another reason with its own pull request already closed never sets the condition, so it never writes, and the open pull request that holds the lock merges on the old pass.
  • Write nothing at a look that settles nothing yet. The pass stays last for one more look (heldRecheckInterval), during which the pull request that holds the lock can merge on it (seed 1456 of the Git waits model).
  • Keep the installation exception: write nothing through a new installation while a pull request other than the recorded one keeps the lock (the decision of 2026-11-20). The new installation does not tie that pull request to the request, but the write does not touch that pull request: it names the recorded commit by its full object ID and can only block it. The exception made a settled look and a look that settles nothing decide differently on the same head, and it let the Git host's listing order decide, so an unmarked open pull request listed first also dropped the write owed while the recorded one was open. Six review passes each found a case where a pass stayed on the head; the decision of 2026-11-21 chose one rule over another exception.
  • Write when the lock is not held. No pull request from the branch keeps it, so no look runs; a look of its own for this would be a new poll of the Git host for a released request.

Amendments

None. The revision of 2026-11-21 was made while the ADR was Proposed; the maintainer accepted it on 2026-11-21 with limit © as written.