Skip to content

Review run: stop when the pull request is merged or closed mid-run #2291

Open

Description

@JacobStephens2

This was generated by AI during triage.

Problem

A Review run that starts on an open pull request keeps working after the pull request is merged or closed, and only finds out at delivery. All its work is then thrown away, or retained on the host (#1961).

On 2026-11-18 (thirdshift 0.37.0, lima-thirdshift, review --author JacobStephens2), PR #2281 was merged by hand at 18:01:49 EST, 7 seconds after a Review run on it started. The run went on for 9m 41s of codex xhigh (about 3.1M input tokens). It made doc fixes in 3 files and ended failed, with the checkout retained at /tmp/thirdshift-review-uylOCl. No admission check can prevent this case. The Spec-run variant is #2290.

Proposed behavior (for the Day shift to decide)

The run re-checks the pull request's state while it works, and stops early when it is merged or closed. It removes its worktree unless the run has already made commits worth keeping, in which case #1961's rules apply. It ends with a distinct outcome, "pull request merged during Review run", not failed, so it doesn't show up as a failure in Needs you.

Decisions needed

  1. When to check: at Process Step boundaries only (a few API calls per run; it would have caught Record the #2023 UI verification grill, glossary terms and ADR 0034 #2281 after its first step), or also by polling during a session, every N minutes, and interrupting the Harness (catches it sooner but spends GitHub quota, which is already near its floor most hours)?
  2. Fixes already made: when the merged pull request's fixes still apply to the Base branch, should they be offered as a follow-up pull request, saved as a patch beside the Command log, or discarded?
  3. Scope: only Review runs, or also Fix runs and a Spec run's Ticket reviews, which can race the same way?

Related: #1961 (stranded fixes), #1974 (quiet period before review), #2290 (Spec-run Ticket PRs).

Activity

  1. added
    enhancement
    ready-for-human
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementready-for-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions