Skip to content

Add pr-triage, one Jev call per pull request, sorted into review tiers - #3

Merged
aarora79 merged 1 commit into
mainfrom
sample/pr-triage
Sep 25, 2026
Merged

aarora79 merged 1 commit into
mainfrom
sample/pr-triage

Conversation

@aarora79

Copy link
Copy Markdown
Owner

Third sample. It sorts a repository's open pull requests into four review tiers, asking eleven questions about each one in a single Jev call.

What it does

fetch_prs.py builds a dataset from the GitHub API and needs no Jev key. pr_triage.py scores a dataset and needs no GitHub token, so one dataset replays as often as you like for the cost of the Jev calls alone.

Nine of the eleven answers carry a weight and average into a review load from 0 to 1, which maps onto a tier. Python owns every threshold on a number: a size floor raises the tier for a diff too large to send whole, and never lowers one.

Measured

Against 26 open pull requests from agentic-community/mcp-gateway-registry on 25 September 2026: 183,426 input tokens, $0.0077, about four seconds for the batch at 159 ms a call.

Those 26 came out 13 high, 12 medium, 1 low and 0 trivial. Running the same cuts against 18 recent open pull requests from apache/airflow gave 3 high, 5 medium, 8 low and 2 trivial, so both distributions come from one set of thresholds. Anyone editing LOAD_FLOORS should re-run both, because a single repository cannot tell a bad cut from a hard queue.

Both triage reports ship in data/. The datasets they scored stay gitignored: one mirrors 26 contributors' diffs, and one command rebuilds it.

Repo wiring

  • Root README.md: a row in the samples table, and a pr-triage block under "Running a sample" noting it wants a GitHub token
  • AGENTS.md: the layout tree, the testing paths for this sample, and step 3 of "Adding a sample" recording that a state with several fields takes one budget per field
  • .gitignore: keeps the two committed reports, drops the datasets

Verified

py_compile, ruff check and ruff format --check clean on both modules.

Run live against a key: a fetch by owner/repo, a fetch by URL, --since as a day count and as a date, --all, a --dataset replay, --explain on a number in the dataset and on one absent from it, a 404 repo, a malformed repo name, a malformed --since, and a missing dataset path.

The file-list truncation arithmetic was checked against 200 synthetic files, because no pull request in either dataset reaches the 4,000-character file-list budget.

Every figure in the sample README was checked against the committed reports, including the worked example, whose nine weighted rows sum to the 0.8247 load the report records.

Known limits

  • No tests, matching the rest of the repo
  • No Go port and no CI wiring, unlike agents-md-readiness
  • --state closed is implemented and has never run against Jev. Closed pull requests are the obvious calibration set, since their review cost is already known

pr-triage sorts a repository's open pull requests into four review
tiers. It asks eleven questions about each one in a single call, weights
nine of the answers into a review load from 0 to 1, and maps that load
onto a tier. Python owns every threshold on a number, so a size floor
raises the tier for a diff too large to send whole, and never lowers one.

Two modules, because they want different credentials. fetch_prs.py
builds a dataset from the GitHub API and needs no Jev key. pr_triage.py
scores a dataset and needs no GitHub token, so a dataset can be replayed
as often as you like for the cost of the Jev calls alone.

Measured on 25 September 2026: 26 open pull requests from
agentic-community/mcp-gateway-registry ran 183,426 input tokens and
$0.0077, about four seconds for the batch at 159 ms a call.

The distribution is the part worth checking. Those 26 came out 13 high,
12 medium, 1 low and 0 trivial, which reads like a broken threshold
until the same cuts run against a repository with mixed traffic. 18
recent open pull requests from apache/airflow came out 3 high, 5 medium,
8 low and 2 trivial. Both reports ship in data/. The datasets they
scored stay out, because one mirrors 26 contributors' diffs and one
command rebuilds it.

Repo wiring: a row in the root README table and a block under "Running a
sample", the layout tree and the testing paths in AGENTS.md, step 3 of
"Adding a sample" noting that a state with several fields takes one
budget per field, and a .gitignore rule that keeps the two committed
reports while dropping the datasets.

Verified: py_compile, ruff check and ruff format --check clean on both
modules. Run live against a key: a fetch by owner/repo, a fetch by URL,
--since as a day count and as a date, --all, a --dataset replay,
--explain on a number in the dataset and on one absent from it, a 404
repo, a malformed repo name, a malformed --since, and a missing dataset
path. The file-list truncation arithmetic was checked against 200
synthetic files, because no pull request in either dataset reaches the
4,000-character file-list budget.

Known limits: no tests, matching the rest of the repo, and no Go port or
CI wiring, unlike agents-md-readiness. --state closed is implemented and
has never run against Jev. Closed pull requests are the obvious
calibration set, since their review cost is already known.
@aarora79 aarora79 added the enhancement New feature or request label Sep 25, 2026
@aarora79
aarora79 merged commit 963ecc7 into main Sep 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant