Repository navigation
feat(agentx): gate PR and manual runs on a reviewer allowlist - #246
Merged
Merged
Conversation
A ci:agentx-mi355x PR run now needs authorization from a reviewer listed in benchmarks/agentx/allowlist.yaml: the plan job reads the PR comments and uses the latest comment by an allowlisted reviewer whose first line is `/agentx-mi355x <model ids or all>` to pick the models, replacing the PR description's `AgentX:` line. Without one, the plan fails and asks the author to get a reviewer's authorization. Manual runs must be started (or re-run) by an allowlisted reviewer, from main. CODEOWNERS assigns allowlist.yaml and agentx-ci.yaml to the reviewers.
RuibinCheung
requested review from
irvineoy,
jiejingzhangamd,
kyle-256,
xiaobochen-amd and
zhenhuang12
as code owners
November 17, 2026 08:29
There was a problem hiding this comment.
🟡 Changes recommended
Sweep authorization can be bypassed through reused plans or stale allowlists, while unauthorized dispatches can disrupt queued runs and indented examples can unintentionally authorize sweeps.
4 open issues
What changed in this PR
Introduces reviewer-controlled planning for AgentX CI on MI355X. Labeled PR runs use reviewer comments instead of the PR description to select models, while manual runs gain reviewer and branch checks.
Changes:
- Selects PR models from the latest allowlisted reviewer's
/agentx-mi355xcomment. - Adds allowlist validation, manual actor/ref checks, and ownership rules.
- Updates planner tests and contributor documentation for the new authorization flow.
| File | Description |
|---|---|
tests/benchmarks/test_agentx_plan.py |
Tests comment selection, authorization, allowlist validation, and workflow wiring. |
benchmarks/agentx/README.zh.md |
Updates Chinese instructions for reviewer authorization. |
benchmarks/agentx/README.md |
Documents reviewer commands and manual-run restrictions. |
benchmarks/agentx/allowlist.yaml |
Defines reviewers permitted to authorize runs. |
benchmarks/agentx/agentx_ci/pr_scope.py |
Validates reviewers and parses authorized model requests. |
benchmarks/agentx/agentx_ci/plan.py |
Enforces planning gates and reports authorization outcomes. |
.github/workflows/agentx-ci.yaml |
Fetches PR comments and passes manual-run context to planning. |
.github/pull_request_template.md |
Updates the AgentX: hint to describe reviewer authorization. |
.github/CODEOWNERS |
Assigns allowlist and workflow ownership to AgentX reviewers. |
Review effort: Max
| PR_BODY: ${{ github.event_name == 'pull_request' && 'pr-body.md' || '' }} | ||
| PR_COMMENTS: ${{ github.event_name == 'pull_request' && 'pr-comments.json' || '' }} | ||
| # A manual run needs an allowlisted reviewer (who clicked Run or Re-run) and main. | ||
| MANUAL_ACTOR: ${{ github.event_name == 'workflow_dispatch' && github.triggering_actor || '' }} |
| """Let only an allowlisted reviewer start a manual run, and only from main.""" | ||
| if args.manual_actor is None: | ||
| return | ||
| allowlist = load_reviewers(args.allowlist) |
| ${REQUIRE_RECIPE_DURATION:+--require-recipe-duration "$REQUIRE_RECIPE_DURATION"} \ | ||
| ${PR_BODY:+--pr-body "$RUNNER_TEMP/$PR_BODY"} \ | ||
| ${PR_COMMENTS:+--pr-comments "$RUNNER_TEMP/$PR_COMMENTS"} \ | ||
| ${MANUAL_ACTOR:+--manual-actor "$MANUAL_ACTOR" --manual-ref "$GITHUB_REF"} \ |
|
|
||
| def is_request(body: str) -> bool: | ||
| """Whether the comment's first line starts with the command, ignoring case.""" | ||
| words = (body or "").splitlines()[0].split(maxsplit=1) if body else [] |
RuibinCheung
had a problem deploying
to
gpu-trusted
November 17, 2026 08:42 — with
GitHub Actions
Error
- Sweep and report run only with this attempt's plan, so "Re-run failed jobs" cannot reuse a plan without re-checking authorization. - Authorize against main's allowlist.yaml, fetched through the API, not the checked-out copy a PR branch or an older commit carries. - Give manual runs by someone off the allowlist, or from another ref, a concurrency group of their own, so they cannot replace a queued run; the workflow's copy of the allowlist must match allowlist.yaml (tested). - Refuse a `/agentx-mi355x` command with leading whitespace, which GitHub renders as code.
RuibinCheung
temporarily deployed
to
gpu-trusted
November 17, 2026 09:01 — with
GitHub Actions
Inactive
main (#250) moved the AgentX tests to pytest. Port this branch's PR-comment, allowlist, manual-run and workflow tests in test_agentx_plan.py to plain pytest functions with parametrize, on main's PlanCase.
RuibinCheung
had a problem deploying
to
gpu-trusted
November 18, 2026 02:54 — with
GitHub Actions
Error
- pyproject.toml sets pytest's pythonpath to benchmarks/agentx, so the tests import agentx_ci directly instead of patching sys.path around importlib. - Replace mock.patch.object with monkeypatch.setattr, and with pytest.MonkeyPatch.context() where a patch must end before the test does. Plain functions and a charted fixture replace doubles nobody inspects; mock.Mock stays only where a test checks the calls. - agentx_results.py keeps the shared payloads; each test imports the agentx_ci modules it uses.
RuibinCheung
temporarily deployed
to
gpu-trusted
November 18, 2026 03:23 — with
GitHub Actions
Inactive
zhenhuang12
approved these changes
Nov 18, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Why
Any collaborator who can add
ci:agentx-mi355xto a PR, or start the workflow by hand, can take the MI355X runner for a full AgentX sweep, and the models come from the PR author's ownAgentX:line. This PR moves both decisions to a short list of reviewers inbenchmarks/agentx/allowlist.yaml. A labeled PR runs only after one of them comments/agentx-mi355x <model ids or all>, and the comment picks the models. Manual runs must be started by one of them, frommain.Scope
pull_requestwithci:agentx-mi355x): the plan job reads the PR's comments and uses the latest one by an allowlisted reviewer whose first line starts with/agentx-mi355x. That comment replaces the PR description'sAgentX:line in picking the models, with the same rules: model ids ignoring case,allalone, unknown names skipped with a warning, and no enabled model skipping the run. Without such a comment the plan fails with an error that names the reviewers to ask.workflow_dispatch):github.triggering_actor(whoever clicked Run or Re-run) must be on the allowlist and the ref must berefs/heads/main; otherwise the plan fails before any sweep. Scheduled runs are unchanged.allowlist.yamlholds the reviewers, so adding one is a one-line change. It is checked to be a non-empty list of distinct, valid GitHub logins. The plan authorizes againstmain's copy, fetched through the API, never the checked-out one a PR branch or an older commit carries; the workflow's concurrency group holds a copy, tested to match, so a refused manual run gets a group of its own and cannot replace a queued run. CODEOWNERS assigns it andagentx-ci.yamlto the same reviewers. The README (en/zh) and the PR template'sAgentX:hint describe the new flow.pyproject.tomlsets pytest'spythonpathtobenchmarks/agentx, so every AgentX test undertests/benchmarksimportsagentx_cidirectly instead of patchingsys.patharoundimportlib. Patches usemonkeypatch(orpytest.MonkeyPatch.context()where one must end before the test does), astests/AGENTS.mdasks;mock.Mockremains only as a double whose calls a test checks. No test is added or dropped by this part.Tradeoffs
pull_request, so the run still shows among the PR's checks; anissue_commenttrigger would not show there and would need the head commit pinned by hand.ci.yaml, so a re-run always re-checks authorization; use "Re-run all jobs".Verification
Environment: head
6c263053, CPU only (no GPU needed: the change is in planning only), Python 3.12, PyYAML, jsonschemaGate overrides: none
Code
pytest tests/benchmarks -k agentx: 325 passed; each AgentX test file also passes alone. Onmainthe same command passes 299 before and after the pytest change.python3 tests/check_layout.pyand pre-commit on the changed files: clean.tests/benchmarks/test_agentx_plan.py:all, unknown names, and a request that selects no model;::errorannotation and a job summary, when no reviewer has authorized;main, refused for another user or another ref;main's allowlist, and passes--pr-comments,--allowlist,--manual-actorand--manual-ref;allowlist.yaml, and sweep and report need this attempt's plan;ruff checkandruff format --checkonbenchmarks/agentxandtests/benchmarks: clean.actionlinton.github/workflows/agentx-ci.yaml: clean.aklr/corechange; no schema or measurement version change.Not run
mainhas noallowlist.yaml, so a labeled or manual run of this branch fails at the allowlist fetch; the flow can be checked end to end only after merging.Risk
Affects: AgentX CI only, the plan job of
agentx-ci.yaml. No kernel, op or serving path changes.AgentX: none
If wrong: AgentX PR or manual runs fail at plan, or run the wrong models. Open PRs that already carry
ci:agentx-mi355xnow fail at plan until a reviewer comments. The gate is not a security boundary against writers: a PR runs its own branch's workflow andallowlist.yaml, and a writer can dispatch from an edited branch workflow. Limiting the runner tomain's workflow would need an org-level runner group.Undo:
git revert. Nothing persistent changes: no schema, measurement version or published result.