⨠feat(pr-signals): --wait polls until CI settles on two agreeing polls, and keep-going names it
Merged
AT
2d ago+398+398+012345678901234567890123456789-29-29-01234567890123456789
Slice: #695
niyam pr-signals <pr> --wait [--timeout <minutes>] polls until CI settles, prints the JSON once, and exits with the verdict. keep-going now names it. This is slice 2 of #693's spec v1, on top of #707 (#694). Alok approved it with a š on its Proposal: comment.
Change:
src/pr-signals.tssignalArgstakes--waitand--timeout <minutes>: whole minutes from 1, 60 by default, and only with--wait.- Each poll is a light read: the pull request, the head's check runs and statuses, and the base's rules, judged as #694 does. It reads no logs, threads or findings.
- Polls run every 30 s. A green wait ends at two polls in a row that agree (
agreed). Each must be settled (pollOf): every runcompleted, no statuspending, and a knownmergeable_state. They must show the same head, the same check-run ids and the same verdict.failed,conflictedandunjudgedend early, at two polls with the same head and verdict, whatever still runs.shortnever ends it. - A moved head is said on standard error, and the count starts again.
- Then one full read, as today, and the exit for the full read's verdict: 0 green, 5 failed, 6 conflicted, 7 unjudged or short, 8 pending. A merge or close during the wait exits 3 or 4, with
phase: "wait". - At the timeout it exits 7 if the last poll was short, else 8. It prints the last poll's
ciunder{ "ok": false, "reason": "ci-not-settled" }. - The plain read still exits 0.
src/run.ts:pr-signalstakes up to five arguments; the usage names--waitand its exits.src/keep-going.ts: the open pull request line namesniyam pr-signals <n> --waitas a background task. In print mode it names the foreground with--timeout 9, run again until it ends.README.md: the wait and its exit table, and the keep-going line.
Choices the slice left open:
- "Ends early" does not wait for other runs. Point 3 ends the wait early on
conflicted,failedandunjudged, because waiting cannot change a conflicted head and the agent can start fixing a failure. If those also had to settle, a required check failing at minute 2 under a 34-minuteLane (src)would report at minute 34. In print mode,--timeout 9would return 8 again and again withverdict: failed. So those three end at two polls with the same head and verdict. Only green waits for every run, as the slice's "Why" asks, so that a late failure is not missed. - Five arguments, beyond the slice's four. The slice says
run.tstakes up to four. That covers7 --ci-only --waitand7 --wait --timeout 9, but not all three flags at once:7 --ci-only --wait --timeout 9is five. Five lets that through and nothing else, sincesignalArgsrefuses any flag given twice. I asked the session that started this one and had no answer before pushing. - The exit comes from the full read's verdict, not the last poll's, so the exit and the printed JSON always agree. A run that starts between the last poll and the full read exits 8, with that run in
ci. - At the timeout, only
shortexits 7. Every other verdict exits 8, as not settled, including a lone green poll that no second poll confirmed.
Evidence:
- Mutation,
pnpm exec agnipariksha --lane src --files src/pr-signals.ts,src/run.ts,src/keep-going.ts --no-reuse:- Before the early end, the run killed 2675 of 2677.
run.tsandkeep-going.tshad no survivors. - The two survivors in
pr-signals.tssat on the timeout'sunjudgedbranch, which the early end made dead. It is gone now. - The last run, on
src/pr-signals.ts, killed 1187 of 1187. - The test fakes throw past 200 check-run reads, so a mutant that never ends the loop dies at once. One timeout was left.
- Before the early end, the run killed 2675 of 2677.
- Real waits, run from a veda worktree with this branch's build on 2026-11-27, against pull requests whose mutation lanes were still running:
pr-signals 654 --ci-only --wait --timeout 5(https://github.com/veda-hq/veda/pull/654) polled for 5 minutes and exited 8. It printedā CI on #654 did not settle within 5 minute(s); the last poll read it as pendingand"Lane (dvara)" still running.pr-signals 646 --ci-only --wait --timeout 3(https://github.com/veda-hq/veda/pull/646) exited 8 on"Lane (pariksha)". Its 10 required checks were read,Mutationmissingwhile its lanes ran.pr-signals 707 --waithere exited 3 at once: merged.
pnpm checkexits 0, with 3255 of 3255 and 207 of 207 tests passing.- Cubic's monthly allowance ran out (its check on #707: "AI review line limit reached", 80,073 of 80,000 lines; reviews resume 9 December 2026). So this pull request, like #707, gets a
neutralCubic check and no review.
Guards: none. No guard file changes.
š¤ Generated with Claude Code
Summary by cubic
Adds --wait to niyam pr-signals, which polls CI until it settles, prints the JSON once, and exits with the verdict. keep-going now names the wait as a background task and, in print mode, as a foreground --timeout 9 run.
New Features
--wait [--timeout <minutes>]polls every 30 seconds until two consecutive polls agree; green requires two settled polls on the same head, check-run ids, and verdict, whilefailed,conflicted, andunjudgedend early after two polls with the same head and verdict.- Exits 0 green, 5 failed, 6 conflicted, 7 unjudged or still short, 3 merged, 4 closed, and 8 when the timeout (default 60 minutes) passes while still pending.
- A moved head restarts the count with a message; a
shorthead is polled until the timeout, since a late required check can look missing at first. - After the wait, one full read runs as before; the exit comes from that full read's verdict, so the exit and the printed JSON always agree.