Expand description
The Kanban and GitHub (docs/specs/SPEC_WARDEN_KANBAN_2026_10_20.md §6.9, D5):
- Finding the PR. When an agent holding one task opens a PR, the card gets the PR’s address once GitHub lists it, so the card links to it without the agent naming it. A result that names one PR (“PR #12”) does the same at hand-in, when that PR is from the branch the agent is on: a result that only mentions someone else’s PR links nothing, so that PR’s merge can’t close the task.
- Closing on merge. A task in Review whose PR has merged is accepted:
the merge was the review. Off with the setting
kanban:closeonmerge. - Merged, then Released (SPEC_KANBAN_STAGES_COLOURS_AND_NARROW_VIEW_2026_10_23.md
§4): a task’s PR that merged is recorded with when (
work_prs.rs), so the board can show the task in Merged even while its agent still holds it; and once a release of the repository was made from a commit at or after that merge, the task is recorded as in that release (Released).mainis linear (a merge queue), so a release made after a merge contains it.
srv holds no GitHub credential, so both read GitHub’s public API without
one: they work for public repositories, and a private one stays as it was
(the agent links its PR with Tasks, the operator accepts by hand). The
unauthenticated API allows 60 calls an hour per address, shared with
everything else on the computer (several AgentMux instances run on a busy
one, the update check among them), so this spends at most HOURLY_BUDGET
and stops until GitHub’s reset when told it is over. (Measured: an
unauthenticated 304 answer counts against the limit like a 200, so asking
with an ETag would save nothing.) A task dev build doesn’t ask at all,
unless AGENTMUX_KANBAN_PR_POLL is set: it shares the computer’s limit and
its Kanban with the instance the person uses.
Structs§
- PrRef
- A PR on GitHub:
owner/repoand its number.
Enums§
- PrState
- What GitHub says about a PR.
Constants§
- HOURLY_
BUDGET - The most calls this srv makes in an hour.
- SETTING_
CLOSE_ ON_ MERGE - The setting that stops a merged PR closing its task (default on).
Functions§
- close_
merged - A task’s PR merged: accept it, if it is still in Review. Returns whether it moved (another srv on this computer may have got there first).
- close_
on_ merge_ enabled - Whether closing on merge is on (
kanban:closeonmerge, default on). - find_
opened - An agent holding
work_idwas seen atseen_msopening a PR frombranchinrepo(fromowner’s fork when--headnamed one): look for it on GitHub a few times as it appears, and link the first found that was created by then. Without--head,ghmay have pushed to a fork of the user’s, whose owner srv doesn’t know: the last look takes the newest open PRs and matches the branch instead. - is_
from_ branch - Whether GitHub’s answer for a PR says it is from
branchofrepo(owner/repo). - link
- Link a task to its PR, unless it has one already;
sourcesays whose finding it is (the holder’s owngh pr create, or a hand-in’s text). Returns whether it did. - link_
if_ from - A hand-in named
prwhile its agent was onbranchofrepo(itsorigin): link it if that PR is from that branch of that repository, so a PR the result only mentions (someone else’s, one it built on, a fork’s same-named branch) isn’t taken for the task’s own. - merged_
at - When GitHub’s answer for one PR says it merged (ms).
- parse_
pr_ ref - The PR a card’s link names: a GitHub PR address,
owner/repo#12, or#12/12in the card’s repository. - pick_
opened - The PR a just-seen
gh pr createopened, from a list GitHub gave: the first created sincesince_ms(less [CREATED_SLACK_MS]), frombranchwhen one is given. An older PR from the same branch (merged long ago, or open before this command) is not this command’s. - pr_
in_ text - The one PR a hand-in’s text names (“PR #12”, a PR address), when it names
exactly one;
Nonefor none or several. - pr_
state - The state in GitHub’s answer for one PR.
- release_
containing - The first release (oldest; not a draft) made from a commit at or after
merged_ms, from GitHub’s list of a repository’s releases: its tag and when it was published (ms). A release’screated_atis the date of the commit it was made from. - report_
of - What GitHub’s answer for one PR tells the card’s list: its state, head, and when it was opened and last
changed.
Nonefor an answer that names no state. - run_
merge_ loop - The merge loop: every minute, ask GitHub about the PRs of the tasks
that are due a look; record merges and releases, and accept a task in
Review whose PR merged. Started once, after
super::install.