Skip to content

gardener: review-tiers check, judgment as a model draft (#1064) - #1071

Merged
scuttletoby merged 4 commits into
mainfrom
gardener-review-tiers
Nov 23, 2026
Merged

scuttletoby merged 4 commits into
mainfrom
gardener-review-tiers

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Phase 2 of #1064 (phase 1: #1068).

What

  • New general check review-tiers (fork-kit/gardener/checks/review-tiers): merged pull requests that had less review than their tier asks for.
    • Tiers come from options: rules (globs), a registry file in the repository (rows of paths with a tier), unmatched, and per tier requires (minLenses, named lens regexes with counts). Without tiers it judges by the merge gate's own review block.
    • Lens comments are read by the gate's own code (fork-ci/actions/pr-queue: config, lens, review_config, review_glob, review_judge), imported and not copied. The installer copies them into the release as gate/. A comment counts exactly when the gate would take it as a lens, and only if posted by the queue config's lens authors.
    • It always searches the project's own repository; there is no repo option (a different one is refused), so a #N in the report always means that repository's PR.
    • Findings: review-tiers.skipped (warn) when no lens was posted at all; review-tiers.short when some lens kinds are missing (warn at the top tier or a critical PR, else info); review-tiers.late (info) when the lenses posted after the merge meet the tier, so a review done afterwards settles the warning as the hint says.
    • A valid override comment before the merge settles a pull request. So does a counted author's comment whose first line starts with one of waivers. Anyone the queue counts for lenses can waive, the PR's own author too; the README says so next to waivers.
    • exemptLabels and exemptAuthors skip pull requests.
    • More than 100 files: judged as critical in both modes (tiers and the gate's review block).
    • GitHub budget: one free rate_limit read and one paged GraphQL search per run (maxPages, default 8, at most 25; about 10 s a page, so timeoutSeconds must cover it). Below minRemaining (1000) it does not search and judges from the cache. A GraphQL error page is retried once at a quarter of the page size.
    • The cache keeps facts only (paths, lens names, no comment text). Its key includes a hash of the gate's code, so a kit upgrade that changes the lens rules starts afresh.
  • Contract v1 gains cacheDir (a private per-check folder in the state folder) and dryRun. Both are additive; checks read them with .get().
  • Report:
    • A #N where is shown; when the report goes to another repository it is written OWNER/REPO#N, so it never links to the wrong #N.
    • Well-known token shapes (ghp_, github_pat_, sk-, xoxb-, AKIA, private key blocks) are masked in check text and in the judgment.
  • Judgment:
    • Shown as "Judgment (model draft)" with a line saying nobody checked it. It passes the same publish filter as check text and is dropped in counts-only.
    • timeoutSeconds bounds the whole answer: before each read the socket timeout is cut to the time left, so neither a trickling nor a stalled server can run past the deadline.
    • No paid fallback, on purpose; the README and docstring explain why.

Fix round 1 (lens findings)

  • S1 (a busy repo never finished its search): a search cut off by maxPages or the budget remembers where it stopped (resume: day, since, before) and the next run continues from there (updated:<= that point, overlapping by one PR; a page that all shares one second steps past it), so every PR is judged within a few runs. partial is now a warn, and the README documents maxPages x 10 s. Test: maxPages 1 over 3 pages judges every PR by the third run.
  • S2 (a review after the merge never cleared the warning): lenses after the merge that meet the tier now give one review-tiers.late info instead of the warning.
  • S3 (the repo option could send one repository's PRs out under another's name): the option is removed and refused.
  • Extra (from the [Feature]: Import/sync existing Codex chats pingdotgg/t3code#2206 round): "no lens at all" (skipped, warn) is counted apart from "a lens kind missing" (short).
  • M1: more than 100 files is judged critical by the gate's review block too. M2: the gate code hash is in the cache key. M3: the unused bot fact is dropped. M4: see Judgment above. M5: a GraphQL error page is retried smaller. M6: the README waiver note.

State question (runs again, stops half-way, old/empty state)

  • Runs again the same day: it searches only updated:>= the day before the last full search, then continues any saved resume point. Merged pull requests already in the cache are still judged.
  • Next day: the same incremental search. Pull requests that left the window are pruned from the cache.
  • Stops half-way (a GitHub error on page 2): the check fails and the cache file is byte-for-byte unchanged, with no temporary file left. A partial search keeps the old search day and saves a resume point, so the next run picks up where this one stopped.
  • Old, broken or empty state: these all read as empty and the whole window is searched: an empty file, not JSON, a list, no version, an older version, entries without the new keys, another repository, queue config or gate code, a search day in the future. A cache without a resume point works as before; a broken resume point is dropped with a note.
  • Newer state (a downgraded kit): not used and not overwritten.
  • Dry run: reads the cache and writes nothing.
  • Model endpoint: down, silent (accepts and says nothing), trickling (slow), stalled near the deadline, junk (not HTTP), errors, empty answer. Each is a note and the run goes on.

Calibration (dry runs on two real repositories)

  • This fork (gate review block, 7 days): about 3 GraphQL points for 8 pages. Many merged PRs have no lens comments at all, so they are listed. These findings are real (for example fork-kit: gardener kit, a daily report issue per project (#1064, phase 1) #1068).
  • A second, private project (its own tiers): about 50 findings, most of them PRs with no lens comment.
  • Both hit maxPages 8 before fix round 1; the search now resumes across runs, and a busy project can set maxPages to about 20.

Tests

fork-kit/gardener/tests passes. Each fix has a test that fails without it, and RedCheck mutates each guard (28 mutations in checks, 21 in report):

File Tests
checks 60
report 35
run 38
install 10

Also run (earlier in this PR): fork-kit/common/tests/machine_file.test.py 27 OK, fork-ci/actions/pr-queue/review_judge.test.py 57 OK, .github/scripts/fork-ci-release.test.py 98 OK, fork-kit/common/tests/kit_install.test.py 189 OK, and the seam check (clean).

Two fixes found on the way: the kit tests' fixture now copies the kit in the fork's layout (the installer reads gate/ from fork-ci/actions/pr-queue), and the worktrees check reads branches with refname:lstrip=2, because refname:short prints heads/<name> when a tag or remote has the same name and the check then crashed.

General vs project

  • General (this PR): the check, its tier model (rules, registry, required lens counts, waivers, exemptions), the cache and resume point, the GitHub budget, the judgment and the report filter. No project names in code; tests use made-up names.
  • Project (adapter, not here): each project's tier table, registry file, waiver words and maxPages go in its own machine-file entry or config. The SkyRPG adapter comes in a separate PR in that repository.

🤖 Generated with Claude Code

scuttletoby and others added 4 commits November 23, 2026 21:09
- New general check review-tiers: merged pull requests that had less review
  than their tier asks for. Tiers and waiver words come from options (or the
  merge gate's own review block); lens comments are read by the gate's own
  code (fork-ci/actions/pr-queue, installed as gate/). One rate_limit read and
  one paged GraphQL search per run, cached in the check's cacheDir, so the
  next run searches only pull requests updated since the day before.
- Contract v1 gains cacheDir and dryRun (additive; read with .get()).
- Report: a "#N" where is shown (OWNER/REPO#N when the report goes to
  another repository); well-known token shapes are masked.
- Judgment: shown as "Judgment (model draft)", timeoutSeconds bounds the
  whole answer (a trickling server is cut off), no paid fallback (documented).
- Tests: verdicts, override/waiver/exempt, gate review block, budget and
  partial searches, the cache (runs again, stops half-way, old/empty/newer
  state, dry run), slow and silent model endpoints; RedCheck mutations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cluded

The installer reads the gardener's gate/ from fork-ci/actions/pr-queue two folders up from the kit; the shared
install fixture copied the kit to a folder with nothing beside it, so 7 gardener install tests failed in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…is ambiguous)

A branch named like a tag or remote printed as heads/<name> and crashed the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…option

Fix round 1 from the lens:
- A search cut off by maxPages or the budget now remembers where it stopped
  (resume point in the cache) and goes on there next run, older pull
  requests first, until the whole window is read; "partial" is a warning.
  A page of one second is stepped past; a broken resume point is dropped.
- Lenses after the merge that, with those before it, meet the tier clear
  the warning and leave a "late" note; the fix hint says so.
- "No lens at all" (skipped, warn) is counted apart from "a lens kind
  missing" (short, warn at the top tier, else info).
- The "repo" option is refused: the check reads the project's own repo.
- The gate's code is part of the cache key; the unused "bot" fact is gone.
- With the gate's review block, a pull request with more than 100 files
  is judged as critical.
- A GraphQL page GitHub cannot answer is asked again once with 5 pull
  requests a page.
- The judge's model call is bounded by timeoutSeconds in total: each read
  waits at most until the deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby
scuttletoby merged commit 9afbe51 into main Nov 23, 2026
32 checks passed
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