Skip to content

Review run: a pull request that changes mid-run strands its fixes in a retained worktree and is never reviewed again #1961

Open

Description

@JacobStephens2

This was generated by AI during triage.

Problem

When a pull request changes during a Review run, the run's committed fixes are never published. They stay in a retained Review worktree, which then keeps that pull request out of every later review --author Pass. Nothing releases it: the author's new commits don't, and neither does the Pass firing every two minutes. The pull request is never reviewed again until someone deletes the worktree and local branch by hand.

This happened to both waiting pull requests on one host on 2026-11-10 (thirdshift 0.27.0, a private repository, one thirdshift review --author <login> crontab line every two minutes):

  1. Author pushed during the run. The run captured head 76f529d, review-and-address committed two fixes on top, and the author pushed 87597e2 while the session ran. Delivery failed with the branch moved during Review run and warned retaining checkout /tmp/thirdshift-review-… and local branch … at c79aabb…: the worktree has unpushed commits.
  2. Pull request made draft during the run. review-and-address succeeded with a fix commit, then the run ended with pull request … is a draft and the same retention warning. The author later marked it ready and pushed five more commits.

From then on, conflicts::eligible (src/processes/review/conflicts.rs) found a pull_request_conflict for each and skipped them. Because the retained branch no longer descends from the pull request's current head, the recovery described in the guide ("its captured head is the PR's current head") can never apply. One failure notification went out per conflict state (#1780). After that, the hold appeared only as a suppressed skip; #1962.

Related, but not the same: #1800 is about a stale head at the start of a run. Here the head was current at the start and moved during the session.

Proposed behavior (for triage to decide)

When the pull request's current head has moved past the retained worktree's captured head, and the worktree holds only clean committed fixes descending from that captured head (no uncommitted edits, no unfinished Git operation, same ownership token):

  1. Try to carry the fixes forward. Rebase or cherry-pick the fix commits onto the new head in the worktree. If that applies cleanly, deliver them as recovery does today, or rerun review on the new head with the fixes in place.
  2. Otherwise release them. Save the fixes durably, as a patch or bundle beside the Command log and named in the Activity log, and post the patch, or a pointer to it, as a pull request comment if that fits ADR 0015 / Trusted-account rules. Then remove the worktree and local branch so the next Pass reviews the new head.

Anything outside that narrow shape (dirty tree, foreign branch, changed ownership) stays preserved for the Day shift, as today.

Decisions needed

  • Carry forward (1) at all, or always release (2)? A rebase onto someone else's newer commits means fixes the author hasn't seen land on top of their work.
  • Does the draft case behave the same way, or should a draft pull request keep its retained worktree until it is marked ready?
  • Where should the saved fixes live, and for how long?

Workaround

Delete the retained worktree and its local branch on the host. conflicts::eligible clears the suppression file on the next Pass.

Activity

  1. added
    bug
    needs-triage
    on Nov 10, 2026
  2. JacobStephens2 commented on Nov 10, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Prevention counterpart: #1974 proposes a quiet period before a Review Pass takes a pull request, which would avoid most of these cases. This issue still covers the ones that get through.

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

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation summary

    Confirmed the mechanism for #1961 on selected Base main, commit 960513a91e3ca30df2dbfce46b625e91833d0e7c (0.28.0).

    • src/processes/review/delivery.rs:245 refuses publication when the PR head differs from the captured head. Draft eligibility checks also stop delivery.
    • src/worktree/ownership.rs:209 preserves worktrees containing unpushed commits.
    • src/worktree/review_recovery.rs:310 requires exact equality between the recorded captured head and the current PR head before recovery. Ancestry alone cannot authorize recovery, even if the newer head includes retained commits.
    • src/processes/review/conflicts.rs rejects that checkout during later author Passes. Its suppression record controls notifications; it provides no recovery or expiry.

    Two qualifications: a draft made ready again can recover if its head remains unchanged. Also, the conflict fingerprint includes the current PR head, so subsequent pushes can re-enable notification without releasing the checkout.

    Existing regression tests passed for moved-head/draft delivery refusal, conflict suppression, same-head recovery, and changed-head recovery refusal. The private-host incidents themselves were not inspected.

    Recommended direction

    Save committed fixes privately and verify the archive before releasing a clean, positively owned worktree and factory-created local branch. Preserve uncertain ownership, unfinished operations, dirty work and pre-existing local branches. Archive failure must leave the original work intact. Keep automatic carry-forward as a separate policy decision. Public patch publication needs an explicit policy consistent with ADR 0015; retained work can include Security-review fixes.

    This remains distinct from #1800 (stale head at acquisition), #1962 (visibility of held PRs), and #1974 (quiet-period prevention). Keep #1961 open for the decisions and proposed split below.

    Questionnaire

    For the Day shift: #1961's blocking mechanism is confirmed locally. The repository defines preservation guards but does not settle the following recovery policy.

    1. Should the initial implementation archive and release eligible retained fixes, as recommended, or automatically carry them onto the newer head? If carry-forward is required, must it rerun review, validation and configured Security review before delivery to the newly observed head? This determines the publication contract.
    2. Should draft PRs keep their retained work until ready again? Recommended: recover normally when ready at the same head; archive and release on the next eligible Pass when the head changed. This determines draft timing.
    3. Should archives be verified Git bundles with a manifest naming the PR, captured head, retained head and owning Command, stored under configured logs.dir and retained until manually removed? Specify a different location or retention period if needed; this determines when cleanup is safe.
    4. Should PR comments contain only a sanitized recovery notice, with artifact paths confined to local logs and notifications? Recommended: no automatic patch upload. This settles publication without overriding ADR 0015.
    5. Approve splitting this into two dependent Tickets: A, archive and release eligible fixes when a Review run fails, including failure-safe preservation and recovery instructions; B, use that mechanism during later Review Passes to unblock already-retained changed-head checkouts, including draft transitions, ownership/race tests and documentation. B depends on A. Keep optional carry-forward separate, and leave held-PR visibility and quiet-period work in Review Pass: name pull requests held by retained Review worktrees in the skip reason and Needs you #1962 and Review Pass: wait until a pull request's head has been quiet before reviewing it #1974.
  5. added
    ready-for-human
    and removed
    in-progress
    on Nov 11, 2026
  6. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Another instance on 2026-11-11, thirdshift 0.27.2, on lima-thirdshift:

    • A Review run on Spec: wait out GitHub quota exhaustion instead of failing (Quota wait) #2004 ran 09:46–10:14 EST, committed f3499cda "Address review of the Quota wait" (6 files), then failed with pull request changed during Review run. A Spec run on orchestrate was delivering the same pull request.
    • Retention gave a different reason from the one in this issue: retaining checkout /tmp/thirdshift-review-hKBqk9 and local branch issue-1994 at f3499cda…: the worktree has uncommitted changes. The only "change" was an untracked .review-logs/ directory the session had written for its own build and test output, so the session's own scratch files are enough to retain a worktree.
    • Later Review Passes skipped Spec: wait out GitHub quota exhaustion instead of failing (Quota wait) #2004 with retained Review worktree captured a different pull request head.

    Cleaned up by hand on 2026-11-11 at about 11:30 EST. The commit is kept as local branch salvage/review-2004-f3499cda, the logs are in ~/.thirdshift/salvage/review-2004-f3499cda/ on that host, the worktree was removed and local issue-1994 was deleted.

    The cause in this case, a Review Pass taking a pull request that a live Spec run is still delivering, is filed separately: #2037.

  7. JacobStephens2 commented on Nov 19, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Two more instances on 2026-11-18 (thirdshift 0.37.0, lima-thirdshift): Review runs on #2281 and #2286 ended failed with retained checkouts, because their pull requests were merged mid-run. Prevention is split out: #2290 (Spec-run Ticket PRs slip past the admission holds) and #2291 (stop a Review run when its pull request is merged or closed).

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

    bugready-for-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions