feat: add per-PR reviewer leases for parallel review (Closes #407) #424
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
No labels
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#424
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
Closes #407.
Adds structured per-PR reviewer leases stored as PR-thread comments so parallel reviewer sessions can work different PRs without racing the same queue entry.
Changes
reviewer_pr_lease.py— lease format, acquire assessment, freshness classification, mutation gategitea_acquire_reviewer_pr_lease— post lease comment and record in-session ownershipgitea_heartbeat_reviewer_pr_lease— phase/activity updatesgitea_assess_reviewer_pr_lease— read-only lease inspectionreview-merge-pr.md§26B documents lease workflowtests/test_reviewer_pr_lease.py(8 cases)Validation
8 passed
Worktree
branches/feat-issue-407-reviewer-pr-leases@a9d6a9cIndependent audit — REQUEST CHANGES (test regressions detected)
Auditor:
sysadmin/prgs-reviewer(not PR authorjcwalker3).Pinned HEAD:
a9d6a9c863497ac27ce0b8f339f2c32c041c4995Worktree + Cleanliness
git statusclean before and after running tests.Regression Test Failures
Running the target tests passed:
pytest tests/test_reviewer_pr_lease.py -q-> 8 passed.However, running the full test suite (
pytest) revealed 25 regression failures across existing review, merge, audit, and inventory tests.Root Cause
The newly introduced
_reviewer_pr_lease_gateunconditionally intercepts all live reviewer and merger mutations (gitea_submit_pr_review,gitea_merge_pr) to check for an active reviewer lease comment on Gitea.This extra GET request (
_fetch_pr_comments) consumes mock side effects in existing tests and fails closed because no reviewer lease is established or mocked in those pre-existing tests.Required Action
Please update or mock the lease gate in the pre-existing unit tests (e.g., by adding a test helper to mock/stub lease checking, or updating mock side-effects) so that the entire test suite passes cleanly.
APPROVED — reviewer: sysadmin/prgs-reviewer (not author). Reviewed updated PR #424 head
8b61c4bin isolated worktreebranches/review-feat-issue-407-reviewer-pr-leases(clean before + after; no local edits).Changes verified:
tests/test_audit.py,tests/test_mcp_server.py, andtests/test_pr_queue_inventory.py._reviewer_pr_lease_gate) remain fully intact in production code.Test verification:
pytest tests/test_reviewer_pr_lease.py -q-> 8 passed).pytest tests/ -q-> 16088 passed, 6 skipped).Approved!
8b61c4b41fto3e4b721d60Re-review after rebase onto master (
cc4741a)Pinned head:
3e4b721d60e97147ba0704773cf57cd0d42cbe31Reviewer: sysadmin / prgs-reviewer
Prior approval at
8b61c4bis stale — fresh validation at rebased head.Scope (#407 only)
reviewer_pr_lease.py— lease format, acquire/freshness/mutation gatesgitea_mcp_server.py— acquire/heartbeat/assess tools +_reviewer_pr_lease_gateon review/merge pathsreview-merge-pr.md§26B documentation_install_owned_reviewer_leasehelperLease gate preservation
Tests (detached worktree @
3e4b721, branches/pr424-review-detached)Verdict
APPROVE — rebased head preserves reviewer PR lease behavior; scope limited to #407; no #440 umbrella leakage.