Skip to content

Stop Delivery and Repair work when the PR is merged, closed, or drafted #730

Closed

Description

@JacobStephens2

From the Oct 11–16 2026 Run retrospective, finding 10. Tracking issue: #721.

The evidence below is historical and attributed to the supplied report (repository snapshot 5504c97); it has not all been independently reproduced. Limited current-checkout checks were made at 53bb9c6. This is filed for maintainer triage, not automatic Pickup.

Requested outcome and validation

Check the PR lifecycle after every Repair and during CI polling. Stop obsolete work promptly for a merged or closed PR, and handle a PR converted to draft according to the existing Delivery contract without continuing to wait as if it were ready. Surface the actual terminal/gated state and preserve the Run's truthful outcome.

Add matching session stop rules: check whether the PR remains actionable before additional validation, pushes, or PR edits; if merged or closed, stop and report it. When a Repair changes no code, do not create an empty commit or push merely to satisfy its prompt. Preserve necessary pushes of real changes, including reconciled upstream commits.

Validate PR transitions during a CI watch and during a Repair, including branch deletion by merge. No later push may recreate a branch deleted at merge, and no merged PR should gain stale review/body edits. Preserve failure information rather than treating a closed or drafted PR as a successful merge.

Related: #712 is the competing-writer cause; finding 2 covers empty-tree Review Repairs; #102 covers unchanged-head CI-fix termination. This lifecycle protection also matters when a human merges a PR during a Run.

Original finding, including evidence, proposed fixes, and confidence

10. Sessions have no stop rules when the work is moot (Factory)

Activity

  1. JacobStephens2 commented on Oct 17, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: bug
    Summary: Stop obsolete Delivery and Repair work promptly when its PR becomes merged, closed or draft.

    Current behavior: PR readiness is checked after Repair/CI rounds, while the CI watch itself only observes checks. Sessions and later orchestration steps can continue validation, pushes or PR edits after the PR is no longer actionable. The historical report records a push recreating a branch deleted at merge; this triage confirmed the relevant code gaps without rerunning that incident.

    Desired behavior: Revalidate the selected PR's lifecycle during CI polling and around Repair/session completion before further mutations. A merged or closed PR ends obsolete work promptly, naming the actual state and preserving a truthful result; an externally merged PR must not be described as a factory Self-merge. A PR changed to draft follows the existing readiness/failure contract rather than continuing CI as ready. Give sessions matching stop guidance before further validation, pushes or PR edits. When a Repair makes no code change, do not create an empty commit or push solely to satisfy its prompt; still push genuine changes, including necessary upstream reconciliation.

    Key interfaces: Delivery, Repair-loop and CI-watch boundaries must share the selected PR identity/lifecycle outcome. The session/Repair instructions must use the same stop contract. Existing failure preservation, Claims and notification outcomes remain truthful.

    Acceptance criteria:

    • A PR merged or closed during a pending-CI watch stops obsolete polling promptly and reports its actual state.
    • A PR changed to draft during the watch or Repair is handled under the existing ready/failure contract, with no false success.
    • After a session or Repair discovers a terminal PR, it performs no later obsolete PR-body update or push that recreates a branch deleted at merge.
    • A Repair with no changes creates no empty commit or pointless push; real changes and required reconciliation still reach origin.
    • Focused deterministic cases cover merged/closed/draft transitions during polling and Repair, and show genuine failures are retained.
    • Session guidance and generated prompt artifacts agree with the behavior.

    Out of scope: Solving cross-machine Claim races (#712), automatically reopening PRs, bypassing CI/reviews, or merging an incomplete/draft PR.

  2. added
    ready-for-agentFully specified, ready for an AFK agent
    in-progressA Claim: thirdshift has taken this issue
    and removed
    needs-triageMaintainer needs to evaluate this issue
    ready-for-agentFully specified, ready for an AFK agent
    on Oct 17, 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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions