Repository navigation
Description
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-agentGitHub 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-agentwhile the state isClaimedleaves itClaimed;unlabeled in-progressthen moves it toReleased, notHandedBack.
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-agentlabelling 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-agentlabelling still leaves the issue Claimed, so it isn't Ready. - A
ready-for-agentlabelling 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 putsready-for-agentback 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:
ClaimHistoryand how the candidate reading folds label events into it: either order same-timestamp events so a Claim's removal comes before aready-for-agentlabelling, or let a labelling seen whileClaimedbecome a hand-back when the Claim's removal follows at the same timestamp.Candidate::handed_back, which Pickup's Ready issue check reads (Reason::Startedwhen it's false).
Acceptance criteria:
- A test with a timeline
labeled ready-for-agentthenunlabeled in-progressat the same timestamp, after an earlier Claim, giveshanded_back: true. The same holds with the two in the opposite order. - A test with
labeled ready-for-agentstrictly beforeunlabeled in-progressgiveshanded_back: false. - A test with
labeled in-progressandlabeled ready-for-agentat the same timestamp leaves the issue claimed. - Existing hand-back, Claim and Pickup tests pass unchanged.
- The Ready issue entry in
GLOSSARY.mdsays 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