Add PR-only queue cleanup mode that dispatches one canonical review per PR #390

Closed
opened 2026-07-07 08:51:11 -05:00 by jcwalker3 · 2 comments
Owner

Problem

Operator queues sometimes need to process open PRs deterministically: one canonical review per PR, then stop or hand off—without batch queue-status reports, multi-PR selection in one run, or author-side fixes mixed into reviewer cleanup.

Today the canonical review-merge-pr workflow supports inventory and selection, but there is no dedicated PR-only queue cleanup mode that dispatches isolated review runs per PR with enforced boundaries.

Required behavior

  1. Add a documented workflow mode (e.g. pr-queue-cleanup or review-one-pr) under skills/llm-project-workflow/.
  2. Mode iterates open PRs (or an operator-supplied PR list) and dispatches exactly one canonical review-merge run per PR:
    • complete PR inventory with pagination proof before any selection claim
    • pin head SHA for the selected PR only
    • session-owned worktree under branches/
    • single terminal review decision per PR (approve / request-changes / comment / skip with proof)
    • no multi-PR validation or batch final report substituting for per-PR proof
  3. After each PR, emit that PR's final report; optional queue summary only after explicit per-PR reports exist.
  4. Merge is forbidden in cleanup mode unless operator explicitly authorizes merge for that specific PR in that run.
  5. Register resolver/route task so reviewer profiles can enter cleanup mode; author profiles cannot.

Acceptance criteria

  • Workflow file + template for PR-only cleanup mode.
  • MCP task routing / capability mapping for cleanup mode (reviewer role only).
  • Tests: single-PR dispatch, blocked multi-PR batching, inventory pagination proof required, merge blocked without explicit per-PR authorization.
  • Runbook section describing when to use cleanup mode vs full queue review.

Related issues

  • #290 — PR review state machine umbrella
  • #173 — blind PR queue evidence requirements
  • #339 — queue-status report verifier (batch reports must not fake per-PR proof)
  • #340gitea_list_prs pagination metadata (dependency for inventory proof)

Non-goals

  • Do not auto-merge PRs in cleanup mode.
  • Do not perform author fixes or branch pushes from reviewer cleanup mode.
  • Do not replace the full review-merge-pr workflow; compose with it per PR.
## Problem Operator queues sometimes need to process open PRs deterministically: **one canonical review per PR**, then stop or hand off—without batch queue-status reports, multi-PR selection in one run, or author-side fixes mixed into reviewer cleanup. Today the canonical `review-merge-pr` workflow supports inventory and selection, but there is no dedicated **PR-only queue cleanup** mode that dispatches isolated review runs per PR with enforced boundaries. ## Required behavior 1. Add a documented workflow mode (e.g. `pr-queue-cleanup` or `review-one-pr`) under `skills/llm-project-workflow/`. 2. Mode iterates open PRs (or an operator-supplied PR list) and dispatches **exactly one** canonical review-merge run per PR: - complete PR inventory with pagination proof before any selection claim - pin head SHA for the selected PR only - session-owned worktree under `branches/` - single terminal review decision per PR (approve / request-changes / comment / skip with proof) - no multi-PR validation or batch final report substituting for per-PR proof 3. After each PR, emit that PR's final report; optional queue summary only after explicit per-PR reports exist. 4. Merge is forbidden in cleanup mode unless operator explicitly authorizes merge for that specific PR in that run. 5. Register resolver/route task so reviewer profiles can enter cleanup mode; author profiles cannot. ## Acceptance criteria - [ ] Workflow file + template for PR-only cleanup mode. - [ ] MCP task routing / capability mapping for cleanup mode (reviewer role only). - [ ] Tests: single-PR dispatch, blocked multi-PR batching, inventory pagination proof required, merge blocked without explicit per-PR authorization. - [ ] Runbook section describing when to use cleanup mode vs full queue review. ## Related issues - **#290** — PR review state machine umbrella - **#173** — blind PR queue evidence requirements - **#339** — queue-status report verifier (batch reports must not fake per-PR proof) - **#340** — `gitea_list_prs` pagination metadata (dependency for inventory proof) ## Non-goals - Do not auto-merge PRs in cleanup mode. - Do not perform author fixes or branch pushes from reviewer cleanup mode. - Do not replace the full `review-merge-pr` workflow; compose with it per PR.
jcwalker3 added the status:in-progress label 2026-07-07 08:56:27 -05:00
Author
Owner

Claiming #390 for implementation (author session, prgs-author / jcwalker3).

Branch: feat/issue-390-pr-queue-cleanup-mode

Planned slice per acceptance criteria:

  1. skills/llm-project-workflow/workflows/pr-queue-cleanup.md — canonical PR-only cleanup mode: forbids issue claiming, branch creation, implementation edits, and issue filing; exactly one canonical review run per PR; stop after REQUEST_CHANGES; after APPROVED, same-PR merge only with explicit per-PR operator authorization and passing merge gates; hard stop after merge or merge blocker; next PR requires a fresh run; final report names the next suggested PR without continuing.
  2. task_capability_map.py + role_session_router.pypr_queue_cleanup task mapped to reviewer role (gitea.pr.review); author sessions route wrong_role_stop.
  3. pr_queue_cleanup.pyassess_pr_queue_cleanup_report verifier: single terminal decision, no multi-PR batching, inventory pagination proof, per-PR merge authorization, no issue/branch mutations in cleanup mode.
  4. Runbook section + workflow contract tests + verifier tests.

Working in branches/issue-390-pr-queue-cleanup-mode.

Claiming #390 for implementation (author session, `prgs-author` / `jcwalker3`). **Branch:** `feat/issue-390-pr-queue-cleanup-mode` **Planned slice per acceptance criteria:** 1. `skills/llm-project-workflow/workflows/pr-queue-cleanup.md` — canonical PR-only cleanup mode: forbids issue claiming, branch creation, implementation edits, and issue filing; exactly one canonical review run per PR; stop after `REQUEST_CHANGES`; after `APPROVED`, same-PR merge only with explicit per-PR operator authorization and passing merge gates; hard stop after merge or merge blocker; next PR requires a fresh run; final report names the next suggested PR without continuing. 2. `task_capability_map.py` + `role_session_router.py` — `pr_queue_cleanup` task mapped to reviewer role (`gitea.pr.review`); author sessions route `wrong_role_stop`. 3. `pr_queue_cleanup.py` — `assess_pr_queue_cleanup_report` verifier: single terminal decision, no multi-PR batching, inventory pagination proof, per-PR merge authorization, no issue/branch mutations in cleanup mode. 4. Runbook section + workflow contract tests + verifier tests. Working in `branches/issue-390-pr-queue-cleanup-mode`.
sysadmin removed the status:in-progress label 2026-07-07 09:07:54 -05:00
Author
Owner

Evidence update — concurrent reviewer sessions can race the PR-only queue.

A reviewer run stopped correctly after detecting that another sysadmin / prgs-reviewer session approved/merged PR #380 mid-run. The first session’s inventory had listed #380 as open, but a later feedback fetch showed it closed/approved at 09:11:01 by the same reviewer identity. The target branch also advanced from 103364a to b5ee656, and fresh review/baseline worktrees from the other session were present.

This shows PR-only queue cleanup mode needs concurrency control:

  • one active reviewer queue run per repo/profile, or
  • a queue lease / selected-PR lease before validation/review mutation
  • stale inventory invalidation when another reviewer mutates the queue
  • hard stop when target branch changes during selection
  • final report must say the run stopped and must not reuse old queue state

Expected behavior:

  1. Reviewer queue cleanup acquires a short-lived queue lease before selection.
  2. A second reviewer session must fail closed or run read-only diagnostics only.
  3. The lease records repo, profile, selected PR if any, timestamp, and phase.
  4. The lease expires or releases after terminal mutation/final report.
  5. If target branch advances during selection, the run invalidates inventory and restarts/stops.
  6. Tests cover concurrent reviewer sessions, same identity collision, stale inventory after merge, and stale target branch after another session merges.
Evidence update — concurrent reviewer sessions can race the PR-only queue. A reviewer run stopped correctly after detecting that another `sysadmin / prgs-reviewer` session approved/merged PR #380 mid-run. The first session’s inventory had listed #380 as open, but a later feedback fetch showed it closed/approved at 09:11:01 by the same reviewer identity. The target branch also advanced from `103364a` to `b5ee656`, and fresh review/baseline worktrees from the other session were present. This shows PR-only queue cleanup mode needs concurrency control: - one active reviewer queue run per repo/profile, or - a queue lease / selected-PR lease before validation/review mutation - stale inventory invalidation when another reviewer mutates the queue - hard stop when target branch changes during selection - final report must say the run stopped and must not reuse old queue state Expected behavior: 1. Reviewer queue cleanup acquires a short-lived queue lease before selection. 2. A second reviewer session must fail closed or run read-only diagnostics only. 3. The lease records repo, profile, selected PR if any, timestamp, and phase. 4. The lease expires or releases after terminal mutation/final report. 5. If target branch advances during selection, the run invalidates inventory and restarts/stops. 6. Tests cover concurrent reviewer sessions, same identity collision, stale inventory after merge, and stale target branch after another session merges.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#390