Repository navigation
Add --redo to nemar admin pr-reviews start - #1922
Conversation
start takes ?redo=1: a reported commit is restarted on its row through the restart edits use, a running review is never superseded (review_running), the Worker echoes redo, and the audit row records it. No SQL or migration change. Tested with the real handler and router, and with six mutations of the restart rule.
Named redo, and start --all --redo for every open pull request with a finished review (drafts, running reviews, exempt pull requests and commits capped for edits stay out). A Worker that predates the flag is detected by the missing echo and the command says so. Tested through the real CLI against the real router, and with four mutations.
Amendment of ADR 0093 for the redo and its two limits, the matching notes in ADR 0107 decision 4, and one clause in the AGENTS.md ADR 0093 entry. Docs only.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1922Version: 🤖 Updated on each push. |
Review findings on the redo: an administrator's start no longer supersedes a job still inside its limit (claimed less than 50 minutes ago, even after the watchdog closed the row), a redo of a blocked contributor's finished review answers contributor_paused and writes nothing, a redo leaves the edit count alone, and an administrator's start is tried again when the row moves under it. The job limit is pinned to the workflow. Tests with five mutations.
A Worker that predates the flag: the answer it gave is reported (a start it made is not hidden), then the command says the flag was ignored and exits 1 without the bug-report hint; a bulk run stops after one answer and keeps its results, in the JSON too. The dry-run list marks the finished reviews and their verdicts, and the help states the block, exemption, running-job and edit-count rules.
ADR 0093 amendment: blocks, edit count, the claim window, retries, volume and the name overlap with ADR 0102; ADR 0092 and 0107 pointers; AGENTS.md wording. Docs only.
|
Review round 1 (two reviewers: Sonnet on tests, CLI and docs; Opus on the Worker restart semantics), all resolved in 95abf3b, 6c89788 and 1275337, pushed once. Fixed: (Opus I1) a start could supersede a job still inside its 50-minute limit when the 60-minute watchdog had closed its row, which a second bulk redo makes likely: Rejected with a reason: (Opus S2) the first run's tokens leave the volume's sums when the report is cleared, which is how every restart already behaves and what ADR 0107 states about the volume line; the run count keeps both runs, and the ADR amendment now says so; (Sonnet) an assertion on the |
The restart write now also requires the claimed_at it read, so a job that claims the review between the guard and the write is never superseded by an administrator's start; the next try reads the claimed row and the guard refuses it. Tested with an injected claim, redo and plain, and a mutation.
Say how many were not tried only when some were; report the ignored flag before a fault exit and keep the bug-report hint for a real fault; mark the finished reviews of every verdict in the tests; say in the help that a recent claim holds a start back.
ADR 0092 names the 50-minute claim window, ADR 0093 says which starts begin the edit count again and that a blocked redo leaves the result alone. Docs only.
|
Review round 2 (delta only: Opus on the Worker fixes, Sonnet on the CLI and docs fixes): no Critical and no Important findings. Resolved in 04c7b2b, 097f1fb and a94f6a3, pushed once. Fixed: (Opus) the restart write now also requires the No third round; merging when CI is green. |
Closes #1921.
nemar admin pr-reviews start <dataset> <pr> --redostarts a commit whose review already has a result (pass, fail or uncertain) again, andstart --all --redodoes the same for every open pull request whose current commit has a finished review. Until now a finished review could only run again through an edit of the pull request's title, body or base, a reopen or a ready-for-review, at most five times (ADR 0107, decision 4), so the pull requests the shadow run had already reviewed (for example on006107 #1 and on002578 #2) could not be re-judged with the 0.10.23 scripts and prompt, and the live-review gate could not be run on them.How it works: the Worker's start route takes
?redo=1and passesredoto the gate withadminStart.isRestartablenow says yes for areportedrow when the start is a redo, and the existingrestartReviewdoes the rest (nonce replaced so the superseded job's claim and report are refused, verdict and report cleared, check back to running,attemptsplus one when the earlier run could have cost a call; the contributor's edit count is left as it is, because a redo is no edit). There is no new SQL, no migration, no workflow and no wrangler change.Limits that are part of the design: a review that is running is never superseded (new fixed word
review_runningfor a redo; a job that claimed its review less than 50 minutes ago counts as running even after the watchdog closed the row, for a plain start too), a blocked contributor's finished review is left untouched and the answer iscontributor_paused, an owner's or administrator's pull request with no review on record is still exempt, and--all --redoleaves out drafts, reviews in progress, exempt pull requests and commits capped for edits. The Worker echoesredo: truein its answers to a start that asked for it; a CLI that sent the flag and does not see the echo reports what the Worker did, says the flag was ignored and exits 1, so an older Worker'sduplicateis never read as "nothing to redo" (a bulk run stops after one answer and keeps its results, in the JSON too). An administrator's start is also tried again when the row moves under it, like a change of the text. The audit row of a redo recordsredo: true.Cost: a redo is a second run of up to two model calls, stated in the help and in the
--allquestion. A bulk redo of about a hundred reviews starts them back to back like--alldoes; a--limitto stage it is not built here.ADR 0093 gets the amendment of 2026-10-24, ADR 0107 decision 4 and the AGENTS.md entry get the matching notes.
Tests, all against the real handler and router (real D1 engine, GitHub as a local stand-in):
backend/test/pr-review-start.test.ts(about thirty redo cases: pass, fail and uncertain restarted on the same row, facts-stage report adds no run, running reviews untouched, overdue restarted, blocked contributor declined, capped commit restarted, no row is an ordinary start, the echo including the early returns, the query values1/truehonored and0/yes/empty/absent not, a member refused, the audit row),backend/test/pr-review-flow.test.ts(a redo supersedes the old job's token and its late report is refused, a redo does not supersede a running review, a delivery withredoset restarts nothing),test/admin-pr-reviews-start-cli.test.ts(the real CLI against the real router, including a Worker stand-in that predates the flag) andtest/pr-reviews-render.unit.test.ts. Ten mutations were each turned red by a named test: redo ignored for a reported row, redo restarting a running row, the running word dropped, the echo dropped, anyredovalue counted, redo as the default for every start,in_progressandexemptjoining the redo verdicts, the client-side verdict filter removed, the echo check dropped, and the flag never sent.Not in this PR: nothing deploys until the next release. Follow-up outside the repository:
nemarOrg/docsadmin/commands.mdx(private) should list--redo.