Skip to content

Fix(handback): Hand back .github pull requests - #124

Merged
ModeSevenIndustrialSolutions merged 2 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-122
Nov 23, 2026
Merged

ModeSevenIndustrialSolutions merged 2 commits into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-122

Conversation

@lf-releng-code-monkey-bot

Copy link
Copy Markdown
Contributor

Closes #122

Authored by an AI agent; human review required
Command Exit
uv run python -B -m unittest discover -s tests 0
uvx zizmor --offline --persona auditor .github/workflows/ 0
AISLOP_NO_TELEMETRY=1 npx -y [email protected] scan --json --base 3c9f13f41f1731c08e89d57533fbe219a0458d1a 0
prek run --hook-stage commit-msg gitlint --commit-msg-filename <(git log -1 --format=%B) 0
prek run --files docs/DESIGN.md scripts/handback.py scripts/selection_inputs.py tests/test_handback.py 0

The github-code-monkey-bot workflow 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.


Summary

scripts/handback.py checked the repository name of each claimed hand-back with the owner pattern ^[A-Za-z0-9][A-Za-z0-9._-]*$. That pattern requires an alphanumeric first character, so the script silently dropped any hand-back for a pull request in .github. That is how lfreleng-actions/.github#384 never got its revision.

Changes

  • Shared validator. selection_inputs.is_repository_name() accepts a name that starts with a dot and refuses . and ... parse_repositories() and handback.candidates() both use it now. NAME_RE is still used for the --org owner check, with a comment explaining why. The issue said to leave bot_evidence.py and review_notice.py alone, and this change does not touch them.

  • Warnings for dropped hand-backs. A result that claims a posted hand-back (verdict: commented, handback: true) and is then dropped now prints a ::warning::handback: <owner/repo#N> not handed back; <reason> line. The reasons are:

    • the claim is malformed;
    • the repository is outside the organisation;
    • the repository name is invalid;
    • the selection names no App;
    • the selection holds no head for the pull request by an author that takes hand-backs;
    • there is no marked review by this run.

    The warning text comes from an artifact, so it is escaped first (ascii, with :: and ##[ broken up). A forged result therefore cannot inject a workflow command.

  • Tests (committed first as expected failures; the fix commit removes the markers):

    • a .github hand-back is confirmed and reaches pulls=/count=1;
    • . and .. are refused without reading GitHub;
    • each kind of drop warns with the pull request's name;
    • a result with an injected newline cannot open a workflow command;
    • a result that claims no hand-back prints nothing.
  • Docs. docs/DESIGN.md §19.9 now describes the warning and the leading-dot rule.

Validation

  • uv run python -B -m unittest discover -s tests: 880 tests, OK.
  • prek run --files docs/DESIGN.md scripts/handback.py scripts/selection_inputs.py tests/test_handback.py: all hooks passed, including aislop.
  • aislop scan --base <base> (aislop 0.16.0, the version the hook pins, with telemetry off): score 100, empty diagnostics.
  • zizmor --offline --persona auditor .github/workflows/: no findings. No workflow files changed.
  • gitlint at the commit-msg stage: passed.

For reviewers

  • The issue asks selected_heads() to warn as well. That function reads selection entries, not results, so it has no claimed hand-back it could name. Instead, handbacks() warns when it looks up a candidate and the selection holds no entry for it. A selection entry that selected_heads() drops therefore still produces a warning naming the pull request.
  • The workflow's own checks in code-review.yaml (repo_re and the dispatch ref pattern) already accept a repository name that starts with a dot, so no workflow change is needed.
  • A forged result now produces a warning where it was silent before. That is intended: it is still never dispatched.

lf-releng-code-monkey-bot Bot and others added 2 commits November 23, 2026 13:19
The hand-back list drops every result in a repository whose name
starts with a dot, so a .github pull request never gets the revision
its review requested, and nothing says so. Add tests, marked as
expected failures, for a .github hand-back that is confirmed and
dispatched, and for a warning naming each dropped hand-back. Pin that
the names . and .. stay refused.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
The hand-back list checked a repository name with the owner pattern,
which needs an alphanumeric first character, so a hand-back for a
pull request in .github was dropped without a word and its revision
never dispatched. Check repository names with one shared validator in
selection_inputs, which allows a leading dot and refuses . and .., as
the repository list already did.

Warn, naming the pull request and the reason, whenever a result that
claims a posted hand-back is dropped: outside the organisation, a bad
name, not in the selection, no App, or no marked review. A lost
hand-back is no longer silent. The artifact's text is escaped before
it reaches the log.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the hand-back validation and warning changes.

No open issues 🎉

What changed in this PR

Fixes #122 by allowing .github pull requests through the antagonistic review hand-back path and making rejected hand-back claims visible.

Changes:

  • Shares repository-name validation between selection and hand-back processing, allowing leading dots while rejecting . and ...
  • Adds escaped warnings explaining why claimed hand-backs are dropped.
  • Adds regression tests and documents the validation and warning behavior.
File Description
tests/​test_handback.py Tests .github confirmation and dispatch-list output, invalid names, and dropped-claim warnings.
scripts/​selection_inputs.py Extracts a shared repository-name validator.
scripts/​handback.py Uses shared validation and warns when claimed hand-backs are rejected.
docs/​DESIGN.md Documents leading-dot repository names and dropped-hand-back warnings.

Review effort: Balanced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.

The change fixes .github hand-backs while preserving selection and review-marker checks. The warning paths and downstream dispatch handling are consistent; no actionable defects found.

Antagonistic round 1 of 3.


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.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit 67eed09 into lfreleng-actions:main Nov 23, 2026
28 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the code-monkey/issue-122 branch November 23, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix(handback): Hand back .github pull requests

2 participants