fix(mcp): mirror abandoned terminal phase into pr_work_lease (#742 review 460)
Addresses REQUEST_CHANGES review 460 on PR #743 @22d0fdd. reviewer_pr_lease._TERMINAL_PHASES gained "abandoned" for owner-session merger finalization, but pr_work_lease._TERMINAL_REVIEWER_PHASES did not. The two modules parse the same append-only lease markers, so the same comment read as terminal through reviewer_pr_lease and active through pr_work_lease, leaving the conflict-fix acquire and PR-sync inventory readers with a stale active lease after an abandoned finalization. Fix: add "abandoned" to pr_work_lease._TERMINAL_REVIEWER_PHASES, with a comment recording that the two sets must stay mirrored. Reproduced before the fix (single abandoned marker): reviewer_pr_lease active=False, pr_work_lease active=True After: both False; released/blocked/done unchanged in both modules. Tests: new TestCrossModuleTerminalPhaseAgreement in tests/test_merger_lease_finalization.py proves the abandoned marker is inactive in pr_work_lease, that both modules agree for released/blocked/done/abandoned, that claimed/validating stay active in both, that the two phase sets are mirrored, that the default 'released' finalization outcome and reason are unchanged, and that finalization appends without rewriting or deleting the prior marker. Separately pinned, NOT fixed here: on a claim-then-terminal ledger, pr_work_lease.find_active_reviewer_lease skips the terminal marker and walks back to the older claim, so it still reports an active lease. That newest-wins gap is pre-existing on clean baselinea8d2087for released, blocked, and done alike — the #577 fix landed in reviewer_pr_lease only — and is out of scope for this bounded remediation. test_abandoned_matches_preexisting_terminal_phases_on_full_ledger pins that "abandoned" introduces no behavior of its own, so all four phases can be reconciled in one separate change. Validation: focused TestCrossModuleTerminalPhaseAgreement 7 passed / 9 subtests; tests/test_merger_lease_finalization.py 45 passed / 20 subtests; related pr_work_lease + reviewer/merger lease + adoption + provenance + capability-map + anti-stomp + report-validator suites 261 passed / 41 subtests; full suite 3312 passed, 6 skipped, 2 failed. Both failures (test_issue_702_review_findings_f1_f6 F1 recovery, reconciler supersession close) reproduce identically on clean baseline mastera8d2087and are pre-existing #737 org/repo-forwarding drift. git diff --check clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
+5
-1
@@ -20,7 +20,11 @@ _FIELD_RE = re.compile(
|
||||
re.IGNORECASE | re.MULTILINE,
|
||||
)
|
||||
|
||||
_TERMINAL_REVIEWER_PHASES = frozenset({"done", "released", "blocked"})
|
||||
# Must mirror reviewer_pr_lease._TERMINAL_PHASES: both modules read the same
|
||||
# append-only lease markers, so a phase that is terminal in one and active in
|
||||
# the other yields two conflicting truths for the same comment (#742 review
|
||||
# 460). "abandoned" is the owner-session merger finalization outcome.
|
||||
_TERMINAL_REVIEWER_PHASES = frozenset({"done", "released", "blocked", "abandoned"})
|
||||
_ACTIVE_REVIEWER_PHASES = frozenset({
|
||||
"claimed",
|
||||
"validating",
|
||||
|
||||
Reference in New Issue
Block a user