Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion design/developer-workflows/pr-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Use this guide for pull-request status, review handling, CI, Renovate, merging,
- If that exact legacy transition is followed by a fresh review and a later coherent fix head, reauthorize only the same immutable fingerprints with `dev-tools/pr-review decide transition --reauthorize --pr <number> --head <exact live SHA> --reason "<reason>"`. The controller requires a prior transition, verifies every carried record again, and requires every other observation to be normal completed attributable anchored evidence; newer evidence remains counting and subject to ordinary reconciliation and judgment. A changed head without this explicit reauthorization remains blocked, and the command never creates a checkpoint or consumes review quota.
- A single previously audited Hosted fingerprint that is absent from the complete current history may be retired only with `--reauthorize --retire-missing-hosted-fingerprint <exact fingerprint>`. This requires the exact prior fingerprint, coherent current topology, complete available Hosted trigger records and paginated GitHub review/comment history, terminal and uniquely attributable responses, no active or unresolved reservation, and no unresolved actionable findings; any missing or ambiguous proof remains held. The fingerprint stays in the transition audit and remains non-counting if it later reappears. This decision never reconstructs evidence or creates a checkpoint and does not grant review, taper, finding-count, or merge-readiness credit.
- Record an explicit channel judgment with `dev-tools/pr-review decide judgment retain|reopen --pr <number> --channel hosted|cli --head <exact live SHA> --checkpoint <id> --reason "<reason>"`. Retain confirms the verified equivalent patch for request and queue safety; reopen explicitly requires fresh review without deleting historical completed taper and resets the taper streak at the bound checkpoint. For CLI, a reopen may bind the latest complete modern checkpoint to a proven descendant live head, but carries no new review credit until later completed results arrive. A narrow channel policy override uses `dev-tools/pr-review decide policy --pr <number> --head <exact live SHA> --checkpoint <id> --hosted-zero-useful <count> --reason "<reason>"` or `--cli-zero-useful <count>` (exactly one channel); it sets that channel's zero-useful completion count for the exact checkpoint.
- Extend the existing allocation with `dev-tools/pr-review decide allocation grant --pr <number> --channel hosted|cli --head <exact live SHA> [--checkpoint <completed checkpoint>] [--min-additional-completed <N>] [--max-additional-completed <N>] [--fresh-taper] --reason "<human judgment>"`. Both bounds count completed, attributable results for that PR and channel beginning at the decision; the optional checkpoint records the observed identity but does not move that count's start. With neither bound, the existing one-result promise remains (`min=1`, `max=1`). A minimum-only allocation has no maximum; a maximum-only allocation has no extra minimum (`min=0`). Without `--fresh-taper`, an allocation after completed taper affects queue eligibility and its additional-result count while preserving the existing historical taper display. Its zero-useful results continue the normal streak. An accepted allocated result resets the active streak at that result, while all earlier checkpoints remain visible with their original counts; after fixes, later zero-useful results can satisfy taper. `--fresh-taper` starts the active streak at the allocation decision immediately; earlier dry results remain visible historical evidence but cannot satisfy it. When both bounds are set, reject `min > max`; the minimum requires that many additional results even after fresh taper, while taper may stop earlier than the maximum once the minimum is met. Rate limits, connection failures, duplicates, partial or ambiguous responses, provisional captures, and other non-counting observations do not consume the count. Hosted and CLI allocations remain independent; request-time identity checks apply only when posting a new review.
- Extend the existing allocation with `dev-tools/pr-review decide allocation grant --pr <number> --channel hosted|cli --head <exact live SHA> [--checkpoint <completed checkpoint>] [--min-additional-completed <N>] [--max-additional-completed <N>] [--exact-additional-completed <N>] [--fresh-taper] --reason "<human judgment>"`. Both bounds count completed, attributable results for that PR and channel beginning at the decision; the optional checkpoint records the observed identity but does not move that count's start. With neither bound, the existing one-result promise remains (`min=1`, `max=1`). A minimum-only allocation has no maximum; a maximum-only allocation has no extra minimum (`min=0`). `--exact-additional-completed N` is mutually exclusive with the separate bounds and `--fresh-taper`, and records `min=max=N`, so ordinary taper cannot stop discovery before all `N` results and the cap stops discovery immediately afterward. It preserves the existing taper rather than starting a fresh streak. Use `allocation renew --exact-additional-completed N` to replace an existing allocation or audited human stop explicitly. A verifiable request already admitted at the exact-allocation decision remains in flight and counts only when it completes attributably; ambiguous or unsupported active evidence is refused. Without `--fresh-taper`, an allocation after completed taper affects queue eligibility and its additional-result count while preserving the existing historical taper display. Its zero-useful results continue the normal streak. An accepted allocated result resets the active streak at that result, while all earlier checkpoints remain visible with their original counts; after fixes, later zero-useful results can satisfy taper. `--fresh-taper` starts the active streak at the allocation decision immediately; earlier dry results remain visible historical evidence but cannot satisfy it. When both bounds are set, reject `min > max`; the minimum requires that many additional results even after fresh taper, while taper may stop earlier than the maximum once the minimum is met. Rate limits, connection failures, duplicates, partial or ambiguous responses, provisional captures, and other non-counting observations do not consume the count. Hosted and CLI allocations remain independent; request-time identity checks apply only when posting a new review.
- Normal taper can finish before a maximum once the minimum is met. After any additional result with accepted findings, no next request is allowed until those findings, current/outdated threads, actionable summary findings, and fix publication/validation obligations are clear, even if capacity remains. Once the maximum is used, no further request is allowed for that PR/channel; a maximum stop is not taper and does not waive accepted findings or fixes. `status` and `evidence` expose the minimum, maximum, completed count, baseline identity, in-flight results, taper state, and controlling reason. When the maximum is exhausted, the controller derives an audited human-cap stop and advances that channel through its normal selector without a separate `decide stop`, subject to the active-review safety described below. Pending obligations remain source-owned and visible as `cap exhausted; findings pending`; this stop is not taper, current-head review, CI/Smoke proof, or merge readiness. A bounded allocation can be replaced explicitly with `allocation renew` and new bounds; `allocation cancel` removes it. Ordinary fixes never reset its completed count.
- When the Overseer deliberately allocates one further completed review before deciding whether to continue, record it before the review with `dev-tools/pr-review decide allocation grant --pr <number> --channel hosted|cli --head <exact live SHA> --reason "<reason>"`. Completed-result counts belong to the PR and channel and survive later identity changes; rate limits, partial, duplicate, and unattributable results do not consume the allocation. Record a human decision to make no further requests with `dev-tools/pr-review decide stop --pr <number> --channel hosted|cli --reason "<human judgment>"`. This audited PR/channel override bypasses the taper gate only for queue advancement; it is not taper completion or proof of review coverage, and it persists across head and parent changes. It requires no completed checkpoint, clean findings, idle provider, or coherent review topology. An already admitted CLI or Hosted run continues with its reservation, capture, attribution, and eventual findings intact; finishing that run does not clear the override. Stop recording and new-request admission share only the short state mutation boundary, while each provider keeps its execution exclusion. Optional `--head` and `--checkpoint` pins must match the observed identities; unavailable optional Git proof is recorded as absent, never fabricated. Existing ambiguity-retention and over-ceiling acknowledgment options record their specific evidence without granting review credit. Discovery can advance only when the same channel has no active provider run. Accepted fixes, pending captures and adjudication, attributable evidence, current and outdated threads, actionable summaries, required CI, runtime proof, ancestry, and merge safety remain independent obligations. A stop overrides taper only and does not manufacture a reviewed head or merge readiness.
- For a channel that still needs review, targeting stops at the first held, unstable, unreconciled, over-ceiling, or judgment-blocked PR; it skips PRs whose channel has completed taper or an audited human stop. The narrow exception is a verified terminal, non-counting Hosted response: keep that PR incomplete and visible, but use the next coherent PR's Hosted window if one exists. Do not post another request on the ambiguous PR or grant it taper or merge credit; revisit its evidence or obtain an audited human stop before its merge handoff. Request-time identity and active-review checks still apply before any new request for an incomplete channel. A file-ceiling rejection requires a coherent topology decision; there is no normal incremental-review fallback.
Expand All @@ -31,6 +31,8 @@ Use this guide for pull-request status, review handling, CI, Renovate, merging,

## Review Orchestration

- Record human channel stops and review allocations independently of stack reconciliation or request readiness. Preserve existing review history and taper; provider requests still require their own attribution, exclusivity, identity, and finding checks. A saved allowance does not clear a hold or retire an already admitted request.

- Configure merge order once with `dev-tools/pr-review stack set`; the controller owns automatic Hosted and CLI targeting across the configured coherent merge train, and each channel advances independently. A cooldown, failure, or CI hold in one lane does not idle the other lane or safe later work. Keep request-time gates and the Hosted publication boundary intact, allow at most one active Hosted request and one CLI process repository-wide, and re-run `status` after head, parent, base, or merge changes to expose `PARENT_MOVED` descendants. Reconcile before an ordinary request, or use `--force` only for a known warning with exact candidate identity and admission-time rechecks.
- Exhausting an authorized maximum review allocation closes discovery for that PR and channel and advances that channel independently, even when accepted source fixes remain pending. Status retains `cap exhausted; findings pending` as source obligation information, with an audited human-cap stop rather than a discovery selection hold. Do not request another review on the capped source. An already admitted active review remains intact and prevents overlapping execution; its late findings remain source obligations. Minimum/maximum accounting, finding counts and resolutions remain unchanged. Cap closure is neither taper completion nor merge proof: accepted fixes, review threads, required CI and all merge-readiness requirements remain mandatory on the source PR.
- Keep the train moving when one PR or channel is blocked: work on the next safe review or fix up the configured chain, including dependency-safe preparation ahead of the front. Do not stop at a blocked request, red CI, provider cooldown, or human merge wait while useful safe work remains. Report the concrete blocker and the work continuing elsewhere; stop only when no safe useful work remains or the human explicitly pauses the lane.
Expand Down
4 changes: 3 additions & 1 deletion dev-tools/pr_review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The output identifies the SQLite schema and writer build. The live shared cutove

For a posted Hosted request, `dev-tools/pr-review wait hosted --pr <number> --trigger-id <comment ID>` watches only that saved trigger. `--poll-seconds` defaults to 30 and `--max-wait-minutes` to 90. It returns JSON and exit status 0 for an attributable completion, 3 for another terminal result, or 4 when the wait expires; it never posts a request, grants review credit, or retires the trigger. The caller must read the result and use `records sync-hosted --pr <number>` before adjudicating a completed review. A wait expiration leaves the underlying trigger unchanged.

To require exactly a chosen number of further completed attributable results on one channel, use `dev-tools/pr-review decide allocation grant --pr <number> --channel hosted|cli --head <exact live SHA> --exact-additional-completed <N> --reason "<human judgment>"`. Use `allocation renew` instead of `grant` to replace an existing allocation or human stop explicitly. The command records the existing minimum and maximum as the same positive number; it does not start a fresh taper streak. Recording any human allocation grant or renewal requires the configured PR, channel, exact live head, and reason, but does not require stack reconciliation, local Git anchor proof, runnable selection, or cleared findings. The same recording boundary applies to one-result and minimum/maximum allocations. Available anchor facts are retained as audit context; unavailable Git facts remain null. Request admission still enforces attribution, exclusivity, identity warnings, and pending findings independently, so a saved allowance may remain held. Earlier completed evidence remains historical, while a verifiable request already admitted at the decision remains in flight and consumes one result only if it later completes attributably. Failures, rate limits, and other non-counting results consume none. Discovery continues until all `N` results complete even if ordinary taper was already satisfied or becomes satisfied early, then closes at the exact cap while accepted findings and fixes remain mandatory obligations.

### Manual Hosted adoption

A human-posted Hosted CodeRabbit request can be incorporated without requesting another review: after the review completes, run `dev-tools/pr-review decide trigger-adopt-manual --pr <number> --trigger-id <GitHub comment ID> --head <current reviewed SHA>`. This verifies the immutable public command, completed response, and current anchor before writing a private attribution record. A queued PR uses its reconciled stack parent; an off-queue PR uses its actual live base branch after matching the live base and head tips to their remote refs. Off-queue adoption leaves the configured review queue unchanged. The command does not post a GitHub comment, create a result checkpoint, or grant taper by itself; adjudicate findings and post the normal public Hosted checkpoint next. A moved head or ambiguous response is refused.
Expand Down Expand Up @@ -53,7 +55,7 @@ Allocation finding-clearance audits distinguish an attributable terminal Hosted

Hosted and CLI preflight briefly serialize on admission locks. A busy Hosted admission is retried through bounded fresh target selection; if contention persists, the command reports admission contention without treating the lock as proof of an active provider request. A lock refusal occurs before the Hosted reservation and POST.

For a historical or missed provider round, name its exact checkpoint comment. The repair command previews an isolated SQLite copy by default, validates the immutable provider identity and source decisions, and imports bounded/redacted source artifacts on `--apply`. Use `--all --continue-on-error` to report each checkpoint separately when some old evidence is incomplete. Missing historical evidence remains labelled; the command never invents an attributable review or changes taper. Repeat an exact import safely; conflicting evidence is refused. `records migrate` reports three distinct CLI capture outcomes while preserving run identity and source fingerprints: failed legacy captures become non-counting SQL attempts; a complete successful native capture is recovered as a completed source run only when it matches its existing started SQL attempt and proves one exact successful result; and an incomplete native capture matching its exact started SQL attempt is terminally classified as failed or timed out, with no source run or taper credit. Changed or conflicting evidence is reported instead of overwriting an earlier import. Normal history reads do not scan those files.
For a historical or missed provider round, name its exact checkpoint comment. The repair command previews an isolated SQLite copy by default, validates the immutable provider identity and source decisions, and imports bounded/redacted source artifacts on `--apply`. Use `--all --continue-on-error` to report each checkpoint separately when some old evidence is incomplete. Missing historical evidence remains labelled; the command never invents an attributable review or changes taper. Repeat an exact import safely; conflicting evidence is refused. A verified reply-only completion observed after an immutable ambiguous Hosted attempt can append its exact source run and checkpoint origin; the initial attempt and archived evidence remain unchanged. `records migrate` reports three distinct CLI capture outcomes while preserving run identity and source fingerprints: failed legacy captures become non-counting SQL attempts; a complete successful native capture is recovered as a completed source run only when it matches its existing started SQL attempt and proves one exact successful result; and an incomplete native capture matching its exact started SQL attempt is terminally classified as failed or timed out, with no source run or taper credit. Changed or conflicting evidence is reported instead of overwriting an earlier import. Normal history reads do not scan those files.

```sh
dev-tools/pr-review records repair-provider \
Expand Down
7 changes: 7 additions & 0 deletions dev-tools/pr_review/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,12 @@ def records_database(command: argparse.ArgumentParser) -> None:
metavar="N",
help="maximum additional completed attributable results after the decision",
)
allocation.add_argument(
"--exact-additional-completed",
type=_positive_int,
metavar="N",
help="require exactly N additional completed attributable results after the decision",
)
allocation.add_argument(
"--fresh-taper",
action="store_true",
Expand Down Expand Up @@ -1662,6 +1668,7 @@ def record(current):
checkpoint=args.checkpoint,
min_additional_completed=args.min_additional_completed,
max_additional_completed=args.max_additional_completed,
exact_additional_completed=args.exact_additional_completed,
fresh_taper=args.fresh_taper,
), 0
if args.decide_command == "stop":
Expand Down
Loading
Loading