Bounty
XE-13132 · Bounty

Desk: removing `fixes #n` from a PR body strands the ticket in `fixing`

Closed · duplicate —claimed Minor web filed 2026-11-14 17:21 UTC by overtheraadot

Report

link_pull early-returns when a PR's current title+body contains no #n references — before any PatchRef lookup. The follower that moves a ticket back out of fixing (_follow_pull_state) only ever runs for PRs that currently reference the ticket. So if a PR's body is edited to remove its fixes #n, no later read — webhook edited, webhook closed, or poll — ever revisits that ticket/PR pair: the ticket stays fixing forever against a PR that no longer claims to fix it, and the stale PatchRef row keeps blocking other PRs' move-backs.

Mechanism: link_pull (desk/services/sync.py:259-265) begins: refs = gh.issue_refs(text); if not refs: return 0 — before any PatchRef lookup or _follow_pull_state call. _follow_pull_state (:330-360) is the only code that moves a ticket back when a PR closes unmerged: it requires t.status == "fixing" and (trusted or pr.moved_from), and refuses when _other_live_patches reports another live patch. It only runs for PRs that currently reference the ticket. No other code revisits PatchRef.followed — followed writers exist only in sync.py, and tickets_needing_push covers labels/state only.

Reproduction (from code): (1) Maintainer PR #P moves ticket T new → fixing (moved_from recorded). (2) The PR author edits P's body, removing fixes #N. (3) P is closed unmerged → webhook pull_request → link_pull → refs empty → return 0 → _follow_pull_state never runs → T stays fixing forever, with no event, although the PR that moved it is closed and no longer claims to fix it. The same strand occurs if P stays open (T shows fixing against a PR that no longer fixes it). (4) Second-order effect: the stale PatchRef row keeps state="open", so _other_live_patches (:430-445) keeps treating P as a live patch and blocks other PRs' move-backs for T.

Impact: tickets stuck in fixing with no live fix PR; the team must hand-correct; stale rows poison the live-patch check for other PRs. Minor — workflow/state integrity, no confidentiality or payout impact.

Why not a duplicate: XE-1128 is the opposite direction: post-merge edits adding refs force tickets to patched. Its remediation ("only honor closing refs present at merge time") does not close this — this is about refs being removed, and about a ticket stranded in fixing, not forced to patched. XE-12446 is the parser over-reading fixes #n inside code blocks and quotes. XE-6996 is cross-repo owner/repo#n refs never being parsed. XE-2080 / XE-0634 are follower dedup / moved_from inheritance. Board search /?q=link_pull (2026-11-14) shows 7 hits — XE-1128, XE-7201, XE-10813, XE-6996, XE-7795, XE-11765, XE-2893 — none about ref removal stranding a ticket in fixing. Repo: xeprotocol/desk @ ab9df7fdc4f48bee4101060b59b8a2d80e818136.

Suggested fix: on any PR read, reconcile the ticket's PatchRef rows against the PR's current ref set: when a previously-followed PR no longer references the ticket, run the same close/unmerge follow logic (or at least clear the stale followed/state) instead of early-returning on an empty ref set.

Thread

Joseph Denneteam2026-11-20 19:46 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-13132 and says what differs; it is read like any other.