feat: canonical cleanup for stale #332 review decision locks (Closes #594) #595

Merged
sysadmin merged 3 commits from feat/issue-594-stale-decision-lock-cleanup into master 2026-07-09 15:01:28 -05:00
Owner

Summary

Implements #594: a canonical MCP path to clear durable #332 review-decision locks that outlive the PR they protected (after #559 session-state persistence).

Problem

~/.cache/gitea-tools/session-state/review_decision_lock-prgs-reviewer.json retained a terminal approve for already-merged PR #586 and blocked formal review of a later PR (#592).

Changes

  • stale_review_decision_lock.py: pure assess/moot policy + audit helpers
  • gitea_cleanup_stale_review_decision_lock: read-first (apply=false), gated apply with live PR proof, identity/profile checks, durable audit + optional PR comment
  • Hard-stop messages point at the cleanup tool when the prior PR may be moot
  • Same-profile auto-clear after successful merge of the approved PR
  • Tests: active locks still block; merged locks clear; open PR cannot bypass; #592-style mark_ready after #586-style cleanup
  • Docs: runbook + review-merge workflow + Safety-and-Gates wiki

Validation

pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py tests/test_mcp_session_state.py -q
# 34 passed

Head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577

Closes #594

## Summary Implements #594: a canonical MCP path to clear durable #332 review-decision locks that outlive the PR they protected (after #559 session-state persistence). ### Problem `~/.cache/gitea-tools/session-state/review_decision_lock-prgs-reviewer.json` retained a terminal `approve` for already-merged PR #586 and blocked formal review of a later PR (#592). ### Changes - **`stale_review_decision_lock.py`**: pure assess/moot policy + audit helpers - **`gitea_cleanup_stale_review_decision_lock`**: read-first (`apply=false`), gated apply with live PR proof, identity/profile checks, durable audit + optional PR comment - Hard-stop messages point at the cleanup tool when the prior PR may be moot - Same-profile auto-clear after successful merge of the approved PR - Tests: active locks still block; merged locks clear; open PR cannot bypass; #592-style mark_ready after #586-style cleanup - Docs: runbook + review-merge workflow + Safety-and-Gates wiki ### Validation ``` pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py tests/test_mcp_session_state.py -q # 34 passed ``` Head: `b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577` Closes #594
jcwalker3 added 3 commits 2026-07-09 14:28:37 -05:00
Durable review-decision locks (#559) can outlive the PR they protect.
When the last terminal mutation references a PR that is already
merged/closed, expose gitea_cleanup_stale_review_decision_lock so a
reviewer can clear the lock with identity/profile gates and a durable
audit trail — without weakening #332 for open PRs or deleting
session-state files by hand.

Also auto-clear same-profile locks after a successful merge of the
approved PR, and document allowed vs forbidden cleanup.

Closes #594
Add allowed/forbidden workflow steps to the review-merge skill and
document the #594 cleanup gate on the Safety-and-Gates wiki page.
Pin per-test durable session-state so patch.dict(clear=True) cannot adopt
host ~/.cache review-decision locks, and clear the merge-test ledger in
setUp. Keeps active #332 hard-stop coverage while making TestMergePR
deterministic without manual host cache cleanup.

Aligned with #590 / PR #592 isolation approach.
Author
Owner

Canonical Issue State

STATE:
PR-open

WHO_IS_NEXT:
reviewer

NEXT_ACTION:
Review and merge PR #595 (issue #594) so gitea_cleanup_stale_review_decision_lock is available on live MCP, then clear the stale #586 prgs-reviewer decision lock and formal-APPROVE PR #592.

NEXT_PROMPT:

Gitea reviewer task: review Scaled-Tech-Consulting/Gitea-Tools PR #595 for Issue #594 (stale #332 decision-lock cleanup).
Head expected: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 on feat/issue-594-stale-decision-lock-cleanup.
Use isolated branches/ worktree. Do not merge without eligibility. After merge of #595: restart gitea-reviewer MCP, run gitea_cleanup_stale_review_decision_lock(apply=true, expected_terminal_pr=586), then formal APPROVE PR #592 at b810e51.

WHAT_HAPPENED:
Author implemented #594 and opened PR #595. Live MCP does not yet expose gitea_cleanup_stale_review_decision_lock (code not on master; MCP also reports stale-runtime). Formal APPROVE for PR #592 remains blocked until #595 lands, MCP restarts, and the moot #586 lock is cleared via the new tool.

WHY:
#332 must stay fail-closed for open PRs; only a gated moot-cleanup path (#594) may clear durable locks after merge. Manual session-state file deletion is not the workflow.

RELATED_DISCUSSION:
none

RELATED_PRS:

  • #595 (this PR, Closes #594)
  • #592 (blocked formal approve; technical review green)
  • #586 (merged; last terminal mutation in stale prgs-reviewer lock)

BRANCH:
feat/issue-594-stale-decision-lock-cleanup

HEAD_SHA:
b98e8dfa1a

VALIDATION:
pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q → 27 passed (full trio with session-state was 34 earlier).

BLOCKERS:
PR #592 formal APPROVE blocked until: (1) #595 reviewed+merged, (2) gitea-reviewer MCP fully restarted onto new code, (3) gitea_cleanup_stale_review_decision_lock apply for expected_terminal_pr=586 succeeds.

LAST_UPDATED_BY:
jcwalker3 / prgs-author / 2026-07-09

## Canonical Issue State STATE: PR-open WHO_IS_NEXT: reviewer NEXT_ACTION: Review and merge PR #595 (issue #594) so gitea_cleanup_stale_review_decision_lock is available on live MCP, then clear the stale #586 prgs-reviewer decision lock and formal-APPROVE PR #592. NEXT_PROMPT: ```text Gitea reviewer task: review Scaled-Tech-Consulting/Gitea-Tools PR #595 for Issue #594 (stale #332 decision-lock cleanup). Head expected: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 on feat/issue-594-stale-decision-lock-cleanup. Use isolated branches/ worktree. Do not merge without eligibility. After merge of #595: restart gitea-reviewer MCP, run gitea_cleanup_stale_review_decision_lock(apply=true, expected_terminal_pr=586), then formal APPROVE PR #592 at b810e51. ``` WHAT_HAPPENED: Author implemented #594 and opened PR #595. Live MCP does not yet expose gitea_cleanup_stale_review_decision_lock (code not on master; MCP also reports stale-runtime). Formal APPROVE for PR #592 remains blocked until #595 lands, MCP restarts, and the moot #586 lock is cleared via the new tool. WHY: #332 must stay fail-closed for open PRs; only a gated moot-cleanup path (#594) may clear durable locks after merge. Manual session-state file deletion is not the workflow. RELATED_DISCUSSION: none RELATED_PRS: - #595 (this PR, Closes #594) - #592 (blocked formal approve; technical review green) - #586 (merged; last terminal mutation in stale prgs-reviewer lock) BRANCH: feat/issue-594-stale-decision-lock-cleanup HEAD_SHA: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 VALIDATION: pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q → 27 passed (full trio with session-state was 34 earlier). BLOCKERS: PR #592 formal APPROVE blocked until: (1) #595 reviewed+merged, (2) gitea-reviewer MCP fully restarted onto new code, (3) gitea_cleanup_stale_review_decision_lock apply for expected_terminal_pr=586 succeeds. LAST_UPDATED_BY: jcwalker3 / prgs-author / 2026-07-09
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #595
issue: #594
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 40160-0858dd531460
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594
phase: claimed
candidate_head: b98e8dfa1a
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T19:42:52Z
expires_at: 2026-07-09T21:42:52Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #595 issue: #594 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 40160-0858dd531460 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594 phase: claimed candidate_head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 target_branch: master target_branch_sha: none last_activity: 2026-07-09T19:42:52Z expires_at: 2026-07-09T21:42:52Z blocker: none
Owner

Canonical Issue State

STATE:
blocked

WHO_IS_NEXT:
user

NEXT_ACTION:
Unblock formal review submission for PR #595 (and later #592) by clearing the durable prgs-reviewer #332 lock that still ends with approve on already-merged PR #586. Prefer a path that does not require the not-yet-merged #594 tool: operator-supported session reset for prgs-reviewer, or temporary fresh reviewer session identity, then re-submit formal APPROVE on #595 at b98e8df. Do not hand-delete session-state as the normal workflow once #595 lands.

NEXT_PROMPT:

Operator unblock for Scaled-Tech-Consulting/Gitea-Tools:

1) Durable lock still blocks formal review:
   ~/.cache/gitea-tools/session-state/review_decision_lock-prgs-reviewer.json
   last terminal: approve on PR #586 (merged).

2) Technical review of PR #595 (#594) is COMPLETE and intended APPROVE at
   b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 (see validation below).
   gitea_dry_run_pr_review would_perform=true; gitea_mark_final_review_decision
   fail-closed under #332 (approve on #586).

3) Chicken-and-egg: the cleanup tool lives on this PR and is not live on MCP yet.
   After operator clears the stale prgs-reviewer decision lock via supported path
   (or once #595 is merged via an alternate eligible reviewer session without that
   lock), re-run formal APPROVE for #595, merge #595, restart gitea-reviewer MCP,
   then gitea_cleanup_stale_review_decision_lock(apply=true, expected_terminal_pr=586)
   and formal APPROVE #592.

Do not rm session-state as the long-term workflow; #595 is the permanent fix.

WHAT_HAPPENED:
Independent reviewer (sysadmin / prgs-reviewer) completed full technical review of PR #595 for Issue #594 in branches/review-pr-595-issue-594. Code, tests, and docs match #594 acceptance criteria. Formal APPROVE could not be submitted: gitea_mark_final_review_decision blocked by durable #332 ledger (approve on merged PR #586). Dry-run APPROVE would_perform=true. Lease 8539 acquired. No formal review ID.

WHY:
#332 hard-stop is working as designed for a terminal mutation, but the durable ledger (#559) still references merged #586. The fix for that is this PR (#595 / #594). Cannot use the new cleanup tool until it is on the running MCP. No #332 bypass or session-state hand-delete performed.

RELATED_DISCUSSION:
none

RELATED_PRS:

  • #595 (this PR; Closes #594)
  • #592 (still waiting on formal APPROVE after #595 lands + cleanup)
  • #586 (merged; source of last terminal approve in durable prgs-reviewer lock)

BRANCH:
feat/issue-594-stale-decision-lock-cleanup

HEAD_SHA:
b98e8dfa1a

VALIDATION:

  • Identity: sysadmin / prgs-reviewer; author jcwalker3; self_author=false; approve eligible
  • Open + mergeable; head matches expected b98e8df
  • git diff --check prgs/master...HEAD: clean
  • Files: docs/llm-workflow-runbooks.md, docs/wiki/Safety-and-Gates.md, gitea_mcp_server.py, skills/.../review-merge-pr.md, stale_review_decision_lock.py, task_capability_map.py, tests/conftest.py, tests/test_mcp_server.py, tests/test_stale_review_decision_lock_cleanup.py
  • pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q: 27 passed
  • pytest tests/test_mcp_session_state.py -q: 7 passed
  • Tool inspect: apply false/true; read+review gates; live merged/closed only; open fail-closed; audit+comment; no #332 bypass

BLOCKERS:
Durable #332 decision lock for prgs-reviewer ends with approve on merged PR #586 — blocks gitea_mark_final_review_decision / formal APPROVE for any other PR including #595. Unblock: supported clear of review_decision_lock-prgs-reviewer (or a reviewer session without that lock), then formal re-review of #595.

LAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-09


Technical review (informal; intended formal decision once unblocked: APPROVE)

Cleanup tool is correctly fail-closed for open/active locks, requires identity + gitea.pr.review for apply, records durable audit, preserves #332 hard-stop tests, documents allowed vs forbidden paths. Minimal test isolation in conftest/TestMergePR is scoped support for deterministic hard-stop coverage, not a production #332 weaken.

Review decision: BLOCKED + DIAGNOSE (tooling/session #332). No formal review ID from gitea_submit_pr_review.
Lease comment_id: 8539

## Canonical Issue State STATE: blocked WHO_IS_NEXT: user NEXT_ACTION: Unblock formal review submission for PR #595 (and later #592) by clearing the durable prgs-reviewer #332 lock that still ends with approve on already-merged PR #586. Prefer a path that does not require the not-yet-merged #594 tool: operator-supported session reset for prgs-reviewer, or temporary fresh reviewer session identity, then re-submit formal APPROVE on #595 at b98e8df. Do not hand-delete session-state as the normal workflow once #595 lands. NEXT_PROMPT: ```text Operator unblock for Scaled-Tech-Consulting/Gitea-Tools: 1) Durable lock still blocks formal review: ~/.cache/gitea-tools/session-state/review_decision_lock-prgs-reviewer.json last terminal: approve on PR #586 (merged). 2) Technical review of PR #595 (#594) is COMPLETE and intended APPROVE at b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 (see validation below). gitea_dry_run_pr_review would_perform=true; gitea_mark_final_review_decision fail-closed under #332 (approve on #586). 3) Chicken-and-egg: the cleanup tool lives on this PR and is not live on MCP yet. After operator clears the stale prgs-reviewer decision lock via supported path (or once #595 is merged via an alternate eligible reviewer session without that lock), re-run formal APPROVE for #595, merge #595, restart gitea-reviewer MCP, then gitea_cleanup_stale_review_decision_lock(apply=true, expected_terminal_pr=586) and formal APPROVE #592. Do not rm session-state as the long-term workflow; #595 is the permanent fix. ``` WHAT_HAPPENED: Independent reviewer (sysadmin / prgs-reviewer) completed full technical review of PR #595 for Issue #594 in branches/review-pr-595-issue-594. Code, tests, and docs match #594 acceptance criteria. Formal APPROVE could not be submitted: gitea_mark_final_review_decision blocked by durable #332 ledger (approve on merged PR #586). Dry-run APPROVE would_perform=true. Lease 8539 acquired. No formal review ID. WHY: #332 hard-stop is working as designed for a terminal mutation, but the durable ledger (#559) still references merged #586. The fix for that is this PR (#595 / #594). Cannot use the new cleanup tool until it is on the running MCP. No #332 bypass or session-state hand-delete performed. RELATED_DISCUSSION: none RELATED_PRS: - #595 (this PR; Closes #594) - #592 (still waiting on formal APPROVE after #595 lands + cleanup) - #586 (merged; source of last terminal approve in durable prgs-reviewer lock) BRANCH: feat/issue-594-stale-decision-lock-cleanup HEAD_SHA: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 VALIDATION: - Identity: sysadmin / prgs-reviewer; author jcwalker3; self_author=false; approve eligible - Open + mergeable; head matches expected b98e8df - git diff --check prgs/master...HEAD: clean - Files: docs/llm-workflow-runbooks.md, docs/wiki/Safety-and-Gates.md, gitea_mcp_server.py, skills/.../review-merge-pr.md, stale_review_decision_lock.py, task_capability_map.py, tests/conftest.py, tests/test_mcp_server.py, tests/test_stale_review_decision_lock_cleanup.py - pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q: 27 passed - pytest tests/test_mcp_session_state.py -q: 7 passed - Tool inspect: apply false/true; read+review gates; live merged/closed only; open fail-closed; audit+comment; no #332 bypass BLOCKERS: Durable #332 decision lock for prgs-reviewer ends with approve on merged PR #586 — blocks gitea_mark_final_review_decision / formal APPROVE for any other PR including #595. Unblock: supported clear of review_decision_lock-prgs-reviewer (or a reviewer session without that lock), then formal re-review of #595. LAST_UPDATED_BY: sysadmin / prgs-reviewer / 2026-07-09 --- ### Technical review (informal; intended formal decision once unblocked: APPROVE) Cleanup tool is correctly fail-closed for open/active locks, requires identity + gitea.pr.review for apply, records durable audit, preserves #332 hard-stop tests, documents allowed vs forbidden paths. Minimal test isolation in conftest/TestMergePR is scoped support for deterministic hard-stop coverage, not a production #332 weaken. **Review decision:** BLOCKED + DIAGNOSE (tooling/session #332). No formal review ID from gitea_submit_pr_review. **Lease comment_id:** 8539
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #595
issue: #594
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 40160-0858dd531460
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594
phase: released
candidate_head: b98e8dfa1a
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T19:44:41Z
expires_at: 2026-07-09T21:44:41Z
blocker: manual-release

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #595 issue: #594 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 40160-0858dd531460 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594 phase: released candidate_head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 target_branch: master target_branch_sha: none last_activity: 2026-07-09T19:44:41Z expires_at: 2026-07-09T21:44:41Z blocker: manual-release
Owner

Canonical Issue State

STATE: BLOCKED
WHO_IS_NEXT: user
NEXT_ACTION: Operator must free the prgs-reviewer durable #332 decision lock (stale terminal approve on already-merged PR #586) so a formal APPROVE can be submitted for PR #595 — e.g. restart prgs-reviewer with a fresh GITEA_MCP_SESSION_STATE_DIR, or clear only the obsolete review_decision_lock-prgs-reviewer artifact under operator control — then re-run formal mark+submit APPROVE for head b98e8dfa1a.
NEXT_PROMPT:

Gitea reviewer task. Invoke gitea-workflow first.

Resume formal APPROVE of Scaled-Tech-Consulting/Gitea-Tools PR #595 for Issue #594 after clearing the durable #332 lock that still records terminal approve on merged PR #586.

Pin head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577
Worktree: branches/review-pr-595-issue-594 (or fresh isolated branches/ reviewer worktree).
Do not mutate root checkout. Do not merge. Do not use raw API/curl/bypasses.

Technical review already complete and green. Submit formal APPROVE via gitea_mark_final_review_decision + gitea_submit_pr_review with expected_head_sha pinned.

After #595 merges and MCP restarts, use gitea_cleanup_stale_review_decision_lock(apply=true, expected_terminal_pr=586, remote=prgs, org=Scaled-Tech-Consulting, repo=Gitea-Tools) for future stale locks — that tool is what this PR adds.

WHAT_HAPPENED: Independent reviewer (sysadmin / prgs-reviewer, not author jcwalker3) fully validated PR #595 at live head b98e8dfa1a. Implementation matches #594 acceptance criteria. Formal gitea_mark_final_review_decision fail-closed under #332 because durable host session-state still records terminal approve for already-merged PR #586. Live MCP does not yet expose gitea_cleanup_stale_review_decision_lock (that tool is introduced by this PR) — bootstrap chicken-egg.
WHY: Durable #559 lock outlives merged PR #586; #332 hard-stop correctly blocks new terminal reviews until moot cleanup exists in the running process. Manual session-state rm by the LLM is forbidden; correction path (#211) is the wrong semantic for multi-PR resume.
RELATED_PRS: #595 (this PR), #594 (issue), #586 (stale terminal approve target, already merged), #592 (blocked earlier by same lock; retry after #595 lands + MCP restart + cleanup)
BLOCKERS: UNBLOCK when review_decision_lock-prgs-reviewer no longer hard-stops mark_ready for PRs other than a live open approved PR (specifically when terminal approve on merged #586 is cleared for this profile). Currently: gitea_mark_final_review_decision returns terminal review mutation already consumed (approve on PR #586).
VALIDATION:

  • Identity: sysadmin / prgs-reviewer; self_author=false; approve eligible
  • PR open + mergeable=true at b98e8dfa1a (matches expected)
  • No duplicate open PR for #594 (only #595)
  • Files: stale_review_decision_lock.py, gitea_mcp_server.py, task_capability_map.py, docs, tests (9 files)
  • git diff --check prgs/master...HEAD: clean
  • pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q: 27 passed
  • related MergePR/correction subset + session/workflow: 26 passed
  • Technical checks: cleanup only when merged/closed; open PR refuse; identity/profile gates; audit trail; #332 hard-stop preserved for active locks
  • Provisional technical verdict: would APPROVE if formal path free
    LAST_UPDATED_BY: sysadmin (prgs-reviewer)

Implementation inspection summary

Check Result
Cleanup only when prior terminal PR merged/closed/moot Pass — assess_stale + live GET
Active/ambiguous locks still hard-stop Pass — open PR refuse; hard-stop tests
Identity/profile/capability gates Pass — gitea.read / verified user / gitea.pr.review / profile match
Durable audit trail Pass — audit payload + optional PR comment
No manual file-delete workflow Pass — docs + recovery messaging
Same-profile merge auto-clear Pass — post gitea_merge_pr
## Canonical Issue State STATE: BLOCKED WHO_IS_NEXT: user NEXT_ACTION: Operator must free the prgs-reviewer durable #332 decision lock (stale terminal approve on already-merged PR #586) so a formal APPROVE can be submitted for PR #595 — e.g. restart prgs-reviewer with a fresh GITEA_MCP_SESSION_STATE_DIR, or clear only the obsolete review_decision_lock-prgs-reviewer artifact under operator control — then re-run formal mark+submit APPROVE for head b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577. NEXT_PROMPT: ```text Gitea reviewer task. Invoke gitea-workflow first. Resume formal APPROVE of Scaled-Tech-Consulting/Gitea-Tools PR #595 for Issue #594 after clearing the durable #332 lock that still records terminal approve on merged PR #586. Pin head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 Worktree: branches/review-pr-595-issue-594 (or fresh isolated branches/ reviewer worktree). Do not mutate root checkout. Do not merge. Do not use raw API/curl/bypasses. Technical review already complete and green. Submit formal APPROVE via gitea_mark_final_review_decision + gitea_submit_pr_review with expected_head_sha pinned. After #595 merges and MCP restarts, use gitea_cleanup_stale_review_decision_lock(apply=true, expected_terminal_pr=586, remote=prgs, org=Scaled-Tech-Consulting, repo=Gitea-Tools) for future stale locks — that tool is what this PR adds. ``` WHAT_HAPPENED: Independent reviewer (sysadmin / prgs-reviewer, not author jcwalker3) fully validated PR #595 at live head b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577. Implementation matches #594 acceptance criteria. Formal gitea_mark_final_review_decision fail-closed under #332 because durable host session-state still records terminal approve for already-merged PR #586. Live MCP does not yet expose gitea_cleanup_stale_review_decision_lock (that tool is introduced by this PR) — bootstrap chicken-egg. WHY: Durable #559 lock outlives merged PR #586; #332 hard-stop correctly blocks new terminal reviews until moot cleanup exists in the running process. Manual session-state rm by the LLM is forbidden; correction path (#211) is the wrong semantic for multi-PR resume. RELATED_PRS: #595 (this PR), #594 (issue), #586 (stale terminal approve target, already merged), #592 (blocked earlier by same lock; retry after #595 lands + MCP restart + cleanup) BLOCKERS: UNBLOCK when review_decision_lock-prgs-reviewer no longer hard-stops mark_ready for PRs other than a live open approved PR (specifically when terminal approve on merged #586 is cleared for this profile). Currently: gitea_mark_final_review_decision returns terminal review mutation already consumed (approve on PR #586). VALIDATION: - Identity: sysadmin / prgs-reviewer; self_author=false; approve eligible - PR open + mergeable=true at b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 (matches expected) - No duplicate open PR for #594 (only #595) - Files: stale_review_decision_lock.py, gitea_mcp_server.py, task_capability_map.py, docs, tests (9 files) - git diff --check prgs/master...HEAD: clean - pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q: 27 passed - related MergePR/correction subset + session/workflow: 26 passed - Technical checks: cleanup only when merged/closed; open PR refuse; identity/profile gates; audit trail; #332 hard-stop preserved for active locks - Provisional technical verdict: would APPROVE if formal path free LAST_UPDATED_BY: sysadmin (prgs-reviewer) ### Implementation inspection summary | Check | Result | |---|---| | Cleanup only when prior terminal PR merged/closed/moot | Pass — assess_stale + live GET | | Active/ambiguous locks still hard-stop | Pass — open PR refuse; hard-stop tests | | Identity/profile/capability gates | Pass — gitea.read / verified user / gitea.pr.review / profile match | | Durable audit trail | Pass — audit payload + optional PR comment | | No manual file-delete workflow | Pass — docs + recovery messaging | | Same-profile merge auto-clear | Pass — post gitea_merge_pr |
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #595
issue: #594
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 40160-6ae73ec596f6
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594
phase: claimed
candidate_head: b98e8dfa1a
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T19:51:08Z
expires_at: 2026-07-09T21:51:08Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #595 issue: #594 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 40160-6ae73ec596f6 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594 phase: claimed candidate_head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 target_branch: master target_branch_sha: none last_activity: 2026-07-09T19:51:08Z expires_at: 2026-07-09T21:51:08Z blocker: none
sysadmin approved these changes 2026-07-09 14:52:03 -05:00
Dismissed
sysadmin left a comment
Owner

Canonical PR State

STATE:
approved

WHO_IS_NEXT:
merger

NEXT_ACTION:
Merge PR #595 at head b98e8dfa1a, restart gitea-reviewer MCP onto master, run gitea_cleanup_stale_review_decision_lock for any remaining moot locks if needed, then formal APPROVE PR #592.

NEXT_PROMPT:

Gitea merger task: merge Scaled-Tech-Consulting/Gitea-Tools PR #595 (Issue #594).
Head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 on feat/issue-594-stale-decision-lock-cleanup.
Confirm approval at current head, then merge with canonical merge tooling only.
After merge: fully restart gitea-reviewer MCP so gitea_cleanup_stale_review_decision_lock is live.
Then formal APPROVE PR #592 at b810e512fd9f50b7c0106305914ad79553faee12 (use cleanup tool if #332 still blocks).
Stay out of Timesheet. Do not mutate root checkout.

WHAT_HAPPENED:
Independent reviewer (sysadmin / prgs-reviewer) formal APPROVED PR #595 for Issue #594 at head b98e8dfa1a.

Operator-approved #211 correction was used to re-open the review path after a moot durable #332 terminal mutation (approve on already-merged PR #586). Permanent cleanup path remains this PR's gitea_cleanup_stale_review_decision_lock after merge (#594).

WHY:
Scoped, tested #594 implementation: moot-only decision-lock cleanup with live PR proof, identity/profile gates, durable audit, #332 preserved for open PRs. Validation green. Safe and merge-ready.

ISSUE:
#594

BASE:
master

HEAD:
feat/issue-594-stale-decision-lock-cleanup

HEAD_SHA:
b98e8dfa1a

REVIEW_STATUS:
approved

VALIDATION:

  • Identity: sysadmin / prgs-reviewer; author jcwalker3; self_author=false
  • git diff --check clean; pytest cleanup+hard-stop 27 passed; session-state 7 passed
  • dry-run would_perform=true; mark_ready after #211 correction; formal APPROVE submitted
  • Operator recovery: gitea_authorize_review_correction(prior_review_id=395, approve, operator_authorized=true) for moot #586 lock

BLOCKERS:
none for this PR

SUPERSEDES:
none

SUPERSEDED_BY:
none

MERGE_READY:
yes — formal approval at current head, mergeable true, tests green

LAST_UPDATED_BY:
sysadmin / prgs-reviewer / 2026-07-09


APPROVE. Does not merge.

## Canonical PR State STATE: approved WHO_IS_NEXT: merger NEXT_ACTION: Merge PR #595 at head b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577, restart gitea-reviewer MCP onto master, run gitea_cleanup_stale_review_decision_lock for any remaining moot locks if needed, then formal APPROVE PR #592. NEXT_PROMPT: ```text Gitea merger task: merge Scaled-Tech-Consulting/Gitea-Tools PR #595 (Issue #594). Head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 on feat/issue-594-stale-decision-lock-cleanup. Confirm approval at current head, then merge with canonical merge tooling only. After merge: fully restart gitea-reviewer MCP so gitea_cleanup_stale_review_decision_lock is live. Then formal APPROVE PR #592 at b810e512fd9f50b7c0106305914ad79553faee12 (use cleanup tool if #332 still blocks). Stay out of Timesheet. Do not mutate root checkout. ``` WHAT_HAPPENED: Independent reviewer (sysadmin / prgs-reviewer) formal APPROVED PR #595 for Issue #594 at head b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577. Operator-approved #211 correction was used to re-open the review path after a moot durable #332 terminal mutation (approve on already-merged PR #586). Permanent cleanup path remains this PR's gitea_cleanup_stale_review_decision_lock after merge (#594). WHY: Scoped, tested #594 implementation: moot-only decision-lock cleanup with live PR proof, identity/profile gates, durable audit, #332 preserved for open PRs. Validation green. Safe and merge-ready. ISSUE: #594 BASE: master HEAD: feat/issue-594-stale-decision-lock-cleanup HEAD_SHA: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 REVIEW_STATUS: approved VALIDATION: - Identity: sysadmin / prgs-reviewer; author jcwalker3; self_author=false - git diff --check clean; pytest cleanup+hard-stop 27 passed; session-state 7 passed - dry-run would_perform=true; mark_ready after #211 correction; formal APPROVE submitted - Operator recovery: gitea_authorize_review_correction(prior_review_id=395, approve, operator_authorized=true) for moot #586 lock BLOCKERS: none for this PR SUPERSEDES: none SUPERSEDED_BY: none MERGE_READY: yes — formal approval at current head, mergeable true, tests green LAST_UPDATED_BY: sysadmin / prgs-reviewer / 2026-07-09 --- APPROVE. Does not merge.
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #595
issue: #594
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 40160-6ae73ec596f6
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594
phase: released
candidate_head: b98e8dfa1a
target_branch: master
target_branch_sha: none
last_activity: 2026-07-09T19:54:01Z
expires_at: 2026-07-09T21:54:01Z
blocker: manual-release

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #595 issue: #594 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 40160-6ae73ec596f6 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594 phase: released candidate_head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 target_branch: master target_branch_sha: none last_activity: 2026-07-09T19:54:01Z expires_at: 2026-07-09T21:54:01Z blocker: manual-release
Owner

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #595
issue: #594
reviewer_identity: sysadmin
profile: prgs-reviewer
session_id: 88834-8a9bb0fc22cd
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594
phase: claimed
candidate_head: b98e8dfa1a
target_branch: master
target_branch_sha: 6913ac98f1
last_activity: 2026-07-09T19:55:42Z
expires_at: 2026-07-09T21:55:42Z
blocker: none

<!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #595 issue: #594 reviewer_identity: sysadmin profile: prgs-reviewer session_id: 88834-8a9bb0fc22cd worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/review-pr-595-issue-594 phase: claimed candidate_head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 target_branch: master target_branch_sha: 6913ac98f13edf47109c46cbfb573184f2505720 last_activity: 2026-07-09T19:55:42Z expires_at: 2026-07-09T21:55:42Z blocker: none
sysadmin approved these changes 2026-07-09 14:57:24 -05:00
sysadmin left a comment
Owner

Canonical PR State

STATE: approved
WHO_IS_NEXT: merger
NEXT_ACTION: Merge PR #595 at head b98e8dfa1a after pre-merge gates, then restart MCP so gitea_cleanup_stale_review_decision_lock is available for future stale locks (including unblocking PR #592 if still open).
NEXT_PROMPT:

Gitea merger task. Invoke gitea-workflow first.

Merge Scaled-Tech-Consulting/Gitea-Tools PR #595 for Issue #594 at head b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577.
Do not mutate root checkout. Use isolated branches/ merger worktree. Stay out of Timesheet.
Confirm approval_at_current_head, pin expected_head_sha, confirmation='MERGE PR 595'.
After merge, restart Gitea MCP namespaces so the new cleanup tool is loaded.

WHAT_HAPPENED: Independent reviewer sysadmin/prgs-reviewer approved PR #595 after operator recovery of stale durable #332 lock (merged PR #586 terminal state). Technical validation green; formal APPROVE submitted at pinned head.
WHY: Implementation meets #594 acceptance criteria — moot cleanup only for merged/closed prior terminal PRs, active #332 preserved, identity/profile gates + audit trail, tests and docs present.
ISSUE: #594
HEAD_SHA: b98e8dfa1a
REVIEW_STATUS: APPROVED by sysadmin at current head
MERGE_READY: yes
BLOCKERS: none
VALIDATION:

  • self_author=false; approve eligible
  • open + mergeable=true at b98e8dfa1a
  • git diff --check clean
  • pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q: 27 passed
  • lease session 88834-8a9bb0fc22cd (comment 8585)
    LAST_UPDATED_BY: sysadmin (prgs-reviewer)

APPROVE summary

Safe, scoped, tested, merge-ready. Does not merge.

## Canonical PR State STATE: approved WHO_IS_NEXT: merger NEXT_ACTION: Merge PR #595 at head b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 after pre-merge gates, then restart MCP so gitea_cleanup_stale_review_decision_lock is available for future stale locks (including unblocking PR #592 if still open). NEXT_PROMPT: ```text Gitea merger task. Invoke gitea-workflow first. Merge Scaled-Tech-Consulting/Gitea-Tools PR #595 for Issue #594 at head b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577. Do not mutate root checkout. Use isolated branches/ merger worktree. Stay out of Timesheet. Confirm approval_at_current_head, pin expected_head_sha, confirmation='MERGE PR 595'. After merge, restart Gitea MCP namespaces so the new cleanup tool is loaded. ``` WHAT_HAPPENED: Independent reviewer sysadmin/prgs-reviewer approved PR #595 after operator recovery of stale durable #332 lock (merged PR #586 terminal state). Technical validation green; formal APPROVE submitted at pinned head. WHY: Implementation meets #594 acceptance criteria — moot cleanup only for merged/closed prior terminal PRs, active #332 preserved, identity/profile gates + audit trail, tests and docs present. ISSUE: #594 HEAD_SHA: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 REVIEW_STATUS: APPROVED by sysadmin at current head MERGE_READY: yes BLOCKERS: none VALIDATION: - self_author=false; approve eligible - open + mergeable=true at b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 - git diff --check clean - pytest tests/test_stale_review_decision_lock_cleanup.py tests/test_terminal_review_hard_stop.py -q: 27 passed - lease session 88834-8a9bb0fc22cd (comment 8585) LAST_UPDATED_BY: sysadmin (prgs-reviewer) ## APPROVE summary Safe, scoped, tested, merge-ready. Does not merge.
Owner

adopted_at: 2026-07-09T19:59:18Z
adopted_by_identity: sysadmin
adopted_by_profile: prgs-merger
adopted_from_session_id: 88834-8a9bb0fc22cd
adopted_from_profile: prgs-reviewer
adopted_from_reviewer_identity: sysadmin
adopted_from_comment_id: 8585
adoption_reason: merger-handoff-approved-head

repo: Scaled-Tech-Consulting/Gitea-Tools
pr: #595
issue: #594
reviewer_identity: sysadmin
profile: prgs-merger
session_id: 40158-bc50b026f9a2
worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr-595-issue-594
phase: adopted
candidate_head: b98e8dfa1a
target_branch: master
target_branch_sha: 6913ac98f1
last_activity: 2026-07-09T19:59:18Z
expires_at: 2026-07-09T21:59:18Z
blocker: none

<!-- mcp-review-lease-adoption:v1 --> adopted_at: 2026-07-09T19:59:18Z adopted_by_identity: sysadmin adopted_by_profile: prgs-merger adopted_from_session_id: 88834-8a9bb0fc22cd adopted_from_profile: prgs-reviewer adopted_from_reviewer_identity: sysadmin adopted_from_comment_id: 8585 adoption_reason: merger-handoff-approved-head <!-- mcp-review-lease:v1 --> repo: Scaled-Tech-Consulting/Gitea-Tools pr: #595 issue: #594 reviewer_identity: sysadmin profile: prgs-merger session_id: 40158-bc50b026f9a2 worktree: /Users/jasonwalker/Development/Gitea-Tools/branches/merge-pr-595-issue-594 phase: adopted candidate_head: b98e8dfa1a4a47ee0e94cfa77840ccea5f8b8577 target_branch: master target_branch_sha: 6913ac98f13edf47109c46cbfb573184f2505720 last_activity: 2026-07-09T19:59:18Z expires_at: 2026-07-09T21:59:18Z blocker: none
sysadmin merged commit ac531dda05 into master 2026-07-09 15:01:28 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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