Skip to content

A hand-back made in the same edit as the Claim's removal can be missed #1261

Closed

Description

@JacobStephens2

This was generated by AI during triage.

What happened

On 2026-10-24 #977 was handed back after its last Spec run with a single command:

gh issue edit 977 --remove-label in-progress --add-label ready-for-agent

GitHub recorded both label events at the same second, and listed the labelling first:

2026-10-24T15:42:42Z labeled ready-for-agent
2026-10-24T15:42:42Z unlabeled in-progress

Pickup runs on the thirdshift host then passed #977 over every two minutes, though it had ready-for-agent, no Claim and a Startable Ticket (#1020). With activity.quiet_skips set, the only trace was Pickup run skipped: no Ready issue in the Activity log, which doesn't name #977 or say why. Removing ready-for-agent and adding it back as a separate step, at 15:51:33, made the hand-back count.

The same swap worked the night before, because GitHub happened to record it the other way round, with unlabeled in-progress at 02:35:55 and labeled ready-for-agent at 02:35:56.

Cause (confirmed in the code)

A started issue (with an Issue branch or pull request) is a Ready issue only after a hand-back: the Day shift applying ready-for-agent after the last Claim ended. The issue's candidate reading replays its label events in timeline order through ClaimHistory::after:

  • labeled ready-for-agent while the state is Claimed leaves it Claimed;
  • unlabeled in-progress then moves it to Released, not HandedBack.

So the issue is passed over as started: …; no ready-for-agent hand-back after the last Claim ended. GitHub gives no reliable order to events with the same timestamp, so a swap made in one edit is a hand-back or not by chance.

Agent Brief

Category: bug
Summary: A hand-back made in the same edit as the Claim's removal should count, whatever order GitHub lists the two events in.

Current behavior:
Label events are applied strictly in the order the timeline lists them. A ready-for-agent labelling listed before an in-progress removal with the same timestamp is ignored for hand-back. The started issue is never Ready until someone relabels it again.

Desired behavior:

  • A ready-for-agent labelling by a Trusted account with the same timestamp as the removal of the last Claim counts as a hand-back, in either listed order.
  • Within one timestamp, the order of other events must not decide a hand-back either. A Claim applied at the same second as a ready-for-agent labelling still leaves the issue Claimed, so it isn't Ready.
  • A ready-for-agent labelling strictly before the Claim's removal is still not a hand-back. A Claim's own release is not one either: a Ticket run that ends with nothing on origin puts ready-for-agent back itself. Its issue has no Issue branch or pull request, so it doesn't need a hand-back, and that path must keep working.
  • The Trusted-account check on the labelling actor is unchanged.

Key interfaces:

  • ClaimHistory and how the candidate reading folds label events into it: either order same-timestamp events so a Claim's removal comes before a ready-for-agent labelling, or let a labelling seen while Claimed become a hand-back when the Claim's removal follows at the same timestamp.
  • Candidate::handed_back, which Pickup's Ready issue check reads (Reason::Started when it's false).

Acceptance criteria:

  • A test with a timeline labeled ready-for-agent then unlabeled in-progress at the same timestamp, after an earlier Claim, gives handed_back: true. The same holds with the two in the opposite order.
  • A test with labeled ready-for-agent strictly before unlabeled in-progress gives handed_back: false.
  • A test with labeled in-progress and labeled ready-for-agent at the same timestamp leaves the issue claimed.
  • Existing hand-back, Claim and Pickup tests pass unchanged.
  • The Ready issue entry in GLOSSARY.md says a hand-back made in the same edit as the Claim's removal counts, if its wording otherwise reads as excluding it.

Out of scope:

  • How skipped Pickup runs report their reasons under activity.quiet_skips (see below).
  • Any change to which accounts can hand an issue back, or to the Claim limit, reservations or settling.

Related, not part of this fix

With activity.quiet_skips = true, a Pickup run that passes over a labelled ready-for-agent issue for a reason a human can fix ("no hand-back", "blocked by", "not settled") leaves no record of which issue or why. The Activity log only says no Ready issue. That made this bug slow to find. A separate issue could make the Activity log keep the passed-over lines, or the Console could show them.

Activity

  1. added
    bug
    needs-triage
    ready-for-agent
    in-progress
    and removed
    needs-triage
    ready-for-agent
    on Oct 24, 2026
  2. removed
    in-progress
    on Oct 24, 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