Reviewer lease acquisition clears preflight capability token needed by gitea_submit_pr_review #546

Closed
opened 2026-07-08 13:05:58 -05:00 by jcwalker3 · 1 comment
Owner

Defect Summary

The Gitea MCP server review workflow contains a pre-flight capability token deadlock:

  1. Calling gitea_resolve_task_capability(task="review_pr") sets the capability proof but clears the in-session lease (via reviewer_pr_lease.clear_session_lease() in init_review_decision_lock).
  2. Calling gitea_acquire_reviewer_pr_lease sets the in-session lease but triggers preflight verification which clears the task capability proof (_preflight_capability_called).
  3. As a result, both requirements of gitea_submit_pr_review (resolved capability proof AND active in-session lease) cannot be satisfied concurrently.

This deadlock forces operators to either bypass the validation or get stuck in a preflight failure loop when trying to submit reviews.

Steps to Reproduce

  1. Call gitea_resolve_task_capability(task="review_pr").
  2. Call gitea_acquire_reviewer_pr_lease to adopt the active lease.
  3. Call gitea_submit_pr_review. The tool fails closed because the capability proof was cleared when the lease was acquired.
  4. Call gitea_resolve_task_capability(task="review_pr") again. This clears the lease in memory, causing gitea_submit_pr_review to fail closed due to missing lease.
### Defect Summary The Gitea MCP server review workflow contains a pre-flight capability token deadlock: 1. Calling `gitea_resolve_task_capability(task="review_pr")` sets the capability proof but clears the in-session lease (via `reviewer_pr_lease.clear_session_lease()` in `init_review_decision_lock`). 2. Calling `gitea_acquire_reviewer_pr_lease` sets the in-session lease but triggers preflight verification which clears the task capability proof (`_preflight_capability_called`). 3. As a result, both requirements of `gitea_submit_pr_review` (resolved capability proof AND active in-session lease) cannot be satisfied concurrently. This deadlock forces operators to either bypass the validation or get stuck in a preflight failure loop when trying to submit reviews. ### Steps to Reproduce 1. Call `gitea_resolve_task_capability(task="review_pr")`. 2. Call `gitea_acquire_reviewer_pr_lease` to adopt the active lease. 3. Call `gitea_submit_pr_review`. The tool fails closed because the capability proof was cleared when the lease was acquired. 4. Call `gitea_resolve_task_capability(task="review_pr")` again. This clears the lease in memory, causing `gitea_submit_pr_review` to fail closed due to missing lease.
jcwalker3 added the status:in-progress label 2026-07-08 14:32:08 -05:00
Author
Owner

Issue claim heartbeat

<!-- gitea-issue-claim-heartbeat:v1 --> **Issue claim heartbeat** - kind: claim - issue: #546 - branch: fix/issue-546-reviewer-lease-preflight - phase: claimed - profile: prgs-author - pr: none - blocker: none - next_action: create worktree and begin implementation
jcwalker3 removed the status:in-progress label 2026-07-08 14:33:57 -05:00
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#546