Repository navigation
Fix(request): Report a failed review request - #230
ModeSevenIndustrialSolutions merged 5 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Overlapping runs can both pass the existing-comment check and post duplicate notices for the same pull request head because the notification job lacks per-pull-request serialization.
1 open issue
What changed in this PR
This PR addresses #228 by making failed antagonistic review requests visible in the Code Monkey workflow and on affected pull requests.
Changes:
- Retry dispatches up to four times, expose failed nominees as job outputs, and fail the step when retries are exhausted.
- Add a notice job with repository validation and a narrowly scoped App token, plus a script that checks eligibility and existing notices before posting.
- Add offline tests and document the retry, notification, and credential boundaries.
| File | Description |
|---|---|
tests/test_workflow.py |
Tests retries, failure outputs, and notice-job security contracts. |
tests/test_request_notice.py |
Tests notice eligibility, duplicate detection, recovery, and validation. |
scripts/request_notice.py |
Posts failed-review-request notices on eligible App-authored pull requests. |
docs/DESIGN.md |
Documents retries, failure reporting, and the notice job. |
.github/workflows/code-monkey.yaml |
Adds dispatch retries, failure outputs, and the notice job. |
Review effort: Balanced
af7c88d to
233a5c6
Compare
There was a problem hiding this comment.
🤖 Antagonistic review by agent: 2 finding(s) for the human reviewer.
The failure-reporting path needs tighter safeguards: its notice can target an unselected pull request, and its retries treat ambiguous dispatch failures as definite refusals.
Antagonistic round 1 of 3. Revision requested from Code Monkey.
Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.
233a5c6 to
074e933
Compare
There was a problem hiding this comment.
🤖 Antagonistic review by agent: 1 finding(s) for the human reviewer.
The refusal-only retries and narrower target checks improve the failure path, but a delayed notice can attribute an old dispatch failure to a newer head.
Antagonistic round 2 of 3. Revision requested from Code Monkey.
Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.
|
Maintainer direction, posted by an AI agent (Claude) shepherding this pull request for the maintainer. An uncertain dispatch gets a notice too. Round 2 keeps a failure that is not an
Nothing else is requested in this round. |
Pin the behaviour issue lfreleng-actions#228 asks of the antagonistic dispatch step: a failed dispatch is tried again on up to three later passes, each after the wait RETRY_DELAYS names; a nominee that never goes lands in a new failed output and fails the step. The fake gh can now fail a call a set number of times, and a fake sleep records each wait. The old test that a failed dispatch is only a warning goes: the step now fails on it. Review finding (antagonistic review): a dispatch whose response is lost may still have started a run, so retrying every failure could start two reviews. The fake gh now refuses with an HTTP 403 answer, and a new test pins that a failure GitHub did not refuse (a lost response, an HTTP 502) is sent once, listed as uncertain in the summary and fails the step. Review finding (antagonistic review): a notice must name the head the failed request was for, not whatever head the pull request has when the notice job runs. The tests pin that the report's antagonistic_heads output reaches the step as HEADS, that every failed entry carries the nominee's published head, and that a nominee without a well-formed head refuses the whole list. Maintainer direction: an uncertain dispatch gets a notice too. The tests pin that failed carries both kinds, each entry naming its kind, and that failed_count counts both. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
A dispatch of the antagonistic review that GitHub refused, as a rate limit did on 2026-11-20, was one warning in a job that passed, and nothing asked again. The step now makes up to four passes, the later ones over the nominees that have not gone, after waits of 15, 60 and 240 seconds read from the step's RETRY_DELAYS. A failure it will try again is a notice; a nominee that never goes is an error, lands in the new failed and failed_count job outputs, and fails the step once the outputs and the summary are written. An unset dispatch token still warns, dispatches nothing and passes. Review finding (antagonistic review): a failed gh call does not prove GitHub rejected the dispatch; one whose response was lost may have started a run, and sending it again could start a second review. The step now retries only an answer carrying an HTTP 4xx status, a refusal that applied nothing, a rate limit among them. Any other failure is sent once, is an error annotation and an uncertain line in the summary, and fails the step. Review finding (antagonistic review): the notice named the live head, not the head whose clean review the request was for. The report now emits antagonistic_heads, each nominee's published head; the step validates it and puts the head in every failed entry, and a nominee without one refuses the whole list before any dispatch. Maintainer direction: an uncertain dispatch gets a notice as well. Each failed entry now carries kind, failed or uncertain, and the uncertain nominees join failed and failed_count. docs/DESIGN.md sections 18.6 and 20.5 say so. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
A failed request for an antagonistic review was recorded nowhere a reader of the pull request would look. request_notice.py posts one comment on the pull request saying the request did not reach the review bot and how to ask again, but only when the pull request is open, this App opened it, and this App has not already posted a notice of that kind for that head. The comment holds fixed text and validated values alone. Its one write recovers from a transient failure through write_recovery with repeat_safe=False, finding the notice by its marker, so a lost reply is never sent twice. Its marker does not match the round footer, and the App is never a maintainer, so it starts and feeds no round. Review finding (antagonistic review): the nominee comes from an unauthenticated result, and the script checked only state, authorship and an existing notice, so a forged nominee could put the notice on another App pull request in a selected repository. It now takes --branches, the selected code-monkey/issue-<n> branches the workflow binds the nominee to, and posts nothing unless the pull request's head branch is one of them; a test pins each refusal. Review finding (antagonistic review): the script compared nothing with the head the request was for. It now takes --head and posts nothing when the pull request's head has moved from it, since a later round makes its own request. Maintainer direction: --kind failed|uncertain picks the text; an uncertain notice says the request may not have reached the review bot. The marker names the kind, so a head gets one notice of each kind. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Add contract tests for a job that comments on a pull request whose antagonistic review request never went. They fail until the job lands. Review finding (antagonistic review): the offline check bound only the repository. The tests now pin that it binds the selected pull request: a revision entry by its pull_number, a pull request opened this run by its issue's branch, which it hands on as branches; an unselected pull request in a selected repository, or a malformed or missing branch, is refused before the mint. Review finding (antagonistic review) and maintainer direction: the tests pin that the job hands each entry's kind and head to the script, and that the offline check refuses an unknown kind or a head that is not a commit SHA. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
Add the antagonistic-notice job. For each nominee whose request did not certainly go, it checks the entry offline against this run's selection, mints a pull requests: write App token for that one repository, passes the identity pre-flight and runs scripts/request_notice.py, which comments once per head and kind on an open pull request the App opened. The job locks on code-monkey-notice-<repository>-pull-<n> with cancel-in-progress false and queue: max. Review finding (Copilot): two named runs each lock within their own run, so both could reach the job for one pull request, pass the existing-comment check and post two notices for one head. The later leg now waits and finds the first. Update the allow-list and mint contract tests for the new job and describe it in docs/DESIGN.md sections 8, 10.5, 11, 13 and 20.5. Review finding (antagonistic review): the offline check accepted any positive number in a selected repository, so a forged nominee could direct the App's notice to another of its pull requests there. The check now binds the entry to the select job's matrix: a revision entry with that pull_number, or failing one the repository's issue entries whose pull request opens this run. It passes their code-monkey/issue-<n> branches to request_notice.py, which posts only on a pull request whose head branch is one of them. docs/DESIGN.md section 20.5 and its trust note say so. Review finding (antagonistic review): the notice now binds to the published head the request was for: the job passes the entry's head, and the script posts nothing once the head has moved. Maintainer direction: an uncertain dispatch gets a notice too, saying the request may not have reached the review bot; the job passes each entry's kind and the marker names it. docs/DESIGN.md sections 8, 13 and 20.5 describe both. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
074e933 to
95d3baa
Compare
There was a problem hiding this comment.
🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.
No actionable defects found in the diff. The retry logic distinguishes refusals from ambiguous failures, and notices are constrained by the trusted selection and nominated head.
Antagonistic round 3 of 3. That is the last one: a maintainer takes it from here.
Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.
ba71ddf
into
lfreleng-actions:main

Closes #228
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI81ecac69abef9c6559ee750bda44bdfff3872898uv run python -B -m unittest discover -s testsAISLOP_NO_TELEMETRY=1 prek run --files $(git diff --name-only 81ecac69 HEAD)uvx zizmor --persona auditor .github/workflows/uvx gitlint --config .gitlint --msg-filename <each commit message>git log --raw --format=%h 81ecac69abef9c6559ee750bda44bdfff3872898..HEADThe
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
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.
Round 4 of revision, on its base. It answers antagonistic review round 2: #230 (review).
Issue #228: a request for an antagonistic review that GitHub refused was a single warning in a job that passed. This pull request:
uncertain.failedoutput and fails the run.antagonistic-noticejob runsscripts/request_notice.py, which comments on the pull request once per head and kind.This round
antagonistic_heads, the published head each nominee's clean review covered. The dispatch step validates it and putsheadin everyfailedentry. The notice job passes--head.request_notice.pyposts nothing when the pull request's head has moved from that head, because a later round makes its own request. The notice text and its marker name the published head.failedentry now carrieskind, which isfailedoruncertain, and uncertain nominees are included infailedandfailed_count. The offline check refuses an unknown kind or a head that is not a SHA. An uncertain notice says the request may not have reached the review bot. The marker is nowkind=<kind> head=<sha>, so each head gets one notice of each kind.docs/DESIGN.md(§8, §13, §18.5, §18.6, §20.5) are updated to match.Checks run
uv run python -B -m unittest discover -s tests: 1660 OK. Each commit was also run on its own and is green, with the expected-fail markers behaving as intended.prek run --files <changed files>: exit 0.uvx zizmor --persona auditor .github/workflows/: no findings.Review notes
failedoutput keeps its name even though it now also holdsuncertainentries.Antagonistic review
The review body has one finding, the head-binding defect, and the inline thread carries it. It is fixed as described above.