Skip to content

feat(ci): review gate as a reusable workflow; agent tools move to kadet-hub/ops - #12

Merged
Moep90 merged 9 commits into
mainfrom
feat/review-gate
Nov 6, 2026
Merged

Moep90 merged 9 commits into
mainfrom
feat/review-gate

Conversation

@Moep90

@Moep90 Moep90 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

The review gate from kadet-hub/registry#558, now a reusable workflow that each kadet-hub repository calls pinned by commit SHA. tools/agent/ leaves this repository: it moved with its history to the private kadet-hub/ops (kadet-hub/ops#1), where the agent app will not be installed. A public repository cannot call a workflow from a private one, which is why the gate lives here.

Spec

docs/specs/review-gate.md is new, prefix RG, plus a short docs/specs/README.md that points to the registry's spec format. The agent identity spec (AGT) moved to kadet-hub/ops; its AGT-11 points here for the decision rule.

review-gate

.github/workflows/review-gate.yml runs on workflow_call. The input reviewers takes logins separated by spaces, default neat-bot, and each of them must approve. The job has pull-requests: read and nothing else, checks out nothing, and downloads review_gate.py through the contents API from job.workflow_repository at job.workflow_sha, the commit the caller pinned. If the runner leaves those empty, the step fails instead of reading main.

The decision is the one from #558: the gate passes when every reviewer's latest review approves the head commit and nobody with write access has an open change request. Renovate's pull requests pass.

neat-bot's status comment does not count (DEC-2). I looked at how neat-bot reports on the last 60 pull requests of six repositories. "N finding(s), none judged useful" and "none above medium" come with an approval of the head only when the line ends in ", approved". Without that suffix the run posts no review at all. "no file was selected for review" means nothing was reviewed; the six such pull requests I opened changed only Markdown. The comment is a single comment rewritten by every run and names no commit, and a run that started before a push can write its result after it: in kadet-hub/examples#107 a push at about 08:21 UTC got "2 finding(s), none judged useful" seven seconds later from the run on the previous head. A time comparison would have passed the new head unreviewed, so the gate waits for an approval.

Calling it

README.md has the caller workflow. The check is named review-gate / review-gate. No repository calls the gate yet; that is the rollout in kadet-hub/ops docs/rollout.md, after this is merged.

README.md also has the "How changes are reviewed" text for the repositories. It names neat-bot, the Qwen model it runs and Claude Sonnet, which filters its findings. The Qwen version is tbd (OQ-1); I still have to fill it in.

Verification

  • python3 -m unittest discover -s .github/review-gate -v: 5 tests, 13 fixture cases, pass. Nine mutations (only the first reviewer checked, head SHA or state ignored, a comment closing a change request, an extra or write permission, a checkout, the script read from main, no empty top-level permissions) each made the suite fail.
  • review_gate.py against the live API, read-only with my token: registry#567, approved at its head, passes; registry#565, with only the status comment, fails; #567 with another SHA fails; a Renovate author passes without an API call; an empty reviewers fails.
  • zizmor 1.30.1 --offline: no findings. actionlint 1.7.12 does not know job.workflow_repository and job.workflow_sha yet, and flags ubuntu-26.04 as on the existing workflows.
  • A temporary local caller (review-gate-selftest.yml) ran the gate on this pull request at 9e53e45 (run): job.workflow_repository and job.workflow_sha resolved to this repository and the merge commit, the contents download worked with a pull-requests: read token, and the gate failed because neat-bot had not approved the head. f03d449 removes the caller again.
  • neat-bot's first run here ended with "12 finding(s), none judged useful" and no review: no finding to fix or answer, and exactly the status-only case DEC-2 is about.

neat-bot's findings

  • Renovate's exemption goes by the pull request's author, which stays renovate[bot] after someone else pushes to the branch. Fixed in 3a462b7: RG-3a requires a renovate branches ruleset (Renovate and the admin role) before a repository requires the check. registry and recipes have one, the other repositories don't yet; kadet-hub/ops#1 adds it to the rollout.
  • An API error ended the run with a traceback and swallowed gh's message. Fixed in df6d122: the gate now fails with the endpoint and gh's message, and the new Api test checks that.

neat-bot's run on df6d122 ended with "10 finding(s), none judged useful" and again posted no review, so there is nothing left to fix, but no approval either. This pull request's own gate would stay red until neat-bot approves.

The review gate moves here from kadet-hub/registry#558 so every kadet-hub
repository can call one copy, pinned by commit SHA (DEC-1). It counts
only reviewer approvals of the head commit; neat-bot's status comment
names no commit and a run that started before a push can report after
it, so the comment does not count (DEC-2). The reviewer logins become an
input with neat-bot as default (RG-1).

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
.github/workflows/review-gate.yml runs on workflow_call with the input
reviewers (default neat-bot). It downloads review_gate.py through the
contents API from job.workflow_repository at job.workflow_sha, the
commit the caller pinned, and fails closed when the runner does not
provide them. The job holds pull-requests: read only and checks out
nothing, so a fork pull request gets nothing it could use.

review_gate.py, fixtures.json and the tests come from
kadet-hub/registry#558 (.github/actions/review-gate/). The decision is
unchanged except that every login in reviewers must approve the head.
Two fixtures cover a second reviewer, and Workflow checks the job's
permissions and the pinned script. The test workflow runs them.

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
mint-token, its test, the README and the session guide moved with their
history to the private kadet-hub/ops, where the agent app is not
installed. The tools workflow went with them, and CODEOWNERS no longer
names tools/.

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
…G-4)

The README shows how a repository calls the review gate, pinned by
commit SHA, and the name of the check a ruleset requires. It also holds
a "How changes are reviewed" text for the repositories' READMEs: reviews
are automated, neat-bot is an AI reviewer with a Qwen model (version
tbd) and Claude Sonnet filtering its findings, and the maintainer can
block a pull request with a change request.

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
Shows the reusable workflow running on this pull request: job.workflow_sha,
the contents download with a pull-requests: read token, and the decision.
Reverted before the merge.

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
@github-actions
github-actions Bot requested a review from neat-bot November 5, 2026 20:33
@neat-bot

neat-bot commented Nov 5, 2026 •

Copy link
Copy Markdown

6 finding(s), none judged useful, approved

It ran on this pull request at 9e53e45: job.workflow_repository and
job.workflow_sha resolved, the contents download worked with a
pull-requests: read token, and the gate failed because neat-bot had not
approved the head.

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>

@neat-bot neat-bot 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.

I left one comment on this change.

Comment thread .github/review-gate/review_gate.py Resolved
…(RG-3a)

The gate exempts a pull request by its author, which stays renovate[bot]
when someone else pushes to the branch. RG-3a makes a renovate branches
ruleset, Renovate and the admin role only, a condition for requiring the
check; registry and recipes have one, the other repositories not yet.
The README names it next to the caller.

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
@Moep90
Moep90 requested a review from neat-bot November 5, 2026 20:54

@neat-bot neat-bot 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.

I left one comment on this change.

Comment thread .github/review-gate/review_gate.py Resolved
gh's error went into the captured stderr, and check=True ended the run
with a traceback that did not say why. gh() now exits with "review gate
failed: gh api <path>: <gh's message>", still failing closed. Api tests
it. From neat-bot's finding on this pull request.

Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
@Moep90
Moep90 requested review from neat-bot and removed request for neat-bot November 5, 2026 21:05

@neat-bot neat-bot 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.

I left one comment on this change.

Comment thread .github/review-gate/review_gate.py Resolved
Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
@Moep90
Moep90 requested a review from neat-bot November 6, 2026 16:11

@neat-bot neat-bot 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.

I went through this change and have nothing to flag.

@Moep90
Moep90 merged commit 4be1004 into main Nov 6, 2026
1 check passed
@Moep90
Moep90 deleted the feat/review-gate branch November 6, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants