Repository navigation
Add --concurrency to nemar admin pr-reviews start - #1929
Conversation
runPaced keeps at most n of the reviews a run started in progress, starting the next as each leaves in_progress. A read that cannot tell is never taken as finished, and three in a row stop the run. Ctrl-C ends a wait at once and reports what was never tried. Tested on a simulated pool with a virtual clock, with six mutations.
start --all [--redo] --concurrency n keeps at most n of the reviews the run started in progress, reading the admin list every 30 seconds while it waits. Ctrl-C and three unreadable lists in a row stop the run and list what was never started (as commands for a redo). The unpaced run goes through the same scheduler with no limit. Hint above ten starts at once, plan in --dry-run, concurrency and not_started in the JSON. Tested through the real CLI against the real router with jobs finishing during the run, and with five mutations.
Amendment for start --all --concurrency and the pointer from ADR 0107's note on the output-tokens-per-minute limit. Docs only.
Review fixes for the scheduler: a review that leaves the in-progress list is confirmed finished before its slot is freed (a closed pull request or a lagging search also drops out), a start that may have reached the Worker takes a slot, a slot is held at most 100 minutes, a read in flight no longer holds Ctrl-C, and Ctrl-C during the last unreadable read ends as interrupted. Tests with four more mutations.
A second Ctrl-C leaves at once and the first says so, one keypress delivered twice counts once, ten unreadable reads (about five minutes) stop the run with a dim line for each, a failed start is listed to be checked, the redo continuation says to run the commands by name, and no markReportedExit before exit 130. Tests for a closed pull request, a hanging list read, a hanging start (paced and unpaced), the unreadable branch and the 128,000 figure.
The overdue time is 90 minutes, not 60; leaving the list is confirmed; the unpaced run's Ctrl-C and JSON change are named; ten unreadable reads; the second amendment is named in ADR 0107. Docs only.
|
Review round 1 (Sonnet): no Critical findings; the invariant (never more than n of this run's reviews in progress) held in every scenario the reviewer built. Everything is resolved in 1d0ae24, a1625aa and 47bf94e, pushed once. Fixed: (I1) Ctrl-C was dead during a hanging read and a second Ctrl-C did nothing: the read and the confirmation are now raced against the abort, Ctrl-C during the read that would have been the last unreadable one ends as interrupted, the first Ctrl-C prints that it stops after the request in flight and the second leaves at once (one keypress delivered twice within half a second counts once, which a test found); (I2) the overdue time is 90 minutes (60 plus 30 of grace), not 60, in the ADR and here; (I3) the ADR and the help said nothing changes without the flag, while every The uncommitted edit the reviewer saw in Round 2 (delta only) is next, then merge when CI is green. |
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1929Version: 🤖 Updated on each push. |
Round 2 fixes: a start whose connection or response failed (status 0) may have begun the review and takes a slot; the confirmation names the commit the run started so an unreadable GitHub or a moved head no longer reads as finished; both reads are bounded at two minutes; a second Ctrl-C says which start was in flight. The tests observe the front instead of sleeping, kill every child they launch, and cover the dropped response, the unbounded read and the moved head. ADR 0093 follows.
|
Review round 2 (Sonnet, delta only): no Critical findings and two Important ones that let more than n reviews run, both real and reproduced, both fixed in the latest commit and pushed once; no third round. Fixed: (Important 1) a start that died on the connection or whose response could not be read is an Not changed, by design: the 500 ms debounce also swallows a deliberate second Ctrl-C pressed within half a second of the first (acceptable: a second press after reading the message takes longer). |
Closes #1926.
nemar admin pr-reviews start --all [--redo] --concurrency <n>keeps at most n of the reviews the run started in progress at once. A bulk start began every review together, and each review reserves its whole output budget (128,000 tokens) against the workspace's output-tokens-per-minute limit when its request begins (ADR 0107, Consequences), so about a hundred starts asked for a hundred budgets at once and queued a hundred jobs in one repository. It is a sliding window, not fixed batches: the next review starts as each one reports, so one slow review (a truncating one runs up to half an hour) does not hold up the other slots.How it works, CLI only (no Worker, migration, workflow or wrangler change): while the window is full the command waits 30 seconds and reads the admin list with
verdict=in_progress(one request that answers for every pull request); a started review counts as running while it is in that list. Leaving the list is not proof of finishing (a pull request that is closed or merged, or that GitHub's search leaves out for a moment, drops out while its job runs), so a review that left it is confirmed finished by a read of its stored review before its slot is freed, and no slot is held for more than 100 minutes (the Worker calls a review overdue after 90). A start that failed with a connection error or a 5xx may have reached the Worker, so it takes a slot until the queue shows otherwise. An incomplete list or a failed request cannot tell what finished, so it is never taken as finished: the window stays full, each such read prints a dim line, and ten in a row (about five minutes) stop the run. A start that is declined (a blocked contributor, an exempt author,review_running) takes no slot. Only the reviews this run started are counted, not the ones contributors' pushes started. The administrator picks n from the workspace's limit (n x 128,000 must fit it); the CLI does not read or guess that limit.Ctrl-C ends any
--allrun, paced or not: it stops after the request in flight, lists the pull requests never started (asnemar admin pr-reviews start <dataset> <pr> --redocommands for a redo, because a rerun of--all --redowould redo the finished ones again) and any start that failed, and exits 130; a second Ctrl-C leaves at once, and one keypress delivered twice counts once. The same list is printed when the reads fail (exit 1). Reviews already started keep running.--dry-runshows the plan,--jsoncarriesconcurrency,stopped_byandnot_started, the confirmation question says "At most N run at once", and above ten starts at once without the flag the list ends with a hint. The unpaced run now goes through the same scheduler with no limit, so Ctrl-C ends it gracefully too.NEMAR_PR_REVIEWS_POLL_MS(default 30000) is read by the command so tests do not wait 30 seconds.Tests:
test/pr-review-pace.unit.test.tsruns the scheduler on a simulated pool of jobs with a virtual clock and checks the limit at every start (a sliding window, declined answers take no slot, a throwing start is recorded, unreadable reads never count as finished and three in a row stop the run, Ctrl-C in a wait and in a start,stopAfter);test/admin-pr-reviews-start-cli.test.tsdrives the real CLI against the real router while the test plays the jobs finishing and samples the number of reviews in progress (never above the limit, and the limit is reached), a paced redo, the SIGINT paths (with and without--redo), a front that fails the list read, a list GitHub cut short, the argument checks before the API is asked, the dry run, the JSON, the hint at 10 and 11, and the help. Eleven mutations (six of the scheduler, five of the wiring) were each turned red by a named test; one survivor, an incomplete list taken as complete, got its own test. Not in this PR: the runbook for the wholepr-reviewscommand group goes to nemarOrg/docs, and nothing deploys until the next release (this ships with--redo).