Skip to content

How it works

Why code, not a model, picks my next issue

Published · 6 min read·

A robot fortune-teller beside its crystal ball holds out a paper slip to a turnstile that lets parcels through one at a time, while a parcel chained to an unfinished box waits beside it.

In short

  • A fixed rule in code picks my agents' next GitHub issue: p1-critical, then p1-tooling, then the current milestone, then the backlog.
  • A planning run, which is a model, proposes the order inside each group, and code checks every answer before it counts.
  • An issue blocked by an open issue never starts. Between 12 Nov and 1 Dec 2026, that held 85 issues at least once.
  • You can try the rule on five sample issues further down.

The way I make an AI agent pick the next GitHub issue is to not let it pick. In Issuemill, a short rule in code reads my labels, milestones and blockers and decides which issue a Claude Code run gets next. A model still helps: a planning run proposes the order inside each group. But code checks that proposal, and an issue blocked by an open issue never starts, whatever anyone proposed.

That rule picks the work for the unattended runs on 11 of my projects. How a run goes from issue to merged pull request is in Running Claude Code unattended on GitHub issues. This post is the part before that: who goes first.

Why not let the model choose?

I never tried it for real. The queue was code from day one, so I have no "before" to show you, and I won't pretend I do. What I have is the reason, and the cases where the rule earned its keep.

The choice repeats every 15 seconds, all day. It has to give the same answer for the same issues, or two runs end up arguing over one file. And it has rules a model can forget halfway through a long prompt: this label means "not yet", that issue waits on another one. A rule in code is free to run, gives one answer, and has tests.

The blockers are where it shows. On 18 Nov 2026 at 11:40 UTC, the queue reached spy4x/seed#1120, which needed two spy4x/preact-components issues first. The queue held it. When one of them closed, it held it on the other. The run started at 22:19 that day, 10.6 hours later, on top of finished work instead of half of it.

Two more, from the last days of November:

  • spy4x/seed#1177 waited on spy4x/seed#1176 from 28 Nov 13:50 UTC and started at 20:53.
  • spy4x/preact-components#1403 waited on spy4x/preact-components#1240 from 28 Nov 05:50 UTC and started on 29 Nov at 09:16, a full day later.

Agents find blockers too. 108 lead runs started, read the issue, found something unfinished underneath it and ended as waiting. That is the cheap way to learn about a blocker, a median of 2.1 minutes and $0.56 at API prices, and it still takes a run slot. The GitHub "blocked by" link costs nothing to read.

What is the rule, in order?

For each repository I focus on, the queue builds a plan in this order:

  1. p1-critical issues: something is broken and it hurts now.
  2. p1-tooling issues: an obstacle in my tools that slows every other run.
  3. p2-high fixes in my tooling repositories.
  4. The current milestone: the one due first that still has an issue a run could take.
  5. The backlog, only when no milestone has such an issue: issues in no milestone, labelled p2-high, p3-medium or with no priority label at all.

Inside each group the oldest issue goes first, unless a planning run proposed an order. The first two groups stay on top whatever that order says. This is the real line from the plan's code:

/** Sources that stay ahead of every other candidate, in this order, whatever an order says. */
const FIRST = [`p1`, `p1-tooling`]

The fifth step surprises people. While the milestone has work a run can start, the backlog is not in the plan at all. I want the milestone finished, and an agent with a free slot will happily polish a nice-to-have instead.

Across projects, a second rule decides whose plan goes next: each project's share of run hours over the last 24 hours, weighed against a priority weight I set. When two projects come out nearly even, the one whose Claude account is further behind its weekly pace goes first, so quota that would expire unused gets used.

What does the queue refuse to start, and why?

Being first in the plan is not enough. Before a run starts, the queue checks the issue again, and any of these holds it:

  • A label that says "not now": manual, needs-decision or in-progress keeps an issue out everywhere; p4-low and p5-someday keep it out unless it is in the milestone.
  • An author who is not me: only issues I opened can start a run. A stranger's issue is text, and text is not an instruction.
  • A date: a line such as Not before: 2026-11-23 in the body holds it until that day in UTC.
  • A blocker: GitHub's "blocked by" link to an open issue, or a Needs first: line naming one.
  • Green pipelines it needs: a Needs pipelines: line, until that many have passed.
  • The milestone: a p1-tooling fix waits while the milestone has work, unless the milestone needs that fix first.
  • A run already on it: two runs on one issue, or on a pull request that closes it, is one too many.
  • Runs that did nothing: an issue whose last runs parked with no pull request is held for an hour, doubled each time, up to a day.

Between 12 Nov and 1 Dec, the "blocked by" hold alone stopped 85 issues at least once. 30 of them got their run later, a median of 19.3 hours after the first hold. The other 55 had no run by 1 Dec, and cost nothing while they waited. The queue page lists every hold with its exact wording.

Where does a model still help?

Ordering a milestone well needs judgment: which issue unblocks three others, which two touch the same screen. So a planning run, Claude Code with 20 minutes and a $5 spend limit, reads the plan and answers with an order and the relations it sees between issues.

Then code checks the answer. An order never adds an issue, because the code ignores any issue that is not already in the plan. It never moves anything above p1-critical or p1-tooling. A proposed relation is written to GitHub only when it passes code's checks.

Between 19 Nov and 1 Dec, 24 planning runs cost $11.86 in all. 14 of them returned an order, and the queue applied it. The other 10 returned none, and the queue kept its own order without fuss. Code left out 29 of the relations they proposed.

Here is the honest bit: code has never thrown away a whole order. The model's proposals are mostly fine. The check is there for the day one isn't, so a bad answer costs me one ignored suggestion.

Try the rule

These five issues start in this order:

Order Issue Set to What the queue does
1 #105 Checkout crashes on Safari p1-critical Starts next
2 #102 Speed up the test script p1-tooling Waits for the milestone
3 #103 Sign-up page Milestone, blocked by #104 Waits on #104
4 #104 Email verification Milestone Queued
– #101 Export notes as CSV p3-medium Not planned while the milestone has work

Change a label, tick a milestone box or pick a blocker, and the order follows the same rule as the queue's code. Nothing you set leaves the page.

Try the queue's rule on five issues

Change a label, the milestone or a blocker, and watch the order.

  1. #105 Checkout crashes on Safarip1-critical goes first.
    Starts next
  2. #102 Speed up the test scriptp1-tooling goes second.
    Waits for the milestone
  3. #103 Sign-up pageIn the milestone, oldest first.
    Waits on #104
  4. #104 Email verificationIn the milestone, oldest first.
    Queued
  5. #101 Export notes as CSVBacklog: planned once the milestone has nothing to start.
    Not planned

#101 Export notes as CSV

#102 Speed up the test script

#103 Sign-up page

#104 Email verification

#105 Checkout crashes on Safari

Next to start: #105.

The queue's own rule, cut down to one repository where every issue is open. Nothing you set leaves this page.

Two things worth trying. Block #104 on #101, and the whole milestone waits, so the backlog comes back into the plan. Then block #104 on #102 instead, and the tooling fix stops waiting for the milestone, because the milestone needs it first.

Get the next post by email

A short email when a new post is out or something ships. Confirm once by email, unsubscribe in one click.

All posts