Skip to content

Stop a Spec run when its Spec PR is closed or retargeted mid-Run #1469

Open

Description

@JacobStephens2

This was generated by AI during triage.

What happened

A Pickup run started a Spec run while the Day shift was reshaping that Spec. The reshape gave the Spec a new Base branch. Six minutes into the Run, the person closed the Spec PR on purpose, keeping the Spec branch only as a source to copy work from, and rewrote the Tickets to open their own PRs against the new Base branch.

The Run didn't notice. For about 90 more minutes it carried out Tickets on the old plan. Two Ticket runs Self-merged into the abandoned Spec branch and closed their Tickets, even though the rewritten Tickets now asked for something else. The Run noticed only at final readiness, when PullRequest::ensure_ready_and_mergeable (src/pull_request.rs:340) reported that the Spec PR "is closed, not open". It then printed a Recovery command, which would have continued on the abandoned base. The person had to reopen both Tickets by hand.

Why

The Spec PR's state is read at the start and at final readiness. Nothing reads it again between Tickets. A Run that lasts hours therefore keeps merging into a Spec branch the person has already given up.

Proposal

Before starting each Ticket, and again before each Self-merge into the Spec branch, re-read the Spec PR. If it is closed, merged, or now targets a different base than the Run started with, stop the Run before doing more work. Report a distinct cause, such as "the Spec PR changed under the Run", and give no Recovery command that resumes the old plan.

Why ready-for-human

The checkpoints and their cost are policy calls:

  • Which changes count: a closed PR, a changed base, or also an edit to the Spec body or a Ticket body?
  • Whether a Ticket run that is already in flight finishes or gets abandoned.
  • How this interacts with Continuations and the "Preserved" report.
  • Whether Pickup should have dispatched at all. The Spec carried the in-progress Claim label, not ready-for-agent, and the command log that would explain the dispatch wasn't available during triage. That may be a separate issue.

Activity

  1. added
    enhancement
    ready-for-human
    on Oct 27, 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