Skip to content

A Review Pass takes a pull request that a live Ticket run or Spec run is still delivering #2037

Closed

Description

@JacobStephens2

This was generated by AI during triage.

From a 2026-11-11 check of the fleet's open pull requests (thirdshift 0.27.2 on every host).

Agent Brief

Category: bug
Summary: A review --author Pass takes a pull request while a live Ticket run or Spec run is still delivering it, on this or another host. The Delivery's next push makes the Review run fail with pull request changed during Review run, and its committed fixes are stranded in a retained Review worktree (#1961).

Current behavior:

  • A Review run reserves the pull request: Reservation::take (src/processes/review.rs around line 226) creates refs/thirdshift/reservations/<PR number> and refuses a pull request labelled in-progress.
  • A Ticket run or Spec run reserves its issue (refs/heads/thirdshift/pickup/<issue>) and Claims the issue with in-progress. It takes no reservation and adds no label on its pull request.
  • Neither checks the other's reservation. During Delivery (the Repair loop and CI watch), the pull request's head has no agent review, so the Review Pass treats it as waiting.

Observed on 2026-11-11, with review --author JacobStephens2 on lima-thirdshift every 15 minutes:

Pull request Live Command delivering it Review run on lima Outcome
#2004 (Spec #1994) Spec run on orchestrate, Repair and CI watch 09:46–10:14 EST pull request changed during Review run. Commit f3499cda "Address review of the Quota wait" (6 files) never pushed. Worktree /tmp/thirdshift-review-hKBqk9 and local branch issue-1994 retained. Later Review Passes skipped #2004 (retained Review worktree captured a different pull request head) until removed by hand.
#2021 (#2016) Ticket run on stephens 10:16–10:50 EST pull request changed during Review run.
#2024 (#2018) Ticket run on thirdshift.app, CI watch started 11:01 EST, still running at 11:30 —

Each Review session costs 20–40 minutes of Harness use, and its work is lost whenever the Delivery pushes again.

Desired behavior:

A Review Pass passes over a pull request while a live Command is delivering it, and takes it once that Command has ended, so a Review run never races a Ticket run's or Spec run's Delivery. It logs the pass-over reason (e.g. #2024 is being delivered by a live Ticket run for #2018), as other per-candidate skips are logged.

Choose the mechanism in triage. Options:

  1. The Review Pass treats a pull request as held while any of its closing issues has a refs/heads/thirdshift/pickup/<issue> reservation on origin, or carries in-progress.
  2. Ticket runs and Spec runs also take refs/thirdshift/reservations/<PR number> for the length of Delivery, so the existing Reservation::take refusal applies.

Option 2 also protects the other direction, where a Delivery starts while a Review run holds the pull request. Option 1 needs no change to Ticket runs.

review <PR URL> typed by hand keeps its current behavior, or warns.

Key interfaces:

  • src/processes/review.rs and src/processes/review/conflicts.rs: candidate eligibility.
  • src/reservation.rs: reservation refs for issues and pull requests.
  • docs/guide.md, Review runs: say which pull requests a Review Pass passes over.

Acceptance criteria:

  • With a Ticket run's issue reservation on origin for the pull request's closing issue, thirdshift review --author <login> does not take that pull request. It takes the next eligible one, or skips with a reason naming the pull request and the Command holding it.
  • The same holds for a Spec PR whose Spec is reserved by a live Spec run.
  • Once the reservation is released, the next Review Pass takes the pull request.
  • A pull request with no closing issue behaves as now.
  • Tests run through the CLI against the fake gh, with two thirdshift processes.

Out of scope:

Activity

  1. added
    bug
    needs-triage
    in-progress
    and removed
    needs-triage
    on Nov 11, 2026
  2. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Confirmed against selected Base commit 482507a (thirdshift 0.29.0). Keep this as one bug issue.

    Diagnosis and evidence

    Review Pass admission in src/processes/review.rs:39 checks the PR's reservation and eligibility, but never checks its closing issues. src/review/reservation.rs:21 reserves the PR number in both the legacy Pickup namespace and the PR reservation namespace, then checks the PR's labels. Neither reservation covers a differently numbered closing issue.

    Pickup holds its issue reservation through dispatch and Claim ending (src/pickup.rs:260). Direct Ticket and Spec commands make an issue Claim without a Pickup reservation (src/run.rs:321). Consequently, checking issue refs alone would miss direct commands.

    A scratch harness using the existing Scenario support, real Git, fake gh and two thirdshift processes reproduced Review completing from a separate clone while a direct Ticket run, a direct Spec run, or a Pickup-dispatched Ticket run remained in CI watch. Their linked issues still carried in-progress; the Pickup case also held its issue reservation. A separate case confirmed that a held closing-issue reservation alone does not prevent Review admission.

    Chosen implementation

    Use option 1 with both signals: a Review Pass passes over a PR whenever any linked closing issue has an in-progress Claim or an issue reservation on its origin. Preserve explicit review behavior.

    Add a focused, paginated closing-issue lookup using the existing GraphQL query and URL parsing in src/github/review.rs:345 and :493. Check the linked issues during Pass selection and recheck after acquiring the PR reservation, before worktree inspection or sessions. Inspect reservation refs read-only; never acquire, release or expire another Command's issue reservation. Preserve repository identity when checking refs so unrelated repositories' issue numbers cannot collide. Failed observations must not authorize admission.

    Log the skipped PR, the holding issue/Command and the observed Claim or reservation, then continue to the next candidate. Identify a Ticket or Spec run only when supported by evidence. Retain existing PR reservation cleanup.

    This chooses the issue's proposed admission guard. It addresses a Command already delivering when Review selects its PR; it does not establish mutual exclusion against a Delivery started after Review. Existing captured-head checks remain necessary.

    Acceptance and validation

    Add permanent CLI regressions in tests/review_pass.rs using two processes and separate clones sharing a bare origin: live Ticket and Spec Delivery, reserved and direct-command paths, selection of the next eligible PR, an explanatory all-held skip, and selection after the issue Claim/reservation ends. Cover multiple closing issues, pagination, a PR without closing issues, and unchanged explicit-URL behavior. Retained reservations remain held until operator recovery, consistent with ADR 0017.

    Update docs/guide.md's Review runs section, regenerate site/docs/index.html, and update GLOSSARY.md and the Review Pass description in site/index.html. Search the other hand-written site pages for affected descriptions. Run focused tests and scripts/affected-tests main.

    Local validation passed: scratch reproduction 4/4; review_pass 14/14; existing a_changed_pr_stops_before_posting_recommendations regression 1/1. The affected-test selector reported no changed files.

    Related issues #1961, #1962, #1974 and #1800 cover recovery, retained-worktree diagnostics, settling delays and stale initial heads respectively; this issue is distinct.

  3. added
    ready-for-agent
    in-progress
    needs-triage
    and removed
    in-progress
    ready-for-agent
    needs-triage
    on Nov 11, 2026
  4. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Handing back after the Console Stop at 12:33 EST, at the Day shift's request. The Agent Brief above still stands. The next Pickup continues on the preserved branch.

  5. added
    in-progress
    and removed
    ready-for-agent
    on Nov 12, 2026
  6. removed
    in-progress
    on Nov 12, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions