Skip to content

Review forge PRs in one ranked queue with the board's questions - #5

Merged
cgwalters-bot merged 6 commits into
mainfrom
bot/pr-review
Sep 26, 2026
Merged

cgwalters-bot merged 6 commits into
mainfrom
bot/pr-review

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Collaborator

Stages 3 and 4: one ranked queue of forge PRs, board questions and chores, and a PR review pane.

  • Queue: the bot's open draft PRs in cgwalters-forge that cgwalters hasn't approved or sent back at their current head, plus the board's Needs human and Draft items; P0 first (board Priority; a PR takes its board item's), then oldest first. A Draft item tracking a forge PR is that PR's row; one whose forge PRs are all gone is dropped as stale.
  • Review pane: description (without bot-meta), CI, commits with full messages, foldable per-file diff. Approve / Request changes / Comment submit a review with commit_id = the head shown, after re-reading the PR (a moved head sends nothing). Approve is disabled while GitHub's commit list doesn't end at the head, its confirm names unexpanded files, and an optional /draft line is the only command the app writes. The form is offered only for cgwalters-bot's PRs in cgwalters-forge and cgwalters-bot.
  • Verdicts mirror bot-pr's VERDICT_JQ, including /promote comments (shown as "bot-pr decides", kept in the queue).
  • Fast: conditional requests with ETags; the forge search (no ETags, 30/min budget) once a minute, verdicts only for PRs whose updated_at moved; polling only while visible. Keyboard: j/k, o, u, r, a, x, c, ?. Phone width and light/dark/auto themes.

Testing:

  • npm ci && npm run check (tsc, unit tests, build) in node:24 on devspace cgwalters-devspace-36238960068, at every commit; 325 tests at the tip of this PR.
  • Headless Chromium (Playwright, scratch script, not committed) against this build served locally, with the bot's token from the environment: the queue loaded the real board and forge (55 PRs, 14 questions, 25 other), j/k/o/u/x work, a real forge PR diff rendered (oci: Retry transient registry failures when pulling composefs-rs#1: 10 files, 3 commits), Approve sent {"event":"APPROVE","commit_id":<head from the API>} to a mocked endpoint, and writes elsewhere were blocked. Real writes went only to the throwaway Throwaway PR for review app tests cgwalters-bot/review-sandbox#1: a Comment review posted, and GitHub's refusal of an own-PR approval was shown. No horizontal scroll at 390px, dark theme applied.

Generated-by: AI

A 422 only said "Unprocessable Entity"; the reason (e.g. "Can not
approve your own pull request") is in the errors array, and it is what
a refused review needs to show.

Generated-by: AI
Search answers carry their own x-ratelimit-* headers (30 a minute), so
reading the forge's PRs made the meta line flip between the two budgets
and could trigger the low-budget backoff for the wrong one.

Generated-by: AI
The board's "Needs cgwalters" view is Needs human and Draft: Draft items
are forge PRs and gists ready for his review, and the app is meant to be
his one inbox. Also keep each item's created_at, to rank by how long it
has been waiting.

Generated-by: AI
Prep for the PR review pane: cgwalters wants the bot's forge PRs in the
same inbox as its questions, reviewed without going to github.com.

The review is what bot-pr promote keys on, so the verdict mirrors its
rule: his latest approving, change-requesting or dismissing review,
read against the current head, or conversation comment with a /promote
line. bot-pr dates a /promote against the fork's push log, which the
app can't read, so such a PR shows as promoted and stays in the queue
until bot-pr acts. A submitted review always names the head he was
shown, after re-reading the PR to make sure it didn't move, and the
detail read flags a commit list that doesn't end at the head yet (GitHub
lags a push), so the pane can refuse to approve a stale diff. His text
may not carry a line bot-pr would act on; the only command the app
writes is the /draft line of an approval he asked for.

The forge search has no ETags and a small budget, so verdicts are
re-read only for PRs whose updated_at moved, with heads from one
conditional open-PR list per repository.

Generated-by: AI
…iew pane

cgwalters wants one "things you need me for" inbox that beats GitHub's
own UI, so the queue now lists the bot's forge draft PRs waiting on his
review next to the board's Needs human and Draft items, ranked P0 first
and then oldest first. A PR takes its board item's priority, and that
Draft item isn't listed a second time; a Draft item whose forge PRs are
all gone (promoted or closed) is dropped as stale, once the forge has
been read.

A PR opens a review pane: the description without bot-pr's meta
section, CI, each commit's full message, and a per-file diff that folds
(large files start folded and are rendered only when opened). Approve,
request changes and comment submit reviews of the head shown. Approve
is disabled while GitHub's commit list doesn't end at the head yet,
and its confirmation names files he never expanded. The form appears
only for the bot's own PRs in cgwalters-forge and cgwalters-bot, so a
crafted link can't make the page a one-click approval elsewhere.

The queue and the pane share one view model because the queue's order
and labels depend on the verdicts the pane changes. It is keyboard
driven (j/k, o, u, r; a to approve after a confirmation, x to fold a
file, ? for the list), and usable at phone width. The board shows
first; forge PRs and their verdicts fill in as they arrive.

Generated-by: AI
The page follows the system's color scheme; the switch lets him pick
one for this browser (kept in localStorage, a convenience that may be
blocked). The dark palette now applies when chosen or when the system
prefers it and light wasn't chosen.

Generated-by: AI
@cgwalters-bot
cgwalters-bot enabled auto-merge (rebase) September 26, 2026 12:02
@cgwalters-bot
cgwalters-bot merged commit 94c83e9 into main Sep 26, 2026
1 check passed
@cgwalters-bot
cgwalters-bot deleted the bot/pr-review branch September 26, 2026 12:03
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.

1 participant