fix(route): derive PR author at admission to unjam merge queue#20
Open
andrei-hasna wants to merge 1 commit into
Open
fix(route): derive PR author at admission to unjam merge queue#20andrei-hasna wants to merge 1 commit into
andrei-hasna wants to merge 1 commit into
Conversation
The pr-review admission gate (prReviewRoutingDecision) marked every "Review and safely merge <repo>#N" queue task `required` but derived the PR author only from task metadata fields or an inline "author is X" line. The pr-queue producer stamps the PR URL + `github-pr:owner/repo#N` fingerprint into the description but leaves metadata empty, so ~330 repo-pr-merge-queue tasks were skipped every drain cycle (considered=9 created=0 skipped=8, reason "requires PR author evidence"), holding the fleet PR-merge backlog flat. When the gate is required, the author is absent, and the task carries a resolvable repo+number reference, derive the author at admission via a single `gh pr view <n> --repo <owner/repo> --json author` lookup (one per candidate), then continue non-author reviewer selection from the pool. Self-review protection is unchanged: a derived author that is the sole reviewer candidate is still blocked. The route fails closed when the author genuinely cannot be resolved — no reference, or an unreachable / empty lookup (non-zero exit, spawn error, or blank stdout). The lookup is injectable (PrReviewRoutingDeps.lookupPrAuthor) so tests stay hermetic; the gh binary is overridable via OPENLOOPS_PR_REVIEW_GH_BIN. Adds pr-review.test.ts: author derived from fingerprint reference, evidence author preferred (no lookup), self-review blocked, lookup unreachable fails closed, no-reference fails closed without a lookup, and non-required PR mentions do not trigger a lookup.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Contributor
Author
|
OpenLoops worker review for task Current GitHub state:
Local conflict/semantic evidence:
Validation on current
Blockers before merge:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The PR-review admission gate
prReviewRoutingDecision(src/lib/route/pr-review.ts, invoked for every todos-task drain atroute-event.ts:428) marks every "Review and safely merge<repo>#N" queue taskrequired=truebut derives the PR author only from task metadata fields or an inline "author is X" regex. It never queries GitHub.The pr-queue producer (
repos ops pr-queue --upsert-tasks) writes queue tasks with empty metadata and a description carrying the PR URL +github-pr:owner/repo#Nfingerprint but no author line. So ~330repo-pr-merge-queuetasks were skipped every drain cycle:created=0means no worker is ever dispatched, no merge lands, and the fleet PR backlog stays flat (145+ PRs stuck). This is the linchpin.Fix
When the gate is
required, the author is absent, and the task carries a resolvable repo+number reference (PR URL orgithub-prfingerprint already present in the task text), derive the author at admission via a singlegh pr view <n> --repo <owner/repo> --json author -q .author.loginlookup (one per candidate), then continue non-author reviewer selection from the pool.self-review is not routable).PrReviewRoutingDeps.lookupPrAuthor; theghbinary is overridable viaOPENLOOPS_PR_REVIEW_GH_BIN.authorSource("evidence"|"github-api") andpr-reference-detected/author-derived-github-api/author-lookup-unresolvedsignals for observability.Tests (
src/lib/route/pr-review.test.ts, 9 new)github-prfingerprint reference → route admitted, one lookup, correct non-author reviewer selectedVerification
bun test src/lib/route/→ 13 pass / 0 failbun run typecheck(tsc --noEmit) → cleanbun run build→ cleangitleaks protect --staged→ no leaksRefs chief task 49f5670c. Do NOT self-merge — needs an independent reviewer + separate merger per the delivery contract; this fix unblocks the merge path itself so it needs a clean landing.