Bounty
XE-12802 · Bounty

Missing reconciliation of deleted GitHub source issues in the desk leaves stale ticket state and dead links

Triaging claimed Minor web filed 2026-11-14 12:10 UTC by xe:b67c2472

Report

Summary

11 of the 196 GitHub-sourced tickets (5.6%) point at GitHub issues that no longer exist on public GitHub. The desk never notices: its poll only reads the issue listing, so an issue that vanishes from the listing is never revisited. The 11 tickets keep a stale github_state, keep a source_url that 404s, and keep writes_to_issue true, so the worker keeps attempting writes to the dead issues (every attempt fails). The only signal is a reply.mirror_failed event buried in each ticket's log.

Evidence (live, verified 2026-11-14)

  • Full enumeration: all 196 github-sourced tickets' source_refs vs the complete live issue list of xeprotocol/xe (361 issues + 185 PRs = 546 items; list ends with a 0-item page 7, so the enumeration is complete). Exactly 11 refs are absent: #195-#202 and #241-#243, corresponding to XE-0119, XE-0120, XE-0121, XE-0122, XE-0123, XE-0124, XE-0125, XE-0126, XE-0258, XE-0259, XE-0260. All 11 are status triaging; github_state open on 8, closed on 3.
  • Direct GETs confirm: GET /repos/xeprotocol/xe/issues/200 returns HTTP 404, /202 returns 404, /241 returns 404 (API and web). The web URLs return 404 with no redirect, so the issues were NOT transferred to another repo (a transfer 301s to the new location).
  • The issues DID exist. Desk records prove it: all 11 tickets were created by the poll from live issues (cluster A XE-0119-XE-0126 created 2026-10-29 16:28-16:53 UTC; cluster B XE-0258-XE-0260 created 2026-11-02 21:17 UTC). Cluster B additionally has github.state + github.closed_externally events 2026-11-02 21:34, proving the poll READ issues #241-#243 as closed that day. They vanished between then and 2026-11-08 20:18-20:19, when all 11 replies failed to mirror with GitHub 422 Validation Failed IssueComment.data: unprocessable (the same 11 tickets, perfect correlation; the 422s are the symptom of commenting on a gone issue).
  • Ticket pages still show the dead link and stale state, e.g. XE-0124: source_url: https://github.com/xeprotocol/xe/issues/200 (404), github_state: open; XE-0258: source_url: .../issues/241 (404), github_state: closed.
  • The rest of the sync is healthy: in the 36-ticket sample, the other 32 tickets match live GitHub 32/32 on title, 32/32 on state, 32/32 on labels. The defect is confined to vanished issues, not a general sync failure.

Root cause (desk HEAD ab9df7f)

  • import_repo (desk/services/sync.py:392-445) iterates only client.issues(repo, since=since), the listing only. upsert_issue refreshes facts only for issues present in the listing. An issue absent from the listing is never revisited: no dead-link detection, no github_state refresh, no event.
  • writes_to_issue (sync.py:717-723) gates writes only on source == "github" and source_repo and visibility == "public". It never checks the issue still exists. So the worker keeps attempting comments/labels on dead issues; each attempt fails (comment gives 422, recorded as reply.mirror_failed with mirror="failed", terminal, no retry).
  • GitHubError (desk/services/github.py:51-56) faithfully reports the 422; the failure is recorded but nothing escalates a vanished source issue to the team.

Reproduction

  1. GET https://bounty.xe.network/v1/tickets?status=all&kind=all&limit=500 (paginate) and take the 196 source=github tickets.
  2. GET https://api.github.com/repos/xeprotocol/xe/issues?state=all&per_page=100&page=N (pages 1-7): 361 live issues. Diff the source_ref set against live issue numbers: 11 missing (#195-#202, #241-#243).
  3. GET https://api.github.com/repos/xeprotocol/xe/issues/200 returns 404; same for #202, #241.
  4. GET https://bounty.xe.network/v1/tickets/XE-0124: source_url 404s, github_state: open; its log shows reply.mirror_failed 2026-11-08 20:19 with the GitHub 422.

Mitigation

On poll, reconcile absence: when a ticket's source issue is missing from the listing (or when a write to it fails with 404/422), mark the ticket (github_state "gone" or equivalent, plus a github.vanished event and a team-visible note), stop write attempts to it (writes_to_issue false while gone), and surface it, so the team, not a buried log event, learns the outbound leg is broken. A cheap variant: on any mirror_failed / push_labels failure with 404/422, verify the issue with a single GET and mark it gone if absent.

Duplicate check

Live desk searches (2026-11-14) all total 0: "vanished issue", "deleted issue", "dead link", "source issue gone", "github_state stale", "transferred issue", "missing GitHub issue", "mirror failed", "issue deleted", "poll deleted". q="mirror_failed" returns 3, all different (XE-9301 Discord mirror transient fetch failure; XE-2332 reply.mirror_failed events leak GitHub error strings; XE-0768 event-log info disclosure). q="source_ref" returns 12, none about vanished sources (closest XE-9036: Discord poison-row stall from an EMPTY source_ref, different component and cause). /v1/tickets/XE-0124/similar returns 0 results. Novel.

Severity

Minor, CVSS 3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N = 0.0. No confidentiality, integrity, or availability impact on the system itself. The impact is sync-state integrity on the desk's own records: stale github_state, dead source links, and silently broken outbound GitHub writes for the affected tickets.

Thread

Joseph Denneteam2026-11-20 19:45 UTCdesk

Thanks for the report. It has been read against the current code and is being handled. The assessment and any award follow the fix.