Skip to content

dev-lead pushes to a pull request opened with dev-lead:hands-off: the pr-opened path classifies review-changes before the label is visible #2294

Open

Description

@don-petry

Problem

A pull request created with gh pr create --label dev-lead:hands-off is still picked up by dev-lead's pr-opened path, which pushes a commit to the branch. The label is meant to guarantee one writer per branch.

Observed on "fix(monitors): report a fleet-paused run as paused" (#2281), 2026-10-11:

Time (UTC) Event
15:19:31 Pull request opened; dev-lead:hands-off applied by the same gh pr create call
15:19:32 Dev-Lead Agent run 38150798255 starts on the pull_request event
run log [intent] type=review-changes reason=pr-opened context={"pr_number":2281,...}: no hold-label skip
15:30:37 The run pushes commit 3968aa45 ("fix(reviews): harden mktemp, batch size and last-line read in fleet pause") to the hands-off branch
15:42:20 It posts its dev-lead-fix-reviews … intent=review-changes status=partial comment
15:46:21 A later run posts the hold notice for the same label

Every later event on that pull request was classified correctly (type=skip reason=hands-off-label, for example run 38151506242). Only the first one was not.

Likely cause (not confirmed in the code)

gh pr create --label creates the pull request and then adds the label in a second call. The opened event's payload is built at creation, so its labels array is empty. If the intent classifier takes the labels from the event payload on this path, it cannot see a label that was added a second later. The GitHub API has no way to create a pull request with labels in one call, so every labelled pull request is exposed to this.

The run then worked for eleven minutes before pushing, so a live label read at any point before the push would have stopped it.

Scope

  1. On the pr-opened path (and any other path that can end in a push), read the pull request's labels live before classifying, not from the event payload.
  2. Re-check the hold label immediately before a push, so a label added while the run was working also stops it.

Acceptance criteria

  1. A test in which the event payload carries no labels and the live read returns dev-lead:hands-off: the intent is skip reason=hands-off-label.
  2. A test in which the label appears between classification and push: nothing is pushed, and the run says why.
  3. The same holds for the other hold labels that path honours.

Impact so far

The commit dev-lead pushed was reasonable (three review suggestions) and was kept after review. The harm is the guarantee: a session that owns a hands-off branch can have its head moved under it, which also invalidates a head it has just verified for merging. Related: "dev-lead retry sweep ignores dev-lead:hands-off" (#2089, closed), which fixed a different path.

Activity

  1. github-actions commented on Oct 11, 2026

    @github-actions
    Contributor

    Thanks for the detailed report and the timeline, which makes this much easier to follow. The theory that the opened event payload carries empty labels because gh pr create --label adds the label in a second call is plausible. To confirm it, could you say whether the intent classifier on the pr-opened path reads labels from the event payload or from a live API call? If you've already checked that in the code, a pointer to the file and line would help us fix the right place.

  2. don-petry commented on Oct 11, 2026

    @don-petry
    CollaboratorAuthor

    A workaround that held once, for anyone opening a hands-off pull request before this is fixed: open it as a draft with the label, then mark it ready. On "fix(tests): give the dev-lead sidecars a per-test directory" (#2296), opened that way at 16:56 UTC, dev-lead's first pull_request run (38157532579) logged [intent] type=skip reason=hands-off-label and pushed nothing. One observation, not a proof: I have not read why the draft path sees the label when the non-draft path did not.

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

    bugBug reports

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions