Bounty
XE-13131 · Bounty

Desk: poll path drops edited GitHub comments — stale public thread content forever

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

Report

The desk mirrors GitHub issue comments into the public ticket thread through two paths: the poll (import_repo) and the webhook (handle_webhook). The webhook passes update=True when a comment is edited, so the mirrored message takes the new body. The poll calls the same upsert_comment with the default update=False, so an edit re-fetched by the poll is silently discarded: the desk keeps showing the pre-edit body indefinitely, with no event and no error.

Mechanism: import_repo (desk/services/sync.py:410-420) re-fetches comments with client.comments(repo, issue["number"], since=since). GitHub's list-comments since filter is on updated_at, so an edited comment IS returned by the poll — with the new body. The poll then calls upsert_comment(ctx, db, t, c) with no update flag, so update defaults to False (sync.py:167-169). upsert_comment → thread.add_message (desk/services/thread.py:129-156) is idempotent on (source, source_ref): when the row already exists and update is false it returns None without touching the body. Only the webhook path passes the flag (sync.py:681: upsert_comment(..., update=action == "edited")). The module docstring promises "all three go through the same upsert_* functions" (full import, since poll, webhook). The poll and the webhook differ on exactly this flag, breaking that invariant.

Reproduction (from code): (1) Reporter posts comment C on issue #N → mirrored to the ticket thread. (2) Reporter edits C on GitHub (corrects a PoC, retracts a claim) → updated_at bumps. (3) The webhook delivery is missed (desk downtime, GitHub delivery failure) or the edit arrives via a full import (since=None uses the same code path). (4) The poll re-fetches C with the new body → upsert_comment(update=False) → add_message finds the existing row → returns None → the new body is discarded, no event, no error. (5) Every subsequent poll repeats the silent drop; the desk shows the pre-edit body indefinitely. The only two production callers of upsert_comment are :418 (poll, no flag) and :681 (webhook, flag); no other update=True caller exists.

Impact: stale/misleading public thread content: a correction or retraction made on GitHub never reaches the desk, and triage can proceed on superseded text. Minor — integrity of the desk's own records, same class as XE-12966 (also log/state integrity, Minor). No confidentiality or payout impact.

Why not a duplicate: XE-12966 is the >512-char title comparison asymmetry in upsert_issue (different function, different object, different trigger). XE-12802 is deleted issues (stale github_state, dead source_url). Board search /?q=upsert_comment (2026-11-14) shows only XE-11765 (check-then-insert race raising IntegrityError) and XE-2893 (blocked-login issue edits) — different mechanisms. /?q=edited+comment → 0 hits. Repo: xeprotocol/desk @ ab9df7fdc4f48bee4101060b59b8a2d80e818136.

Suggested fix: pass update=True in the import_repo comment loop (or make upsert_comment default to update=True). The webhook already proves the update path is safe: it only rewrites public, unsealed rows (thread.py:151-155).

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-13131 and says what differs; it is read like any other.