Allow fresh formal re-review on new PR head after prior REQUEST_CHANGES #620

Closed
opened 2026-07-09 21:53:51 -05:00 by jcwalker3 · 2 comments
Owner

Problem

A reviewer can be blocked from posting a formal review on a new PR head because the durable #332 review-decision lock still treats a prior terminal review mutation on the same open PR as consumed.

Observed on PR #619:

  • Old formal REQUEST_CHANGES head:
    036b78e31ea5d036452b3a52e0e086b01e0c763f
  • New live head:
    783ea88a01da721138429ede8dc8a6c0c186206a
  • Reviewer completed a new-head review and local decision was REQUEST_CHANGES.
  • Formal review submission was blocked before new-head review mutation.
  • gitea_mark_final_review_decision returned:
    terminal review mutation already consumed in this run (request_changes on PR #619)

Read-only lock assessment:

  • has_lock=true
  • is_moot=false
  • cleanup_allowed=false
  • PR is open
  • manual cleanup forbidden

Impact

A valid new-head re-review cannot post a formal Gitea decision.

This leaves the PR with:

  • old-head formal review state
  • new-head local review findings
  • no formal Gitea review on the current head

It also forces noisy handoffs and risks authors or mergers misunderstanding the current review state.

Required behavior

A new PR head after author changes must establish a fresh review decision boundary without deleting or rewriting historical reviews.

The system must distinguish:

  • prior terminal review decision on old head
  • current live head
  • new reviewer run
  • new formal review decision for the new head

Historical REQUEST_CHANGES should remain durable, but must not block a new review decision on a different head.

Acceptance criteria

  1. A prior REQUEST_CHANGES on head A does not block formal review on head B when:

    • PR is still open
    • head B differs from head A
    • reviewer lease is acquired for head B
    • no formal review exists for head B
  2. Durable review lock keys include enough head/run identity to separate:

    • PR number
    • reviewed head SHA
    • reviewer/session
    • terminal decision state
  3. Stale lock cleanup remains forbidden for open PRs unless the lock is truly moot and safely scoped.

  4. Read-only lock assessment must clearly report:

    • locked head SHA
    • current PR head SHA
    • whether the lock is stale-by-head
    • whether fresh review on current head is allowed
    • whether cleanup is allowed
  5. gitea_mark_final_review_decision should allow a fresh decision when current head differs from the locked old-head decision.

  6. gitea_submit_pr_review should still prevent duplicate formal review submission for the same reviewer/head/run.

  7. Tests must cover:

    • REQUEST_CHANGES on head A, author pushes head B, reviewer posts REQUEST_CHANGES on head B
    • REQUEST_CHANGES on head A, author pushes head B, reviewer posts APPROVE on head B
    • duplicate review on same head remains blocked
    • open PR lock cleanup remains forbidden unless safe
    • lock assessment reports old head vs current head
    • old historical review is preserved

Desired outcome

A fresh review run on a new PR head should be possible and safe.

#332 should prevent duplicate terminal review mutations for the same review boundary, not block legitimate new-head re-review on the same open PR.

Related (not duplicates)

Issue Why related Why not the same work
#332 (closed) Defines terminal hard-stop after live review mutation Same-session multi-PR / same-run budget; does not define open-PR new-head re-review
#594 (closed) Stale lock cleanup after merged/closed PRs Explicitly preserves #332 for open PRs; cleanup remains forbidden while PR is open
#602 (open) Early terminal-lock routing before expensive review work Ordering/visibility of existing lock; does not allow fresh decision on new head of same open PR
#609 (open) Resume prepared review verdicts across disconnects Draft/resume path; not durable lock head-boundary semantics

Evidence

  • PR #619 re-review blocked on formal mutation after author push to head 783ea88a01da721138429ede8dc8a6c0c186206a
  • Prior formal REQUEST_CHANGES was on head 036b78e31ea5d036452b3a52e0e086b01e0c763f
  • Error: terminal review mutation already consumed in this run (request_changes on PR #619)
## Problem A reviewer can be blocked from posting a formal review on a new PR head because the durable #332 review-decision lock still treats a prior terminal review mutation on the same open PR as consumed. Observed on PR #619: - Old formal REQUEST_CHANGES head: `036b78e31ea5d036452b3a52e0e086b01e0c763f` - New live head: `783ea88a01da721138429ede8dc8a6c0c186206a` - Reviewer completed a new-head review and local decision was REQUEST_CHANGES. - Formal review submission was blocked before new-head review mutation. - `gitea_mark_final_review_decision` returned: `terminal review mutation already consumed in this run (request_changes on PR #619)` Read-only lock assessment: - `has_lock=true` - `is_moot=false` - `cleanup_allowed=false` - PR is open - manual cleanup forbidden ## Impact A valid new-head re-review cannot post a formal Gitea decision. This leaves the PR with: - old-head formal review state - new-head local review findings - no formal Gitea review on the current head It also forces noisy handoffs and risks authors or mergers misunderstanding the current review state. ## Required behavior A new PR head after author changes must establish a fresh review decision boundary without deleting or rewriting historical reviews. The system must distinguish: - prior terminal review decision on old head - current live head - new reviewer run - new formal review decision for the new head Historical REQUEST_CHANGES should remain durable, but must not block a new review decision on a different head. ## Acceptance criteria 1. A prior REQUEST_CHANGES on head A does not block formal review on head B when: - PR is still open - head B differs from head A - reviewer lease is acquired for head B - no formal review exists for head B 2. Durable review lock keys include enough head/run identity to separate: - PR number - reviewed head SHA - reviewer/session - terminal decision state 3. Stale lock cleanup remains forbidden for open PRs unless the lock is truly moot and safely scoped. 4. Read-only lock assessment must clearly report: - locked head SHA - current PR head SHA - whether the lock is stale-by-head - whether fresh review on current head is allowed - whether cleanup is allowed 5. `gitea_mark_final_review_decision` should allow a fresh decision when current head differs from the locked old-head decision. 6. `gitea_submit_pr_review` should still prevent duplicate formal review submission for the same reviewer/head/run. 7. Tests must cover: - REQUEST_CHANGES on head A, author pushes head B, reviewer posts REQUEST_CHANGES on head B - REQUEST_CHANGES on head A, author pushes head B, reviewer posts APPROVE on head B - duplicate review on same head remains blocked - open PR lock cleanup remains forbidden unless safe - lock assessment reports old head vs current head - old historical review is preserved ## Desired outcome A fresh review run on a new PR head should be possible and safe. #332 should prevent duplicate terminal review mutations for the same review boundary, not block legitimate new-head re-review on the same open PR. ## Related (not duplicates) | Issue | Why related | Why not the same work | |-------|-------------|------------------------| | #332 (closed) | Defines terminal hard-stop after live review mutation | Same-session multi-PR / same-run budget; does not define open-PR new-head re-review | | #594 (closed) | Stale lock cleanup after merged/closed PRs | Explicitly preserves #332 for open PRs; cleanup remains forbidden while PR is open | | #602 (open) | Early terminal-lock routing before expensive review work | Ordering/visibility of existing lock; does not allow fresh decision on new head of same open PR | | #609 (open) | Resume prepared review verdicts across disconnects | Draft/resume path; not durable lock head-boundary semantics | ## Evidence - PR #619 re-review blocked on formal mutation after author push to head `783ea88a01da721138429ede8dc8a6c0c186206a` - Prior formal REQUEST_CHANGES was on head `036b78e31ea5d036452b3a52e0e086b01e0c763f` - Error: `terminal review mutation already consumed in this run (request_changes on PR #619)`
Author
Owner

Canonical Issue State

STATE:
ready
WHO_IS_NEXT:
author
NEXT_ACTION:
claim issue #620, implement head-scoped review-decision lock boundaries, and open a PR with tests for new-head re-review after REQUEST_CHANGES
NEXT_PROMPT:

You are the AUTHOR for Scaled-Tech-Consulting/Gitea-Tools issue #620 on remote prgs.
Implement durable #332 review-decision lifecycle so prior REQUEST_CHANGES on head A does not block formal review on different head B of the same open PR.
Acceptance criteria are on the issue body. Evidence source is PR #619.
Do not weaken same-head duplicate formal review protection or open-PR cleanup fail-closed rules.

WHAT_HAPPENED:
Created this issue after duplicate search found no open/closed issue covering open-PR new-head re-review after prior REQUEST_CHANGES.
WHY:
#332 and #594 leave open PRs with consumed terminal locks that block legitimate formal re-review when the author pushes a new head.
RELATED_PRS:
#619 (evidence / observed deadlock)
BLOCKERS:
none for starting author work; product fix required before PR #619 formal new-head re-review can complete via normal path
VALIDATION:
whoami jcwalker3 prgs-author; create_issue allowed; duplicate scan of open issues 584-618 plus #332/#594/#602/#609 confirmed non-dup; issue #620 created with labels bug type:guardrail status:ready mcp-health terminal-lock reviewer workflow
LAST_UPDATED_BY:
jcwalker3 (prgs-author)

## Canonical Issue State STATE: ready WHO_IS_NEXT: author NEXT_ACTION: claim issue #620, implement head-scoped review-decision lock boundaries, and open a PR with tests for new-head re-review after REQUEST_CHANGES NEXT_PROMPT: ```text You are the AUTHOR for Scaled-Tech-Consulting/Gitea-Tools issue #620 on remote prgs. Implement durable #332 review-decision lifecycle so prior REQUEST_CHANGES on head A does not block formal review on different head B of the same open PR. Acceptance criteria are on the issue body. Evidence source is PR #619. Do not weaken same-head duplicate formal review protection or open-PR cleanup fail-closed rules. ``` WHAT_HAPPENED: Created this issue after duplicate search found no open/closed issue covering open-PR new-head re-review after prior REQUEST_CHANGES. WHY: #332 and #594 leave open PRs with consumed terminal locks that block legitimate formal re-review when the author pushes a new head. RELATED_PRS: #619 (evidence / observed deadlock) BLOCKERS: none for starting author work; product fix required before PR #619 formal new-head re-review can complete via normal path VALIDATION: whoami jcwalker3 prgs-author; create_issue allowed; duplicate scan of open issues 584-618 plus #332/#594/#602/#609 confirmed non-dup; issue #620 created with labels bug type:guardrail status:ready mcp-health terminal-lock reviewer workflow LAST_UPDATED_BY: jcwalker3 (prgs-author)
jcwalker3 added status:in-progress and removed status:ready labels 2026-07-10 00:01:54 -05:00
Author
Owner

Issue claim heartbeat

<!-- gitea-issue-claim-heartbeat:v1 --> **Issue claim heartbeat** - kind: claim - issue: #620 - branch: fix/issue-620-head-scoped-review-locks - phase: claimed - profile: prgs-author - pr: none - blocker: none - next_action: create worktree and begin implementation
jcwalker3 added status:pr-open and removed status:in-progress labels 2026-07-10 00:04:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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