Skip to content

Fix(request): Report a failed review request #228

Closed

Description

Changes a workflow file: dispatch it by name with allow_workflow_edits=true. Assigned to a maintainer so that only a named dispatch works it.

Problem

A request for an antagonistic review can fail, and nothing tells the pull request.

On 2026-11-20 at 13:23 UTC, run 44741309912 dispatched the review of lfreleng-actions/.github#378 and GitHub answered HTTP 403: API rate limit exceeded. The step logged a warning and the job passed. A minute earlier the issue comment had said "An antagonistic review was requested from the review bot." A round that requests the review does not continue itself (§20.6), so nothing else was going to happen. The pull request merged on 2026-11-22 with no antagonistic review, and nothing on it said the request had failed.

The request is tried once, a failure is a warning in a job that passes, and the only statement on record says the review was requested.

Required behaviour

1. A failed dispatch is tried again

Dispatch antagonistic reviews makes up to four passes. The first tries every nominee; each later pass waits, then tries the nominees that have not gone. The waits before the second, third and fourth pass are 15, 60 and 240 seconds, read from a RETRY_DELAYS value in the step's env ('15 60 240'), so a test runs the step with zeros. One wait per pass, whatever the list holds, keeps the worst case at 315 seconds, inside the job's ten minutes. A pass with nothing left to try ends the loop.

A failed attempt that will be tried again is a notice naming the pull request and the pass. A nominee that never goes is an error annotation.

2. The step reports what did not go, and fails

  • requested stays as it is: the nominees dispatched.
  • failed is new: {"include": [...]} with one entry per nominee that never went, each with pull (owner/repo#N), repository, repo_name and number. failed_count is its length. Both are job outputs.
  • The step writes both outputs and the summary, then exits 1 when any nominee failed. The run goes red.

An unset antagonistic_dispatch_token keeps today's behaviour: a warning, nothing dispatched, success (§10.5).

3. A notice job tells each pull request

A new job, antagonistic-notice, named Report failed review requests:

  • needs: [select, antagonistic]; condition !cancelled() && needs.antagonistic.outputs.failed_count != '' && needs.antagonistic.outputs.failed_count != '0'; a matrix over needs.antagonistic.outputs.failed with fail-fast: false; permissions contents: read; timeout-minutes: 10.
  • Steps, in order: the allow-list loader and harden-runner as every job; an offline check of the nominee; the trusted assets at needs.select.outputs.assets_sha without credentials; the mint; the identity pre-flight on the minted slug; the notice.
  • The offline check: matrix.repository is <inputs.org>/<matrix.repo_name>, the name is a repository name, matrix.number is a positive integer, and the repository is one the select job's matrix names (needs.select.outputs.matrix). A nominee that fails it is an error, and its leg stops before the mint. The nominees come from results nothing authenticates yet (§20.5), so the mint's scope must come from the trusted selection.
  • The mint, notice-token: owner: inputs.org, repositories: matrix.repo_name, permission-pull-requests: write and permission-metadata: read, and no other permission. GitHub accepts an issue comment on a pull request from a token with Pull requests: write.
  • The notice step is the only one that holds the token, and the job never sees antagonistic_dispatch_token.

4. scripts/request_notice.py

request_notice.py --repository OWNER/REPO --number N --bot-slug SLUG
    --run-id RUN_ID --run-url URL --review-repository OWNER/REPO [--summary FILE]

It reads the pull request and posts only when all of these hold; the first that fails is the recorded reason for posting nothing:

  1. The pull request is open.
  2. This App opened it: GitHub types its author Bot, and the login is <slug>[bot].
  3. This App has posted no notice for the pull request's current head. A comment counts only when its author is that same App and its body ends with the marker below naming that head.

Then it makes one write, POST repos/{repository}/issues/{number}/comments, recovered from a transient failure as issue_comment.py recovers its own (write_recovery.recover, repeat_safe=False): the notice is looked for by its marker, taken as posted when found, and never sent again.

🐒 Notice from the Code Monkey workflow: the request for an antagonistic review of head `<first 12 hex>` did not reach the review bot. Every dispatch failed in [this run](<run url>), retries included.

To ask again, dispatch `code-review-antagonistic.yaml` in `<review repository>` naming this pull request.

<!-- code-monkey-notice antagonistic-request head=<40 hex> run=<run id> -->

The body holds fixed text and values the script has validated. It holds nothing from the pull request, the issue, a session or a result. Posting and not posting both exit 0 and print one line saying which and why, which --summary also receives. A GitHub failure exits 1.

5. What the notice must not do

  • It goes on the pull request, never on the issue: the issue's comments hold the round history.
  • It never starts or feeds a round. A comment counts as a maintainer's only when its author_association is OWNER or MEMBER (issue_authors.COMMENT_ASSOCIATIONS), which this App's is not, and the marker does not match the round footer (round_reads.FOOTER).
  • It never counts as a hand-back or a review: the review bot reads those from its own reviews.

6. What stays as it is

  • The dispatch token reaches one step of one job. The antagonistic job keeps permissions: {}, checks out nothing and downloads nothing: the step builds failed itself.
  • The publish job's record, and the sentence the issue comment draws from it, are written before the dispatch and do not change.

Acceptance criteria

  • Tests that run the dispatch step with a fake gh, as AntagonisticRequestContracts.dispatch does: a nominee that fails once and then goes is requested and the step exits 0; one that fails every pass is in failed, the step exits non-zero, and requested, failed, failed_count and the summary are all written; of three nominees with one failing, two are requested and one failed; the waits come from RETRY_DELAYS; the loop ends early when nothing is left; an unset token and a malformed list behave as they do now.
  • Contract tests in tests/test_workflow.py pin the notice job: its name, needs, condition, permissions and step order; that harden-runner leads; that the offline check precedes the mint and reads the select job's matrix; that the token reaches the notice step alone. AntagonisticRequestContracts still holds, and MintProvenanceContracts lists notice-token with its owner and exactly those two permissions, among the target mints that cannot write code.
  • tests/test_request_notice.py, offline: each of the three conditions stops the write on its own; a new head posts again; a marker in anyone else's comment suppresses nothing; a transient failure whose notice then reads back is recorded as posted and not sent again; every write the tests see goes to the issue comments endpoint of the pull request.
  • docs/DESIGN.md is updated in place: §10.5, §13 (a row for a request that fails), §18.6 (the new outputs), §20.5 and the repository layout.
  • uv run python -B -m unittest discover -s tests passes, prek run --files <changed files> and the aislop gate report no findings, and zizmor --persona auditor .github/workflows/ reports none.

Out of scope

Activity

  1. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent has proposed a change for this issue: pull request #230 (head af7c88d). The Copilot review of it has findings (1 unresolved review thread; assessment: changes recommended). Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.

  2. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 1: an AI agent revised pull request #230 (head 233a5c6). Round 1: fixed the one Copilot finding (thread on .github/workflows/code-monkey.yaml). - Duplicate notices across overlapping runs (fixed). Verified: two named runs, or a scan and a named run, hold different workflow-level locks, so both could reach antagonistic-notice for one pull request and pass request_notice.py's existing-comment check before either posts. The job now locks on code-monkey-notice-&lt;repository&gt;-pull-&lt;n&gt; with cancel-in-progress: false and queue: max; the later leg waits and finds the earlier notice. A new contract test (added expected-fail in the test commit, passing in the fix commit) pins it; docs/DESIGN.md §11 and §20.5 describe it. - Commits: amended the test commit and the tip commit it belongs to; still five commits on base_sha (no rebase: the pull request is mergeable, base_sha equals rebase_sha, and no maintainer asked). - Checks: no failing checks on the head. Unit suite, prek on the changed files (aislop included) and zizmor --persona auditor all pass. Remaining: Copilot's review of the new head.. The Copilot review of it is clean. An antagonistic review was requested from the review bot.

  3. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 2: an AI agent revised pull request #230 (head 074e933). Round 2: answered the antagonistic review's two findings (both inline threads on .github/workflows/code-monkey.yaml), both fixed. - Notice could target an unselected pull request (fixed). The offline check now binds the nominee to the select job's matrix: a revision entry with that pull_number, or else the repository's issue entries (pull_number 0, opened this run). It passes their code-monkey/issue-&lt;n&gt; branches to request_notice.py --branches, which posts only when the pull request's head branch is one of them. Tests cover an unselected pull request in a selected repository and a bad or missing branch. - Ambiguous dispatch failures were retried (fixed). Only an HTTP 4xx answer (a refusal, rate limits included) is retried. Any other failure (lost response, 5xx) is sent once, becomes an error and an uncertain summary line, stays out of failed (so no notice claims nothing reached the bot), and fails the step. ### Antagonistic review The body holds no finding beyond the two threads; its summary restates them, and both are fixed as above. Commits: amended the commit each change belongs to; still five commits on base_sha. No rebase: mergeable, base_sha equals rebase_sha, and no maintainer asked for one. No failing checks. Unit suite, prek on changed files (aislop included), gitlint and zizmor --persona auditor pass. Remaining: Copilot's review of the new head. It answers antagonistic review round 1 (#230 (review)). The Copilot review of it is clean. An antagonistic review was requested from the review bot.

  4. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent attempted this issue but its proposal failed a policy check (body line exceeds 72 characters: "did not certainly send, it checks the entry offline against this run's selection,"). Run: https://github.com/lfreleng-actions/github-code-monkey-bot/actions/runs/45099391350

  5. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 4: an AI agent revised pull request #230 (head 95d3baa). Round 4: fixed the antagonistic finding and applied the maintainer's direction. - Head binding (fixed). The report emits each nominee's published head (antagonistic_heads). It reaches the notice as --head. request_notice.py posts nothing if the pull request's head has moved, and the notice text and marker name the published head. Tests cover a moved head. - Maintainer direction (applied). Uncertain dispatches now get a notice too. Matrix entries carry kind (failed/uncertain), and the marker names the kind, so each head gets one notice per kind. - Previous rejection (addressed). All commit body lines are now 72 characters or fewer, and gitlint passes on all five commits. - No rebase. The branch stays on base_sha, which equals rebase_sha; the pull request is mergeable and no maintainer asked for a rebase. - Checks. No failing checks were reported. The full suite (1660), prek and zizmor all pass. ### Antagonistic review The body holds only the head-binding finding, which is also its inline thread. It is fixed as described above. It answers antagonistic review round 2 (#230 (review)). The Copilot review of it is clean. An antagonistic review was requested from the review bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions