Status: implemented and live (§15). The workflow, scripts and
offline tests exist, the bot fork organisations hold the App
installation and the publisher writes through them (§4.3), live
pull-requests dispatches have raised signed, reviewed pull
requests. The caller runs when an operator dispatches it or a run
continues itself, and at no other time (§11); no run scans for new
issues (§6). §17 records the decisions taken on the
first draft's open questions and the points rollout settles.
This document reuses the architecture, vocabulary and lessons of
github-issues-triage
(its docs/development/DESIGN.md, §7 and §13.7 in particular). Where
this design departs from that one, the text says why.
The lfreleng-actions organisation holds a backlog of open issues
across some thirty repositories. Daily triage now labels each one
with category, Priority and Type, which ranks the backlog; nobody has
capacity to work it. Most issues are small, well-scoped and sit in
repositories with a uniform toolchain and a written contribution
standard, which makes them tractable for a coding agent working under
tight constraints.
When an operator names triaged issues, run a coding agent against them and open one pull request per issue. Each pull request:
- comes from a bot-owned branch in a fork held by a bot fork organisation (§4.3), never from a branch in the target repository, which makes the agent's code an outside contribution to the target's CI;
- carries commits that follow the organisation's
AGENTS.md(signed, DCO trailer, Conventional Commit subject, co-author trailer, PR title equal to a single commit's subject); - has passed the repository's own pre-commit hooks, tests and the
aislopgate in the agent's checkout; - states what changed, why, what the agent ran, and which run produced it;
- waits for a human. The organisation requires a RelEng approval before merge, and nothing here can supply one.
The measure of success is a pull request a reviewer can merge after reading it, or reject in less time than the issue would have cost them.
- Merging. The workflow never merges, never approves and never dismisses a review.
- Acting on a review in the same run. The publisher requests and awaits the Copilot review of each pull request it opens and reports the verdict (§8); a revision round in a later run answers it (§20), one round per run, so the trusted jobs never push on the strength of a review the same agent session produced. The same run never acts on its own review; the next run does, and the caller may start that run itself (§20.6), with a fresh select job that re-reads everything and a fresh session.
- Working the
.githubrepository. Its issues track organisation-wide tasks that span repositories. It stays out of scope unless a dispatcher opts in. - Claude Code and Gemini CLI lanes. Copilot CLI is the single harness. The organisation's Enterprise subscription supplies the models this design names.
- Private repositories. The estate is public. §16 lists what a private repository would need.
The triage workflow runs at 07:00 UTC on weekdays and applies labels, Priority and Type. This workflow depends on that output:
- Priority drove the ranking of the retired new-issue scan (§6) and still fills the packet the agent reads.
- Type and category labels drive exclusions (§6) and the commit type the agent chooses.
- An issue without a Type has not seen triage yet and waits a day.
The two workflows live in separate repositories, which rules out a
workflow_run trigger. No timer replaces it: an operator reads
triage's output and names the issues to work (§11). Triage's
excluded-repos.txt lists repositories that produce noise; this
workflow keeps its own list with the same format, seeded
from that one.
Inherited from triage without change: the three-job trusted /
untrusted / trusted layout; artifact retrieval by producer ID and
trusted digest, never by name; a per-invocation namespace
(run-attempt-uuid); INPUT_PERMISSION-* environment forwarding
for App token permissions the pinned action does not declare; the
github_pat_ guard on the model token; harden-runner with the
egress allow-list summary printed once; scratch cleanup by plain
deletion under continue-on-error.
select (trusted) author (untrusted, matrix) publish (trusted)
App: issues read no App credential App: per-repo write
rank + choose checkout target repo verify bundle
selection.json Copilot CLI session replay commits (API)
SHA + ID + digest --> proposal bundle + manifest --> open PR, report
The shape matches triage. The difference is what the untrusted job
produces. Triage's agent emits JSON that a trusted applier turns
into label writes. This agent emits commits: a git bundle and a
manifest. The trusted publisher turns those into a branch and a pull
request. The agent job never holds a credential that can write to
any repository, and it never holds the App key. A fourth job,
forks, runs beside the author matrix with a machine account's
token and readies the forks the publisher writes into (§4.3, §10.6).
Triage confines its agent to cat, jq and four read utilities and
denies git, gh and the write tool. Run 35324225186 showed the CLI
auto-approving anything it classifies as a read, so even that
containment rests on the deny list rather than the allow list.
A coding agent needs git, the write tool, package managers, test
runners and prek. Any interpreter in that set (python, node,
bash itself) is a standing bypass of every shell-level denial.
Tool policy on this job is a productivity setting, not a boundary.
The boundary is:
- No write credential in the author job. Its native
GITHUB_TOKENhascontents: read. The model PAT has Copilot Requests and nothing else. Public repositories clone without authentication. - A trusted publisher that treats the bundle as data. It verifies provenance, inspects the diff against a policy, and makes every write through the App with a token scoped to one repository.
- A human review gate the organisation already enforces.
Consider everything on the author runner (packet, checkout, model PAT, Actions runtime token) exposed to the issue text and repository content the agent reads. A prompt-injected issue can waste model spend and produce a bad diff. It cannot push, cannot open a pull request, and cannot reach another repository.
The hosted runner gives its user passwordless sudo and Docker, and
root on the runner is the means to undo what harden-runner sets up.
So the author job's harden-runner step sets
disable-sudo-and-containers for every session unless the target
opts in. A target opts in with a regular file named
.enable-sudo-and-containers, exact case, at the root of its
default branch; its content is not read, and a symlink, directory or
submodule of that name does not count. A file rather than a
repository variable, because the App holds no grant to read Actions
variables, and git keeps a file's history, shows it in the tree and
adds it through a reviewed pull request. The author job cannot
decide this itself: it runs untrusted, and harden-runner runs before
any checkout.
The pinned harden-runner can skip its setup and still succeed (an
HTTP 409 from its API), so the author job's next step, still before
any checkout, fails a session that did not opt in when sudo -n or
docker info still works.
The select job reads the root tree through the API at the entry's
checkout_sha, the default-branch commit an issue builds on or a
round may rebase onto, never a bot branch or a pull request head:
no round can turn the switch on for itself. It records the
answer as sudo_and_containers (§18.1); an entry without the field
counts as not opted in, and the publisher refuses a proposal or a
round that touches the marker as a protected file (§8 step 3). A failed read
other than an absent marker fails the selection, as its other reads
of a target do. An opted-in repository gives its sessions root and
Docker back, and with them the means to undo harden-runner, so the
marker should stay rare, and each use should say why.
The runtime token can upload artifacts to its run, so an artifact's name, producer run and upload digest prove the run, never the job that made it. A trusted job reads an artifact by an id and digest a trusted job vouched for, and by nothing less: within a run, the select job's outputs; across runs, a notice on the select job's own check run (§6 "Overlapping runs"). The selector disregards evidence nothing trusted vouches for, so it never makes selection skip work.
The calling workflow supplies both the App key and the
assets_repository/assets_ref coordinate that the trusted jobs
execute. The design trusts the caller with both: a caller able to
point the assets at hostile code could as well edit its own workflow
to run that code with the same key. Every caller here pins the assets
to its own github.sha, and issues-triage makes the same
assumption.
The pull request plumbing job executes the pull request's own
scripts with the native token alone. It proves the trusted jobs'
block-mode egress, that the invocation namespace keeps two calls'
artifacts apart, and that the workflow and its scripts work as one
commit. A local uses: reads the workflow from the merge commit
(github.sha), so the job checks the assets out from that commit in
the base repository too. Taking them from the pull request head
would pair the workflow and the scripts from different commits, and
fail every branch cut before main changed the interface between
them. GitHub gives a fork's
pull_request run a GITHUB_TOKEN without write scopes and no
secrets, and here that token can read nothing beyond public issues and contents,
expires with the job, and runs under block-mode egress. That is the
sandbox GitHub intends for untrusted pull requests, and the job
needs no stronger one.
The publisher does not push code-monkey/* branches into the
target repository. A branch in the target is a same-repository
branch, and GitHub runs that repository's pull_request workflows
for it as trusted code: with its secrets and a token that can
write, before any maintainer has read the change. The code on that
branch is agent output shaped by issue text, and may include
workflow edits. Review before merge cannot contain what CI executes
before review.
Bot branches live in a fork of the target instead, held in a dedicated fork organisation, and the publisher opens each pull request from that fork. GitHub then treats the change as coming from outside: the target's workflows run without secrets and with a token that cannot write, subject to the organisation's approval policy for outside contributions, and the change still gets full CI.
AI agents that author pull requests for lfreleng-actions use
these organisations for their forks:
| Fork organisation | Holds forks of |
|---|---|
lfreleng-bot-forks |
Every organisation without a dedicated pool, lfreleng-actions included |
lfreleng-bot-forks-onap |
ONAP project repositories |
lfreleng-bot-forks-oransc |
O-RAN-SC project repositories |
lfreleng-bot-forks-opendaylight |
OpenDaylight project repositories |
The names follow one pattern: lfreleng-bot-forks is the general
pool, and a project that needs its own takes
lfreleng-bot-forks-<project>. The dedicated pools exist so that
each project's forks, and the access to them, stay separate from
the general pool. The rule applies to any agent-authored pull
request in lfreleng-actions, not to this workflow alone; with the
names agreed, the organisation AGENTS.md is its right home.
Publishing then works as follows, with the §5 signing unchanged:
- The forks job (
Prepare forks) resolves the fork organisation for the target's owner from the table, and finds or creates the fork there, beside the author matrix and before the publish job starts. It looks the fork up by the target's name first, then by parent among the target's forks: a fork made before a rename of the target keeps its old name, and the job renames it after the target. A422because another repository holds that name fails that target alone. GitHub answers a fork request for a parent the organisation already forks with the existing fork, and the reply's name, not the target's, is the one renamed or polled. The job polls every fork it requested or renamed against one shared one-minute deadline. It records one still answering 404 then, after a request GitHub accepted, asrequested; not yet visiblewith a warning rather than a failure: GitHub can take longer to fork a large repository, and the publish job, which starts after the author session, reads the fork again. A fork renamed with no request behind it, still 404 then, fails the target, as does any other read failure while polling, 410 Gone included. Creating or renaming a fork needs Administration: write on the fork organisation, and a GitHub App holds its permissions on every installation at once: an App able to create forks could administer every repository in the target organisation too. The job holds the fork pool token of §10.6, a machine account's, and the App holds no Administration grant at all. The publisher requires the fork and never makes one: with no fork it mints no fork token, and the push fails that issue, naming the forks job. - It syncs the fork's default branch with the target
(
merge-upstream), so the recorded base commit is present. The sync fast-forwards over every commit upstream merged since the last one, and GitHub refuses any that touch.github/workflows/unless the token holds Workflows: write; Dependabot pin bumps make that most weeks. Every fork token carries Workflows: write, whatever the proposal edits. Two publishes in one run may sync the same fork at once, and the one that loses the race answers 422 with the fork synced all the same; the publisher retries it with a short backoff and then lets the base-commit lookup decide, as it does after a 409 for a diverged fork, while any other status fails at once. - It creates
code-monkey/issue-<n>in the fork at the base commit and replays the commits there throughcreateCommitOnBranch, with a token minted on the fork organisation's installation for that one fork. - It opens the pull request on the target with head
<fork-org>:code-monkey/issue-<n>, using a token minted on the target organisation's installation. The request setsmaintainer_can_modifytofalse: GitHub limits maintainer edits to forks owned by a user account, and requires a token that can write to the fork. The fork here belongs to an organisation and this token has no access to it, sotruefails with HTTP 422. - A prior attempt (§6) is a pull request whose head repository is
the designated fork, in one of three states. An open one is live
work, a merged one finished the issue, and one closed unmerged is
an attempt a human rejected. The lookup reads every page. Where
the branch has more than one, an open one speaks for the issue
first, then a merged one, then the newest closed one. A scan
skips the issue in all three states; a named issue (§6 "Explicit
issues") overrides a closed one alone. A branch in that fork with
no pull request is an orphan: a publish that pushed and then
failed to open the pull request leaves it on purpose, and the next
run selects the issue again, marked
resume, so the publisher can adopt the branch and finish. A same-named branch in any other fork, or in the target itself, does not count.
Installation. The publisher has no same-repository path. The four organisations exist and each holds an installation of the App on all repositories with Contents: write and Workflows: write (§10.1), and the machine account of §10.6 as a member. Every fork organisation has Actions switched off, which means a bot branch triggers no workflow where it lands, and Workflows: write on a fork token can run nothing there; the target organisation requires approval before workflows run for pull requests from outside contributors, and the change gets CI once a maintainer has read it.
The contract tests in tests/test_workflow.py run when a pull
request changes the workflow. A dispatched run executes whatever is on
the default branch, and nothing in that path re-checks the boundary
before the first App token mint. scripts/preflight.py closes that:
it runs from the pinned assets checkout in the select job, before any
create-github-app-token step, and fails the run closed on drift.
Before the read mint it re-runs the workflow contract tests and
zizmor --persona auditor against the checked-out workflow files,
checks config/bot.json names one lower-case App slug and
config/fork-orgs.json maps to allowed fork organisations alone,
checks each credential has the shape of the thing it claims to be
without printing it, requires a commit-pinned and loaded allow-list
in block mode, and refuses a live run whose assets_sha differs from
job.workflow_sha. After the mint it compares the app-slug the
action returned with the configured slug, so another App's key wired
into this workflow fails rather than acts, and probes the token
against this repository to prove it holds no push, maintain or
admin. The publish job repeats the identity check on the fork
token before push and on the pull request token before open.
The same module, tests and step shape run in every bot repository of
the organisation; this repository's copy differs in the module it
imports for gh and the job names alone.
The organisation enforces commit signatures: one unsigned commit makes a pull request unmergeable. A GPG or SSH signing key on the author runner would sit next to the agent, which §4.1 rules out.
The publisher creates commits through the GraphQL
createCommitOnBranch mutation with the App installation token.
GitHub signs commits made this way with its own key and shows them
as Verified, attributed to the App's bot user. The author job's
local commits exist for the agent's benefit (its hooks run on them,
gitlint checks the message); the publisher re-creates each one from
its tree diff and message rather than pushing the agent's objects.
Consequences the implementation has to handle:
- Message composition. The publisher takes the subject and body
from the agent's commit, drops every agent-written trailer that
names a person (any
*-bykey: no human takes part in a session, and a signed commit must not claim one did), then appends theCo-authored-bytrailer for the assistant, Copilot, whichever model served it (§10.3), andSigned-off-by: <bot login>[bot] <id+login[bot]@users.noreply.github.com>. It rejects a subject over the repository's.gitlintlimit or lacking a capitalised Conventional Commit type. - File modes and symlinks.
FileAdditioncarries a path and base64 contents; it cannot set the executable bit or create a symlink, and nothing in the mutation says it preserves the mode of an existing executable file. The Git Data API can set modes, but commits made through it carry no signature, which defeats the purpose. An unsigned fallback push would produce an unmergeable pull request and more work than it saves, so the publisher rejects a bundle in which any commit adds or changes an executable file, a symlink, a submodule, or any file mode; any edit to an existing executable file counts, even one that keeps its mode, and a deletion passes. It checks each commit against its parent, so a later commit that undoes such a change does not save the chain. The prompt states the rule in those terms, tells the agent to leave executable files untouched and to abstain when a change cannot avoid editing one, and to check every commit withgit log --rawbefore handing back, rewriting the commit that introduced any finding (§7.3). For other steps the replay cannot take, it tells the agent to leave them out, complete the rest, and open the pull request body with anINFObanner listing the follow-up a human has to make. - Renames become a deletion plus an addition. Git history shows the rename through similarity detection as usual.
- Sequencing and rollback. The publisher creates the branch at
the agent's recorded base SHA, then replays commits in order,
passing each result as the next
expectedHeadOid. A failure after a confirmed create (a mismatch, a transient API error, a failed pull request call) deletes the branch before the step fails, since a half-built branch would count as a prior attempt (§6) and keep the issue out of every later run. A create that failed without a clear answer deletes nothing: the branch may have existed before, and a stray branch costs a human a look while deleting another's work loses it. A delete that finds no branch counts as clean. A pull request that exists despite a failed call keeps its branch, and so does one whose existence the publisher cannot confirm either way. The result recordspublish-failedwith the reason and whether the branch came off. - Transient failures. A
5xxor a timeout on a branch write is ambiguous: GitHub may have applied it and lost the reply. Each such write goes throughwrite_with_recovery, which reads the write back before deciding (issue #100). A commit whose branch still sits at itsexpectedHeadOiddid not land and goes again from the same head, since the compare-and-swap refuses a second copy should the first arrive late; a head one commit on, with that commit's parent, tree and message, is the commit landing, taken without a second copy; any other head, a vanished branch, or a read-back that fails, fails the replay as before. The fork sync is idempotent and retries a5xx, or one of gh's status-less wordings (bot_github.TRANSIENT_WORDINGS), on its own backoff, and records the incident even when the sync then ends on a tolerated409or422. A create read back as the branch at the base counts as created, but not as this run's, since a branch standing there before reads the same: a later failure keeps it, as for any create without a clear answer. A delete read back as no branch counts as done. A create or delete not found goes again. Every write recovered this way adds a line to the result'swarnings, so the report shows the incident the run rode out. - An existing branch. The publisher never deletes a branch it did
not create. The one existing branch it moves is a closed attempt's,
when an operator named its issue again (§6) and not otherwise. The
selection then records the closed pull request it admitted the issue
past as
retry_of, whichcheck.jsoncarries from the trusted selection; a scan never sets it. The publisher reads every page of pull requests from that branch on the target: the bot opened each, a human closed each unmerged, and the branch still sits at the head of the oneretry_ofnames. Nothing there postdates the bot's own work, and the closed pull request keeps those commits. The publisher then moves the branch from that checked head to the base withupdateRefsandbeforeOid(the §20.3 compare-and-swap), so a push after the check is never overwritten, and records a warning naming the pull request. A head that moved goes to the adoption test below and is otherwise a conflict; a move that did not apply fails the publication and keeps the branch. A replay that fails after the move does not delete the branch, which this run did not create: the publisher moves it back to the closed attempt's head by the same compare-and-swap, from the head the run left, so a later named run can retry. The publisher reads that head back from the branch, since a commit can land and lose its reply: when the branch holds a leading part of the replay's chain, by the adoption test below, and at least the commits whose reply arrived, its tip is the head; otherwise the head is the last commit whose reply arrived, or the base. A push since the move makes that refuse, and the branch stays untouched. It adopts an existing branch as the run's own earlier work on one condition: the whole chain is what the replay would have made. That means based on the recorded commit with no other history, the same number of commits, and each commit with one parent (the one before it), the tree the offline check recorded, the bot as author, a Verified signature and the checked message. Neither a matching final tree nor matching messages is enough on its own: anyone with push access, or a stale run, could produce either with other content. A pull request counts as the earlier attempt's when the bot opened it from the target, and never otherwise. The result reports an adopted branch without a new pull request, or inpull-requestsmode opens the pull request an earlier attempt never opened; the outcome comment's marker keeps any comment from repeating. Any other existing branch is a rejection. A maintainer may delete the branch after a merge, though, so before any write the publisher re-reads the issue and every pull request from the branch (§8 step 8) and refuses on a closed issue or a pull request another run published meanwhile. - Payload size. GitHub does not document the mutation's request limit. The publisher caps total added bytes at 4 MiB and rejects binaries over 512 KiB; the rollout (§15) confirms the cap holds. The composed pull request body, provenance included, must fit GitHub's 65,536-character limit, checked before any write.
The select job holds an App token with issues: read,
metadata: read, issue-fields: read and issue-types: read
across the organisation. It builds a candidate list and writes
selection.json.
No new-issue scans. No run scans the organisation for new
issues. A run names its work: issues to work, pull_requests to
revise, or revise_only to revise the bot's open pull requests with
work outstanding (§20.1). The reusable workflow's input check refuses
a run that names none of them, before the select job reads anything
or mints a token, and the selector refuses it again, so a caller that
skips the check still scans nothing. The candidate, ranking, category
and one-per-repository rules below describe the scan the selector's
code still holds, unreachable behind both refusals; they stay
documented until that code goes, and §17 records why the scan
stopped. The rules for named issues ("Explicit issues") and for
revision rounds (§20.1) govern every run.
Candidate. An open issue (not a pull request) in a public,
non-archived, non-template, non-fork repository of the target owner
(the author job clones without a credential, so private and
internal repositories cannot take part), whose repository is not on
the exclusion list and is not .github (unless
include_dotgithub), and which:
- has a Type (triage has run);
- has no
question,breaking-changeorchorelabel; - has no
no-agentlabel (a human opt-out, per issue); - has an author whose
author_associationisOWNERorMEMBER, and who is not an App or bot, or carries theagent-approvedlabel, a maintainer's opt-in. Triage gives anyone's issue a Type, so any other author (COLLABORATOR,CONTRIBUTOR,FIRST_TIMER,FIRST_TIME_CONTRIBUTOR,MANNEQUIN,NONE, or an association that is absent or unreadable) needs the label.no-agenttakes precedence: the selector skips an issue carrying both labels. The search payload decides before any per-issue read, the direct read decides again with the final word, and a skip counts once, underuntrusted_author. Every site calls one helper,issue_authors.admits, so the sites cannot drift; - has an author on the run's issue author list and, when anyone edited its body, a last editor on it too (see "Listed issue authors" below);
- has no assignee: an assignee means a human has claimed the work;
- has no pull request, open, closed or merged, from its
code-monkey/issue-<n>branch in the designated bot fork (§4.3: the workflow already tried, or a human declined the result); a pull request from a same-named branch in any other repository does not count, since anyone can open one, and the lookup names the fork organisation in itsheadfilter so that such pull requests cannot push the bot's own off the page; - has no other open pull request linked to close it.
Ranking. Priority Urgent, then High, Medium, Low; issues
with no Priority sort last. Within a priority, older created_at
first.
Categories. A scan worked an issue when the caller enabled any of its categories; no input sets them now. Categories follow the labels triage applies, with the issue Type as a second signal for bugs and features:
| Category | Label | Or Type |
|---|---|---|
bugs |
bug |
Bug |
features |
feature |
Feature |
docs |
documentation |
|
ci |
CI |
|
code_quality |
code-quality |
|
refactor |
refactor |
|
performance |
performance |
|
other |
none of the above |
Security, Scorecard and aislop work arrives with the security
report (§16): those findings are not issues triage labels, so a
category switch for them would select nothing until then.
One issue per repository. After ranking, the selector keeps the
first issue seen for each repository and drops the rest. Two agents
in one repository would race on main and on the toolchain cache;
one agent working two issues would juggle branches and widen the
blast radius of a mistake. The rest of that repository's backlog
waits for the next run. A repository whose pull request takes a
revision round (§20.1) gets no new issue in the same run, since
revisions come first and take the repository. Each skip counts under
one_per_repo and lands in skipped_issues with a reason naming
the repository and a chosen field naming the entry that took it;
the summary then shows what waited and for what. The rule does not
bind revision rounds: each round is its own job with its own
checkout of the default branch head and one fork branch, and two
rounds of one repository share no state, so every bot pull request
with work outstanding gets a round within the cap. Two such pull
requests may conflict at merge time whatever order the rounds take,
and the round after the first merge resolves that (§20.2).
Cap. The first max_pull_requests survivors form the selection;
each yields at most one pull request, so the value bounds the pull
requests a run can raise. 0
lifts the cap as far as the Actions matrix limit of 256 jobs, which
the selector applies itself so a broad run degrades to a bounded
selection instead of failing at matrix expansion. A second bound
holds the serialised selection under 12 MiB, inside the 16 MiB the
verifier accepts, since 256 entries at the per-issue body and
comment caps would otherwise exceed it.
The revise_only scan. A revise_only run (§9.1) is the one
scan left: it revises the bot's open pull requests with work
outstanding (§20.1) and reads no issue, so no candidate, ranking or
category applies, and it runs under the full max_pull_requests
cap, revising every pull request of a repository with work
outstanding. Nothing schedules it: an operator dispatches it, so a
published pull request's findings, failing checks and maintainer
comments that arrive after the continuation loop ends (§20.6) wait
for that dispatch. A revise_only scan names nothing: the input
check refuses it beside issues, in a mode other
than pull-requests, or with revise off. Beside named
pull_requests it changes nothing, since a named run scans nothing
and works what it names and nothing else.
Overlapping runs. Scans share one concurrency group, but a live
dispatch naming issues or pull_requests locks on its own run
(§11), since a group built from its target list would pass GitHub's
400-character limit. So nothing stops a revise_only scan from
running beside a named dispatch, or two
dispatches beside each other, and both can select one issue or pull
request. One of them is then wasted: a revision stands down at the
author job when the other has already pushed (§20.2), and a new issue
spends a whole session the publish job then refuses. Before it
selects, the select job lists the caller workflow's other runs that
are in_progress or queued, with the native token, which holds
actions: read and checks: read on the caller repository the runs,
their artifacts and their check runs live in; a caller grants both.
For each it reads the monkey-evidence-* artifacts that run's
select jobs published, found through every page of that run's
own artifact listing: the name must carry the run's id and the
listing must name the run as its producer. A run id and an upload
digest prove which run uploaded an artifact, not which job, and the
untrusted author job holds that run's Actions runtime token (§4.1),
so it can upload a look-alike whose name, producer and digest all
check out. An artifact counts when a select job of that run vouches
for it, and not otherwise. After its upload, the select job prints one
::notice titled monkey-evidence-vouch naming the artifact, its id
and the digest upload-artifact reported, and the check reads the
check run annotations of the run's jobs named Select, or
<caller job> / Select, that succeeded, in every attempt. No job
holds checks: write, so a job's own workflow commands alone
annotate its check run, which must carry one such notice,
no more, for the job's own run and attempt; a job with none, or with
two or more, vouches for nothing. The check reads annotations rather
than the job's log: the API serves them itself, while a log
download redirects to a rotating storage host that the block-mode
egress allow-list refuses, which would leave the check failing open
on every run. The check disregards evidence no select job vouches
for, or whose id or digest differs from the vouch, with a
::warning:: naming it, and that
evidence holds nothing, so a forged or unverifiable artifact can
never make selection skip work:
the worst it costs is the duplicate attempt the publish job's locks
and compare-and-swap already stop. The zip's bytes must then match
the vouched digest. Every
attempt's evidence counts: a rerun of failed jobs may reselect one
caller leg while another leg's author jobs retry on its first
selection, and no name ties evidence to its leg, so a full rerun's
superseded selection holds a little longer rather than a leg's work
going unheld. That run holds every issue and pull request in its
selection.json, a revision's issue and its pull request both,
unless the selection is a dry run or a select-mode run, which
publish nothing. The selector skips a held
target, named or scanned, ahead of the cap, the budget and the
one-per-repository rule, counts it under held and records it in
skipped_issues with a reason naming the run that works it, so the
summary shows it like any other skip. A target the operator named
(issues or pull_requests) is not routine: its reason names the
holding run and ends ; not worked, the select job prints a
::warning:: naming it and that run, and the selection summary and
the run report list it under "Named targets not worked", so no one
mistakes a dispatch whose every target another run held for work
done. The run still ends green. The report reads those entries
from unreviewed-heads.json, the select job's vouched file it already
validates, which accepts that reason beside the unreviewed heads';
report.json lists them as named_not_worked. The running round's
publish job also reads the comment a held dispatch meant to answer
(§20.6 "Comments the round never read"). The selector records a round
under its pull request, whichever of its numbers another run holds,
and passes over it before reading its packet: a named round by the
pull request it names, a scanned round by the pull request and issue
its ranking reads, and a named round whose issue alone another run
holds after building it. A held scan target frees its
place for the next candidate, so the run may work a second issue of
the repository the other run works in. A run whose select job has not
finished has published nothing and holds nothing, so two runs that
select at nearly the same time would both pass the check. The run
id breaks that tie: before it applies holds, the check lists the
other in_progress runs with a lower id and polls each one's jobs
every 10 seconds until every one of its select jobs, in every attempt
and caller leg, has finished: a select job vouches in its last step,
so a finished one has vouched or never will, and one that succeeded
says nothing of another still running. A wait cut short by the shared
bound may last 0 seconds, and the summary records it all the same.
Those waits share one five-minute bound of their own, beside the check's
deadline below, and both sit well inside the select job's 20 minutes.
At the bound, or on a failed read of its jobs, the check stops
waiting for a run still selecting, warns with a ::warning::, and
that run holds nothing unless it has vouched by the time the check
reads it; the summary records the time already spent either way, and
for a wait cut short it states what that run holds once the check has
read its evidence (the wait ended before it finished, and it holds nothing, or the count of targets a select job had already vouched
for).
The check does not wait for
a run with a higher id, since that run waits for this one, and a
queued run holds nothing until it starts.
The selection summary records each wait (waited 20s for run <id> to publish its selection), and selection.json carries the same lines
as overlap_waits. The publish job's re-read (§8 step 8) still covers
what the tie-break cannot. The check fails open: a run listing,
an artifact listing, a job listing, a select job's annotations, a
vouched
artifact missing from the listing, a download, a digest or a
selection that fails prints a ::warning:: and holds nothing for
that run, even where its
other evidence read cleanly, or for every run when the listing fails,
and selection proceeds as before.
A run past its report holds nothing: before it reads a run's
evidence, the check lists that run's jobs with filter=latest, and
when they include a job named Report, or <caller job> / Report,
every such job has started (in_progress or completed, any
conclusion), there are no fewer of them than Select jobs, and
every Select, Author (…) and Publish (…) job has completed, the
run holds nothing. The report job needs every publish job of its
leg, so such a run has nothing left to write to any target; a caller
that calls the reusable workflow more than once holds until every
leg is past its report, never released by one leg's report while
another still publishes;
the parent of a continuation (§20.6) is past its report by
construction, since its continue job needs the whole call. The
listing is filter=latest, never filter=all: it lists the jobs of
the run's latest attempt, where jobs the attempt did not re-run
appear as finished copies and a job it will re-run appears
once GitHub creates it. So a re-run that publishes again holds until
its own report starts, and a re-run of the continue job alone
holds nothing; filter=all would show an earlier attempt's finished
report while a later attempt still publishes. A job listing that
fails warns and that run holds nothing, as above. Job names and
states come from GitHub, which takes the names from the trusted
workflows, so the author job can change neither.
The whole check runs under one
five-minute deadline, well inside the select job's 20 minutes, since
a stalled download alone may take five: past it the check warns, the
runs read in full still hold and the rest hold nothing. The check
saves wasted work and no more; the publish job's locks and the
compare-and-swap (§11, §20.3) remain the safety net.
scripts/run_overlap.py holds the check, and scripts/overlap_wait.py
the tie-break wait and the run listing both share; each reads at most
20 other runs.
Guidance ref. guidance_ref may name a branch, a tag or a
commit. The selector resolves it to a commit, following an annotated
tag, and refuses a ref whose target is anything but a commit, so the
recorded provenance always names the commit whose AGENTS.md the
agent read.
Excluded repositories. The select job hands exclude_repos to
list-splitter-action
before the input check and the read mint: it splits on commas and
whitespace, drops repeats without regard to case, and must hold bare
repository names of org, every bad name reported before the run
fails. The splitter works offline and takes no token. The selector
receives the split list, never the raw input; it still checks each
name against [A-Za-z0-9_.-]+, so its own tests stand behind the
splitter's. The list binds the revise_only scan (§20.1); a named
issue or pull request is the operator's choice and waives it. The
repositories input, which once narrowed the new-issue scan, went
with that scan.
Listed issue authors. The issue_authors input, which the
dispatch caller fills from the repository variable
CODE_MONKEY_ISSUE_AUTHORS alone, lists the GitHub logins whose
issues the bot may work, split on commas and whitespace and matched
without regard to case. It adds to the association rule above and
does not replace it. It fails closed: the configuration pre-flight
(issue_authors.py check) stops the run before any token exists when
the list is empty or holds an entry that is not a user login, such
as an App's name[bot], and the selector refuses such a list again.
An issue passes when its author is a listed login that is not
an App or bot, and, when GitHub records an edit to its body
(lastEditedAt), its last editor (editor) is too, read through
GraphQL for every candidate in the same reply as the body the packet
carries, so the editor checked is the one of that body; a deleted
or non-user editor never passes, and an unreadable edit state
counts as edited. GitHub keeps no editor for a title edit, so the
rule covers the body alone. The rule binds every way in, the scan,
a named issue and a revision round, named or scanned, and counts a
skip under author_not_listed or editor_not_listed. The issue
comments the agent reads (comments, and a round's new_comments)
keep those from a listed author alone, on top of the association
filter, and an issue comment brings a revision round, or resumes one
after a handoff, when it comes from a listed author (§20.1); a
pull request's comments and review threads keep the association rule
alone. The only_known_authors input, filled from the repository
variable ONLY_KNOWN_AUTHORS alone, gates the rule: unset, empty or
true applies it as above; false turns it off, so the list goes
unread and none of the checks in this paragraph or §20.1 applies,
while the association rule and the OWNER/MEMBER comment filter
stay; any other value, compared after trimming whitespace, fails the
same pre-flight. The error for a missing or malformed list names
CODE_MONKEY_ISSUE_AUTHORS and says to populate it, never to set the
flag. With the rule off, pre-flight emits a warning, and the step
summary states the mode on every run. The selection records the
mode as only_known_authors and the list as
issue_authors, and the publisher re-checks each entry against it,
offline in the proposal check, live in the step 8 re-read and live
again before the pull request opens (§8 steps 8 and 9), and an edit
made while the session ran stops publication. A revision re-reads it
live before each write to the target: the retitle, the push, the
replies and description a proposal or a handoff writes (§20), and
the Copilot review request with its notice (§8 step 10). The
outcome comment re-reads it live too, whatever the outcome (§8 step
12), and so does restoring a title after a failed push (§20.3). A
refusal by the list
sets author_unlisted in result.json, and no step writes to the
issue for it, the comment included. The publisher never resolves the
flag itself: it reads the selection's record, where a JSON false
alone turns the rule off, so a record without the field keeps it
on.
Explicit issues. When issues names one or more issues, the run
works those and scans nothing. The splitter accepts repo#N,
owner/repo#N, repo/issues/N and the issue URL, refuses a
reference to another owner, and publishes each as owner/repo#N;
the selector reads that form and nothing else. Naming an issue is an
operator's decision, so the triage signals do not apply: no Type,
label, assignee or category filter, no association rule, no ranking, and
no one-per-repository rule, since the operator chose the set. The
summary lists the author association of each named issue admitted:
the operator sees whose issue they approved. What
remains is what the pipeline cannot work around: a repository the
author job cannot clone or the publisher cannot fork (archived,
template, fork, non-public or empty), a closed or absent issue, a
number that names a pull request, the no-agent opt-out, an
author or last editor off the issue author list, an open or merged
bot pull request from an earlier attempt, and an open pull request
linked to close the issue. A bot pull request a human closed
unmerged does not exclude a named issue: the operator decided to try
again, and the run works the issue afresh on the same
code-monkey/issue-<n> branch, which the publisher resets from the
closed attempt's head to the base (§5 "An existing branch"). A merged one
does: the work landed, and redoing it takes a new issue. An open one
becomes a revision round where §20.1 allows, and a skip otherwise.
The publisher re-makes these checks, on a scan and a named run
alike, before it writes (§8 step 8): the selection's reads may be an
hour old by the time the author session ends.
A named run reads each distinct repository on its own and never
lists the owner, so an owner at the listing ceiling can still have
an issue named; a skip never stops the issues beside it, while a
permission, rate-limit or server failure still fails the run. The
selection records every named issue it skipped with its reason, in
skipped_issues, naming the earlier pull request and its state
where one is the cause, and the summary lists them, so a maintainer
who named five issues and sees three in the matrix learns why. An
issues list given but naming no issue, such as separators alone,
is an input error rather than a scan, and fails before selection.
The read mint scopes to the issues' repositories plus the guidance
repository.
The token action finds the installation through the first repository
in that scope, so a step before the mint reads each named repository
with the native token and keeps the ones GitHub reports as existing
and public, since that token also reads the private caller
repository, which the App installation may not cover; a run whose named
repositories all fail that read stops there.
Outputs. selection.json lists, per chosen issue: repository,
number, title, body, Priority, Type, labels, created_at, the
main HEAD SHA observed at selection time, and the comments that
pass the filter below. The job publishes the artifact ID and a
SHA-256 of the file as job outputs. It also publishes a JSON matrix
for the author job.
Comments. Comments often carry the clarification the body
lacks; they are also where a passer-by can address the agent
directly. The packet includes a comment when its
author_association is OWNER or MEMBER, in order, up to 20
comments and 64 KiB in total, and drops the rest with a count of
what it dropped. It reads at most three pages of 100 comments,
oldest first, stopping once the count fills, and records
comments_truncated when newer comments went unread, so a long
thread cannot exhaust the select job. The issue body itself is always present: external
reports are the point of the exercise, and the prompt treats every
body as data rather than instruction.
Previous rejection. When the bot's latest outcome footer on the
issue says rejected, the select job reads that run's publish
result (result.json, section 18.4) from the caller repository with
the run's own token (github.token, actions: read), since the App
token may not reach it, and adds its reasons to the entry as
previous_rejection under a fixed heading: at most 10 reasons, each
cut to 2,000 bytes and 8 KiB in all, counted as selection.json
serialises them, escapes included, with a count of what it dropped.
The records count against the selection's 12 MiB budget like the
entries do: one that would overrun it keeps a note and drops its
reasons. The prompt asks the agent to address each reason first. The
read fails soft: a run in another repository, a missing, ambiguous or
expired artifact, a download the bounded fetch refuses, or a result
too deeply nested to parse leaves a fixed note in place of the
reasons, and selection goes on; the select job replaces a lone
surrogate in a reason rather than fail on it. A history
longer than the round reads span, or a failed read of it, adds
nothing. The reasons quote the refused proposal, so they are data,
like the issue body.
One matrix entry per selected issue, max-parallel set from
max_concurrent_agents, timeout-minutes set from
max_runtime_minutes plus twenty minutes of setup slack. Actions
expressions cannot add, so the select job computes both budgets and
publishes them as outputs. Hosted runners cap a job at 360 minutes,
which bounds max_runtime_minutes at 330.
- A clone of the target repository at the SHA recorded in
selection.json, made without credentials. - The issue packet for this single issue: title, body, labels,
Priority, Type, filtered comments (§6), extracted from
selection.jsonand a per-issue fetch made in the select job. - The organisation
AGENTS.md, fetched in the select job fromlfreleng-actions/.githubat a commit SHA the select job records, and carried in the evidence artifact. The author job does not fetch it live. - The repository's own
AGENTS.md, if present, read from the checkout. - The prompt (
prompt/author.md), from this repository's checkout at the reusable workflow's pinned SHA. - A placeholder git identity,
Code Monkey <code-monkey@example.invalid>, which the packet step configures in the checkout, plainly not an account: the publisher replaces every*-bytrailer and authors each commit as the App (§5), so the local identity need do no more than pass the target's hooks. The App's own sign-off runs to 113 characters and fails gitlint's B1 in a target whose.gitlintlacks the organisation's trailer exemption; the placeholder's fits within 72 columns. The runtime context names it as a placeholder, and the bot identity never reaches the author job's git configuration.
Pinned @github/copilot@1.0.112 on Node 22, in
tools/copilot-cli/package.json. Triage verified 1.0.80; this
workflow needs --usage-output-file, which 1.0.80 lacks and 1.0.83
first provided.
The CLI and aislop install with npm ci from the lockfile committed
under tools/copilot-cli/, read from the verified assets checkout,
into $RUNNER_TEMP/copilot-cli, outside anything the session reads.
The lockfile pins the whole dependency tree by integrity hash, so a
run never resolves a package from the registry and two runs on one
commit install the same tree. Its .npmrc refuses install scripts,
and Dependabot bumps the pin after a seven-day cooldown.
cd workspace && copilot --prompt="$prompt" --model="$MODEL" \
[--fusion-tier="$FUSION_TIER"] \
--mode autopilot --no-ask-user \
--no-custom-instructions --disable-builtin-mcps --no-auto-update \
--allow-all-tools \
--deny-tool="$deny" \
--add-dir "$artefacts" \
--secret-env-vars=COPILOT_GITHUB_TOKEN \
--log-dir="$artefacts/copilot-logs" \
--usage-output-file "$artefacts/usage.json" \
--share="$artefacts/session-summary.md"
The workflow adds --fusion-tier when MODEL is fusion and at no
other time (§10.3). --help leaves the flag out in 1.0.112, as in
1.0.114 and 1.0.115-8, but the CLI parses and validates it: a value
other than standard, high or max fails, and so does the flag
beside a model other than fusion or auto. A later CLI pin
re-checks that it still parses, as for the sub-agent tool names
below.
The working directory is the target checkout; --add-dir grants
the artefacts directory, where the agent writes its manifest and
the workflow keeps the prompt, packet and guidance.
--no-custom-instructions stops the CLI loading instruction files
from the checkout on its own terms. The prompt injects the org
AGENTS.md text directly and asks the agent to read the local stub.
That keeps the trusted copy authoritative and pinned.
The CLI's skill tool runs skills it finds in the working
directory's .github/skills. Skills are code the agent runs, and
the checkout is content the agent is there to change, so that trust
is off by default: $deny includes skill unless the caller sets
load_repo_skills. The input exists for dispatch against a
repository whose skills a maintainer has read. It never applies to
content from outside the target repository; the workflow checks out
the default branch of an organisation repository and nothing else.
gh and git push stay denied. The agent has nothing to
authenticate with, and a call that fails looks to the model like a
bug to work around. The prompt says the workflow opens the pull
request.
--allow-all-tools is the honest setting given §4.1. The deny list
holds what the agent must not attempt rather than what it cannot do.
allow_subagents=false adds task to the deny list. In
@github/copilot@1.0.83 that is the tool which spawns sub-agents;
list_agents, read_agent and write_agent manage custom agent
definitions and go on the same list. A later CLI pin re-checks these
names against --available-tools output.
Two sources give the agent its instructions, and they do not overlap:
- The task, in
prompt/author.md: which issue, the tractability test and when to abstain, the branch to work on, the manifest to hand back, and the facts about this workflow that no organisation document can know. - How to make a change that can merge, in the organisation
AGENTS.md(§7.1) and the target repository's own stub: commit messages, atomic commits, tests, hooks, theaislopgate, licence headers. The prompt names these sources and does not restate them, so a change to organisation policy reaches the agent without an edit here. This repository's ownAGENTS.mdrecords that rule for future contributors to the prompt.
The workflow facts the prompt adds, four in all:
- Signing. The agent commits with
git commit -sand no-S: the runner holds no signing key, and the publisher's replay signs the commits and appends the Copilot co-author and the bot's sign-off (§5). The local identity is the placeholder of §7.1, which the replay replaces. - Replay limits. No added or edited executable file, symlink or
submodule, and no mode change: the publisher refuses any edit to
an existing executable file, even one that keeps its mode, and
lets a deletion pass. The agent leaves executable files
untouched, puts new code in new regular files run through their
interpreter, creates any link or submodule a test needs at run
time, abstains naming the file when the change cannot avoid
editing one, and checks
git log --raw <base>..HEADfor those modes in every commit before writing the manifest, rewriting the commit that introduced one rather than undoing it in a later commit, since the publisher checks each commit against its parent. At most five commits and 100 file changes per commit; under 4 MiB in total; a subject within the target's.gitlinttitle-max-length, or 50 where it sets none, as the publisher enforces (§8) even where the target's gitlint is looser; no change to a protected file, which the prompt names by class (agent instruction files, review and gate configuration, licences) with the examples §8 lists, abstaining and naming the file when the change cannot avoid one. Workflow files are in scope. Where the fix needs a step the replay cannot take, the agent finishes the rest and opens the pull request body with anINFObanner naming the human follow-up. - Publication and review. The agent cannot push, so the workflow
publishes its commits, opens the pull request, requests the
Copilot review, waits for it and reports its verdict. The review
arrives after the session ends and the agent never sees it; a
later session answers it in a revision round (§20), and a human
reads every round. So the prompt asks for a change
that passes review the first time: the agent reviews its own diff
as a reviewer would and names in the body what a reviewer would
question. It states the review-cycle steps that need GitHub
(requesting, waiting, replying, resolving) as steps the session
cannot take, and never tells the agent to skip them or that
something else takes them;
tests/test_workflow.pypins the prompt to the workflow's review steps. - Sudo and containers. The runtime context states
sudo and containers: availableornot available(§4.1). A session that expects either and finds neither would otherwise try to route around the failure, so the prompt tells it not to: it abstains, or leaves the step out and says so, naming.enable-sudo-and-containersas what a maintainer adds to the repository.prompt/revise.mdcarries the same rule for a round.
Both prompts also say, in Recording checks, how a session takes
the record commands holds on this runner; which checks a change
needs stays the guidance's. The exit_code is the check's own
status, never a pipeline's last stage. The session reads the whole
output of a non-zero exit, and a failure it expected accounts for
that exit once the session has excluded it and run the check again.
The session makes a hook the runner cannot run runnable where no
tracked file changes, and otherwise excludes it by id
(SKIP=<id>), runs the hooks again, runs its tool directly where it
can and names the exclusion in the pull request body; it never
excludes a hook that reported a finding. The last hook run listed is
the session's run over the files its commits change, after its last
commit, as it ran. The publisher marks a proposal whose last hook
run did not exit 0 and publishes it all the same (§18.2).
The publisher's mechanical checks (§8) do overlap the guidance on purpose: they are the gate that decides whether a proposal can merge, not a second statement of the policy, and they cover the subset a machine can judge.
The job runs git bundle create for the range from the base SHA to
code-monkey/issue-N and uploads changes.bundle,
manifest.json and usage.json as the proposal artifact for
that matrix entry, named with the namespace and the issue key. It
uploads the CLI logs and session-summary.md separately as the
session artifact. The publisher reads the proposal and never
opens the session artifact.
A cleanup step then deletes the CLI's spilled tool output, its
home directory and the checkout, under continue-on-error.
The author job runs harden-runner in audit mode, with sudo and
containers disabled unless the target opted in (§4.1). It needs the npm
registry for the locked toolchain tarballs, PyPI, GitHub, the
Copilot API and whatever hook repositories the target's
.pre-commit-config.yaml pins. A block-mode allow-list
that covers every repository's toolchain is a maintenance load this
design defers; the audit log records what each session reached.
The select, publish and report jobs run in block mode with the
organisation's allow-list from harden-runner-block-action, pinned
by commit in both callers, with allow_list_summary: 'true' on the
select job alone. block is the reusable workflow's default; a
caller may pass audit to diagnose a blocked endpoint. The dispatch
caller's options job runs in block mode too, loading the same
coordinate it forwards, without a token or a summary.
Each loader also passes the caller's supplemental allow-list, its unpinned flag and any inline extra endpoints, empty by default, so no trusted job blocks an endpoint the caller allowed. Naming a supplemental list makes it required, so a missing list fails at the loader rather than at the first blocked connection. The pre-flight pin check covers the baseline alone: a same-organisation supplemental may follow its default branch, a rule the action enforces.
A trusted matrix job over the same selection, after the whole
author matrix, that runs even when some author entries failed
(!cancelled() and a successful selection) so each issue gets a
verdict. Each entry holds the App key and mints tokens for its own
repository alone. A matrix rather than one sequential job because
GitHub exposes no per-entry outputs from a matrix job: the publisher
for an issue finds its proposal by the artifact name the author
entry used, which is acceptable because the publisher trusts nothing
in that artifact whatever its name, and step 1 cross-checks its
content against the verified selection.
For each selected issue:
-
Locate the proposal artifact by name (
monkey-proposal-<namespace>-<key>). A missing artifact recordsauthor-failedfor that issue. The evidence fileselection.jsoncomes by the select job's artifact ID and must match its digest before anything else happens.proposal_fetch.pythen fetches the untrusted proposal through the API rather thandownload-artifact, which would extract it before any size check: it refuses a zip larger than the sum of the file caps, streams it to disk under that limit, retrying a download that gets no reply or a transient5xx, checks the zip directory (entry count, regular files, per-file caps, stored or deflated and unencrypted) and extracts the manifest, bundle and usage files alone, each read with a hard stop. An artifact it refuses recordsauthor-failedthe same way, so every issue reaches a result, a comment and a report row. -
Verify the bundle.
git bundle verifyagainst a fresh credential-less fetch of the target at the recorded base SHA. The bundle's prerequisite must equal that SHA, the history must be linear, and the commit count ≤ 5. Manifest fields present, typed, and equal to the selection's repository, issue, base and branch, for every outcome, so an abstention or failure from the wrong artifact cannot land on this issue. Outcomeabstainorauthor-failedthen records and moves on. A small compressed bundle can hold enormous objects, so the publisher caps every read of its content: counts come before listings and object sizes before content, a commit message stops at 64 KiB, the binary check reads 8 KiB, and any read that passes its cap stops git and rejects the proposal. Every git process also runs under operating-system limits on memory, CPU time and file size, so a pack that inflates past them while git indexes it stops that process rather than the runner. Each git process leads its own process group, which a timeout or an oversized read kills whole, taking helpers such asindex-packwith it. -
Policy-check the diff across all commits: no executable files, symlinks, submodules or mode changes (§5); no path escaping the tree and every path valid UTF-8, since the API takes text and the check would otherwise see one name while the API creates another; at least one and at most 100 file changes per commit, the mutation's requirements; total added bytes under the cap; no addition, edit, deletion or rename of a protected path, as
protectedinproposal_policy.pydefines it. It covers three classes, since a change to one is the agent rewriting its own instructions or the checks it reports as passed:- agent instruction files: a file named
AGENTS.md,CLAUDE.md,GEMINI.md,copilot-instructions.md,SKILL.md,.cursorrules,.windsurfrulesor.clinerulesat any depth; anything under a.copilot,.claude,.cursor,.agents,.windsurf,.clinerules,.geminior.codexdirectory at any depth; and anything under.github/instructions/,.github/prompts/,.github/agents/,.github/skills/or.github/copilot/; - review and gate configuration:
CODEOWNERS,REUSE.tomland.gitlintat any depth, an.aislopdirectory at any depth, the zizmor configuration by the names zizmor discovers (zizmor.yml/zizmor.yamlat the root or directly under.github/), andSECURITY.md,.pre-commit-config.yaml(behind a switch, below),.zizmor.yml/.zizmor.yamland.enable-sudo-and-containers(§4.1) at the root; - licences: a file whose name starts with
LICENSEorLICENCEat any depth, and anything under aLICENSESdirectory.
Names and directories other than the licence ones compare without regard to case. A symlink in the base tree at a protected path protects what it points at, since editing the target changes what the protected name means. Before it classifies the diff, the check lists the base tree once (
git ls-tree -r) and resolves each symlink whose own path the rules cover, or that stands for a directory holding covered paths (.claude,LICENSES,.github), the way git stores it: relative to the link's directory, following every link on the way, up to eight. The check then refuses a change to the target, to a link on the chain, to the link itself, or to a path under a linked directory that the rules would cover under the link's name, and creating a missing target counts as a change. A link inside such a directory's target counts under that name too, and under every other name that leads to it, unless one name already protects everything beneath it. A link that is absolute, climbs above the root, loops or passes the bound makes the check refuse any change to the link, to each link it reached before failing (the one past the bound included), or to the first path each of them names, naming both. A link the walk reaches again is a loop when the walk has consumed nothing it held pending at that link's last expansion;a -> .followed ina/a/settingsis a finite hop. A chain past the bound is still followed until it ends or loops, and the path it ends at stays protected under the link's name; a chain of more than 4,096 links refuses every proposal. A link the check reaches through more than eight directory links protects its whole target, and so does every link inside that, so neither bound leaves a protected path editable. Links that alias each other under more than 4,096 names, counted as the check queues them, refuse every proposal. The check tests a changed path against the links before the names, so a rejection of a link names its target or why resolution failed. A checkout resolvesdir/..throughdir, which has to exist as a directory, so the check refuses any change at or under one a resolved link climbs out of with.., unless a link on its chain lies in that directory and holds it in place. A diff names a submodule it deletes, not the paths inside it, so the check also refuses a change at a path that holds a target, a pinned link or such a directory, and, under a linked directory, at a path whose name under the link would hold covered paths. A checkout also cuts a link target at its first NUL byte, so a target read while resolving that holds one refuses every proposal. Base-tree names and targets keep their bytes, so two links whose names differ in invalid UTF-8 stay apart. The rejection names the link as the cause, and a proposal cannot add a link of its own (above).protected_links.pyholds these rules. Changes under.github/workflows/setneeds_workflowsin the check summary; no token mint depends on it (step 6). Whether they pass is the entry'sallow_workflow_editsgrant (§9.1), which the selection records (§18.1): the run's switch, or theworkflow-edits-oklabel on the issue. The check rejects a new proposal that adds, edits or deletes a workflow file, naming the file, unless the entry grants it; an entry without the field takes the run's value, and a selection without either counts as off. A revision round may change the workflow files its pull request already changes and no other, whatever the switch says, unless the issue carries the label (§20.3). The root.pre-commit-config.yamlfollows the same rules under its own grant,allow_precommit_config_edits: the run's switch of that name, or theprecommit-edits-oklabel on the issue. It decides which checks the repository runs, so a change to it setschanges_precommit_configin the check summary, the check rejects it on a new proposal unless the entry grants it, and a revision round may change it when its pull request already does, or when the issue carries the label, and not otherwise. A proposal that changes it says so in the provenance block's summary line and in aLint gateline that names the label when the label granted it, and a reviewer reads every hook change. Each grant stands alone:workflow-edits-oknever unlocks.pre-commit-config.yaml,precommit-edits-oknever unlocks.github/workflows/, and neither unlocks any other protected file. A JSONtrueturns a grant on; a present value of any other type is off, and an absent field takes the run's switch.workflow_gate.pyholds these rules andworkflow_grant.pyreads both grants through the same functions.Every proposal then faces an online zizmor audit, the last part of the check (
online_audit.py), since the author job's offline run skips the audits that need the network, such asstale-action-refs. The check exports the base and the head into two worktrees side by side and runszizmor --persona auditor --min-severity informational--format json --collect=all --strict-collection .in each, online, with the native token alone inGH_TOKENand every other token andZIZMOR_*variable stripped. It runs whatever the proposal changes: zizmor decides what it collects, not the check, since a check that guessed which changes zizmor reads (nested workflow directories, anaction.ymlsymlink whose target changes) would let every wrong guess skip the audit unseen.--collect=allaudits tracked files a.gitignorewould hide, and--strict-collectionfails on an input zizmor cannot parse instead of dropping it. Both trees load the base's zizmor configuration (.github/zizmor.yml,.github/zizmor.yaml,zizmor.ymlorzizmor.yaml, first found) through--config, or none through--no-config, so a proposal cannot loosen the rules that judge it. A finding is new when the head holds more findings of that rule in that file than the base does, so findings that moved or that the change fixed never block; findings zizmor reports as ignored never count. New findings reject the proposal, naming each rule and file. zizmor's no-inputs exit (3) counts as no findings for that tree, which covers a repository with no workflow at all and a proposal that adds its first workflow or removes its last. Every other failure rejects: a missing token or binary, a timeout, another exit outside zizmor's finding codes, or output that is not a JSON list. The publish job installs zizmor with the select job's steps, from the version inconfig/zizmor-version.txtthat both jobs and CI read, before the proposal lands in its workspace. - agent instruction files: a file named
-
Check the message of each commit against the rules the org guidance makes mechanical: subject length from the target's
.gitlint(fallback 50), capitalised type from the allowed list and a capitalised description, as the organisation's gitlint rule requires, no trailing punctuation, blank line after the subject, body lines ≤ 72 outside URL lines, and valid UTF-8 throughout, since the API takes text. Compose the trailers (§5). -
Resolve the fork organisation. The matrix entry names it; the step requires it to match the bot pool pattern, to differ from the target organisation, and to equal what the committed mapping (
config/fork-orgs.json) resolves for the target's owner. It then reads, with the native token, whether the public fork exists; the forks job has readied it by now (§4.3). Dry-run andselectmode go no further than this step. -
Mint a fork token on the fork organisation's installation, once the fork exists:
repositories:the barerepo_namewithcontents: write,metadata: readandworkflows: write, since the step 8 sync can fast-forward over upstream workflow changes (§4.3). No mint in the pipeline requests Administration. A missing fork gets no token; the push then fails that issue before any read, naming the forks job. -
Mint a pull request token on the target organisation's installation for that repository alone, with
pull_requests: writeandmetadata: read: the one token in the pipeline that can write to the target.pull-requestsmode, for a proposal or a handoff, alone. The mint runs ahead of the push so a revision can set its title first (§20.3); the push step itself holds the fork token alone, andopenandrespondwait for the push to succeed. -
Push to the fork. First re-read the issue with the fork token, since the target is public and an author session may take an hour: its state and labels, every pull request in any state from
<fork-org>:code-monkey/issue-<n>on the target, and the open pull requests linked to close it (issue_recheck). A closed issue (the reason names the pull request or commit that closed it, from the timeline), ano-agentlabel, an author or last body editor off the selection'sissue_authorslist, unless the selection recordedonly_known_authorsfalse (§6), an open or merged pull request from the branch, a closed one the entry'sretry_ofdoes not name, or another linked open pull request is arejectedverdict with no write to the fork, as for a revision whose pull request closed (§20.3). The one open pull request it lets through is the bot's own carrying this proposal's chain: a rerun after an earlier attempt opened it, which the adoption below records. The re-read takes the fork's name as GitHub holds it now: a fork kept from before a rename of the target carries the old name until the forks job renames it, so the re-read finds it by parent as that job does and counts its pull requests and chain under that name. A read by name that GitHub redirects to a renamed fork takes the name its reply carries. A failed read is a failed step: nothing publishes on trust. Abranchesrun makes the same reads. Then require the fork (§4.3), sync its default branch, createcode-monkey/issue-<n>there at the base SHA (an existing branch is a rejection unless it holds this proposal's own chain, or is a named retry's closed attempt the publisher resets to the base, §5), then replay commits per §5. The sync, the create, each commit and a rollback's delete ride out a transient5xx: each reads itself back and goes again when it did not land (§5). -
Open the pull request (
pull-requestsmode) against the default branch with head<fork-org>:code-monkey/issue-<n>: title from the manifest (equal to the subject on a single commit, enforced); a body the publisher heads with its ownCloses #<n>line and a provenance block (run URL, model, issue link, commands run, the AI authorship disclosure, and the statement of how a later round answers review findings, §11.6 of the organisation guidance), which nothing the agent writes can precede, hide or turn into code, so the merge closes the issue and the disclosure always shows; after the block, when the manifest's last hook run did not exit 0 (§18.2), one line of the publisher's own naming that command, in a code span escaped as a provenance table cell, and its exit code, so a failing run shows outside the collapsed block; then, below a rule, the manifest's body with@mentionsdefused, so agent text cannot notify anyone before a human reads it; labelcode-monkeyif the label exists. Not a draft: a ready pull request notifies code owners, and a draft does not by default. Opening it does not bring a Copilot review: GitHub's documentation limits ruleset-driven automatic review to pull requests "created by a Copilot user", and this App is not one, so a target'scopilot_code_reviewruleset leaves a bot pull request unreviewed; step 10 asks for one. A422that says a pull request already exists, when none of the bot's own is open from the branch, is arejectedverdict, as at step 8: someone else got there first. Before the call the step re-reads the issue's author and last body editor against the §6 list, since someone may have edited the issue after the push: a refusal is arejectedverdict markedauthor_unlisted, and a read that fails ispublish-failed; both keep the fork branch and open nothing. Any other failure here keeps the fork branch and recordspublish-failed, since a pushed branch is not a publication; the next run's selection sees the orphan, selects the issue withresumeset, and its publisher adopts the branch and opens the pull request. -
Request the Copilot review (
request_review, on by default) with the review token (§10.4) when the caller passes one, and with the pull request token otherwise, as onerequestReviewsByLoginGraphQL mutation, run once, for the pull request'snode_id, withbotLogins: ["copilot-pull-request-reviewer[bot]"](the input takes the[bot]suffix) andunion: true, so it adds the bot to the reviewers already requested and sends no user or team.gh pr edit --add-reviewer @copilotis not used:ghsends the same mutation withunion: false, replacing the whole reviewer set from a read it made first, so a stale read drops the CODEOWNERS team request. The mutation selects nothing butclientMutationIdand its reply is not read: reading the pending requests back resolves therequestedReviewerunion for each, and theBase Protectionsruleset requests a team on every pull request, which needs organisation Members: read to resolve. The review token lacks it (§10.4), so GitHub applies the mutation and still answersFORBIDDEN. From the App's installation token GitHub can accept the mutation without adding the reviewer, so the step verifies the request through the issue's events (issues/{number}/events, every page), which the token can read. Before the mutation it reads them and notes the newest event id; after the mutation, with or without an error, it counts the request as sent when areview_requestedevent naming the BotCopilot(or the reviewer's own login) has a newer id, so an earlier round's request never counts and no clock comparison enters. A Copilot request already pending when the step starts counts too: its newest request event is a request, not a removal, and is newer than Copilot's newest review. When the step fails to read the reviews before the mutation, it retries this check, against the events it read then, on each read after it: an additive request for a reviewer already pending may add no event. A Copilot review of the published head counts as well, since a fast review clears the pending request. A review of an earlier head proves nothing, since a revision round always has one, and with no published head recorded no review counts. The events lag the request, so the step reads the events and the head review again after 2, 4 and 8 seconds, as the revision publisher reads a lagging head, before it calls the request refused. Neither of the obvious reads can serve: RESTrequested_reviewersnever lists the Copilot bot as pending (it lists the ruleset's team alone), and GraphQLreviewRequestsneeds the team resolved, which the token cannot do; the step reads the REST list for its log line and nothing else. When no proof holds, a mutation error is a refusal with GitHub's message; otherwise a failed read is a refusal that names it, and a missing request is a refusal too. A failed read of the pull request before the mutation sends nothing and is a refusal. The request is best effort: a refusal becomes a warning inresult.jsonwith GitHub's answer, a line in the job log and a::warning title=Copilot review request::annotation on the run, in the publisher's own words with GitHub's text defused, and anINFOnotice at the top of the pull request body, placed once with the same token and taken down by a retry whose request succeeds, so a maintainer reading the pull request knows whether the workflow requested a review; the issue comment and the report (pending (not requested)) say so too. The publish goes on, and no token gains a permission for it. A request that lands logs the reviewers the REST read listed, which never include Copilot. Either way the log names the credential that asked,review tokenorApp token, never the token, so a lapsed or revoked review token shows as a refusal under its own name. The App's token cannot add the reviewer (§17 item 4); the review token can, and this step alone holds it. Before any of it the step honours an outcome markedauthor_unlistedand otherwise re-reads the issue's author and last body editor against the §6 list, since someone may have edited the issue after the push: a refusal marks the resultauthor_unlisted, and a read that fails warns; either sends no request and places or removes no notice, records the request as not made, and leaves the publication standing. -
Await the Copilot review with the job's own token, since the target is public: poll for a review by
copilot-pull-request-reviewer[bot]whosecommit_idis the head the publisher pushed (the last commit of the replayed, or adopted, chain; the publisher reads the pull request's current head to confirm it, never to choose it), read the pull request's unresolved review threads through GraphQL, and classify the pair by the organisation definition (AGENTS.md§11.5) in a pure function with offline tests built from real review bodies: clean when every thread has a resolution, the overview lists no suppressed finding and no finding on code unchanged since the last review (a section Copilot writes in the body alone and opens no thread for, above which the body says "No open issues"), and the assessment is🟢 Approval recommended(🟢 Ready to approvein older reviews) or🔵 Needs a closer look; findings otherwise,🟡 Changes recommendedand the older format with no assessment included; pending when no review of the head arrives within the wait, whose reason states how long polling ran, since the reserve for a hit's reads stops it short of the nominal wait. The body is text from outside: the classifier reads 64 KiB at most and treats a longer body as findings, since the part it cannot read may hold suppressed findings; drops fenced code and Copilot's one HTML comment, its format marker, and reads inline code as prose, so a tag, a comment opener, a heading or a label quoted in a closed code span names no assessment and counts no finding; fails closed on any HTML comment outside inline code, a code span left open on its line, an escaped backtick, an HTML tag the real bodies never carry, a tag left open on its line, or a heading or fence inside a<details>block before its blank line, since parsing what such text hides is a losing game and none of it can then supply an assessment or hide a finding. The tag set tracks a format Copilot moves under us, so the fixtures hold a body of each format seen and a test holds every one to a reading, and a details section the classifier does not know, neither a count it reads nor a finding's own badged title, fails the body closed rather than wait for a rule of its own; takes the earliest heading as the assessment; and records labels and counts, never the text, matching headings on one line, reading a CRLF body as its LF twin, and taking an unreadable count as a finding; a>inside a quoted attribute closes no tag, a line opening with any of the known tags starts an HTML block, and a declaration, processing instruction or CDATA block outside inline code fails closed as a comment does. The wait checks its deadline before every read and keeps a reserve for the reads a hit needs (the listing, the threads page by page, and a second read of the head), so it cannot overrun the job's budget by a read's worst case. Once a review lands, the publisher reads the head again: a push during the wait makes it a review of the old head. A read failure the shared wrapper's retries did not cure costs one poll whenbot_github.is_transientaccepts it (a5xx, or gh's own timeout or cut-off reply): the wait repeats the read that failed, of the head before the wait, the review, its threads or the confirming head, after 30 seconds or what remains, within the same deadline and reserve (transient_reads.py), so a GitHub incident shorter than the wait no longer ends it; the window is the bound and no retry adds a timer. No read, the first head read included, starts unless time is spare beyond the reserve. A wait that rode out such failures adds one line toresult.jsonwarningswith their count and the last error, escaped and bounded, so the report shows the incident even when the round succeeded. A head that moved before the wait began, a review of another head, any other read failure (a4xx, or a reply that arrives whole but lacks what the read needs), a wait spent on transient failures, whose reason names the last one, and no review within the wait all end as pending, never clean; §20.3 relies on that for rounds. When step 10 recorded a refusal (requested: false), nobody asked for the review the full wait would poll for, so the wait shrinks to a grace of five minutes' polling on top of the reserve, 15 minutes in all, long enough for a maintainer's own request to bring a review; with none it ends aspending (not requested)with a reason naming the shorter wait. A caller's shorter wait stands, and a request that landed keeps the full wait. The record goes intoresult.jsonasreview(§18.4). Once the verdict is in, the rest of the same wait reads the head's check runs and its combined commit status (head_checks.py), with the same token, since the target is public, and no new mint. A commit status, which services such as pre-commit.ci post instead of a check run, counts as a run with no annotations: apendingone has yet to settle, andfailureanderrorfail. The publish job gates on Copilot's review and reports CI: a failing check never stops the publication, it records and warns. The read shares the wait's deadline, fixed before the review poll starts, and the reserve for its last reads, so the job's budget does not grow; a review that took the whole wait leaves the checks one read. Runs count when theirhead_shais the published head. While a run has not completed it polls every 30 seconds, as long as two reads still fit before the deadline. It then reads the failing runs' annotations under the same bound (check_reads.py, as the revision round's packet does), and reads the head once more: a push since, or a read that fails for good, recordsunknown, never passing. A transient failure of any of these reads costs one poll within the same bound, as in the review wait, and adds its ownwarningsline, under "the checks wait"; one the bound leaves no time to repeat recordsunknownwith the last error. A failed listing drops the runs an earlier poll read, so a window spent retrying the listing is neverrunning; a retried annotation read that the bound cuts short isunknown, not a partial record; and a failed head read repeats alone, not the annotations before it. The state ispassing,infrastructure(every failing run failed at harden-runner's egress agent, below),failing(a run concludedfailure,timed_outorstartup_failure, or a status isfailureorerror, and at least one is a defect),running(a run still unsettled at the deadline, with any failures so far),none(no runs or statuses at all) orunknown. A failing run isinfrastructurewhen one of its failure-level annotations has the titleharden-runner agent did not start, or a message that starts, after stripping, withharden-runner's agent reverted its changes,harden-runner's agent did not report readyorharden-runner's agent reported an error(the block action's wordings,check_reads.AGENT_TITLEandAGENT_MESSAGES); every other failing run, and one whose annotations go unread because the wait ran out, is adefect. The reader classifies every failing run before the 30-run bound applies, so the counts of both kinds are whole whatever the record keeps, and the bounds keep defect runs first, by name, and then infrastructure ones, so a run that brings a round is never left out for one that does not. Such a run failed before the job ran its own steps: it needs a re-run, not a fix. Failing names bounded and escaped reach a::warning title=Checks::annotation on the run, which says when the failures are infrastructure and need a re-run. A pending commit status whose contextconfig/stale-statuses.txtlists (pre-commit.ci - pr), last updated more than the run'sstale_status_minutesago (default 8;0turns the rule off), is stale (§13.1): each read sets it apart, so the poll does not wait for it and the state comes from the rest. The record lists it understaleand a second::warning title=Checks::names it (pre-commit.ci - pr still pending after 8 minutes; not waited for). A check run is never stale, whatever its name, and a failing or passing status keeps its result. The record goes intoresult.jsonaschecks(§18.4); the revision scan (§20.1) of a later run acts on the failures, since this round has ended. Then the publisher reads whether the pull request can merge (merge_state.py), with the same token, since the target is public, and no write. A head that conflicts with the default branch gets nopull_requestCI, since GitHub cannot build its merge ref, so its checks look missing rather than failed and the review alone would call it ready. The probe runs after the wait, since the base can move during it. GitHub computesmergeablein the background and answersnullwhile it does, so the read goes again after 2, 4, 8, 16 and 32 seconds, about a minute in all. An answer counts when the pull request names the published head; the probe treats a stale read, or a push since, like anull. An answer stillnullor for another head, or a read that fails, recordsnullwith a warning: unknown, never mergeable. The probe also reads the default branch's head, records whether it moved from the head the selection read (rebase_shafor a revision,base_shafor an issue) and, from GitHub's compare, the count of commits the published head lacks of it. A read that fails leaves its fieldnullwith a warning and stops nothing. -
Comment on the issue with one line: the pull request URL on success; on
abstain, the agent's reason; on a policy or provenance rejection, which check failed and the run URL; on a rejection because the issue closed after selection (step 8), nothing, since a comment on a finished issue is noise. An issue whose author or last body editor is off the §6 issue author list gets nothing either: the step skips an outcome markedauthor_unlistedand, for any other, re-reads the author and last editor live against the selection's list first, whatever the verdict, since an abstention or a failure never passed the push's re-check; a refusal marks the result and posts nothing, and an unreadable issue fails the step with no post. The reason descends from the untrusted manifest; the publisher cuts it to 2,000 characters when recording and again when rendering, which keeps the comment inside GitHub's limit with the run URL intact. The comment uses a further per-repository token carryingissues: writeand nothing else, minted for this step alone. GitHub has no permission that stops at comments:issues: writealso covers labels, assignees, milestones, close and reopen. The publisher's code path calls the comment endpoint and no other, the token lives in one trusted step, and labelling stays with triage. Dry-run skips the comment. Each comment ends with a hidden marker naming the run and the outcome; before posting, the publisher looks for it on the bot's own comments since the run's creation, a time every attempt shares. A retry after a lost reply or a later failure then posts nothing twice, and a marker someone else pastes cannot suppress the comment. A transient5xxon the post looks for the marker once more: a comment found counts as posted, with a warning inresult.json, and none found fails the step with no second post, since a slow first copy may still land. An operational failure before any write, the offline check or a token mint, posts nothing: the target saw no change, the verdict may be unknown, and one publisher fault would otherwise comment on every issue in the run. Step 13 records it in the report instead; a failure during or after the writes (step 7 on) still comments, since the fork saw a branch and its rollback. On a published pull request the line states the review's verdict: clean; findings, with the counts and the assessment and the statement that a maintainer must act on them; or pending. A head the probe found conflicting leads with that instead: it names the default branch and whether it moved during the run, says no CI ran, states the review without calling it clean and says the next round rebases it (§20.1); an unsettled answer says GitHub did not confirm whether the pull request can merge. Failing checks on the head add a sentence naming them, bounded and escaped, as do failures among checks still running when the wait ended; failures at the egress agent add their own,N check(s) failed at the egress agent and need a re-run, named the same way; passing, absent or unread checks add nothing. A pull request nominated for an antagonistic review (§20.5) adds a sentence saying the workflow requested one from the review bot; when the switch is off, the comment says nothing of it. A conflict or a known failing check, settled or still running, at the round cap leaves work undone: that comment hands over to a human. The marker carries the review verdict too, for findings the counts and the assessment, and for a pending review the workflow could not requestpending/not-requested, then the probe's answer asmergeable=true,falseorunknownwhen it ran, then the checks' state aschecks=when the record exists, with a short hash of the failing checks' names when it names any (checks=running/<hex>; infrastructure failures join the hash as a second list, and the wholedefectsandinfrastructurecounts join it when they exceed the names kept, even when the record keeps none), so a rerun whose wait ended differently or whose failures changed, resolved a thread under the same verdict, or requested the review a first attempt could not, posts again instead of leaving the issue at odds withresult.json; the bot's latest outcome for the run alone suppresses a repeat, so an outcome that changed and changed back posts as well, and a search that fills every page it may read proves nothing and posts. A record the publisher does not recognise reads as pending. -
Record
result.jsonand a step-summary section. A step that runs whatever came before writes apublish-failedresult when an earlier failure (the offline check, a token mint) left none, so every selected issue reaches the report. A final report job gathers everyresult.jsonby artifact-name pattern and renders one table: issue, verdict, output URL, Copilot review verdict, premium requests consumed (fromusage.json), detail. Below the totals it counts the review verdicts and the probe's answers (mergeable, conflicting, unconfirmed, not probed), lists each conflicting pull request apart with the count of commits behind and, at the round cap, that a human must take over, counts the head checks' states (not readfor a result with no record and no review), lists each pull request with known failing checks, settled or still running, and their names and, at the round cap, that a human must take over, lists apart each pull request with checks that failed at the egress agent and need a re-run, counted inreport.jsonasinfrastructure_check_failures, and states, once, how a later round answers review findings. A report covers one selection, its namespace: a retried entry shows its latest attempt's row, but the spend total counts each author session once, since a rerun author job uploads a new proposal artifact and the ID of each proposal artifact names the session that produced it. A full rerun selects afresh under a new namespace and gets its own report; the earlier report keeps the earlier sessions' spend, so a run's cost is the sum of its reports. The report job also exposes the pull requests the run opened or revised as the workflow's outputs (§18.6), and names those it nominates for an antagonistic review, which a later job asks the review bot for; a last job comments on any pull request whose request did not certainly go (§20.5).
| Input | Type | Default | Notes |
|---|---|---|---|
org |
string | required | Target owner |
mode |
string | pull-requests |
select, branches, pull-requests |
dry_run |
boolean | true |
Author runs; publisher writes nothing |
model |
string | claude-opus-5.5 |
Copilot model identifier (§10.3); fusion routes through Copilot Fusion |
fusion_tier |
string | '' |
§10.3: standard, high or max, required with model: fusion and refused with any other model |
max_pull_requests |
string | '10' |
0 = up to the matrix limit |
max_runtime_minutes |
string | '180' |
Per agent |
stale_status_minutes |
string | '8' |
§13.1: a listed pending status older than this is stale; 0 turns it off |
max_concurrent_agents |
string | '10' |
1–30, matrix max-parallel |
allow_subagents |
boolean | true |
§7.2 |
include_dotgithub |
boolean | false |
§6 |
load_repo_skills |
boolean | false |
§7.2: trust checkout skills |
allow_workflow_edits |
boolean | false |
§8 step 3: let new proposals change .github/workflows/; the workflow-edits-ok label grants one issue the same, rounds included |
allow_precommit_config_edits |
boolean | false |
§8 step 3: let new proposals change the root .pre-commit-config.yaml; the precommit-edits-ok label grants one issue the same, rounds included |
request_review |
boolean | true |
§8 steps 10–11: request, await, report |
request_antagonistic_review |
boolean | true |
§20.5: ask the review bot after a clean review |
antagonistic_repository |
string | lfreleng-actions/github-code-review-bot |
Holds the antagonistic workflow (§20.5) |
issues |
string | '' |
Issues to work (§6) |
pull_requests |
string | '' |
Bot pull requests to revise (§20) |
revise |
boolean | true |
§20: revise before working new issues |
revise_only |
boolean | false |
§6: revise the bot's pull requests with work outstanding |
outstanding_only |
boolean | false |
§20.6: named pull requests take the scan's tests |
continues_run |
string | '' |
§20.6: the dispatching run, which must have published |
inherit_run_parameters |
boolean | false |
§20.1: take the run parameters from the named pull request's latest round footer; one pull request alone |
continue_rounds |
boolean | false |
§20.6: the caller dispatches continue_pull_requests; the outcome comment says who answers a late maintainer comment |
exclude_repos |
string | '' |
Commas and/or spaces; overrides bundled list |
issue_authors |
string | '' |
§6: logins trusted to open and edit issues; empty fails the run |
only_known_authors |
string | '' |
§6: false turns issue_authors off; empty or true keeps it; else fails |
fork_pool_token_max_days |
string | '' |
§10.6: longest token lifetime, 1 to 366 days; empty means 90; else fails |
fork_pool_token_expires |
string | '' |
§10.6: recorded token expiry, YYYY-MM-DD; a mismatch warns |
guidance_repository |
string | <org>/.github |
Holds the org AGENTS.md |
guidance_ref |
string | main |
Branch or tag recorded and used |
harden_runner_egress |
string | block |
Trusted jobs; author is always audit |
harden_runner_allowlist |
string | '' |
Allow-list action coordinate |
harden_runner_supplemental_allowlist |
string | '' |
Merged with the baseline; required when set |
harden_runner_supplemental_unpinned |
boolean | false |
Same-org supplemental may omit @ref |
harden_runner_extra_endpoints |
string | '' |
Inline host[:port] tokens merged in |
github_app_client_id |
string | '' |
Empty limits runs to dry-run |
assets_repository |
string | this repo | Prompt and scripts |
assets_ref |
string | '' |
Resolved to a SHA in select |
Secrets: copilot_token (model PAT, §10.2), github_app_private_key
(select and publish alone), copilot_review_token (the review
request step alone, §10.4), antagonistic_dispatch_token (the
antagonistic request job's dispatch step alone, §10.5),
fork_pool_token (the forks job's prepare step alone, §10.6). All
five are optional.
allow_workflow_edits and allow_precommit_config_edits are the
defaults for every issue in the run. A maintainer grants one issue
workflow edits with the workflow-edits-ok label, and pre-commit
config edits with the precommit-edits-ok label; WORKFLOWS and
PRECOMMIT in scripts/workflow_grant.py name them, and the same
functions read both. The select job reads each label, without regard
to case, with the issue's other labels and records the grant on that
issue's selection entry alone (§18.1), so no other issue in the run
widens. A label also lets the issue's revision rounds change its
grant's files beyond those their pull request already changes
(§20.3), which a switch never does. Each label grants its own paths
alone. Someone with triage permission applies it through the GitHub
UI or API, as with no-agent and agent-approved; the author job
sees it as data in the packet and nothing else, and nothing in issue
text sets it. No token or permission changes: the fork mint requests
workflows: write on every run (§10.1). The check summary, the issue
comment and the report name a label when it let a proposal change its
grant's files, and the provenance block's Lint gate line names
precommit-edits-ok when it granted the change: a round whose gated
changes §20.3 already allows credits none.
Numeric inputs are strings because reusable-workflow number
inputs cannot carry validation and fromJSON handles the
conversion at the point of use. The select job rejects values
outside the stated ranges. A run must name issues or
pull_requests, or set revise_only; the input check refuses one
that names none of them (§6 "No new-issue scans").
inherit_run_parameters needs one pull request alone in
pull_requests, no issues, and pull-requests mode; the input
check refuses it otherwise, and the selector refuses it again. One
pull request gives one footer to inherit from and one source for the
run's budgets. With it on, the run parameters (§20.1) come from that
pull request's latest round footer when it records them, and the
inputs above hold their place otherwise. Off, the default, nothing
changes. The select job publishes the values in effect as job
outputs, and the author, publish and antagonistic request jobs read
those, never the inputs, for the model, the tier, the sub-agent and
skill switches, the session budgets, the review switches and the
stale status minutes.
workflow_dispatch alone, with the inputs below: the caller has no
schedule, and an organisation administrator starts every run that is
not a continuation (§20.6). A run-name keeps the Code Monkey ⏰
prefix and adds what the run works, so the Actions list tells runs
apart: a dispatch names its pull_requests, else its issues, as
the form's raw text, else a revise_only scan, else that it named
nothing (a run the input check refuses), and marks a Copilot Fusion
run with its tier, (Fusion high), and a dry run. GitHub
truncates a long name, and nothing reads it back.
| Input | Type | Default |
|---|---|---|
dry_run |
boolean | false |
model |
choice | Claude Opus 5.5 |
fusion_auto_model_select |
boolean | false |
fusion_tier |
choice | standard |
mode |
choice | pull-requests |
max_pull_requests |
string | '10' |
max_runtime_minutes |
string | '180' |
stale_status_minutes |
string | '8' |
max_concurrent_agents |
string | '10' |
allow_subagents |
boolean | true |
include_dotgithub |
boolean | false |
load_repo_skills |
boolean | false |
allow_workflow_edits |
boolean | false |
allow_precommit_config_edits |
boolean | false |
request_review |
boolean | true |
request_antagonistic_review |
boolean | true |
issues |
string | '' |
pull_requests |
string | '' |
revise |
boolean | true |
revise_only |
boolean | false |
outstanding_only |
boolean | false |
continues_run |
string | '' |
inherit_run_parameters |
boolean | false |
The model choice shows display names and the caller maps them to
the identifiers in §10.3. The caller passes inputs.dry_run, so a
dispatch is live unless the operator ticks dry_run. The reusable
workflow's own dry_run (§9.1) keeps its default of true; the
caller alone defaults live. A form field left blank takes the
default above.
max_pull_requests semantics: 1 raises at most one pull request,
20 at most twenty, and 0 lifts the cap as far as the matrix
limit; anything non-numeric or negative fails the select job. The
form holds 24 inputs, within GitHub's limit of 25. The
repositories, categories and include_assigned inputs went with
the new-issue scan they shaped (§6, §17).
revise_only is the form's choice and the caller passes it through.
fusion_auto_model_select lets Copilot Fusion pick the model per
task (§10.3) and overrides model: on, the options job passes
fusion as the model and fusion_tier (standard, high or max)
as the tier; off, the caller drops the tier, the reusable workflow
gets an empty fusion_tier, and every argument it receives is the one it
received before the switch existed. The continue job forwards both
inputs, so a Fusion run's rounds stay on Fusion at its tier.
A revise_only dispatch must leave issues empty, keep
pull-requests mode and revise on; the input check refuses it
otherwise (§6).
stale_status_minutes bounds the wait on a slow status service
(§13.1). An operator dispatching against a repository whose hooks are
slow, or during a pre-commit.ci incident, lifts it for that run
('30'), or sets '0' to wait on the status as on any check; a
blank field takes the default, and the continue job forwards the
run's value. The input check refuses anything but a non-negative
integer.
outstanding_only is the continuation's input (§20.6): it needs
named pull_requests and no issues, and the input check refuses
it otherwise. continues_run, which the continue job sets to its
own run's ID, needs outstanding_only and must be a run ID; an
operator leaves it empty.
inherit_run_parameters is the hand-back's input (§20.5): the review
bot sets it, and the caller passes it through. The reusable
workflow's input check refuses it unless the dispatch names one pull
request alone in pull-requests mode (§9.1). An operator may set it
too, to run a pull request's next round with the parameters its last
round used.
mode |
dry_run |
Select | Author | Branch | PR |
|---|---|---|---|---|---|
select |
any | yes | no | no | no |
branches |
true | yes | yes | no | no |
branches |
false | yes | yes | yes | no |
pull-requests |
true | yes | yes | no | no |
pull-requests |
false | yes | yes | yes | yes |
Dry-run publishes the verified diff and the composed messages as an artifact and in the step summary, which is how the prompt and policy get tuned before anything reaches a repository.
A dedicated App, LF/RelEng Code Monkey Bot, distinct from the
triage and code review bots, so authored code carries its own
identity in history and an administrator can revoke its permissions
without affecting the others. The separation also matters the other
way: an App that pushes code must never be one whose approval counts
towards a review. The calling workflow names the credentials by
role, as every bot repository in the organisation does:
vars.BOT_APP_CLIENT_ID and secrets.BOT_APP_PRIVATE_KEY. The App
is public so the fork organisations (section 4.3) can install it;
OAuth and webhooks stay off. Its permissions:
| Permission | Level | Used by | For |
|---|---|---|---|
| Metadata | read | select, publish | Repository listing |
| Issues | write | select, publish | Scan; one comment per outcome (§8 step 10) |
| Issue fields | read | select | Priority |
| Issue types | read | select | Type |
| Checks | read | select | A revision's failing check runs and their annotations (§20.1); no job logs |
| Contents | write | publish | Fork sync, branch, commits (fork organisations alone) |
| Pull requests | write | publish | Open PR, label |
| Workflows | write | publish | Fork sync over upstream workflow changes; commits that touch .github/workflows/ (fork organisations alone) |
The App holds no Administration permission and no mint requests one: an App holds its permissions on every installation at once, so the grant that would let it create a fork would let it administer every repository in the target organisation as well. The forks job creates and renames forks with the fork pool token instead (§10.6).
The App holds two kinds of installation. On the target organisation
the publisher mints Pull requests: write to open the pull request
and Issues: write for the comment, and no mint there ever requests
Contents or Workflows. On each fork organisation it
mints the writes that build the branch, and that installation must
cover All repositories. The machine account of §10.6 creates the
forks, not the App, and GitHub adds a repository a user creates to no
installation that lists chosen repositories, so the publish job's
fork mint, scoped to that one fork, would fail for every fork the
account made after an operator chose the list. When the fork exists
and the mint fails, the publish result's reason reads could not mint a token for <fork>; the App's installation on <fork_org> must cover all repositories, and the step summary says the same.
| Fork organisation | Installed | Actions |
|---|---|---|
lfreleng-bot-forks |
all repositories | disabled |
lfreleng-bot-forks-onap |
all repositories | disabled |
lfreleng-bot-forks-oransc |
all repositories | disabled |
lfreleng-bot-forks-opendaylight |
all repositories | disabled |
| Fork-organisation permission | Level | For |
|---|---|---|
| Metadata | read | Repository listing |
| Contents | write | Sync the fork, branch, commits |
| Workflows | write | Fork sync; commits under .github/workflows/ |
The App holds no Actions permission and no mint requests one: job logs stay out of every trusted job (§20.1). Checks: read is a later grant, so the installation must accept the App's permission update before a run that requests it, or the select job's mint fails.
The select job mints a token with the read levels alone, org-wide by
default and scoped to the named repositories plus the guidance
repository when the caller lists any;
issues: write on the App is a ceiling, and each mint requests the
lower level it needs. The publish job mints one token per
repository for the write steps and a separate one for the comment.
The App key never leaves those two jobs and no action in the author
job receives it, including as a post-step input.
Workflow edits are in scope, behind a switch. The estate is
workflows, and an issue labelled CI is as fair a target as any
other; a bot that cannot touch .github/workflows/ would abstain
from a large share of the backlog. A workflow edit is also the
change with the widest reach, so a new proposal may make one when
the operator sets allow_workflow_edits or a maintainer labels its
issue workflow-edits-ok, and not otherwise (§9.1, §8 step 3); a
revision round stays within the workflow files its pull request
already changes unless its issue carries the label (§20.3). The fork mint requests
workflows: write on every run, whatever the verified diff holds:
the fork sync (§4.3 step 2) fast-forwards over upstream
workflow changes too, and a proposal that edits no workflow would
otherwise fail against a fork whose upstream changed one. The grant
stays on the fork organisations, which hold bot forks alone and run
no Actions; no target-organisation mint requests it.
The same arrangement triage proved: a personal fine-grained PAT with
Copilot Requests and no repository grants, held as the org secret
COPILOT_CLI_TOKEN, presented to the CLI as COPILOT_GITHUB_TOKEN
and checked for the github_pat_ prefix. Its owner's entitlement
pays for every premium request; usage.json from each session makes
the spend visible per run. Expiry (15 December 2026) needs an owner
and a rotation reminder.
Copilot Requests scope is enough for --model. The PAT grants no
repository access and the author job has no other credential.
A check of three of the four identifiers below (claude-opus-5.5,
claude-sonnet-5.5 and gpt-6-astra) against the pinned CLI on
30 September 2026, with the entitlement behind COPILOT_CLI_TOKEN,
started a session for each one. A maintainer checked claude-fable-5.2
on 16 November 2026 with Copilot CLI 1.0.83 and their own
entitlement, not the pinned CLI or the workflow's credential; a dry
run of this workflow with the option completes that check.
An unknown name fails at once with
Model "..." from --model flag is not available, before any
request reaches the model. An interactive /model shows the same
list. The dispatch form offers the latest release of each family;
the earlier claude-opus-5, claude-sonnet-5 and claude-fable-5.1
still resolve, so a caller of the reusable workflow may name them
directly.
| Display name | --model |
|---|---|
| Claude Opus 5.5 (default) | claude-opus-5.5 |
| Claude Fable 5.2 | claude-fable-5.2 |
| Claude Sonnet 5.5 | claude-sonnet-5.5 |
| GPT-6 Astra | gpt-6-astra |
Every session runs through the Copilot CLI, so every commit carries
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
whichever model served it: §6.3 of the org guidance names the
assistant used, not the model behind it. The mapping still goes by
identifier prefix (claude-, gpt-, gemini-), so a model from
an unlisted family fails the publish rather than commit under an
identity nobody chose. It lives in config/coauthors.json in this
repository, where a pull request reviews any change to it. An
organisation-level variable would suit a mapping that more than one
workflow shares; triage does not commit, so nothing else reads it
today. Move it when a second consumer appears.
Copilot Fusion is a selectable mode, off by default:
fusion_auto_model_select on the dispatch form (§9.2), or
model: fusion with a fusion_tier from a caller of the reusable
workflow (§9.1). The CLI then picks the model for each prompt within
the tier: standard, high or max, where high and max may
call more than one model for one prompt. The input check refuses fusion
without a known tier, and a tier with any other model, before the
select job reads anything; §7.2 gives the invocation and the CLI's
own checks of the flag.
Billing is per underlying model, at that model's standard rate;
Fusion itself costs nothing, and paid plans get 30% off Fusion model
costs through 2026-11-30. The session's premium request total in
usage.json already counts what each model cost, so the report's
spend needs no change.
Fusion works apart from sub-agents and does not start them: a sub-agent's model is not one Fusion chose. When Fusion discards a draft, changes the draft already made in the workspace are not undone; the offline check and the reviewers judge the commits the session leaves, as for any other run.
Every run, Fusion or not, records the models the session ran on.
The check reads the top-level keys of modelMetrics in usage.json
alone, keeping at most ten ids of the shape [a-z0-9][a-z0-9.-]{0,63}
whose values are objects, sorted, and counting the rest as dropped
(models_used and models_dropped, §18.3). A missing or unreadable
file leaves the list empty and changes nothing else. The check
summary lists them, the provenance block's Model line reads
Copilot Fusion (`high` tier), routed to `a`, `b` on a Fusion
run, and adds routed to to a fixed model's line when the models
differ from the one requested and not otherwise, and the run report gives each
entry a Models column beside its spend. config/coauthors.json
maps fusion to the same Copilot trailer as every other prefix.
This document calls the antagonistic reviewer (§20.5) "a different model" from the author. A Fusion run no longer guarantees that, since Fusion may route the author's prompts to the reviewer's model; the antagonistic flow treats a Fusion run as any other.
GitHub adds the Copilot reviewer when a Copilot user asks, not when
the App does: the App's installation token gets the mutation
accepted and no reviewer added (§17 item 4). The repository secret
COPILOT_REVIEW_TOKEN is a fine-grained PAT owned by a maintainer
with a Copilot seat, resource owner lfreleng-actions, all
repositories, with Pull requests: write and the implicit Metadata:
read. Reviews it requests bill to that maintainer's seat. It holds
nothing at organisation level, so it cannot resolve a team reviewer
in a GraphQL reply, and §8 step 10 verifies the request
through the issue's review_requested events, which the token can
read, rather than through the mutation's reply. REST
requested_reviewers cannot serve either: it never lists the
Copilot bot as pending. Granting
Members: read would make the reply readable, but widens the token
beyond the one mutation it exists for.
The caller passes it as the optional copilot_review_token, and the
publish job's Request Copilot review step is the one place that
reads it: as GH_TOKEN when set, with the pull request
token in its place otherwise, so a caller without the secret keeps
the App's request. No job-level key, job output, other step or the
author job references it, and the await step keeps the job's own
token, since the target is public. tests/test_workflow.py pins
that reach. The step logs the name of the credential it used, never
its value. The PAT can write to every pull request in the
organisation, so it widens what that one step could do, not what the
App holds; its expiry needs the same owner and rotation reminder as
the model PAT (§10.2).
The request for an antagonistic review (§20.5) starts a workflow in
another repository, which neither the App's installation token nor a
job's own token can do. The repository secret
CODE_REVIEW_DISPATCH_TOKEN is a fine-grained token, resource owner
lfreleng-actions, limited to the one repository
antagonistic_repository names, with Actions: write and the
implicit Metadata: read; it can start, cancel or rerun that
repository's workflows and nothing else. The dispatch caller passes
it as the optional antagonistic_dispatch_token, and the
antagonistic job's Dispatch antagonistic reviews step is the one
place that reads it. That job holds permissions: {}, checks out
nothing and runs after the report job, so no agent output, script
from a target or publish step runs beside it; the publish job, which
records the nomination, holds no new credential. The
antagonistic-notice job that follows a failed request never sees
this token: it mints the App's own pull requests: write token for
one repository at a time (§20.5).
tests/test_workflow.py pins that reach. Without the secret the
step warns, dispatches nothing and succeeds, so the default stays
harmless until a maintainer sets it. Its expiry needs the same owner and
rotation reminder as the model PAT (§10.2).
Creating a fork, or renaming one to follow a renamed target, needs
Administration: write on the fork organisation (§4.3 step 1). The
App cannot hold it without holding it on the target organisation
too, so a machine account does this one job: a dedicated
GitHub account, a member of the four fork organisations and of no
other, with no access to any target. Its classic token, scoped to
public_repo alone, is the repository secret FORK_POOL_TOKEN: with
that membership it can fork a public repository into a pool and
rename a fork there, and it can write to no target repository. A
classic token rather than fine-grained ones, because a fine-grained
token has one resource owner and the pools are four organisations.
Membership alone does not cover renames. Renaming a repository needs
admin on it, and the account holds admin on the forks it creates
but not on those the App created before it. So the account needs
admin on every repository in the fork organisations: as an owner of
each, or through a base permission of admin there. Before renaming
a fork it did not create in the same run, fork_pool.py reads the
fork and checks the token's permissions.admin; without it, that
target fails naming the account and the right it lacks, and the
job makes no write to that fork.
A fork the account creates belongs to no App installation that lists chosen repositories; GitHub adds a repository to such an installation when the App itself creates it, and not otherwise. So the App's installation on every fork organisation covers All repositories (§10.1), or the publish job cannot mint a write token for a fork this account made. The forks job holds no App key and cannot check that setting in advance; a publish that meets it fails naming the installation instead.
The dispatch caller passes it as the optional fork_pool_token, and
the forks job's Find, create or rename forks step is the one place
that reads it. That job holds contents: read, runs beside the author
matrix, and checks out the trusted assets at the pinned commit and
nothing else; no agent output or target code runs beside it.
fork_pool.py first has pool_token.py read the token's
X-OAuth-Scopes and refuse one that is not classic or carries any
scope besides public_repo, so an operator's own token, which could
reach far more, never makes a write. It proves each matrix entry
against config/fork-orgs.json before touching a fork, requests every
missing fork before it waits for any, against one shared deadline, so
a large first run waits about as long as one fork, and writes each
fork's row to the step summary as its outcome is final. It tries every
target and fails the job when any fork is not ready; the publish job
still runs, and the targets without a fork fail alone. Without the
secret the step warns, reads nothing and succeeds, and every fork that
already exists keeps working. tests/test_workflow.py pins that
reach.
No classic token stops at chosen organisations: it can write to
every repository the account can, the forks that head the open pull
requests among them, and GitHub signs commits made through the API.
Human approval, last-push approval and stale-review dismissal still
stand between such a commit and a merge, but a leaked token stays
useful until it expires, and a classic token may never expire. So
pool_token.py also reads the GitHub-Authentication-Token-Expiration
header of the same reply, which GitHub omits for a token that never
expires. No header, one it cannot parse, or an expiry further ahead
than the lifetime limit fails the job before any write, naming the
date it read and the limit applied.
The limit is the fork_pool_token_max_days input, which the
dispatch caller takes from the repository variable
FORK_POOL_TOKEN_MAX_DAYS alone, as it takes issue_authors: no
dispatch form field can widen it. Empty or unset means 90 days.
Anything but a whole number of days from 1 to 366 in ASCII digits,
such as 0, 367, 30.5 or a value padded with spaces, fails the
job before it reads the token, naming the variable and the value. The
ceiling stops a large number from switching the rotation rule off in
effect. An expiry 21 days away or less passes with a ::warning
naming the date on every run, and the rotation falls due before the
job stops. The token's owner creates its successor with an expiry
within the limit and replaces FORK_POOL_TOKEN when the warning
appears.
The header remains the sole source for those checks. The
fork_pool_token_expires input, from the repository variable
FORK_POOL_TOKEN_EXPIRES, records the same expiry as YYYY-MM-DD
for the scheduled check below, which holds no token and cannot read
the header. In the forks job it never relaxes, replaces or adds a
refusal: when it differs from the header's date by more than one day,
the slack the header's time zone needs, the job warns naming both
dates, and an unreadable value is a warning too. Both inputs reach
the prepare step through env:, never as an expression in its
script.
Live runs are irregular, so the expiry has its own schedule:
fork-pool-token-expiry.yaml runs daily at 06:15 UTC, and on
dispatch. This is no bot run and restores no schedule of one (§11):
it dispatches nothing, holds no App key and no FORK_POOL_TOKEN,
and reads FORK_POOL_TOKEN_EXPIRES alone. Its check job checks out
this repository with contents: read and runs
pool_token.py expiry-check, which writes days_left and
notify to the step outputs and a short report to the step summary.
An unset variable warns that the check cannot run and posts nothing;
an unreadable one fails the job. From 21 days before the date the job
warns; from 7 days before, and every day after it, notify is true
and the notify job posts to Slack once per run, until the variable
names the next token's expiry. A dispatch with test_notification
posts a message labelled as a test whatever the date, to prove the
wiring. A notify-failure job posts when the check fails, since an
unreadable variable would otherwise silence every later alert.
The posting jobs run in the production environment, as zizmor's
secrets-outside-env audit requires, and follow the organisation's
sample: the organisation secret SLACK_BOT_TOKEN and variable
SLACK_CHANNEL_ID, a Check Slack configuration step that warns and
skips the post when either is missing, and
slackapi/slack-github-action with chat.postMessage and
errors: 'true', so a post Slack rejects fails the job rather than
passing undelivered. The post step alone holds the token; the
configuration step learns whether the secret exists, never its value,
and the Python runs in a job with no secret at all. Every job blocks
egress against the organisation allow-list the dispatch caller pins,
and the workflow's concurrency group never cancels, so a manual test
and the schedule cannot race to post twice.
- No schedule. The caller runs on
workflow_dispatchalone, and every run that is not a continuation is one an organisation administrator started (§9.2). The caller dropped the weekday 02:00 UTC full scan, therevise_onlyslot it ran every hour, and the Slack digest that reported them (§17). Nothing here reads the previous day's triage on a timer; an operator who wants a triaged issue worked names it. The daily fork pool token expiry check (§10.6) runs on a schedule of its own, but starts no run and holds no bot credential. - Continuation (§20.6): once a run's report lists pull requests whose
round left work outstanding, its
continuejob dispatches this caller once for each of them, so the next round starts within minutes. Each continuation, a live dispatch naming one pull request, runs as a named run and locks oncode-monkey-named-<run_id>, below: continuations run in parallel, and the publish locks and the overlap check (§6 "Overlapping runs") keep two runs off one pull request. - The gap the
revise_onlyslot covered. A pull request whose continuation loop has ended still gathers work: a Copilot review still pending when publish stopped waiting, a maintainer's comment, or a check that fails later. Nothing picks that up on its own any more. An operator'srevise_onlydispatch revises every such pull request across the organisation, and a dispatch namingpull_requestsrevises the ones it names. The continuation is not stretched to cover the gap: a job that dispatched on a later review or comment would need its own trigger, and so its own trust and loop review, which is work for the hardening pass rather than this change. - Caller concurrency group
code-monkey,cancel-in-progress: false, for liverevise_onlydispatches, and for a live dispatch naming nothing, which the input check refuses before it does any work: one run at a time. The group setsqueue: max, so pending runs wait in a FIFO queue of up to 100 rather than GitHub's default single slot, where a newcomer cancels the run already pending and a dispatch an operator made vanishes without trace. GitHub rejectsqueue: maxbesidecancel-in-progress: true. A dryworkflow_dispatchwrites nothing and takescode-monkey-dry-run-<run_id>instead: it never waits behind a live run. A live dispatch that namesissuesorpull_requeststakescode-monkey-named-<run_id>, keyed on its own run: dispatches run apart rather than evict each other without trace, and the group name keeps a fixed length, where one built from the target lists would pass GitHub's 400-character limit at about fifteenrepo#Nreferences and fail the run before any job starts. Its scope is the named targets alone (§6 "Explicit issues", §20.1), andmax_pull_requestsbounds it. Two dispatches naming the same or overlapping targets run together, as do arevise_onlyscan and a named dispatch; the later one's selector skips a target the earlier one already selected (§6 "Overlapping runs"), and when both select within the same five minutes the run with the higher id waits, up to five minutes, for the lower one to publish its selection first, so the tie goes to the older run. The publish job's locks below serialise their writes to any one pull request or issue, so neither can retitle, push or roll back a title under the other (§20.3), and the §6 open-pull-request check, the publisher's branch-exists refusal and the revision's compare-and-swap limit the overlap to a wasted author session, never a duplicate pull request or a lost round. - The reusable workflow locks a live scan on
code-monkey-<caller repository>-<owner>for the whole pipeline. A dry run locks oncode-monkey-dry-run-<run_id>-<owner>and a live run namingissuesorpull_requestsoncode-monkey-named-<run_id>-<owner>, both keyed on the caller run (github.run_idin a reusable workflow is the caller's), so the legs of one caller run queue on their own lock and never cancel or wait on an unrelated run. No group name embeds an input list, so none can grow past GitHub's limit. All three groups setcancel-in-progress: falseandqueue: max. - The publish job locks once more, on the pull request it revises
(
code-monkey-publish-<repository>-pull-<n>) or the issue it publishes (…-issue-<n>), across named and scanned runs. These locks are what serialise two runs on one pull request or issue: two named runs, whether their target lists match or merely overlap, or a scan and a named run, reach it together, and a revision's retitle, push, restore and respond must not interleave with another run's (§20.3). A dry run writes nothing and locks within its own run. The lock setsqueue: max, so a third run on one pull request waits its turn, where the default queue would cancel it with no result, issue comment or report row; the revision's compare-and-swap refuses a push whose pull request moved while it waited (§20.3). - The
antagonistic-noticejob locks on the pull request it reports (code-monkey-notice-<repository>-pull-<n>), withcancel-in-progress: falseandqueue: max, so two runs whose requests for one pull request both failed post one notice for its head: the later leg reads the earlier notice and posts nothing (§20.5). testing.yamlkeys pull request runs on the ref, so a newer push cancels a stale run, and gives each manual dispatch a group of its own.- Within a run, the branch-existence rule in §6 and the one-issue-per-repository rule make concurrent agents independent.
- Across runs, the
code-monkey/*pull request check in §6 stops a second attempt at an issue whose first attempt a human has not yet processed.
| Artifact | Producer | Content | Retention |
|---|---|---|---|
monkey-evidence-<ns> |
select | selection.json, matrix.json, agents.md, summary |
7 days |
monkey-proposal-<ns>-<key> |
author | bundle, manifest, usage | 7 days |
monkey-session-<ns>-<key>-<attempt> |
author | CLI logs, prompt, share summary | 7 days |
monkey-result-<ns>-<key>-<attempt> |
publish | check.json, result.json, summary |
90 days |
code-monkey-<ns>-<attempt> |
report | report.md, report.json |
90 days |
<ns> is the select job's namespace and <key> the issue key.
Trusted evidence downloads use the producer's artifact ID; the
proposal download uses the name (§8). Names that append the run
attempt let a rerun of the publish job alone avoid immutable-name
conflicts while producer artifacts survive.
| Failure | Effect | Mitigation |
|---|---|---|
| Agent times out | No proposal artifact | Publisher records author-failed; issue eligible next run |
| Agent abstains | Manifest says why | Recorded; publisher comments the reason on the issue (§8 step 8) |
| Hooks need network the runner blocks | Agent cannot pass gates | Author job runs in audit mode (§7.5) |
Task needs sudo or containers (an image build, a loop mount) in a target without the marker |
Runner refuses both; the step cannot run | Prompt tells the agent not to work around it: it abstains, or leaves the step out and says so, naming .enable-sudo-and-containers; a maintainer adds the marker to the default branch where the repository needs it (§4.1, §7.3) |
main moves after selection |
Branch created at old base | GitHub reports mergeability; reviewer rebases or agent retries later |
| Target repository renamed | Its fork keeps the old name, so the by-name lookups miss it | The forks job finds the fork by parent and renames it after the target (§4.3 step 1); selection reads the old name until that job runs |
| Fork pool token absent, expired or too broad | The forks job makes and renames no fork; a target without its fork fails its publish, naming the forks job | The job warns when the secret is absent or expires within 21 days, and fails naming the scopes, the expiry or the lifetime limit otherwise; the scheduled expiry check posts to Slack from 7 days out; existing forks keep working; restore the token (§10.6) |
| Diff adds or edits an executable file, symlink or submodule, or changes a mode | Publish refused | Agent leaves such files untouched, checks every commit with git log --raw before the manifest, and abstains naming the file when it cannot avoid one (§5, §7.3) |
| A revision's branch moves or vanishes after selection | Round's input is stale | Author job stands down with a ::warning:: and an abstain manifest; no session, run stays green (§20.2) |
| Two runs overlap | A wasted session on one target; never a second pull request | Caller concurrency group for scans; named-issue dispatches lock per run; the selector skips targets another active run selected and waits for an older run still selecting (§6 "Overlapping runs"), failing open; the publisher re-reads the issue and the branch's pull requests before any write (§8 step 8), so a run that loses the race publishes nothing |
| Model PAT expired | Every agent fails at start | Prefix guard cannot detect; rotation owner (§10.2) |
| Runaway spend | Long sessions in parallel | max_runtime_minutes × max_concurrent_agents bounds wall-clock; usage report per run |
| Bundle forged by agent | Publisher replays attacker commits | Provenance by artifact ID; policy checks; per-repo token; human review |
| Selection evidence forged by an author job | A later run skips work it should do | Evidence counts when a select job vouches for it in a notice on its own check run; the check disregards anything else with a warning (§6 "Overlapping runs") |
| Bot commits fail DCO check | PR blocked | Trailer matches the API author identity (§5); rollout step 2 confirms against DCOAPP |
| Copilot ignores the App's review request | No review arrives | The review token asks instead (§10.4); without it, or when it lapses, the read-back of the issue's events shows the refusal, recorded as a warning, a ::warning annotation on the run, the credential's name in the log and pending (not requested) (§8 steps 10–11) |
Transient GitHub 5xx during the review wait |
None beyond a later poll | The wait repeats the read at the next poll within the same deadline (§8 step 11); one line in result.json warnings counts the retries and names the last error. A wait spent on them is pending and the checks unknown, never clean or passing |
| Review never arrives within the wait | Verdict pending |
Reported as pending, never clean; a maintainer requests one by hand |
| The request for an antagonistic review fails (a rate limit, an outage) | No review bot run starts; the issue comment already says the workflow asked for the review | The step tries a dispatch GitHub refused (HTTP 4xx) on up to four passes over 315 seconds (§20.5); a nominee that never goes is an error annotation, appears in the job's failed output as kind failed and turns the run red; the antagonistic-notice job then comments on that pull request, once per head and kind, while its head is still the one the request was for (§20.5). Any other failure may have started a run, so the step never sends it again: an error annotation, an uncertain summary line, an entry of kind uncertain whose notice says the request may not have arrived, and a red run |
| A check fails at harden-runner's egress agent (a transient resolver failure, the agent reverting at job start) | The run fails before the job's own steps, saying nothing of the change | Classified infrastructure from its failure-level annotation (§8 step 11): no revision round, no withheld nomination, reported apart as needing a re-run; a repository that fakes the wording can at most make its own failure spend nothing (§20.1) |
| A status service (pre-commit.ci) queues for hours and never reports | A pending status holds the head unsettled: the wait runs out and the scan reads checks still running round after round |
A listed context pending past stale_status_minutes is stale (§13.1): not waited for, not failing, named in the record, the comment and the report; the next round runs the hooks itself |
| A session misreads its own failing hook run (a pipeline's status taken for the hook's, a hook that always fails on the runner hiding one that newly fails) | Proposal publishes on hooks that did not pass; the exit code shows in the collapsed provenance table alone | The prompts say how to take a check's exit status, read a failure whole and exclude a hook the runner cannot run by id (§7.3). A proposed manifest whose last hook run did not exit 0 stays proposed, gains a line after the provenance block (§8 step 9) and a warnings line in check.json and result.json, which the report shows (§18.2, §18.3) |
| Head's checks fail, or never settle within the wait | Published pull request carries red or unfinished CI | Recorded as checks, never a gate: a ::warning annotation, a sentence in the issue comment, and the report; a later round, continued or dispatched, picks the failures up (§8 step 11, §20.1). A read that fails or a head that moves records unknown |
A timer that gates work applies to the narrowest class that needs it,
carries a documented default and a per-dispatch override, and on
expiry degrades to record and proceed, never to failure or to an
indefinite wait. Most mandatory checks in the organisation are fast
lints, but some linting jobs take tens of minutes, soak tests over
twenty and some builds thirty; a blanket limit would turn those into
premature failures. No stale rule covers check runs, then; it covers
the commit status contexts config/stale-statuses.txt lists, one per
line (stale_statuses.py). Its sole entry is pre-commit.ci - pr,
which queues for hours when its infrastructure is slow, often
without ever reporting. Such a status, pending and last updated
more than stale_status_minutes (default 8) before the read, is
stale: the publish job's poll stops waiting for it (§8 step 11), the
scan does not read the head as checks still running (§20.1), the
antagonistic nomination does not withhold for it (§20.5), and the
issue comment, the report and the next round's packet name it so a
human or a later round can judge it. 0 turns the rule off. A check
run that needs a timer of its own gets its own configuration entry,
never a blanket value; when pre-commit.ci gives way to the
organisation's own linting workflow, a check run, the entry goes and
the rule with it.
.github/workflows/code-monkey.yaml reusable workflow
.github/workflows/code-monkey-cron.yaml dispatch caller
.github/workflows/fork-pool-token-expiry.yaml expiry alert (§10.6)
.github/workflows/testing.yaml PR plumbing, offline tests, actionlint
prompt/author.md agent task (§7.3)
AGENTS.md organisation stub (§12 there)
config/excluded-repos.txt repositories to skip
config/coauthors.json model prefix to trailer (§10.3)
config/stale-statuses.txt status contexts a timer covers (§13.1)
scripts/select_issues.py selection policy
scripts/selection_inputs.py its command line, targets and caps
scripts/explicit_issues.py named issues (§6)
scripts/issue_categories.py category switches and matching
scripts/selection_outputs.py selection files and summary
scripts/issue_reads.py GitHub reads for selection
scripts/repository_reads.py owner listing or one repository
scripts/sudo_marker.py the sudo and container marker (§4.1)
scripts/bot_github.py gh wrapper, REST and GraphQL (shared)
scripts/bot_evidence.py evidence digest verification (shared)
scripts/artifact_fetch.py bounded artifact extraction (shared)
scripts/preflight.py pre-flight gate (shared)
scripts/ledger.py run ledger (shared, unused here)
scripts/proposal_fetch.py proposal cap table over artifact_fetch
scripts/proposal_policy.py the rules a proposal must pass
scripts/proposal_check.py offline bundle verification
scripts/protected_links.py protected symlinks in the base tree
scripts/proposal_model.py verdict record and its rendering
scripts/session_usage.py session and run spend, models (§10.3)
scripts/workflow_gate.py which gated files a proposal may change
scripts/publish.py replay, open PR, reconcile
scripts/publish_cli.py its eight commands' command line
scripts/branch_refs.py bot branch and its PR on GitHub
scripts/fork_pool.py the forks job: find, create, rename (§4.3)
scripts/pool_token.py token scopes, expiry, alert (§10.6)
scripts/stale_branch.py a closed attempt's branch (§5)
scripts/issue_recheck.py the issue re-read before a push (§8)
scripts/branch_chain.py a branch read back as replayed work
scripts/git_bounded.py git with capped output
scripts/issue_comment.py one-line outcome comment
scripts/review_outcome.py its review sentence and marker token
scripts/merge_state.py whether a pull request can merge
scripts/proposal_report.py merge results into the report
scripts/report_outputs.py the run's pull request links (§18.6)
scripts/continuation.py which rounds continue (§20.6)
scripts/request_notice.py a failed review request's notice (§20.5)
scripts/review_verdict.py classify a Copilot review (§8 step 11)
scripts/review_sections.py its suppressed and unchanged-code counts
scripts/review_text.py what one line of it the classifier reads
scripts/copilot_review.py request and await the review
scripts/head_checks.py the published head's checks (§8 step 11)
scripts/transient_reads.py a wait's transient read failures
scripts/review_request.py the request and its refusal notice
scripts/revision_reads.py a bot pull request's state (§20)
scripts/thread_reads.py its review threads and their replies
scripts/thread_comments.py one thread's comments, read whole
scripts/thread_pending.py resolved threads a round left unanswered
scripts/check_reads.py its head's failing checks
scripts/stale_statuses.py statuses pending too long (§13.1)
scripts/round_reads.py the issue's rounds and new comments
scripts/round_caps.py the round caps a result reads (§20.1)
scripts/round_recount.py the ceiling's rounds after a race
scripts/revision_select.py revision candidates and entries
scripts/revision_scan.py the owner-wide scan, ranked
scripts/revision_rounds.py the rounds a run works, built on demand
scripts/unreviewed_heads.py heads with no Copilot review (§20.1)
scripts/revision_check.py a revision's offline checks
scripts/branch_swap.py the compare-and-swap branch move
scripts/revision_publish.py the push, replies and resolves
scripts/selection_choose.py the cap, budget and one-per-repo rule
scripts/run_overlap.py targets other active runs hold (§6)
scripts/overlap_evidence.py their vouched selection evidence (§6)
scripts/overlap_wait.py the tie-break wait for older runs (§6)
prompt/revise.md the revision task (§20.2)
tests/ unittest suite, offline
pyproject.toml, uv.lock Python tooling
docs/DESIGN.md this document
The five modules marked shared come verbatim from
lfreleng-actions/bots-template, and every bot carries them; a fix
lands in the template first and then propagates here. ledger.py
ships so the copied set stays whole, though this bot does not yet
read a prior run's ledger.
The template's linting configuration stays as the repository's
gate: prek hooks including gitleaks, gitlint, ruff, mypy,
basedpyright, actionlint, gha-workflow-linter, reuse, markdownlint,
write-good and aislop at threshold 100. pre-commit.ci stops the
whole run at 3 minutes and has no network, so it skips four hooks:
gha-workflow-linter and aislop need the network, and
monkey-tests and actionlint are the slowest. The regression and
actionlint jobs in testing.yaml run the last two, and
linting.yaml runs the rest of ci.skip through the
generic-workflows linting reusable.
- A live
branchesorpull-requestsdispatch writes into a bot fork (§4.3) with Actions switched off, so the agent's code runs nowhere until a maintainer approves the pull request's workflows on the target. Dry-run andselectmode mint no write token. - Land the workflow with the schedule in dry-run and
pull-requestsmode. Inspect diffs, messages and abstentions for a week of runs. - Dispatch
branchesmode live against one repository's named issue. Confirm Verified commits, DCO status, message format and that the branch-exists guard trips on a second run. - Dispatch
pull-requestsmode live against the same repository. Confirm the PR title check, Copilot's automatic review, label and provenance block. - Flip the schedule to live (done: weekdays at 02:00 UTC, with a
Slack digest of each run's pull requests). Watch spend from
usage.jsonand the ratio of merged to closed bot pull requests. - Stop unattended runs (done): remove both schedules, the Slack digest and the new-issue scan, so every run is a dispatch that names its work or a continuation of one (§6, §11, §17).
Each step is a signed commit and a PR through the normal review process. Disabling the workflow in the Actions UI is the kill switch.
- A comment at the round cap from the select job. The publisher of a segment's last round says a human must take over; the selector names a pull request it skips at the cap later in the summary alone.
- More than one issue per repository per run, sequentially in one session, if the one-per-repository rule starves the backlog.
- Stub roll-out. The organisation
AGENTS.mdis onmainoflfreleng-actions/.github; a one-off mode could open its §12 stub pull request in every repository, which is itself an issue this workflow could work. - Dispatch from triage, naming the issues triage marks ready (§11), once a cross-repository token has an owner and the hardening pass has reviewed an unattended trigger.
- Remove the dormant scan code. The selector still holds the
new-issue scan (
scan_candidates, its ranking and category filters, and the--repositories,--categoriesand--include-assignedarguments, §18.5) behind the refusal in §6; a later change deletes it and the selection fields it alone fills. - Private repositories. A
contents: readtoken for the author job would be the first credential on that runner and needs its own containment answer.
The questions the first draft left open, and how they closed:
| Question | Decision |
|---|---|
| Model identifiers | Checked live against the pinned CLI; §10.3 |
| Where bot branches live | Bot fork organisations, never the target (§4.3); CI on agent code runs as an outside contribution |
| Mode changes and symlinks | Reject; agent banners the human follow-up in the PR body (§5, §7.3). Unsigned commits are unmergeable and create work |
| Payload cap | 4 MiB added, 512 KiB per binary; rollout confirms (§5) |
| Pre-commit config edits | Off by default for new proposals; allow_precommit_config_edits turns them on for the run, the precommit-edits-ok label for one issue. A revision round leaves .pre-commit-config.yaml alone unless its pull request already changes it or its issue carries the label. The provenance block flags every such change and names the label that granted it (§8 step 3) |
| Workflow edits | Off by default for new proposals; allow_workflow_edits turns them on for the run, the workflow-edits-ok label for one issue. A revision round changes no workflow file beyond those its pull request already changes unless its issue carries the label. App holds workflows: write, granted to every fork mint (§8 step 3, §10.1) |
| Assigned issues | No scan, so no assignee filter; an operator who names an assigned issue works it (§6) |
| Sub-agent tool | task; agent-definition tools denied alongside (§7.2) |
| Skills from the checkout | Off by default; load_repo_skills for a repository a maintainer has read (§7.2) |
| Issue feedback | One comment per outcome via a comment-step token; no labelling, which stays with triage (§8 step 8). GitHub has no permission that stops at comments |
| Trigger | Operator dispatch naming issues, pull requests or revise_only, plus the continuation (§20.6). This change removed the weekday cron, the revise_only slot that ran every hour, the Slack digest and the new-issue scan: the proof of concept showed the pipeline can run with no operator, and unattended operation stops before a security hardening pass over the whole pipeline, so new work starts when an operator names it and at no other time. A pull request whose continuation ends with work still arriving waits for an operator's revise_only dispatch (§11). Dispatch from triage is a later option (§16) |
| DCO | DCOAPP today, a pre-commit lint soon. The trailer matches the API commit's author identity (§5) |
| Co-author trailer | Copilot, the assistant, for every supported model prefix in config/coauthors.json (§10.3) |
| Comments in the packet | OWNER and MEMBER authors, bounded by count and bytes (§6) |
| Private repositories | Out of scope for v1 (§2, §16) |
| Who requests the Copilot review | A maintainer's PAT with a Copilot seat, held by the request step alone; reviews bill to that seat (§10.4, item 4 below) |
Still to confirm during rollout rather than before it:
- DCOAPP and API commits (§5, §15 step 2). The app compares the
Signed-off-bytrailer with the commit author. Commits made throughcreateCommitOnBranchcarry the App's bot identity as author, so the trailer the publisher appends uses that identity. The first livebranchesrun proves it, and if the app exempts bot authors the check passes regardless. - Pre-commit DCO lint and bot commits. The coming hook runs on
the agent's local commits, which carry the placeholder identity
of §7.1 and its
-strailer; API replay does not run hooks. Confirm the hook accepts the placeholder when it lands. createCommitOnBranchpayload limit (§5). If a 4 MiB diff fails in rollout, lower the cap; the agent's abstention path covers larger changes.- Requesting a Copilot review with an App token (§8 step 10).
GitHub's documentation bills a review "when a bot requests" it
to the organisation, which implies an App may ask. The live
pull-requestsruns showed it cannot: the mutation succeeds with the installation token, but the timeline shows no Copilot request and no review arrives, while the same request with a user token brought a review every time. GitHub never refused, so the step reportedsentuntil it learnt to read the request back; it now records the refusal, and the review stays pending. The read-back goes through the issue'sreview_requestedevents, not the mutation's reply: the reply's pending requests include the ruleset's team request, which the review token cannot resolve, so GitHub answered every applied request with an error. RESTrequested_reviewersdoes not serve either: with Copilot pending it lists the team alone, so a read-back through it (#71) recorded every landed request as refused. Decided: the step uses a credential held by a Copilot user, theCOPILOT_REVIEW_TOKENsecret of §10.4, a maintainer's fine-grained PAT with Pull requests: write, whose seat GitHub bills for the reviews it requests. No App mint widens for it, and without it the step falls back to the App's token and its refusal. A livepull-requestsrun confirms the log recordsreview request: sentand the review arrives.
The files the three jobs exchange. Every reader treats a file from a
less trusted producer as hostile input: typed, bounded, and
cross-checked against the trusted selection.json.
{
"schema": 1,
"org": "lfreleng-actions",
"generated_at": "2026-09-18T09:02:11Z",
"mode": "pull-requests",
"dry_run": true,
"allow_workflow_edits": false,
"workflow_edits_label": "workflow-edits-ok",
"allow_precommit_config_edits": false,
"precommit_edits_label": "precommit-edits-ok",
"model": "claude-opus-5.5",
"fusion_tier": null,
"bot": {
"login": "lf-code-monkey[bot]",
"email": "123456+lf-code-monkey[bot]@users.noreply.github.com"
},
"guidance": {
"repository": "lfreleng-actions/.github",
"path": "AGENTS.md",
"ref": "main",
"commit": "<40 hex>",
"sha256": "<64 hex>"
},
"candidates_seen": 78,
"skipped": {"pull_request": 0, "repository": 12, "label": 5,
"untrusted_author": 4, "author_not_listed": 2,
"editor_not_listed": 0, "no_type": 3, "closed": 0,
"category": 0, "assigned": 2, "attempted": 1,
"linked_pr": 0, "one_per_repo": 30, "cap": 15,
"revision": 0, "duplicate": 0, "held": 0},
"only_known_authors": true,
"issue_authors": ["alice", "bob"],
"explicit_repositories": [],
"explicit_issues": [],
"skipped_issues": [],
"overlap_waits": [],
"issues": [
{
"key": "sbom-action-40",
"repository": "lfreleng-actions/sbom-action",
"repo_name": "sbom-action",
"number": 40,
"url": "https://github.com/lfreleng-actions/sbom-action/issues/40",
"title": "...",
"body": "...",
"labels": ["feature"],
"priority": "Medium",
"type": "Feature",
"created_at": "2026-09-18T18:52:05Z",
"author_association": "MEMBER",
"author": "alice",
"author_is_bot": false,
"edited": true,
"editor": "bob",
"editor_is_bot": false,
"default_branch": "main",
"base_sha": "<40 hex>",
"branch": "code-monkey/issue-40",
"sudo_and_containers": false,
"allow_workflow_edits": false,
"workflow_edits_label": null,
"allow_precommit_config_edits": false,
"precommit_edits_label": null,
"comments": [
{"author": "login", "association": "MEMBER",
"created_at": "...", "body": "..."}
],
"comments_dropped": 0,
"comments_truncated": false
}
]
}model is the --model identifier, and fusion_tier the Copilot
Fusion tier when model is fusion, else null (§10.3); the
provenance block names both. Both are the run's effective values, so
a run that inherited its parameters (§20.1) records the inherited
model and tier here.
A run dispatched with inherit_run_parameters (§9.1) adds four
fields, and a run without it adds none:
{
"inherit_run_parameters": true,
"inherited_parameters": {
"model": "fusion", "fusion_auto_model_select": "true",
"fusion_tier": "high", "max_runtime_minutes": "120",
"max_rounds": "10", "stale_status_minutes": "8",
"allow_subagents": "true", "request_review": "true",
"request_antagonistic_review": "true", "load_repo_skills": "false",
"include_dotgithub": "false"
},
"inherited_from": "https://github.com/<caller>/actions/runs/<id>",
"inheritance_note": ""
}inherited_parameters holds the checked values by cron form input
name, inherited_from the run URL of the footer that carried them.
When the run inherits nothing, inherited_parameters is {},
inherited_from is null and inheritance_note says why, and the
step summary repeats the note; otherwise the summary lists each
inherited value. The select job's Settle run parameters step reads
inherited_parameters back to publish the run's effective values.
key is <repo_name>-<number> and doubles as the matrix key and
the artifact-name suffix. skipped carries every counter, zero or
not, and the summary lists each: pull_request, repository,
label, untrusted_author (an author outside OWNER and MEMBER,
or an App, without agent-approved, §6), author_not_listed and
editor_not_listed (an author or last body editor off the issue
author list, §6), no_type, closed,
category, assigned, attempted, linked_pr, one_per_repo,
cap, revision, duplicate and held (another in-progress run
selected the target, §6 "Overlapping runs"; a named target's reason
ends ; not worked). An issue entry's
author_is_bot
records whether an App or bot opened the issue; author, edited,
editor and editor_is_bot record the login that opened it and the
last edit to its body, which the issue author list checks (§6). explicit_issues
holds the named issues as owner/repo#N, in the order given, and
skipped_issues one
{issue, reason} per named issue or pull request the selection
dropped; both are empty on a scan, but for a target another run
holds and an issue the one-per-repository rule held back, which
skipped_issues records on a scan too, the latter with a chosen
field naming the entry that took its repository as owner/repo#N. overlap_waits
holds one line per older run the overlap tie-break waited for (§6
"Overlapping runs"), empty when it waited for none. explicit_pull_requests,
revise and revise_only record the §20 inputs; a revise_only
selection holds revision entries alone and candidates_seen is 0.
allow_workflow_edits records the run's §9.1 switch the publisher's
check reads (§8 step 3) and workflow_edits_label the label that
grants one issue the same; a JSON true turns the switch on and any
other value leaves it off. allow_precommit_config_edits and
precommit_edits_label record the pre-commit config switch and its
label the same way.
A revision entry adds task: "revise", rebase_sha, checkout_sha,
pull_request (number, url, title, head_sha, mergeable,
created_at), round (global, as the footers number it),
segment_round (the round's place in its antagonistic segment, which
the cap reads, §20.1), stale_rounds (the superseded rounds before
this one, which the ceiling reads with round, §20.1), max_rounds
(the run's rounds per segment),
collected_at (when the selection read the comments; every entry
carries it), session (the run id and the select job's attempt:
new on a full rerun, which authors anew, kept across a retry of the
publish job alone; every entry carries it, and the scratch branch
and the reply marker are its), round_reasons, rounds, threads (thread_id,
comment_id, path, line, outdated, resolved, author,
maintainer, created_at, body, replies as {author, maintainer, created_at, body} for the newest later comments from
Copilot or a maintainer,
a maintainer's kept before a reviewer's, replies_dropped,
maintainer_latest and maintainer_undated, read over the whole
thread before the bound trims the replies, and
maintainer_unanswered, whether no reply of the bot's there answers
that newest word, and maintainer_answered, whether one does: a
reply answers the words its round read, dated up to the seen= its
marker carries, or, on a reply without one, the words before it in
thread order), threads_dropped,
review (the §8 step 11 record of the head, with the body),
antagonistic_review (the hand-back of §20.1 as {review_id, round, run, head_sha, url, author, submitted_at, body, body_truncated}, or
null),
checks (the head's failing check runs and commit statuses, as
{name, conclusion, app, details_url, title, summary, annotations, kind}; a status carries its context as name, its state as
conclusion, its description as title, its target_url as
details_url, a null app, an empty summary and no annotations,
bounded as a run is; each annotation
{level, path, line, title, message} at level failure or warning,
and kind defect or infrastructure (§8 step 11);
empty when none failed), checks_dropped (the failing runs, and
the annotations of carried runs, the bounds left out: at most 30
runs, 10 annotations each, 2 KiB per title, summary and message,
32 KiB in all, defect runs kept before infrastructure ones;
annotations past the third page of a run count unread, whatever
their level), checks_unsettled (the head's runs
whose status is not completed, queued, in progress or waiting,
and its pending statuses,
counted over every run whatever the bounds keep: an empty checks
beside a non-zero count says CI had not finished, not that it
passed; a stale status, §13.1, is not counted), checks_stale (the
stale statuses, at most 30, each with context, updated_at and
the run's minutes: the hook service did not report, so the result
is unknown), pr_comments, new_comments and
new_pr_comments; an issue entry has task: "issue" and
checkout_sha equal to base_sha. Every entry carries
sudo_and_containers: true when the root tree at its
checkout_sha holds .enable-sudo-and-containers as a regular
file, and false otherwise (§4.1). Every entry also carries its own
allow_workflow_edits, which the publisher's check reads (§8 step
3): on an issue entry true when the run's switch is on or the
issue carries the label, on a revision entry true when the issue
carries the label and false otherwise (§20.3).
workflow_edits_label names the label when it granted what the
run's switch would not, and is null otherwise. Every entry carries
allow_precommit_config_edits and precommit_edits_label by the same
rules, from the pre-commit config switch and the precommit-edits-ok
label. A JSON true alone
turns a grant on, and a present value of any other type is off;
an entry without the field takes the run's value, and a revision
entry without it keeps §20.3's rule. Either
kind adds
previous_rejection when the bot's latest outcome on the issue was
rejected (§6), as {heading, run_url, reasons, reasons_dropped, note}: note is null when the select job read the reasons, and otherwise
a fixed text saying why it could not. Beside it the select job writes
matrix.json
({"include": [{key, repository, repo_name, number, base_sha, branch, fork_org, fork_repository, task, checkout_sha, rebase_sha, head_sha, pull_number, sudo_and_containers, allow_workflow_edits, allow_precommit_config_edits}]}, the last three false unless the
entry's field is a JSON true; the author job's runtime context
states the two grants), agents.md (the
guidance bytes whose
SHA-256 the guidance block records), excluded-repos.txt and
unreviewed-heads.json (the skipped_issues entries whose reason
says the head has no Copilot review, §20.1, which the report reads
from this artifact). The job outputs selection_sha256,
guidance_sha256 and unreviewed_sha256 over the exact bytes.
Written by the agent into the artefacts directory. When the agent
leaves none, the workflow writes one with "outcome": "author-failed" so the publisher has something to report. A
revision round that stood down because its branch moved or vanished
after selection ran no agent, and the workflow writes "outcome": "abstain" with the reason and "superseded": true instead (§20.2).
That stand-down alone sets superseded: the bundle step deletes the
field from a manifest the agent wrote, and the check honours it on a
revision's abstention alone.
{
"schema": 1,
"outcome": "proposed",
"repository": "lfreleng-actions/sbom-action",
"issue": 40,
"base_sha": "<40 hex>",
"branch": "code-monkey/issue-40",
"reason": null,
"pr_title": "Feat(sbom): Add CycloneDX 1.6 output",
"pr_body": "...\n",
"commands": [{"command": "uv run pytest", "exit_code": 0}]
}schema must be the integer 1; the publisher rejects any other
value, or none, rather than read the fields under a contract it
does not know. outcome is proposed, abstain or
author-failed, and for a revision handoff (§20.3); the last three
need a reason. A proposed manifest must carry a non-empty
pr_title and pr_body whatever the commit count, and on a
single-commit branch the title must equal the commit's subject.
changes.bundle
sits beside the manifest when the outcome is proposed, created by
the workflow (not the agent) from base_sha..branch. A revision's
manifest may set base_sha to the entry's rebase_sha instead,
and adds round_summary and responses, one {thread_id, comment_id, reply, resolve} per thread answered (§20). usage.json
is the CLI's own usage output. Bounds on acceptance: manifest
1 MiB, bundle 32 MiB, usage 1 MiB; regular files, no symlinks.
commands lists the checks the session ran, each {command, exit_code}; the check keeps the first 50 entries with a string
command, cut to 200 characters, and records an exit_code that is
not an integer as null. They fill the provenance table (§8 step
9). A hook run is a kept entry whose command names prek run or
pre-commit run as whole words: SKIP=a,b prek run --files x and
uvx pre-commit run --all-files are, prek install and
git commit -s (pre-commit and commit-msg hooks) are not. The
prompts make the last hook run the session's run of the hooks over
the files its commits change, after its last commit (§7.3); when it
exits anything but the integer 0, a missing exit code included,
the proposal stays proposed and the publisher marks it (§18.3). No other entry
affects a verdict, and nothing marks a manifest with no hook run, or
one whose failing hook run a passing one follows. hook_runs.py
holds the rule.
The output of publish.py check, produced with no credential but
the native token it hands zizmor for the online audit (§8 step 3).
{
"schema": 1,
"key": "sbom-action-40",
"repository": "lfreleng-actions/sbom-action",
"issue": 40,
"branch": "code-monkey/issue-40",
"base_sha": "<40 hex>",
"default_branch": "main",
"verdict": "proposed",
"reasons": [],
"needs_workflows": false,
"changes_precommit_config": false,
"workflow_edits_label": "",
"precommit_edits_label": "",
"commits": [
{
"sha": "<40 hex>",
"tree": "<40 hex>",
"headline": "Feat(sbom): Add CycloneDX 1.6 output",
"body": "...\n\nCo-authored-by: ...\nSigned-off-by: ...",
"additions": [{"path": "src/x.py", "size": 1234}],
"deletions": ["old.py"]
}
],
"pr_title": "Feat(sbom): Add CycloneDX 1.6 output",
"pr_body": "...",
"stats": {"files_changed": 2, "added_bytes": 1234},
"premium_requests": 37.5,
"agent_seconds": 1543,
"models_used": ["claude-opus-5.5", "gpt-6-luna"],
"models_dropped": 0,
"warnings": [],
"online_audit": "online audit: no new zizmor findings"
}verdict is proposed, abstain, rejected or author-failed
here; result.json (§18.4) adds publish-failed for a write that
failed after verification, with the branch rolled back.
reasons explains anything but proposed. needs_workflows records
whether the proposal edits .github/workflows/, for the check
summary alone; no step gates on it. changes_precommit_config
records whether it edits the root .pre-commit-config.yaml, for the
summary and the provenance block. The workflow and pre-commit config
rules of §8 step 3 are part of the check itself, and land in
reasons. workflow_edits_label names the label that let the
proposal change workflow files when the run's switch would not, and
is blank otherwise, including on a round whose workflow changes pass
§20.3 without the label; when the check cannot read the pull request
to tell, the label still grants the round and the field names it.
precommit_edits_label does the same for the precommit-edits-ok
label and the root .pre-commit-config.yaml, and the provenance
block's Lint gate line names it.
result.json carries each, or null, for the issue comment and the
report.
commits[].body is the
composed message the publisher will send: the agent's body plus the
trailers §5 describes. pr_body is the composed body: the closing
line and provenance block first, then the agent's text.
premium_requests and agent_seconds come from the session's
usage.json, and models_used from the top-level keys of its
modelMetrics: at most ten well-formed model ids, sorted, with
models_dropped counting the entries left out (§10.3). A missing or
unreadable file leaves the list empty.
online_audit is the online zizmor audit's pass note, blank
when the check rejected the proposal before reaching it; its
rejections land in reasons. warnings holds notes that change no
verdict: an unanswered thread or a round summary that misses its
hand-back on a revision (§20.3), and on any proposal one line naming
a last hook run that did not exit 0 and its exit code (§18.2).
result.json starts its own warnings with these, once, for a
first attempt and a revision alike, so the run report shows them.
The report row's notes cell keeps the hook line a share of its own,
which a long rejection reason cannot take.
A revision's check also carries threads, the threads its entry
carried as {thread_id, comment_id, held}: held is the word on a
resolved thread the bot never replied on, or null, which the push
and respond steps read for the footer's pending (§20.2).
{
"schema": 1,
"key": "sbom-action-40",
"repository": "lfreleng-actions/sbom-action",
"issue": 40,
"verdict": "proposed",
"reasons": [],
"dry_run": false,
"mode": "pull-requests",
"branch_url": "https://github.com/.../tree/code-monkey/issue-40",
"commits": ["<40 hex>"],
"pull_request_url": "https://github.com/.../pull/41",
"comment_url": "https://github.com/.../issues/40#issuecomment-1",
"premium_requests": 37.5,
"agent_seconds": 1543,
"models_used": ["claude-opus-5.5", "gpt-6-luna"],
"models_dropped": 0,
"run_attempt": 1,
"author_session": "<proposal artifact ID>",
"review": {
"requested": true,
"verdict": "findings",
"assessment": "closer-look",
"unresolved_threads": 1,
"suppressed": 0,
"previously_missed": 0,
"reasons": ["1 unresolved review thread"],
"review_id": 5425770192,
"commit_id": "<40 hex>"
},
"antagonistic": {"state": "off", "reason": null}
}URLs are null where the mode or a rejection stopped short, and
author_session where no proposal arrived. models_used and
models_dropped copy the check's (§18.3), and a result the publish
job writes after a failure keeps the list. The report shows the ids
of a model id's shape and drops the rest, since a result is not yet
authenticated. reasons starts as the
check's, at most 20, each cut to 2,000 characters: a rejection quotes
the proposal it refused, and the next selection carries them to the
agent (§6). issue_closed is true on a rejection because
the issue closed after selection (§8 step 8), and absent otherwise:
the comment step then posts nothing on the finished issue, and the
report row still shows the reason. only_known_authors and
issue_authors carry the check's mode and list, and
author_unlisted is true when that list refused
the issue: offline, at the push, before the pull request opens, at a
revision's replies or at the comment step's own re-read, which then
posts nothing (§8 step 12). review is present on
a published pull request when request_review is on: requested
says whether the request landed (§8 step 10), verdict is clean,
findings or pending, assessment is approval, closer-look,
changes or null, and commit_id is the head the review judged.
On a published pull request the probe (§8 step 11) adds mergeable
(true, false, or null when GitHub never settled or a read
failed), mergeable_state (GitHub's short word, or null),
default_branch, base_moved_during_run and base_behind_by
(null where a read failed). A conflict means false and nothing
else: the comment, the report and the outputs read null as
unconfirmed. The same step adds late_comments: where a maintainer
commented after the round read the pull request (issue, pull request, review thread), [] when nowhere, null when it found
nowhere but a read failed, or did not run (§20.6).
On a published pull request with request_review on, the wait
(§8 step 11) adds checks: state (passing, infrastructure,
failing, running, none or unknown), commit_id (the head it
read), failing (at most 30 runs and 32 KiB, each with name,
conclusion, app, details_url, title, summary, bounded
annotations, each with level, path, line, title and
message, and kind, defect or infrastructure, as the revision
packet carries them, a failing commit status among them; an entry
without kind reads as a defect),
dropped (failing runs left out),
unsettled (runs not yet completed and statuses still pending),
infrastructure (failing runs
the egress agent failed, kept or left out, so the comment and the
report count those the bounds dropped; a record without it counts
the entries marked so), defects (the other failing runs, kept or
left out, so a defect the bounds dropped still marks a running
head failed; a record without it counts the entries not marked
infrastructure), read_at, reason (why
the state is unknown, or null) and stale (the statuses
§13.1 stopped waiting for, at most 30, each with context,
updated_at and minutes; a record without it has none). The
comment adds one sentence naming them and the minutes, the report
counts the heads with any, and the marker's checks= token folds
their contexts into its hash, so a rerun that saw them settle posts
again. Check names come from the code
under review: the comment and the report bound and escape them.
The comment and the report read a checks record of the wrong
shape, or for a commit other than the published head, as unknown,
and a result with a review but no checks as unknown too.
The comment and the report read a record with any field missing or
added, or any other verdict, as pending, and a pending record
whose requested is false as a review the workflow could not
request rather than one that did not arrive. The report job merges
every result.json into one table whose review column names the
verdict (pending (not requested) for that case) and, for findings,
the counts of threads, suppressed
findings and findings on unchanged code, a count of the wrong shape
left out.
On a pushed result the publish job adds antagonistic (§20.5):
state is requested (nominated: the request job will ask, and
its summary says whether the dispatch landed), off (the switch),
dry-run, or skipped with reason naming the condition that
failed. The comment reads it; the report recomputes the rule.
Open gap. The publisher writes this file, but the report cannot
yet prove it did: the author job can reach the Actions runtime
token (§4.1) and upload an artifact of the same name. Until each
result carries a MAC under a key the author never holds, fetched
under the bounds §8 step 1 applies to proposals, the report is
informational, and nothing may write on the strength of it (the
activity log of §19 included). The maintainers have yet to choose
the secret that supplies the key. The next selection's
previous_rejection (§6) reads this file too; it writes nothing on
its strength, and the agent treats its bounded reasons as data, so a
forged result can at worst mislead one attempt a human reviews.
select_issues.py --org ORG --output-dir DIR --mode MODE --model ID
[--dry-run] [--repositories "a, b"] [--issues "o/r#1,o/r#2"]
[--exclude-file PATH]
[--exclude-repos "a,b"] [--include-dotgithub] [--include-assigned]
--max-pull-requests N [--categories LIST]
--guidance-repository O/R [--guidance-ref REF]
[--guidance-path AGENTS.md] [--bot-slug SLUG]
bot_evidence.py verify --directory DIR --expect selection.json=HEX
--expect agents.md=HEX [--limit-bytes N]
proposal_fetch.py --repository O/R --run-id ID --name ARTIFACT
--output ACCEPTED
publish.py check --selection PATH --key KEY --proposal-dir DIR
--workdir DIR --coauthors PATH --output check.json
[--summary check-summary.md] [--run-url URL]
publish.py apply --check check.json --workdir DIR --mode MODE
[--dry-run] [--run-attempt N] [--author-session ID]
--output result.json
publish.py comment --result result.json [--run-url URL]
publish.py review-request --result result.json --output result.json
[--credential "review token"|"App token"]
publish.py review-await --result result.json --output result.json
[--wait-minutes N]
publish.py respond --result result.json --check check.json
--output result.json
antagonistic_request.py --result result.json --output result.json
--switch true|false [--repository O/R]
request_notice.py --repository O/R --number N --kind failed|uncertain
--head SHA --bot-slug SLUG
--run-id RUN_ID --run-url URL --review-repository O/R
--branches JSON [--summary FILE]
publish.py report --results DIR --output-md PATH --output-json PATH
[--org ORG --github-output PATH] [--unreviewed-heads PATH]
merge_state.py --result result.json --check check.json
--output result.json
select_issues.py refuses a run that passes neither --issues nor
--pull-requests, unless it sets the flag the revise_only input
maps to (§6 "No new-issue scans").
The workflow no longer passes --repositories, --include-assigned
or --categories, which the retired new-issue scan alone reads
(§16).
select_issues.py, merge_state.py, request_notice.py,
publish.py push, open, respond, comment, review-request
and review-await read GH_TOKEN; report reads the select job's unreviewed-heads.json
when given one (§20.1). Everything else
runs offline. A verdict other than
proposed is data, not an error: the scripts exit non-zero for
operational failures alone.
A caller cannot read report.json without the run's namespace, so
the reusable workflow declares seven workflow_call outputs. Five
come from the report job's Build report step through
publish.py report --org ORG --github-output PATH; selected_count
is the select job's own count, the length of the trusted matrix,
checked there as digits; antagonistic_pull_requests is the
antagonistic job's requested, the nominees it dispatched (§20.5):
| Output | Value |
|---|---|
pull_requests |
Single-line JSON array of URLs, in report order |
pull_request_count |
The array's length, as a string |
unmergeable_pull_requests |
Those whose head conflicts (§8 step 11) |
failing_check_pull_requests |
Those with failing checks (§8 step 11) |
selected_count |
Entries selected, issues and revisions, as a string |
antagonistic_pull_requests |
owner/repo#N of each request (§20.5) |
continue_pull_requests |
owner/repo#N of each to continue (§20.6) |
run_parameters |
The run's parameters as JSON (§20.1, §20.6) |
Outside a live pull-requests run, continue_pull_requests is
always [].
Results are not yet authenticated (§18.4), so report_outputs.py
treats each field as hostile. A URL counts when the whole value
matches ^https://github\.com/<org>/[A-Za-z0-9_.-]+/pull/[1-9][0-9]*$,
<org> the run's org input, with case folded in ASCII alone, so
no non-ASCII letter that Unicode folds onto an ASCII one (the
dotless ı in gıthub.com) passes; duplicates, compared the same
way, keep their first place. unmergeable_pull_requests passes
the results whose mergeable is false through the same filter:
it never names a link pull_requests would refuse, and
failing_check_pull_requests does the same for the results whose
checks record shows a known failure: state failing, or running
with defect failures already recorded (its whole defects count,
names kept or not); failures at the egress agent
(infrastructure) are not among them. A dry-run
result, or one without a pull_request_url, contributes nothing.
The script leaves any other value out and never copies it; it counts
them in report.json (excluded_pull_request_urls, beside the
pull_requests array), in the report and as a ::warning::. The
keys stay fixed and neither value can hold a newline. A selection that ran no
agent gives [] and 0; a run whose report job did not run gives
empty strings. Like the report, the outputs are informational: they
name pull requests, and nothing may write to a repository on the
strength of them. The caller reads none of the pull request lists
for display since the Slack digest went (§11); a forged result can
at most add a link to another pull request in the organisation to
the run's outputs. The report's
antagonistic_pull_requests output, the request job's input, and
the continue_pull_requests output, the caller's continue job's
input, are the two exceptions; §20.5 and §20.6 bound them. Beside
the first, the report's antagonistic_heads output, which is not a
workflow output, maps each nominee to the published head its clean
review covered, so a notice of a failed request names that head.
The antagonistic job also sets two job outputs that are not workflow
outputs. failed is {"include": [...]}, one entry per nominee whose
review request did not certainly go, each with pull
(owner/repo#N), repository, repo_name, number, kind and
head, the nominee's entry in antagonistic_heads; failed_count
is its length, as a string. kind is failed for a nominee GitHub
refused on every pass and uncertain for one whose single dispatch
failed without an answer saying GitHub refused it. The step builds
both from the nominees it has already validated, and both are empty
when the job did not run or had no token (§20.5).
Status: designed, not built. The bot keeps one open issue in
this repository, titled Code Monkey activity log and labelled
code-monkey-log, as its record and as memory between runs. The
selector finds it by label and by the bot as its author, so a
human-opened issue with the same label cannot stand in for it.
Each live run adds one comment, written by the trusted report job, covering:
- pull requests the run raised, and branches it pushed without a
pull request (
branchesmode, or a publish that stopped short); - pull requests the bot raised earlier that a human has since reviewed, merged or closed, and the issues those merges closed;
- issues the bot itself opened, such as the human follow-up an
INFObanner describes; - interrupted work:
author-failedandpublish-failedresults, and abstentions whose reason says the issue needs more iteration; - which open issues a blocker held back, and the blocker's reason.
The issue body holds the current state, rewritten each run: open bot pull requests with their review state, work in fork branches (§4.3) that has no pull request yet, the latest note per issue, and the blockers below. The comments are the history; the body is what the next run reads.
Linting tool releases, and issues or releases in upstream projects, sometimes block a class of work until something outside the estate changes. Maintainers list those in the body, between two markers the bot preserves when it rewrites everything else:
# code-monkey:blockers
- scope: "repo:sigul-docker-k8s"
reason: "Waiting on upstream sigul 1.3 packaging"
tracking: "https://pagure.io/sigul/issue/123"
- scope: "category:ci"
reason: "actionlint 1.7.13 rejects the \$/ self-repository syntax"
tracking: "https://github.com/rhysd/actionlint/issues/711"
- scope: "issue:lfreleng-actions/java-workflows#47"
reason: "Needs the Maven 4 release"
tracking: "https://github.com/apache/maven/releases"A scope names a repository, a category (§6), a label, or one issue.
The selector skips every open issue a blocker matches, counts it
under blocked, and the run's comment says what each blocker held
back. The selector reads blockers from the body alone: the body is
editable by maintainers and the bot, while anyone can comment. A
malformed block fails the select job instead of the selector
ignoring it, so a typo cannot release blocked work unnoticed.
The manifest gains an optional notes field for what a later
session should know: what the agent tried, what failed, what it
would do next. The publisher bounds it to 2,000 characters and
flattens it like a reason (§8 step 8). The report job files it in
the body against the issue, replacing any earlier note. When the
selector next chooses that issue it adds the note to the packet,
marked as an earlier session's notes; the prompt treats it as data,
the same as issue text, since it descends from issue text.
The report job mints a token for this repository alone with Issues: write, which the App already holds; the select job reads the log with its existing read token, scoped to include this repository. The author job never touches the log. Live runs write the log; dry runs put the same content in the step summary and leave the issue alone, but still honour its blockers.
A pull request the bot opened is not finished until a Copilot review of its head is clean (organisation guidance §11.5), and a review with findings, or a maintainer's comment, needs an answer. A revision round sends a session back to the pull request: it reads the review and the comments, revises the same branch in place, and the publisher moves the branch, answers each thread, and runs the §8 review gate on the new head. One run performs one round; the next run, continued or dispatched, performs the next, up to ten per pull request, the cap the guidance sets, counted afresh for each antagonistic review that hands the pull request back (§20.1).
Three ways in, all through the select job and its read token:
pull_requestsnames the bot's open pull requests to revise, through the list splitter in pull-request mode. A named pull request gets a round with or without work outstanding: the operator decided.- An issue named in
issueswhose earlier attempt is an open bot pull request becomes a round on that pull request rather than a skip. Withreviseoff the earlier behaviour stands. A closed earlier attempt brings no round: the run works the named issue afresh (§6 "Explicit issues"), and a merged one keeps it out. - A
revise_onlyscan (§6 "Therevise_onlyscan") searches the owner for the App's open pull requests and selects those with work outstanding, and nothing else; an operator dispatches it (§11), since no schedule does any more. Work outstanding is: an unresolved review thread whose opening comment comes from Copilot, a listed antagonistic review App or anOWNER/MEMBER; a Copilot review of the head with findings; an antagonistic review that handed the head back after the bot's latest footer, recorded asantagonistic review round N handed back; a check run on the head whose conclusion isfailure,timed_outorstartup_failureand whose kind isdefect(§8 step 11), recorded asfailing checksamong the round's reasons (the publish job'schecksrecord, §18.4, reports the same failures on the round that published the head, but selection reads them afresh); a head that conflicts with the default branch (mergeablefalse), recorded asconflicts with the default branch, since GitHub runs no CI on it and it would otherwise wait unseen; or anOWNER/MEMBERcomment on the issue, the pull request or a review thread that counts, resolved or not, an opener or a reply, after the bot's latest footer, or one on a resolved thread, older or not, that no reply of the bot's there answers, or that the last handled round carried and posted no reply for (its footer'spending=); on the issue, the comment must come from a listed issue author (§6), whose comments alone reach the packet, unlessONLY_KNOWN_AUTHORSturned the list off. The predicate leaves out, by name, a check the head's own round cannot influence (check_reads.EXCLUDED, empty today); the round cap bounds a check that fails for reasons outside the pull request. GitHub computesmergeablein the background, so the selection reads anullagain on the §8 step 11 backoff, for the head it selected, before the test, which adds up to a minute per such candidate; one that never settles is no work on its own, so a GitHub hiccup spends no round. A head with nothing else whose check runs have not all finished (check_reads.is_unsettled, the predicate the publish job'srunningstate uses; the reader sets a stale status, §13.1, apart first, so it alone isnothing outstandingand is no work, and the entry'schecks_stalenames it) skips aschecks still running, notnothing outstanding, so the skipped-issues record and the report tell it from a green head and the next scan reads it again, since the select job waits for no CI; with other work outstanding the round goes ahead and the entry'schecks_unsettledtells it CI had not finished; a head whose failures are allinfrastructure, settled, with nothing else outstanding, skips with the reasonrevision_select.INFRASTRUCTURE_ONLY(failures at the egress agent alone; it needs a re-run), notnothing outstanding, so the skipped-issues record, the summary and the digest show it, and a re-run or the next push clears it; with other work outstanding the round goes ahead and the packet carries those entries markedinfrastructure(CheckPacket.infrastructurecounts them whole, each failing run read and classified before the bounds, asoutstandingcounts the defects); a head with nothing else outstanding, its checks settled with no infrastructure failure, and no Copilot review skips with the reasonunreviewed_heads.NO_REVIEW, orunreviewed_heads.REFUSEDwhen the bot's latest footer on the issue records the review aspending/not-requested(§8 steps 10–11), notnothing outstanding(see "Heads with no review" below); a clean head with nothing else needs no round; and after a handoff (§20.3) neither the disputed threads nor a failing check nor a hand-back brings a round on its own, a maintainer's comment does. Revisions come before new issues, ranked by the originating issue's priority and then the pull request's age, the scan reading each hit's pull request and issue for the rank before the cap, under the same cap but not the one-per-repository rule (§6), so a repository with two or more pull requests outstanding gets a round on each, and a pull request past the cap costs no reads: the selection builds a candidate when the budget has room for it, so a failed read of a round it could not admit aborts nothing. Revisions select inpull-requestsmode alone, named ones included, since abranchesrun publishes none.
Heads with no review. A head reaches the scan with no Copilot review
when the publish job's wait ended pending, Copilot not having answered
within it or GitHub refusing the request because the review token lapsed
or was never set (pending (not requested), §10.4), or when a
maintainer pushed to the bot branch and nobody asked for a review of the
new head. With nothing else outstanding no round has anything to answer.
Read as nothing outstanding, which the scan does not record, a lapsed
token would turn every new pull request into a silent stall, so the scan
records the skip in skipped_issues like every other.
unreviewed_heads.py lists those heads under their own heading, with
their count and the count whose request GitHub refused, in the selection
summary and in report.md and report.json. The list reaches the
report as a file, not a job output: a scan may skip hundreds of heads,
more JSON than one environment string holds (E2BIG). The report job
fetches the select job's evidence artifact by ID, without failing the
job when the fetch does, and passes unreviewed-heads.json on when its
bytes match the select job's unreviewed_sha256; otherwise it warns and
the report omits the list. The report prints an entry when it names a
pull request of the owner with one of the two reasons, and counts the
rest, an unreadable file as one. A skip is not a selection; the
counts in the step summary are what tells a human the token lapsed. The
scan leaves such a head for Copilot's own arrival or for a human: the
next scan reads it again, and
a review that arrives with findings, a thread, a failing check or a
maintainer's comment brings a round as before. The select job does not
request a review itself: it mints a token with the read levels alone by
design (§10.1), and the review token reaches the publish job's
Request Copilot review step and nothing else (§10.4). A re-request path would
need that token: one shape that fits the trust model is a selection
entry of a new kind that runs no author session and whose publish job
runs the request and the wait alone. That is a larger change, left until
the counts show the case occurs.
Whatever the way in, the candidate must be the bot's own: open, opened
by the App, head in the designated fork (§4.3) on a
code-monkey/issue-<n> branch; its repository must pass the §6 safety
tests, and its issue must be open and carry no no-agent label, so
closing the issue or opting it out stops the rounds. A round a scan
finds also applies the §6 author rule: the selector skips the round
of an issue from an author outside OWNER and MEMBER, or from an
App, that lacks the agent-approved label, and the reason names the
label, so its pull request costs no further rounds until a
maintainer approves the issue. A named round, like a named issue,
applies no association rule. Every round, named or scanned, applies
the §6 issue author list, when ONLY_KNOWN_AUTHORS leaves it on:
an issue whose author or last body editor
is off the list costs no round and counts under author_not_listed
or editor_not_listed, not revision, and the publisher re-checks
it live before it retitles, pushes, restores a title, posts a
proposal's or a handoff's replies or description, or comments on the
issue. The
selector skips a round, named or scanned, whose pull request or issue
another in-progress or queued run already selected, counts it under
held and names that run in the reason, so two runs do not revise
one pull request at once (§6 "Overlapping runs"); a named round also
warns, the report lists it as not worked, and the running round hears
the comment that dispatch was for (§20.6). A scan honours the
run's repository policy, the named repositories or everything but the
exclusions, before it reads a hit. The round number continues from the
bot's own footers on the issue: the last line of each of its comments,
the first publication's included as round zero, read across the whole
comment history or failing closed when that history outgrows the read. A
marker in a comment's body text is text. The footer names when its run
read the comments (since=), and that, not the footer's own time, is
the watermark a maintainer's comment must follow to be new: a comment
posted while a run was reading is work for the next round. The
watermark sits one second before the read, since it has second
precision and a comment must follow it strictly to be new; the
overlap may reread a boundary comment and loses none. The latest
footer is the one with the latest read time, not the latest post: a
retry of an older round that posts after a newer handoff rewinds
neither the watermark nor the pause, and two posts of one read order
by their time. The footers of other pull requests do not count: a
revision round's footer names its pull request (pr=), and one
naming another belongs to an earlier attempt, from a pull request a
human closed before an operator named the issue again (§6 "Explicit
issues"), whenever it posts. A footer naming none, a first
publication's or one written before footers named their pull
request, counts from the pull request's opening on. The new pull
request so starts its own round count, cap, watermark and pause
afresh. A footer
whose round published nothing, an abstention, a rejection or a failure,
counts toward the cap and moves no watermark, since it handled no
request. A handled round's footer may also name a maintainer's word
it carried on a resolved thread and posted no reply for
(pending=, §20.2); the latest handled footer's is the one the
next selection reads.
Superseded rounds. A round that loses a race with another run's
push did no work the cap exists to bound: the author job stood it
down because the branch moved or vanished after selection (§20.2),
the push found the branch at another head before its swap or the
swap's compare-and-swap refused it (§20.3), or respond found a
handoff's head moved (§20.3). Its footer ends stale=1 (§20.3), and
round_reads.round_history counts such a footer in stale alone:
it raises no round number, opens or lengthens no segment, anchors no
review and adds no round summary, so the round costs the pull
request none of its segment's cap, and the next round takes the same
round number. It still ran, so the selector adds stale to the
highest round against the ceiling of sixty below. A branch that
vanished reads the same way, though its pull request, merged or
closed, is never selected again; a pull request
the push or respond reads as closed is a plain rejection. Racing
runs, or a stand-down a manifest forges past the bundle step, could
then loop without bound, so a guard of its own (MAX_STALE_ROUNDS,
ten) skips a pull request whose history holds ten superseded
footers, before any hand-back read, until a human looks. Another
run can post the tenth while a counted round runs, so the publisher
reads the guard for every outcome (round_caps.guard_reached, the
recounted stale_rounds plus this round if superseded): a counted
round there withdraws its nomination and, unless a clean proposal,
says a human must look.
The cap per antagonistic segment. The review bot gives a pull
request up to five antagonistic rounds before a maintainer takes over
(lfreleng-actions/github-code-review-bot issues 28 and 58), and each
hand-back needs its own Copilot cycles to answer, so ten rounds is a
cap per segment, not per pull request. The first publication
opens the first segment; the first round whose footer carries a
review, as the hand-back its entry held (handback=<review id>) or
as the one it answered (antagonistic=<review id>, §20.3), opens the
next, and counts as its first. A failed round records the hand-back
its entry held too, so its retries count in the segment it opened. A
later round naming the same review, as a handoff a maintainer resumes
on the same head or a retry of a failed round does, opens nothing, so
each review ID anchors at its first round and the latest of those
anchors starts the segment. round_reads.round_history returns
the segment's count beside highest, by round number, so a round
posted twice counts once, and
the footer's round=N stays global: the round number is monotonic
for history and summaries, and the cap alone reads the segment. The
selector skips a pull request whose segment holds ten rounds, or the
rounds a dispatch's max_rounds input sets for that run, unless
the selection finds an unanswered hand-back of the head (the one the
work-outstanding test reads: a listed App typed Bot, the current
head, the marker on the body's last line, posted after the
watermark) whose review no footer has anchored yet; that round opens
a new segment and goes ahead whatever the last one counted. The
anchor, not the watermark, decides: a failed round moves no
watermark, and a hand-back that a round's selection read as it
arrived postdates that round's watermark, yet a footer carries
each. No comment resets the count, and a footer counts when the bot
posted it. At the cap the selector reads the hand-back alone, before
the packet, so a capped pull request costs one read. Above every
segment sits a ceiling of sixty rounds (MAX_TOTAL_ROUNDS: the first
publication's ten and ten for each of the review bot's five rounds);
at or above it the selector skips first, reading no hand-back,
whatever the segment says or the run's cap, so footer history that
goes wrong still ends the loop. The segment's cap bounds the rounds
that count; the ceiling bounds those and the superseded rounds above
together, which also have their own guard of ten. The entry carries the global
round, segment_round, stale_rounds and max_rounds, and the
publisher reads them through one rule, revision_reads.round_cap_reached,
with round plus stale_rounds as the rounds the ceiling counts
(round_caps.spent_of): the issue comment's cap notice, the
report's cap note and the antagonistic review nomination all read
that sum, so a round that spends the ceiling's last round offers no
further round the selector would refuse. Two runs that select one
pull request read the same history, so neither count holds the
other's round: after 54 counted and four superseded rounds, a
counted winner and a superseded loser of round 55 spend the sixtieth
between them, yet each selection counts 59. The comment step holds
the issue token, so it recounts the history before it writes
(round_recount.recount): it reads every footer of the pull request
but this attempt's own (its run URL and since), adds this round
once, and records the sum as rounds_spent and the superseded
rounds before it as stale_rounds, neither below the selection's.
The comment, then the report and the nomination it recomputes from
result.json, read that sum whichever run posts second; a
nomination the recount puts at the cap becomes skipped. A read
that fails keeps the selection's count, with a warning. At the cap
the selector skips the pull request with that reason, and the
publisher of the segment's last round has already said a human must
take over until the next antagonistic review hands it back. One key
admits one entry, so a pull request named beside its own issue runs
once.
The entry (§18.1) carries both bases: base_sha, the commit the
pull request's chain descends from (the compare merge base), and
rebase_sha, the default branch's head. It carries the pull request,
the unresolved threads and any resolved thread holding a maintainer's
word after the watermark, marked resolved, with the ids a reply and
a resolve need and the newest replies from Copilot or a maintainer on
each, read from the whole thread page by page so a crowd of
passers-by hides no
maintainer's answer, since that answer is an instruction as much as
a comment on the pull request is. The reads take in every thread
that counts before the packet's bounds apply, and the whole of each
thread before the bound trims its replies, so they hear a
maintainer's word after the watermark whichever thread or reply
holds it. A resolved thread counts here because the publisher
resolves a thread in the round that answers it, so a maintainer who
answers that reply writes on a resolved thread; one with no such word
stays out of the packet and its bounds, and Copilot's and a review
App's comments on it are not heard. A resolved thread carried for a
maintainer's word is no unresolved finding: it brings a round through
that word alone, and wakes a pull request handed back to a
maintainer as any maintainer comment does. The footer's watermark moves past a word
the bounds left out of the packet, and a resolved thread, unlike an
open one, would never come back for it: so a resolved thread is also
carried while no reply of the bot's there answers a maintainer's word
on it, whatever the watermark, until a round answers it; a reply
counts as the bot's when its author is the App, typed Bot, not a
user who took the App's slug. A reply answers what its round read:
its marker carries seen=, the selection's collected_at, and it
answers the words dated up to then and none posted while the round
ran, which the agent never saw, so such a word stays unanswered
through a later round that leaves it out of the bounds or posts no
reply. A reply without seen= answers the words before it, ordered
by date, then by place in the thread where both share a second. A resolved
thread the bot never replied on has the watermark alone, so those go
first among the threads holding a word, and when the bounds cannot
hold them all the reads fail closed, as for a thread too long to
read, rather than let the watermark pass one. A round can carry such
a thread and still post no reply on it: the agent left the response
out, GitHub refused the reply, or the publisher answered no thread
at all. The push then records the oldest word the round carried on
one as the result's pending, the respond step clears each word
whose reply is on its thread, and the footer names what remains
(pending=). The next selection hears again any resolved thread the
bot never replied on whose word is no older than that, whatever the
watermark, until a round's reply lands. A thread the bot answered
after that word owes nothing: the selection neither hears it again
nor counts it toward that fail-closed bound. The threads holding a
word go first into the bounded packet,
and within a thread a maintainer's replies outrank a reviewer's for
the places the bound allows. The entry carries the
head's review verdict; the head's failing checks, read from the
public check runs API (filter=latest, every page, failing closed
past ten) with the failure and warning annotations of each, and from
the public combined status (commits/{sha}/status, one page of 100,
failing closed past it; GitHub keeps the latest status per context),
whose failure and error statuses count as failing checks and
pending ones as unsettled, bounded as the threads are; the
maintainers' comments on the pull request,
the maintainers' comments on the issue and the pull request since the
last round, newest first within the bounds and one oversized comment
hiding none behind it, so the instruction that caused the round
reaches the agent whatever the count of older comments, the earlier
round
summaries and the issue packet as before, all as data, bounded as
the issue comments are. An annotation names the failing step,
seldom its cause, which sits in the job log. The select
job reads no log: logs need Actions: read and redirect to a rotating
storage host outside the select job's egress allow-list, so the job
records which checks failed and where, and the session, which has
the checkout and the toolchain, recovers why (§20.2). The read mint
adds Checks: read for this and scopes to the
named repositories as for issues. The combined status needs no
permission on a public repository, and every selection path refuses
one that is not public, so the mint does not ask for Commit statuses,
which the App registration does not hold: GitHub would refuse a mint
asking for it. Should private repositories come into scope (§16), the
App gains Commit statuses: read first, then the mint and §10.1. A
status's context, description and target_url come from whoever
can post statuses on the repository: data, bounded and escaped as a
run's name and title, and the select job never follows target_url.
Antagonistic review. The review bot's antagonistic mode
(lfreleng-actions/github-code-review-bot issue 28) reviews a bot
pull request once Copilot's review of its head is clean, as one
COMMENT review by its own App, and dispatches this workflow with
the pull request named when it has something to hand back. Its
findings sit in inline threads and in the review body: the summary,
which may name a defect of the whole change, findings with no diff
line to sit on, every finding when GitHub refused inline placement,
and notes on malformed or capped findings. The trusted Apps are
config/antagonistic-reviewers.txt, one login per line without the
[bot] suffix, read from the assets checkout at the pinned commit as
the other configuration is; an empty list turns the source off. An
author counts when the list holds its login and GitHub types it a
Bot (REST type, GraphQL __typename), so a user who took the
App's slug as a login is nobody's reviewer. The selection lists the
pull request's reviews and takes the newest submitted one by a listed
App whose commit_id is the head and whose body, trailing whitespace
aside, ends with the line <!-- antagonistic-handback round=N head=<head SHA> run=<run id> --> naming that head. A review of an
older head, a marker that is not the last line, or one naming another
head does not count, and an antagonistic-review marker hands
nothing back. The review bot's trusted applier writes that line
alone, and it disarms < in agent text, so the marker is the review
bot's word, not its agent's. The selection reads that review before
the threads and again after its other reads: GitHub posts a review
with its inline comments, so the threads read between the two hold every
finding it placed on the diff. When the two reads name different
reviews, one landed mid-read and its threads may be in the packet
without its body; a round they started would move the head past the
review, which then never counts again. The read fails instead, and
the next run reads threads and body together. The entry carries
that review's body
bounded as Copilot's is, marked when cut, under
antagonistic_review; the App's unresolved threads count as work and
enter the packet with Copilot's and the maintainers', under the same
bounds and reply trimming, and the publisher answers and resolves
them as it does every thread. The prompt tells the session the body
is another agent's review, data and never instructions, as Copilot's
text is: nothing parses findings out of it, the session reads it.
A review listing that fails, or a listed review without a readable
body, fails the read as every revision read does, so no round runs
without the findings that brought it. This workflow also asks for
that review itself once Copilot's is clean (§20.5); the marker
above, never the request, makes a hand-back.
Inherited run parameters. A run that named one pull request with
inherit_run_parameters (§9.1) runs its round with the parameters
the pull request's last round used, not the form's. Every round's
outcome footer records them as its last token, after stale=1:
params=v1: and then model, tier, runtime, rounds, stale,
subagents, skills, dotgithub, review and antagonistic,
each name:value, joined by ,, the switches as 1 or 0 and
tier left out without Fusion (scripts/run_parameters.py). The
token never holds =: the footer's own fields are name=value, and
a reader looser than round_reads.FOOTER, such as the review bot's
hand-back check for antagonistic=, would read a field spelt
antagonistic=1 inside the token as answered review 1. The
select job reads the latest footer of that pull request not marked
stale=1, ordered by the read time it records as the watermark is,
so neither a superseded run, which may have used other parameters,
nor a late retry of an older round sets them. It checks each value
of that footer's token as the form's input check would: the model
id against its pattern and the Fusion tier pairing, the integers
against their ranges, the switches as 1 or 0. A token that fails
any check inherits nothing, with a warning. So does a read that
fails, a pull request that is not the bot's, or one whose latest
footer carries no token, as every round's footers did before this,
and as one does whose token outgrew its bound; an older footer's
token never stands in. In each case the form's values stand. The
inherited set is the eleven cron inputs model,
fusion_auto_model_select (derived from the model),
fusion_tier, max_runtime_minutes, max_rounds,
stale_status_minutes, allow_subagents, request_review,
request_antagonistic_review, load_repo_skills and
include_dotgithub. The run's own target and safety inputs
(dry_run, mode, pull_requests, issues, revise,
revise_only, outstanding_only, continues_run, the edit grants,
the concurrency and pull request caps, the egress settings and the
guidance and assets coordinates) never inherit, so no footer can
widen what a run may touch.
A reader older than the token, a run or a caller pinned to a commit
before it, finds no footer in a comment that carries one: its
pattern ends at stale=1. It then counts no round, moves no
watermark and anchors no hand-back from that comment. The reader
and the writer land in one commit, so move every caller whose runs
work the same issues to it together, and let runs started on an
older commit finish first. The review bot needs no change to
read the footer, since the token holds no name= field of its own.
The author job checks out the default branch head (checkout_sha),
the commit the select job also read the sudo and container marker at
(§4.1), fetches the bot branch from the public fork without a credential,
refuses any head but the recorded one, and checks it out. A branch
that moved or vanished after selection stands the round down, as
the publish job does (§20.3): the moved branch is another round's
work, a named dispatch's or a revise_only scan's, and a vanished one
means the pull request merged or closed, so the job neither
fetches again nor retries. The fetch step prints a ::warning::
naming the branch, the fork and, for a moved branch, both heads cut
to seven characters, exits 0 and sets an output that skips every
later step that would install the toolchain, assemble the prompt or
run the session. The bundle step then writes an abstain manifest
with the same reason and superseded: true, so the run stays green,
the round counts toward no segment's cap (§20.1), the report and digest
count a skip rather than a failure, and the issue gets the one
"did not attempt it" comment; the publisher's own moved-head
rejection is never reached, since the round proposes nothing. Any
other fetch failure still fails the job. The prompt is
prompt/revise.md: weigh each finding as the guidance says, fix
what deserves a fix, commit by the guidance's review-round rules
(amend a single commit; one dedicated feedback commit on a
multi-commit branch), keep the chain on base_sha unless a
maintainer asked for a rebase or the pull request is not mergeable,
and then rebase onto rebase_sha and no other commit. A round whose
reasons include conflicts with the default branch exists for the
conflict, so the prompt asks for the rebase even when no maintainer
did. The manifest
(§18.2) adds a reply per thread with whether to resolve it, the pull
request body and a round summary. The prompt describes the failing
checks as data, never instructions, since their names, summaries and
annotations come from the code under review, and asks the session to
reproduce each failing job from the repository's workflow
definitions, record what it ran in the manifest's commands, and
report a failure it cannot reproduce or attribute to the change in
the pull request body rather than fix it blind. When
checks_unsettled is non-zero, the prompt tells the session that CI
had not finished when the selection read the head, so the absence
of a failing check is not evidence it passed, and that it still runs
the repository's tests before it finishes. The bundle step reads the
base the agent chose, accepting nothing but the two recorded values
on the command line. The trust boundary of §4 stands: the job holds
no write credential and the fork is public.
The offline check verifies the whole chain against whichever
recorded base the manifest names and rejects any other. The check
compares a chain that adds, edits or deletes a file under
.github/workflows/ with the pull request itself: it fetches the
recorded base and published head from the bot fork, anonymously,
and rejects a round that touches a workflow file the diff between
them leaves alone, naming the file, whatever allow_workflow_edits
says; the root .pre-commit-config.yaml passes the same test,
whatever allow_precommit_config_edits says. The workflow-edits-ok
label on the issue lifts the rule for workflow files alone (§9.1):
its entry's grant lets the round add, edit or delete any workflow
file, so a round can answer a review's request for a regression test
in another workflow, and the runtime context tells the session
workflow edits: allowed; the label never widens a round into the
pre-commit configuration. The precommit-edits-ok label lifts the
rule for .pre-commit-config.yaml alone in the same way: its round
may change the file when its pull request does not yet, the runtime
context tells the session pre-commit config edits: allowed, and
the label never widens a round into a workflow file. A rejection
names the label its file lacks. One exception covers commits the round
carries over, such as an edit and its revert: a file outside that
diff passes when the
chain leaves it as its own base had it and the pull request's
published commits already made every change the chain makes to it,
in the same order and no more often, read along the first-parent
line for at most 64 commits. The check reads a change as the file's
mode and blob before and after it, from each commit's raw diff with
no pathspec, so a name holding a glob character covers that file
alone. It replays the published changes onto the chain's base, each
merged three ways as a rebase would and stopping at the first that
does not apply, and requires the chain's changes to equal those:
a rebase over an upstream edit elsewhere in the file still
matches, while an edit moved to another line, rewritten or repeated
does not. The base is
the pull request's own, not the
rebase commit, so upstream workflow changes a rebase brings in
neither widen nor narrow what the round may touch. A chain that
touches no gated file fetches nothing, and one that does reads
the pull request's diff once for all its paths. The check also
types each
reply and binds it to a thread the selection carried, defusing
mentions and bounding the text; requires the round summary; and
warns of a thread left unanswered, which stays open for a human. It
records a rebase, and the description's round line says so, and
says when the round set out to resolve a conflict the selection saw;
the probe runs after the check writes that line, so a conflict that
arises during the round reaches the comment, the report and the
next selection, not the description. That
line, and the round's issue comment, also name the failing checks
the selection carried, escaped and bounded as agent text is, since
a check's name comes from the code under review, and, when the
selection's checks_unsettled is a count from one to 1,100, say N check(s) still running at selection; any other value says nothing.
A round sent by an
antagonistic hand-back names the review it answers, its round and
its URL, in both places, from the trusted selection fields alone,
never the body, and the check refuses an entry whose URL is not the
one built from the entry's repository, pull request number and
review id; the prompt asks the session for a section headed
Antagonistic review in its round summary, and on a proposal in its
pull request body too, answering each finding the body alone holds,
fixed or not and why. The check warns when the round summary
lacks one. Where other rounds cut the summary to 2,000 characters,
the check rejects a hand-back round whose summary, mentions defused,
runs over that bound: a handoff answers in its summary alone, and a
published round's footer records the review as answered. The review
gate (§8) still waits for Copilot alone, not for CI. A
manifest outcome of handoff, open to a revision alone, says the
agent changed nothing because it disputes every remaining finding or
needs a human's decision: the check reads its replies the same way,
none may resolve a thread, the publisher replays no chain, posts the
replies, leaves the threads open, comments the handoff on the issue
with the agent's reason and round summary, and skips the review
gate, since the head did not move. The handoff has no swap to refuse
a moved head, so respond, which holds the pull request token where
the push step holds none for a handoff, reads the pull request's
state and head before any reply goes up: a pull request closed or
merged since selection is a rejection with no reply, as on the push;
a head that moved during the session is a rejection, since the
replies answer code the agent did not see, and a superseded round
(§20.1); an issue whose author or last body editor the §6 list no
longer admits is a rejection marked author_unlisted; and a state,
head or issue it cannot read is a failure, never a handoff taken on
trust. The
next scan leaves the pull
request alone until a maintainer comments, on the issue, the pull
request or one of the disputed threads.
A single-commit revision whose subject changed sets the pull
request's title before the push, with the pull request token minted
ahead of it: the Semantic Pull Request check runs on the push and
compares the title with the subject, so the title must lead
(organisation AGENTS.md §10.1). It reads the pull request and the
bot branch first, since the pull request's head can lag a branch
deleted or moved since, and writes when the pull request stays open
and it and the branch both head at the selected commit, or at this
run's own published chain on a retry. A
pull request closed or merged since selection, a head another
session moved, or a branch that reads as gone keeps its title, as
the push will refuse that round, and none of them fails the step.
A push that then
fails with the branch unchanged gives the old title back, with the
same token, while the head and title are still this attempt's, and
after a retitle whose reply GitHub lost, since the record of the old
title goes down before the write; a
publication keeps the new title and an unknown swap outcome restores
nothing, since the branch may hold the new chain. A refusal by the
§6 issue author list restores nothing either: one the push recorded
as author_unlisted stands without a read, and otherwise the
restore re-reads the issue's author and last editor against the list
the retitle recorded, failing the step with no write when that read
fails. Either title write
reads the pull request back once after a transient 5xx: the title
in place counts as set, and anything else fails the step, with the
PATCH never sent again. A resend could replace a title a maintainer
or another session set meanwhile, while a title that did not land
costs nothing lasting: a later round or a maintainer sets it.
Neither step writes a result, so the log alone notes it. The push reads
the pull request's state and the bot branch before it writes to the
branch. A pull request closed or merged since selection is a
rejection, found before the publisher touches the fork: the round
stands down with no push, replies or review gate, and its issue
comment says so, as for any rejection. The push then syncs the
fork, replays
the chain onto a temporary branch
(code-monkey/issue-<n>-r<round>-<session>, the session being the
run id and select attempt, so two named dispatches revising one pull
request at one round, within one second even, neither resume nor
delete each other's branch, and a full rerun owns a branch of its own)
through createCommitOnBranch,
which signs every commit, then moves code-monkey/issue-<n> to the new
head with updateRefs, beforeOid set to the recorded head and
force: true: GitHub refuses the move when the branch no longer
holds that head, and the publisher records a rejection rather than
force over work the run did not see. Before it replays, the publisher
asks of the branch the proof the new-issue path asks of an existing
one, the verified chain on the round's base, and adopts the branch
that passes: a rerun after a swap that succeeded and a later step
that failed would otherwise replay against a beforeOid the swap
itself retired and refuse the run's own publication. The publisher
reads a branch that fails the proof once more before any write: a
head other than the recorded one, or a branch that reads as gone (a
404), is a rejection with no replay, temporary branch or swap, and
marks the round superseded (§20.1).
GitHub has answered a stale beforeOid with a generic error the
compare-and-swap refusal below cannot recognise, so this read, not
the swap, settles a move made before it. A 404 in the adoption proof
likewise means no chain, never a failure, while any other read error
still fails the publication. When the swap
answers with an
error the publisher reads the branch itself, since GitHub may apply
the move and then lose the reply: at the new tip the move stands,
with a warning; at the recorded head the move did not happen and the
failure says the branch holds its old head; elsewhere, the
compare-and-swap refusal, and that message alone, is the rejection,
superseded like the read before the swap,
while any other error there, or no answer, is an outcome the result
names unknown and never calls unchanged, so a human reads the fork
before the next round. After the read above, a move between that
read and the swap is the one way to end there. The publisher reads
the temporary branch's
own creation the same way when its reply is an error or the branch
already exists: a branch at the base belongs to this attempt and the
replay goes on; one carrying the round's verified chain holds an
earlier attempt's finished replay, adopted; one holding anything else
belongs to nobody the publisher may delete for, so the result names
it and the move fails. The
temporary branch goes
whatever happens, and one the cleanup could not remove is a warning
in the result whatever the swap's outcome. A branches run moves
nothing: a revision publishes in pull-requests mode alone, where
the replies and the review gate follow. The fork mint is the
existing one; no new permission.
With the pull request token, respond first reads the pull request's
head: the compare-and-swap guarded the branch move alone, and another
run may have advanced the pull request since, so a head other than
the one this round published, or one it cannot read, leaves every
write below undone with a warning and the publication standing.
GitHub's pull request object lags the ref update, so a read that
still names the head the round began from is a stale read, not a
move: respond reads again after 2, 4 and 8 seconds, and warns, naming
the round's tip and the previous head, when the read never
catches up. Any other head skips at once. It then re-reads the
issue's author and last body editor against the §6 list, since
someone may have edited the issue after the push: a refusal marks the result
author_unlisted, and a read that fails warns; either leaves every
write below undone and the publication standing. It
then posts each reply on its thread
prefixed with the AI disclosure and ending in a marker that names
the round, the session and, as seen=, when the selection read the
thread (its collected_at),
resolves the threads the agent
marked fixed, and replaces the title and body with the composed
ones, keeping the publisher's header. A reply changes no thread's
state: a resolved thread the agent answers stays resolved, and the
publisher never unresolves one. One refused write is a warning
and the rest proceed, as is a thread grown too long for the bounded
read. A rerun reads each thread first and posts no
reply whose marker a comment by the App, typed Bot, there already
ends with, so a user who copies the marker skips no reply, and a
failure after the replies notifies no reviewer twice, while a later
session at the same round number, one whose predecessor left no
footer, posts its own; the resolve
still runs, since one lost after the reply is its own retry.
A transient 5xx on a reply reads the thread for its marker once
and never posts again; the resolve runs once with no read-back; the
description edit reads the pull request back once, counts the title
and body in place as written, and otherwise ends with a warning and
never sends again, since a later round may have written its own
description meanwhile and a resend would replace it with this older
one. Each write recovered this way adds a warning to the result.
and the rest proceed. The §8 review gate then requests and awaits
the review of the new head, and the issue comment names the round,
the pull request and the head the push left, since later rounds
replace the same branch, the summary and the verdict, with the round
in its marker, which is how the next selection counts rounds. Every
round whose entry held an antagonistic hand-back, whatever its
verdict, records it in its marker as handback=<review id>, which
anchors the segment (§20.1). A proposal or handoff that consumed the
hand-back then ends its marker with antagonistic=<review id>, the
receiving-side key lfreleng-actions/github-code-review-bot issue 31
will use for an idempotent hand-back; a failed round never writes
it. A round that lost a race with another run's push (§20.1) ends
its marker with stale=1, after every other field, and its comment
says the round does not count toward the round cap, with no cap
notice unless it spent the ceiling's last round or was the tenth
superseded round, when the comment says a human must step in. A
counted round other than a clean proposal says the same once the
recount finds ten superseded rounds. The
round history reads every footer form, with any of these fields or
without them. The summary and the reasons are agent text: flattened
to one line, mentions defused and HTML escaped, so they can neither
hide the verdict and
the marker after them nor collapse them into a block. At the cap,
ten rounds in the segment or the run's max_rounds (§20.1), every
outcome but a clean proposal says the cap is that number of rounds
per antagonistic review round,
that a human must take over until the next antagonistic review
hands the pull request back, and promises no further round
otherwise, since the selector skips the pull request until then, a
handoff's "once a maintainer comments" included; at the sixty-round
ceiling it says a human must take over, with no exception. The run
report's capped details and the pull request's disclosure of how
the workflow answers findings say the same.
Nothing in the author job changes: it still holds no write credential and never the App key. The publisher gains no permission: replies, resolves and the description edit are writes to the target's pull requests, which the pull request token already covered, and the branch move is a write to the fork, which the fork token already covered. The select job's read mint gains Checks: read, for the head's failing checks; no mint gains Actions, so no trusted job reads a job log. The antagonistic review source reads reviews and threads the read token already covered, and changes no permission. The compare-and-swap is the new guard: the publisher moves an existing branch to the chain it verified alone, and from the head the trusted selection recorded alone. The agent's replies are text from outside, defused and bounded like its pull request body, and a thread the agent disputes stays unresolved for a human, as the guidance requires.
Open points, listed in §16: a comment at the round cap from the select job, and rounds within one run.
With request_antagonistic_review on, the default, the workflow
asks the review bot for its antagonistic review (§20.1) of each pull
request it published this run whose Copilot review came back clean,
rather than wait for the review bot's own schedule. The rule
nominates a live proposed result with a pull request when
Copilot's review is clean and judged the published head, the
probe did not find a conflict, the head has no known failing check
and its checks are passing, infrastructure, running or none
(never unknown; the mode does not wait for CI, and a re-run of a
job the egress agent failed is no reason to withhold it), and the
round is below the sixty-round ceiling. The rule
nominates a clean head at a segment's cap: the next hand-back opens
a new segment. A maintainer comment the round never read
(late_comments, §20.6) always withholds the nomination, since a
clean antagonistic review hands nothing back and would leave the
comment unanswered: below a cap the next round answers it first and
earns the nomination once it ends clean; at a cap, the segment's
included, the reason says a human answers it.
scripts/antagonistic_request.py holds the rule.
Four jobs share the work. The publish job's offline
Record antagonistic review request step writes the result's
antagonistic record (§18.4) for the comment, with no token. The
report job recomputes the rule from every result, ignoring the
recorded state, over the URLs report_outputs.py already accepted,
and emits the nominees as owner/repo#N, with each one's published
head in antagonistic_heads. The antagonistic job,
skipped in a dry run, outside pull-requests mode, with the switch
off, antagonistic_repository empty or no nominee, re-validates each
nominee against the run's org, refuses the whole list on one bad
entry or one nominee without a published head, and runs
gh workflow run code-review-antagonistic.yaml -f dry_run=false -f pull_requests=<nominee> once per pull request
with the token of §10.5. The step tries a dispatch GitHub refused
again: it makes up to four passes, the first over every nominee and each later
one, after a wait, over those that have not gone. The waits before
the second, third and fourth pass are 15, 60 and 240 seconds, one
per pass whatever the list holds, from the step's RETRY_DELAYS; at
315 seconds the worst case sits inside the job's ten minutes, and a
pass with nothing left ends the loop. An answer carrying an HTTP 4xx
status, a rate limit among them, proves GitHub refused the dispatch
and applied nothing; nothing else does. Any other failure, a lost response or
a server error, may follow a dispatch GitHub accepted, and sending it
again could start a second review run, so the step never does: it
becomes an error annotation and an uncertain line in the summary.
A refusal the step will try again is a notice naming
the pull request and the pass; a nominee refused on every pass is an
error annotation. The requested output, the nominees dispatched,
feeds antagonistic_pull_requests (§18.6); the failed output lists
the refused ones as kind failed and the uncertain ones as kind
uncertain, each with its published head, and once the step has
written both and the summary it fails when any nominee failed or
stays uncertain, so the run goes red.
A red run tells nobody reading the pull request, so the
antagonistic-notice job, which runs when failed_count is
neither empty nor 0, comments on each pull request in failed,
one matrix entry each. The failed list comes from a job that reads no
artifact, but results are not authenticated (§18.4), so before any
token exists an offline step checks the entry: repository must be
org/repo_name with a plain name, number a positive integer,
kind failed or uncertain and head a commit SHA. It then
binds the entry to the select job's matrix. A revision entry
in that repository with that pull_number binds it, and its branch;
failing one, the branches of the repository's issue entries, whose
pull_number is 0 because their pull request opens this run, bound
the branch it may be on; with neither, or a branch not of the form
code-monkey/issue-<n>, it stops. The job then
checks out the pinned assets, mints an App token with pull requests:
write and metadata: read on that one repository, passes the identity
pre-flight (§10.1) and runs scripts/request_notice.py with those
branches, the kind and the head. The script posts when the pull
request is open, the App opened it, its head branch is one of them,
its head is still the published head the request was for, and the
App has posted no notice of that kind for that head, and not
otherwise; a notice counts when the App wrote it and it ends with the
marker <!-- code-monkey-notice antagonistic-request kind=<kind> head=<sha> run=<run id> -->. A head that moved belongs to a later
round, which makes its own request: a notice naming it would claim a
request nobody made for it failed, and its marker would hide that
round's own notice, so the script posts nothing. Two named runs, or
a scan and a named run, hold different
workflow locks (§11) and can reach the job for one pull request
together; the job's concurrency
group per pull request, never cancelled and with queue: max, makes
the later leg wait, find the earlier notice for that head and post
nothing. The comment names
the head and links the run. A failed notice says the request did
not reach the review bot and how to ask again: dispatch
code-review-antagonistic.yaml in antagonistic_repository naming
the pull request. An uncertain notice says the request may not have
reached it, since its dispatch ended in an error that does not say
whether GitHub accepted it, and to dispatch the same workflow if no
review arrives. The notice carries no round footer and no review
bot marker, so it counts as neither a round nor a hand-back (§20.1).
Trust. Nothing authenticates a result yet (§18.4), so a forged result can nominate another bot pull request in the organisation. The other side bounds the cost: the review bot's selection re-checks the bot authorship, the clean Copilot review of the current head, its own round cap and whether it already reviewed that head, so a forged nomination at most spends one skipped selection. The notice, the one write a nominee leads to, goes on the pull request the selection names or, for one opened this run, on the selected issue's branch, so a forged entry cannot direct it to another bot pull request in a selected repository. The request never counts as a hand-back; the review bot's marker does (§20.1).
The review bot's hand-back dispatches the caller with
inherit_run_parameters=true beside the one pull request it hands
back, so the round that answers the antagonistic review runs on the
model, tier, budgets and switches of the round it reviewed, not the
form's defaults (§20.1). That change lives in
lfreleng-actions/github-code-review-bot and needs this input to
exist first.
A run performs one round per pull request and ends (§2). The publish job already knows whether the round left work outstanding, so the dispatch caller starts the next round itself rather than leave it to an operator's next dispatch. The next round is a new run, with a fresh select job that re-reads everything from GitHub, a fresh session and the same trusted publish.
The rule. scripts/continuation.py continues a live proposed
result whose pull_request_url the report accepted (§18.6) when at
least one of these holds: Copilot's review has findings and judged
the published head; the head has defect check failures
(review_outcome.checks_failed, so failures at the egress agent
alone do not continue); mergeable is false; or a maintainer
commented after the round read the pull request (late_comments,
below). It does not
continue any other verdict (abstain, handoff, rejected and the
failures wait for an operator), a result with no comment_url,
since the round history counts rounds by their outcome comments and
a round with none would leave the next one the same number, so no
cap would advance (the result's word alone proves nothing, so the
continuation's select job checks the comment itself; see
continues_run below), a review still pending, which
an operator's next revise_only dispatch picks up (§11), a result whose antagonistic
review the run requested, since the review bot's hand-back dispatches that round
and a continuation would race it, or a round at a cap
(round_caps.at_cap: the segment's cap or the sixty-round ceiling,
and the segment's cap of a clean round that a late comment would
otherwise continue).
The report emits the continuing pull requests as owner/repo#N,
validated and deduplicated as the antagonistic nominees are, in the
continue_pull_requests output (§18.6) of a live pull-requests
run: the report job gives [] in any other, since no other mode
moves a pull request's head.
Comments the round never read. A round reads its pull request
when its run selects (collected_at, the footer's since=). A
maintainer who comments while it runs is in no packet, and the running
round holds a named dispatch to act on that comment (§6 "Overlapping
runs"), so without more nothing would answer it until an operator's
next dispatch. After
publication the publish job's Probe mergeability step
(scripts/late_comments.py, from merge_state.py) reads again, with
the same public reads and authors the work-outstanding test counts
(§20.1): a listed author's comment on the issue, a maintainer's on
the pull request, and a maintainer's word on a review thread, each
after collected_at. It records where in the result's
late_comments: a list of issue, pull request and review thread, empty when nowhere, null when it found nowhere but a read
failed, or the round published no pull request. It reads each place
on its own, so a failed read adds a warning and keeps the places the
other reads found; with none found it changes nothing. A late
comment continues the pull request under the rule above, withholds
its antagonistic nomination at every round, a cap's included (§20.5),
and adds a sentence to the outcome comment naming where the maintainer
spoke and what answers it (scripts/late_notice.py). It says the next
round answers it when the continuation will dispatch one, and not otherwise: the
caller passes continue_rounds (§9.1), which the dispatch caller sets
from CODE_MONKEY_CONTINUE as its continue job reads it, and the
publish job's comment step hands it on. With continue_rounds off, a
Copilot review still pending, or no round to follow at a cap, the
sentence says instead that it needs an operator's dispatch, or at a
cap a human; it never says nothing remains open. The marker records
the places as late=issue,pull-request,review-thread, after
checks=, so a publish retry whose read found a comment the first
attempt did not posts its outcome again rather than reuse the older
one, and an identical retry still finds its own. The round history's
footer pattern (round_reads.FOOTER) reads the field; a reader
older than it finds no footer in a comment that carries one, as
§20.1 says of params=. The
continuation's select job tests the comment again from GitHub, so a
forged late_comments brings forward a round the scan would run
anyway, or withholds one nomination. A comment posted after this read
and before the outcome comment still waits for an operator's
revise_only dispatch.
The job. The dispatch caller's continue job needs the whole
code-monkey call and runs when that output is neither empty nor
[], the run is not a dry dispatch, its mode is pull-requests
(the form's choice), and the repository variable
CODE_MONKEY_CONTINUE is not false. Every continuation is a
pull-requests run, so the parent's own mode, a trusted input, must
be too: a forged output of a branches run must not move a live
pull request's head. It gates on the output, not
on the call's result, so one entry's failed publish does not stop
another's round. It loads the allow-list and hardens the runner in
block mode, checks out nothing and reads no artifact, re-validates
the list against the organisation (one bad entry refuses it all),
and runs once per pull request:
gh workflow run code-monkey-cron.yaml --repo "$GITHUB_REPOSITORY" \
-f dry_run=false -f mode=pull-requests -f max_pull_requests=0 \
-f pull_requests="$pull" -f outstanding_only=true \
-f continues_run="$PARENT_RUN" \
-f model="$MODEL" -f fusion_auto_model_select="$FUSION" \
-f fusion_tier="$FUSION_TIER" -f max_runtime_minutes="$RUNTIME" \
-f max_rounds="$ROUNDS" -f allow_subagents="$SUBAGENTS" \
-f request_review="$REVIEW" \
-f request_antagonistic_review="$ANTAGONISTIC" \
-f load_repo_skills="$SKILLS" -f include_dotgithub="$DOTGITHUB" \
"${inherit[@]}"naming its own run as continues_run and
forwarding the values the run used, the code-monkey call's
run_parameters output, which are the inherited ones when the run
inherited (§20.1): the run's own model, Copilot Fusion switch and tier,
runtime, round cap, sub-agent choice,
review switches, load_repo_skills and include_dotgithub, so a
dispatch that turned Copilot's or the antagonistic review off keeps it
off for every round it continues,
and one that trusted checkout skills or the .github repository
keeps that trust. A run that inherited also forwards
inherit_run_parameters=true: an inherited model id outside the
form's choices then holds its place through the footer the round
writes, and the form's model is a placeholder the next select job
replaces. One pull request per
dispatch keeps a failure to that pull request, and each loop at its
own pace: a continuation continues as soon as its own round ends,
not when the slowest round of a shared run does. The cost is that
sibling continuations select one after another under the overlap
check's tie-break wait (§6 "Overlapping runs"), at most five minutes
in all. A failed dispatch is a ::warning:: naming the pull request,
and the job succeeds; the step summary lists what it dispatched.
outstanding_only. A continuation names its pull request, but
the name comes from a result the report cannot authenticate, not
from an operator, so it earns none of a named round's waivers.
outstanding_only puts it through the scan's tests (§20.1): the
run's repository policy (the exclusions and the .github rule), the
author rule and the work-outstanding test, the handoff pause
included, in place of named by the operator; the round cap applies
too. A pull request that fails them, its threads
resolved by hand or its checks re-run green after the dispatch, its
repository excluded or its issue's author unapproved, is a named skip
with the scan's reason and costs one select job and no session.
continues_run. A result's comment_url is the result's word,
so a forged result whose round posted no outcome, its publish job
failed, could still name a continuation, and the next round would
repeat the same number with neither cap advancing, as often as
forging and failing repeat. So the continuation names its parent run, and
its select job skips each pull request unless the bot's own footers
on the issue, scoped to that pull request as the round history
scopes them, carry a published round from that run: a proposed
footer, not stale, whose run URL is
<server>/<this repository>/actions/runs/<continues_run>. The
publisher alone posts that footer, so every continued round follows
a counted one.
The credential. The job's own GITHUB_TOKEN with actions: write on this repository and nothing else. GitHub's rule that a
workflow token's events start no run exempts workflow_dispatch, so
the dispatch starts a run with no stored secret. workflow_run
could not serve, since GitHub stops its chains at three levels.
Never held by its parent. The continuation's select job runs the
overlap check about a minute after the dispatch, while the parent
run may still be in_progress. The parent is past its report by
construction, since continue needs the whole call, so the check
releases it (§6 "Overlapping runs") and the continuation is never
held by the run that dispatched it.
Termination. No timer bounds the loop; counts do. Ten rounds per
segment and sixty in all (§20.1), three antagonistic rounds on the
review bot's side, a handoff pausing until a maintainer comments,
and the rule continuing published rounds alone, checked against the
publisher's own footer, so a run that fails never dispatches itself,
whatever its results read, and an outage cannot loop. Setting
CODE_MONKEY_CONTINUE to false stops the loop without a commit;
disabling the workflow stops everything.
Trust. Results are not yet authenticated (§18.4), so a forged
result could name another bot pull request in the organisation. The
dispatched run's select job re-reads everything from GitHub and,
with outstanding_only, works no pull request the scan itself would
not, under the same repository policy, author rule and
work-outstanding test, nor one without the parent run's own counted
round on it. A forged entry costs one select job, the bound
§20.5 accepts, or brings forward a round the next scan would run
anyway; a forged list from a dry or non-pull-requests run
dispatches nothing. The change
leaves the author job alone, and the publish job gains no permission:
its late-comment read uses the public reads its mergeability probe
already makes.