For developers · Orchestrator
The resolver for stuck issues
When the autopilot gives up on an issue (label stalled, see docs/states.md), the resolver
tries it once before a person is asked: one run of a coding agent that finds why the issue is
stuck, removes the blocker and goes on with the issue's branch and pull request like a worker. If
that does not work, the person gets a normal question in the question format
(docs/question-format.md) with the cause, what was tried, the options and a recommendation.
The code is crates/core/src/resolver.rs (record, decision, prompt, question, note) and
crates/cli/src/dispatcher_resolver.rs (trigger, start, outcome).
When it runs#
The resolver is triggered the moment the dispatcher marks an issue stalled. The stall notice waits
meanwhile: the person hears of the issue only when the resolver asks.
- One attempt per stuck issue, never a loop. A resolver run never stalls an issue again and never
starts a second run for the same stall. When the resolver got an issue moving and it gets stuck again
within 7 days, the person is asked right away. Only a new conflict, failed update or moving base
after it got the issue moving (the base moved on, nothing for a person to decide) is resolved again,
up to 3 times in a row (
againin the record), before the person is asked (#1564). A resolver run cut off twice by a restart of the dispatcher is not started a third time. - Ahead of new issues, within the total. Waiting resolver attempts take the next free slot before any new issue, up to the system slots (see "System slots" below). They count in "workers at once" like any run, never on top of it (#1531), and a machine's own maximum always holds. A running worker is never stopped for them. One that finds no place within an hour asks the person instead. It goes through the same usage gate as a worker: a login whose usage is known spent, or not known where "pause on unknown usage" holds (Codex always without a worker distribution), takes no resolver run either.
- Only where the autopilot works. Never in a paused or hidden repository; an attempt waiting when the autopilot is paused is dropped (the issue stays stuck, nothing is asked).
- Hands off an issue that is labelled
extern, has a session of a person open, or has an open question to a person (needs-human), and one that is no longerstalledwhen its turn comes. - Out of an agent's reach (a sign-in on the worker's machine) means no run: the person is asked at once, with the fix in the question. A working copy held by another run gets no resolver either; that cause passes by itself and "Try again" stays the way out.
- A full disk holds it like any new local work (the disk guard): this computer takes no attempt, a worker machine with room still does. With none, waiting attempts stay queued, and their hour of waiting starts again once there is space, so nobody is asked about a full disk.
The backlog sweep#
The trigger misses stalls that happened before the resolver existed, while the dispatcher was down,
or in a crash between the label and the record. A sweep catches them: once at the dispatcher's
start and then every ten minutes by the clock, independent of the stall trigger. It looks at every
stalled issue and queues an attempt for each whose recorded stall (stall.json) has none yet,
with the same rules as above (switches, Autopilot, hands off, out of reach asks at once). A stall
younger than five minutes is left to its trigger. Each sweep logs one line, resolver.sweep,
with what it found, queued and asked, how many records it wrote (recorded) and the skipped issues
by reason.
Stuck without a record: an issue that was stuck before the dispatcher kept stall records has no
recorded cause. The sweep writes one for it (stall.json, cause unknown, logged as
resolver.stall_recorded): stalled when the issue last changed on the forge (a label change moves
that time too), or at the sweep when the forge does not answer, never older than 30 days. From
then on it is a stall like any other: younger than five minutes it waits for the next sweep, and it
gets exactly one attempt. The run's brief says the cause is unknown and has it work the cause out
first: the issue and its comments, the branch against its base, an open pull request with its
state and checks (gitoodo worker context), the worktree, and the dispatcher's log of the issue
(gitoodo trace <owner/repo>#<n>); then it acts as for that cause. The question after a failed
attempt names the cause as "not recorded". An issue the resolver already had is never recorded
again, even when its stall record is gone.
Attempts from the sweep are the backlog, started after the fresh stalls, oldest stall first, in the system slots like fresh ones. Beyond those, the backlog takes the slots the round's new work left free. There is no further share for a large backlog: it would come out of the user's own worker slots, and the two system slots already give it a start in every round in which a slot frees. The disk guard holds the backlog like any new local work. No question is asked for the wait, so a long backlog never turns into a flood of questions. The stuck list says "The resolver takes it as soon as a slot is free" on such a row and counts the issues the resolver works through under its heading. A pause drops backlog attempts that have not begun (the next sweep after the pause queues them again).
Never twice: an issue whose record holds this stall in any state (resolved, asked, skipped, stopped, or still waiting or running) is never swept again for it. Only a later stall is new.
Switches: Settings → Dispatcher → "Resolver for stuck issues" (global, dispatch.resolver, on by
default) and per repository the rule "Resolver for stuck issues" next to the Autopilot (on by default while the
Autopilot is on). Either switch off means no attempt.
System slots#
Of the slots of "workers at once", up to two go first to the resolver's runs, the **system
slots** (gitoodo_core::system_slots; dispatch.system_slots in the config file, no setting in the
app; 0 lets them wait like new issues). They are a priority, not capacity of their own: every
resolver run counts in the total and goes through the same gate as every start
(docs/orchestrator/dispatcher.md, "One gate"), and each machine's own maximum holds. While every
slot is busy, a waiting attempt takes the next one that frees, ahead of new issues. Until #1531
the system slots came on top of the total, which let the fleet run "9 of 8".
- Only while needed. While no resolver attempt waits or runs, the workers use every slot of the total. When one comes, nothing running is stopped; it starts in a system slot on any machine with room below its own maximum.
- Kept at the start (#1422). Until every repository with the autopilot on or a resolver
attempt was read in this run (or the first full poll is done), the system slots take no new
issue, so a waiting attempt is not overtaken by workers in the first minute. Attempts from
resolver.jsonstart once their repository was read in this run, not on the stored model, so no decision rests on old labels; the classifier reads those repositories first. With no need known, the slots go back to the workers at once (dispatch.system_reserve_start/_end). - Any machine for the resolver. A resolver run goes to any machine with a free slot within its
own maximum, chosen with the same checks as a worker's (sign-in, agent, tools, the issue's
os:andhost:labels), the machine it stalled on first, since its working copy is there. - Triage takes no slot (#1426). A triage call is a short model call of the classifier on the
dispatcher's computer, one at a time, without a working copy. It neither waits for a slot nor
counts against a machine's maximum or the total, so new issues are assessed right away even
while every slot runs a worker. A running call is marked (
triage-callin the state folder, older than two minutes holds nothing) for the status page only.
The status page keeps this calm: the Resolver line says how many system slots are in use only on hover ("System slots: 1 of 2 in use").
The run#
The resolver runs on any machine with a free slot (see "System slots"), the one the issue stuck on
first; the question after a failed attempt names that machine. It prefers an agent of the worker
pool other than the one that got stuck. Its worktree is set up from the issue's branch, so it
continues where the workers stopped. On a worker machine it reads its context
(gitoodo worker context) and delivers like a worker there, through the dispatcher's computer,
which holds the forge token. Its prompt names only commands that work there: a wait for other
issues is a question (gitoodo ask) instead of gitoodo worker blocked, which only the
dispatcher's computer records, and gitoodo trace shows that machine's part of the log. A question
there leaves the attempt waiting for the answer as on this computer. A machine that ends its
waiting runs for an update puts the attempt back into the queue without costing a start; it starts
again in a free slot like any waiting one.
Its first message holds the issue, the recorded stall cause, the run history, the end of the last run's output, the conflicting files for a conflict, and the worktree and branch. It tells the agent to diagnose, fix and end with one machine-readable outcome:
| Outcome | Command |
|---|---|
| Fixed and delivered (push, PR) | gitoodo worker resolved --reason <text> |
| The blocker passed, a worker goes on | gitoodo worker resolved --requeue --reason <text> |
| The base already does it | gitoodo worker resolved --obsolete <sha> --reason <text> |
| Waits for other issues | gitoodo worker blocked --on #N --reason <text> |
| Only a person can decide or act | gitoodo ask (a question in the format) |
What the prompt asks it to do per cause, in short: for a conflict, first check whether the base
already does what the issue asks (then it ends with --obsolete <sha>, the base's commit, and a
one-line why, without redoing the work: once the run ended the dispatcher asks the forge whether
that commit is on the base branch; confirmed, the issue gets one note naming the commit and is
closed, Gitoodo's own pull request for it too, never set back to ready; not confirmed, it goes back
into the queue and the note says the claim could not be checked, #1574); otherwise rebase onto origin/<base> (merge only where the
repository's history is made of merge commits), resolve the conflicts itself (both entries kept in a
changelog or list), deliver with gitoodo worker push/pr, which replace the rebased branch on the
forge under a lease (see below), and never merge the pre-rebase state back in. It asks only when
the two sides want different behaviour, naming every conflicting file and what each side wants.
It also reproduces failing checks locally from gitoodo worker context's
failed_checks and ask when the base branch itself is red, read a merge refusal "open
dependencies" (412) as a wait and record it with blocked --on, turn a forge dependency, a "defer
until #N" answer or a dependency named in the worker's text into blocked --on, and read runs
that ended right after their start. Merge rights (405), a release step, a scope decision and the
machine's environment are a person's: it asks straight away with the fix.
A delivery whose branch lacks the forge's head replaces it with a leased push only when that head
is still the one the worker's checkout last saw (refs/remotes/origin/<branch>; a satellite sends
it with the bundle) and the delivered commit contains the base's current head; anything else is
refused as before, so commits someone else pushed are never lost (#1565).
gitoodo worker resolved is accepted only from the resolver run itself: through the dispatcher's
broker, or on a worker machine through its service, which ends the run and hands the outcome to the
dispatcher with the run's end.
Outcomes#
- Solved or requeued: the run ends, one collapsed note goes on the issue in the forge's
language (the line "the resolver got this issue moving again", unfolded what was stuck, what it
did, the result and the issue's open pull request; marked as Gitoodo's own and with
<!-- gitoodo:resolver run=<run id> -->, so applying the same outcome again edits that note instead of adding one). The outcome is applied only after the run's end and once no lease holds the working copy any more, so the next claim never meets the resolver's own lease (#1493); the issue goes fromstalledback toready; the next worker picks up the branch. A run that delivered a pull request without reporting counts as solved. - Blocked: as for a worker; the issue waits for its dependencies.
- Asked (the agent asked with
gitoodo ask): the question stands, the issue isneeds-human. It waits for the person's answer under "Asked of me" and is never stuck, with no "Solve": the classifier shows the new label at once, before its next read of the forge, andneeds-humanoutranks astalledthat stayed beside it (#1535). The card's answer hint is in the language on the forge. - Hung: the watchdog ends a run that showed no progress (no output, no change in its working
copy) for the hang timeout (
dispatch.hang_timeout_seconds, 10 minutes; a resolver run here is not restarted in place). An agent idle at its prompt counts as no progress. Its work is committed and pushed, its slot is free at once, and the attempt starts once more, on another machine than the one it hung on when one has room (resolver.requeued, causehung). Only when that second start hangs or fails too is the person asked. Before it counts as hung, the watchdog reads the run's last screen: an agent that sits at its usage limit notice there did not hang (next point). A run that ends without an outcome within 2 minutes of its start did no work (its start failed on that machine) and is retried the same way (resolver.requeued, causequick_end) (#1563). - At a sign-in or start confirmation on a worker machine (its agent signed out there): the run
never began. It is no attempt and no hang: that agent is paused on that machine as after a
worker's blocked start, and the attempt goes back into the queue without costing a start, for
another machine first (
resolver.end, resultstart_blocked). Blocked on the same machine again with no other to take it, the person is asked (#1562). - At the usage limit (the run stopped at its agent's limit, seen live or by the watchdog on its last screen, see the dispatcher's "Usage limits"): no failure, no start used and no question. The login is locked until the reset the notice names, on every machine with it. The work is saved on the branch, and the attempt goes back into the queue and waits there, without the one-hour timeout, until an agent or login with usage left can take it (another agent of the pool first); the stuck row says "The resolver waits for usage until Tue 14:39" (or without a time when the reset is not known).
- Resolved by a pull request counts only when the run itself pushed to it: an open pull request for the issue that was not updated since the run started (one exists for every stall over failing checks or a conflict) is no delivery, and such a run ends as failed (#1563).
- Failed (the run ended or hung without an outcome): the resolver asks the person a question: why it is stuck, what was tried, the branch (for a conflict, failed update or moving base with the conflicting files, up to 8, each with the last commit that touched it on the base and on the branch, fetched fresh from the forge into the repository's clone here, so it holds for runs on worker machines too; when that fails, the question says the files could not be read instead of naming old ones, #1575), and "Continue on the branch" (recommended) or "Start over from the base branch". If even that question cannot be posted, the stall notice of before comes.
- Stopped by a person: the issue stays stuck with its stall notice.
The record is resolver.json in the dispatcher's state folder (states queued, running, resolved,
requeued, asked, skipped, stopped). An attempt is marked "asked" before its question is posted, so
a failed post never leads to a second attempt. After a restart or update of the dispatcher a
running attempt whose worker is gone starts once more, and an outcome that was recorded but not yet
applied is applied.
In the app#
A stuck issue the resolver still takes is nobody's to look at yet, so it counts nowhere: not in the
header's "N need you", the badge on "Asked of me", the repositories' marks, the tray title or the
Dock badge (docs/counters.md). The core decides it once, when the read model is served
(resolver::takes, overlay_stalls in crates/cli/src/classifier.rs): the resolver takes it while
its attempt is queued or running, and also before that while it is sure to come (switched on for
the repository, the issue free for it, a reachable cause, no attempt for this stall yet: the stall's
trigger or the next backlog sweep queues it, including the sweep's 5-minute grace). Such an issue
gets a resolver view with pending: true, so a fresh stall never flashes into the list. Off,
out of reach, asked, or its attempt over: the issue needs the person and shows as before; an issue
the resolver asked about shows as its question and counts once.
"Hängt fest" holds only what the resolver could not solve (#1493, resolver::stuck): a stuck
issue is nobody's (passing: true, shown nowhere) while it moves again by itself, that is a
working copy a run held (for up to six hours, PASSING_SECS) or the resolver's outcome for this
very stall on its way; it is the resolver's while it takes it (above); everything else is the
person's. An attempt skipped because the issue had moved on leaves no record, so stuck again the
issue goes back to the resolver. Once the issue moves again, its detail sheet on the board shows
the resolver's line ("Resolver: Solved: Conflicts with the base branch · 09:48", its own sentence
on hover) from resolved_by in the read model.
"Asked of me" keeps those issues behind one quiet line under the stuck ones, "4 the resolver is
taking – show", in the style of "N more from repos without autopilot". Opened, each line says
"The resolver takes it as soon as a slot is free – …", "The resolver takes it next – …" or "The
resolver is on it with <agent> – …" with "View issue"; a running one turns like the sidebar's repos.
The resolver's colour is violet (--color-kind-resolver, triage has blue): its waiting attempts in
the queue ("Sessions"), after what waits for triage and before new work, its session tile, these
lines and a board row it works on are tinted whole with a violet leading edge and carry the
"Resolver" marker (icon and name, so the colour is never the only sign).
The help topic "Needs you" has a section on it.
The status page shows the resolver as the second background step after triage, in the same step
list and from the same status shape (StepStatus; DispatcherStatus.resolver, from resolver.json
after each round): Running with the issue it works on, the machine and since when, and how
many wait ("Working on gitoodo #1058 on hp840 · for 4 min · 3 waiting"), Ready with nothing queued, Off when the global switch is off (a choice, so the top
line stays "All running"), Ready with "Waiting for disk space" while the disk guard holds queued
attempts, and Error (cause attempts) after three failed attempts in a row within a day (a run
that ended without an outcome, hung or was lost, or a question that could not be posted); like a
disturbed triage it counts in the top line. A click on the line opens the stuck issues.