fix(reviewer): isolate final-decision locks by PR and exact head #896
Open
opened 2026-07-24 21:39:26 -05:00 by jcwalker3
·
0 comments
No Branch/Tag Specified
master
feat/issue-643-request-preview-initiate
fix/issue-897-permission-stale-runtime-classification
feat/issue-641-runtime-session-view
feat/issue-663-restart-classes
feat/issue-661-drain-proof-hard-gate
fix/issue-854-semantic-container-exclusion
issue-640
fix/issue-682-starlette-httpx2
v1.1.0
Labels
Clear labels
allocator
anti-stomp
architecture
bug
chore
codex
concurrency
contamination
control-plane
dashboard
database
design
documentation
enhancement
gitea
glitchtip
important
incident
incident-bridge
integration
jenkins
labels
leases
mcp
mcp-health
mcp-menu
multi-project
mutating
nice-to-have
observability
portability
preflight
protected-branch
queue
read-only
reconnect
recovery
refactor
release
reliability
resumable-review
reviewer
roadmap
safety
security
self-hosted
sentry
stale-runtime
status:blocked
status:in-progress
status:pr-open
status:ready
terminal-lock
testing
tracker
type:bug
type:feature
type:feature
type:guardrail
visibility
workflow
workflow-hardening
workflow-hardening
Controller-owned work allocator
Prevent concurrent LLM session stomping
Architecture / structural design
OpenAI Codex client / workflow session surface
Concurrent session safety
Workflow or session contamination incident
MCP control-plane coordination and allocation authority
MCP operational dashboard/queue view
Internal coordination storage (SQLite/Postgres)
Design / investigation, no implementation
Docs / runbooks
New feature or improvement
Gitea MCP workflow
GlitchTip integration
Operational or process incident requiring durable audit trail
Sentry-to-Gitea incident bridging
Integration testing
Jenkins integration
Label taxonomy management
Lease adopt/release/expire lifecycle
MCP server / tooling
MCP namespace and runtime health
MCP menu surface
Work spanning multiple monitoring projects or Gitea repos
Mutating action; requires gating
Observability, metrics, traces, error reporting
Cross-platform / portability
Shared preflight gates before mutation
Protected branch / stable-branch policy concern
Work queue visibility and allocation
Read-only, no mutation
MCP client reconnect/reload recovery path
Recovery paths for stale/foreign leases
Code refactor / restructure
Release / versioning
Reliability / failure handling
Persist and resume prepared review verdicts across sessions
Reviewer workflow tooling
Roadmap / umbrella issue
Safety rails and fail-closed mutation guards
Security / trust boundary
Self-hosted infrastructure integration
Sentry error monitoring integration
Stale backend daemon / runtime-vs-master parity failures
Issue is blocked
Issue is being worked on
Issue has an open pull request
Issue is ready for work
Terminal review lock (#332) path
Tests / test coverage
Issue tracker hygiene / meta
Bug or defect
Feature or enhancement
Feature or enhancement
Safety gate or guardrail
Workflow state visibility for LLMs/operators
Cross-tool workflow
LLM workflow coordination hardening
LLM workflow coordination hardening
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Scaled-Tech-Consulting/Gitea-Tools#896
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
gitea_mark_final_review_decisionfail-closes on a target PR because of a terminal review decision recorded on a different PR, whilegitea_diagnose_review_decision_locksimultaneously reports that cross-PR isolation permits the very same operation. The two tools contradict each other, and both prescribe retrying the identical failing call, so the prescribed recovery is a loop.The consequence is not merely a stuck workflow — it is a fail-open. A reviewer's blocking verdict could not be recorded at all, so the PR kept a stale approval and stayed merge-eligible.
Proven behavior
Observed live on 2026-07-25. Profile
prgs-reviewer, identitysysadmin, remoteprgs, repoScaled-Tech-Consulting/Gitea-Tools. Runtime parity was green throughout (mutation_safe: true,restart_required: false), so this is not a stale-runtime artifact.1cbbde00895dce1545290a660bc31c4ac9210b3e.580, headdac40ab9b3ef13255c4fe0f6353e6d93e0d0d885) preventedmark_final_review_decisionfor #882.gitea_mark_final_review_decision(pr_number=882, action=request_changes, expected_head_sha=1cbbde00...)Identical output on two attempts.
gitea_diagnose_review_decision_lock(target_pr_number=882, expected_head_sha=1cbbde00...)mark_final_allowed: trueandmarked_ready: falsewere true at the same moment, for the same PR and the same head.The prescribed retry loop
Both tools return the same
exact_next_action: callgitea_mark_final_review_decisionfor PR #882 again — exactly the call that just failed. Following the prescribed recovery loops indefinitely. It was attempted twice, produced byte-identical output, and was then stopped deliberately.Even a non-terminal review comment was blocked
The comment path is not an escape hatch.
gitea_submit_pr_review(pr_number=882, action=comment)returned:while
gitea_dry_run_pr_reviewreportedwould_perform: truefor bothrequest_changesandcomment. The only thing between a validated reviewer and a recorded verdict is a flag thatmark_finalrefuses to set for cross-PR reasons. The reviewer had to fall back to an issue-thread comment (issue #661 comment16232) to record the blocking finding at all.The state is head-scoped but leaks across PRs
In the same session, after PR #885's head moved off
dac40ab9...:Moving #885 to a new head cleared the lock for #885. Terminal state is therefore already tracked per head — it is simply not isolated per PR. A single global "last terminal" slot (
lock_summary.ready_pr_number) is consulted for every target PR.Safety impact
PR #882 carried a reviewer-reproduced fail-open in
drain_proof.py: withcounts.sessions_live_other = 3and the acknowledgement key absent,acks_or_timeoutpassed with detail "no other live sessions required to acknowledge", the proof mintedclean: True, andgate_apply_restartreturnedverdict: allow/allow: True— authorizing a restart against three live sessions with zero acknowledgement evidence.Because the blocking verdict could not be recorded, the undismissed approval
576at that exact head remained in force and PR #882 stayed merge-eligible despite the reproduced fail-open. A merger running normal preflight would have seenapproval_at_current_head: trueand no blocking change request.This guard defect converts a reviewer's blocking finding into no server-side state change at all: a fail-open in the control plane guarding a fail-open in the product.
Required behavior
mark_finalfor PR #882 at any head.gitea_mark_final_review_decisionandgitea_diagnose_review_decision_lockmust never disagree for the same(pr_number, head_sha). One must be the single source of truth and the other must derive from it.exact_next_actionmust name a different, actually-available action, or declare the state terminal and require operator involvement.diagnosemust agree withmark_finalin both directions.References
16232— the reviewer's blocking finding for PR #882, recorded on the issue thread because every PR review path was blockedfeat/issue-661-drain-proof-hard-gate), PR #885 (issue-640)Scope note
This issue tracks the reviewer decision-lock guard only. The
drain_proof.pyacknowledgement fail-open that exposed it is remediated separately on PR #882 / issue #661 and is not in scope here.