The Gitea watch on vhaudiquet/rhema has never polled once: 5296 consecutive failures since it was created, all with
malformed forge response: comment issue_url without a thread number:
That is this bug. comment_event reads a comment's thread number from issue_url and nothing else, and the instance behind git.vhaudiquet.fr sends issue_url: "" on every row of the repo-wide /issues/comments feed (checked against the live API: all rows blank, pull_request_url and html_url populated). One blank row fails the whole pass with ForgeError::Parse, so no issue event, no PR comment and no review from that repo has ever reached the dispatcher. Nothing else in the adapter is at fault.
Commit 1 â the parse fix. The number comes from the first URL that carries one: issue_url, then pull_request_url, then html_url. Any fragment is stripped first, because a comment's html_url points at the comment (â¦/pulls/1#issuecomment-164) and its trailing segment is not a thread. is_pr reads the same three URLs, so a PR comment with a blank issue_url still lands on the pull request's sequence rather than the issue one. A row with no number anywhere stays a loud parse error â the fallbacks must not turn into a silently skipped event. Covered by three unit tests and one wiremock poll test that was red before the fix.
Commit 2 â the rest of the story, and the reason this could not ship alone. Fixing the parse is not enough, because the watcher's cursor lives in a Mutex<HashMap>: it is per-process. Every daemon restart polled from scratch, and Watcher::poll reads "no cursor" as "feed everything the forge returns". The dispatcher does not dedup that away â it dedups against the pending inbox, so an event that was already drained re-ingests clean. Fixing commit 1 in isolation would therefore have fired the repository's entire history as dispatches, each one a comment posted on an old thread.
So the cursor is a row now (watch_cursors, beside watch_health, same scope/forge/subject key): written after every successful poll, read before every one. A watch with no cursor yet â including one that has never polled, which is this watch â starts at now: a watch reports news, and a repository's history is not news. The seed is written before the poll so a forge that is down cannot walk the start line forward on every pass. Removing a watch forgets its cursor, so a re-add seeds afresh instead of resuming into a backlog.
Watcher::poll_since is the seam that lets the daemon pass a cursor it keeps itself; Watcher::poll keeps its in-memory behaviour for other embedders. Timestamp::from_epoch_millis spells an instant the way the forges spell theirs, which is what a seed needs.
Review notes
Three existing tests (e2e, continuity, http) now seed a cursor before the pass, since their subject is the dispatch, not the bootstrap. In http the "watch added over HTTP detects on the next pass" assertion is split in two: the first pass seeds (0 events, asserted), and a rewound cursor then detects the feed (1 event, asserted) â the behaviour change is pinned instead of quietly accommodated.
Account watches keep their in-memory cursor; they are unused today and their replay is bounded by the notifications feed, but the same argument applies if one is ever enabled. Left out to keep this reviewable.
I could not build here (no Rust toolchain in this box), so CI is the first real compile â apologies if it needs a follow-up push for a fmt/clippy nit.
Not in this PR: the mention gate. Right now a repo watch dispatches every comment on the watched repo and posts the reply back as a comment, so once this watch starts working it will answer every comment in vhaudiquet/rhema, including its own replies. That is the next PR; until then this watch should stay quiet (it has no cursor to replay, and a new comment will trigger a reply).
The Gitea watch on `vhaudiquet/rhema` has never polled once: 5296 consecutive failures since it was created, all with
```
malformed forge response: comment issue_url without a thread number:
```
That is this bug. `comment_event` reads a comment's thread number from `issue_url` and nothing else, and the instance behind `git.vhaudiquet.fr` sends `issue_url: ""` on **every** row of the repo-wide `/issues/comments` feed (checked against the live API: all rows blank, `pull_request_url` and `html_url` populated). One blank row fails the whole pass with `ForgeError::Parse`, so no issue event, no PR comment and no review from that repo has ever reached the dispatcher. Nothing else in the adapter is at fault.
**Commit 1 â the parse fix.** The number comes from the first URL that carries one: `issue_url`, then `pull_request_url`, then `html_url`. Any fragment is stripped first, because a comment's `html_url` points at the *comment* (`â¦/pulls/1#issuecomment-164`) and its trailing segment is not a thread. `is_pr` reads the same three URLs, so a PR comment with a blank `issue_url` still lands on the pull request's sequence rather than the issue one. A row with no number anywhere stays a loud parse error â the fallbacks must not turn into a silently skipped event. Covered by three unit tests and one wiremock poll test that was red before the fix.
**Commit 2 â the rest of the story, and the reason this could not ship alone.** Fixing the parse is not enough, because the watcher's cursor lives in a `Mutex<HashMap>`: it is per-process. Every daemon restart polled from scratch, and `Watcher::poll` reads "no cursor" as "feed everything the forge returns". The dispatcher does not dedup that away â it dedups against the pending inbox, so an event that was already drained re-ingests clean. Fixing commit 1 in isolation would therefore have fired the repository's entire history as dispatches, each one a comment posted on an old thread.
So the cursor is a row now (`watch_cursors`, beside `watch_health`, same `scope/forge/subject` key): written after every successful poll, read before every one. A watch with no cursor yet â including one that has never polled, which is this watch â starts at *now*: a watch reports news, and a repository's history is not news. The seed is written before the poll so a forge that is down cannot walk the start line forward on every pass. Removing a watch forgets its cursor, so a re-add seeds afresh instead of resuming into a backlog.
`Watcher::poll_since` is the seam that lets the daemon pass a cursor it keeps itself; `Watcher::poll` keeps its in-memory behaviour for other embedders. `Timestamp::from_epoch_millis` spells an instant the way the forges spell theirs, which is what a seed needs.
**Review notes**
- Three existing tests (`e2e`, `continuity`, `http`) now seed a cursor before the pass, since their subject is the dispatch, not the bootstrap. In `http` the "watch added over HTTP detects on the next pass" assertion is split in two: the first pass seeds (0 events, asserted), and a rewound cursor then detects the feed (1 event, asserted) â the behaviour change is pinned instead of quietly accommodated.
- Account watches keep their in-memory cursor; they are unused today and their replay is bounded by the notifications feed, but the same argument applies if one is ever enabled. Left out to keep this reviewable.
- I could not build here (no Rust toolchain in this box), so CI is the first real compile â apologies if it needs a follow-up push for a `fmt`/`clippy` nit.
**Not in this PR:** the mention gate. Right now a repo watch dispatches *every* comment on the watched repo and posts the reply back as a comment, so once this watch starts working it will answer every comment in `vhaudiquet/rhema`, including its own replies. That is the next PR; until then this watch should stay quiet (it has no cursor to replay, and a new comment will trigger a reply).
`comment_event` read the thread number from `issue_url` alone and failed
the whole poll when it could not. The instance behind git.vhaudiquet.fr
sends `issue_url: ""` on every row of the repo-wide `/issues/comments`
feed, so the first comment row failed the pass with
malformed forge response: comment issue_url without a thread number:
and kept failing on every poll since the watch was created — 5296
consecutive failures, no event ever reported, no comment, no pull
request, nothing. The feed being broken was invisible: a watch that has
never polled once looks exactly like a quiet repository.
The number now comes from the first URL that carries one
(`issue_url`, then `pull_request_url`, then `html_url`), and a fragment is
dropped first: a comment's `html_url` points at the comment
(`…/pulls/1#issuecomment-164`), not at its thread. `is_pr` reads the same
three URLs, so a PR comment whose `issue_url` is blank still lands on the
pull request's sequence.
A row with no number anywhere is still a loud parse error — the
fallbacks must not degrade into a silently skipped event.
The watcher kept one cursor per repo in a `Mutex<HashMap>`, so every
daemon restart began with no cursor — and `Watcher::poll` reads "no
cursor" as "feed everything the forge returns". A restart therefore
replayed the repository's whole history: every old thread a dispatch, and
every dispatch a comment posted on a thread nobody had just touched. The
dispatcher's dedup lane does not save this: it dedups against the pending
inbox, and a drained event re-ingests clean.
The cursor is a row now (`watch_cursors`, beside `watch_health`, same
scope/forge/subject key), written after every successful poll and read
before every poll, so a restart resumes where the last pass stopped.
A watch with no cursor yet — newly added, or added to a repository full of
history — starts at *now* rather than at the beginning: a watch reports
news, and history is not news. The seed is written before the poll, so a
forge that is down cannot walk the start line forward on every pass and
lose the news arriving in between. Removing a watch forgets its cursor
too, so a re-add seeds afresh instead of resuming into a backlog.
`Watcher::poll_since` is the seam the daemon needs to pass a cursor it
keeps itself; `Watcher::poll` keeps its in-memory behaviour unchanged.
`Timestamp::from_epoch_millis` spells an instant the way the forges spell
theirs, which is what a seed is.
Tests: the first pass feeds nothing and asks from the seeded instant; a
second pass resumes from it; the cursor moves only forward per watch and
dies with the watch. `e2e`/`continuity`/`http` seed an established watch,
since their subject is the dispatch, not the bootstrap.
The fresh-watch pass now seeds its cursor at *now*, and the issues feed
is where GitHub applies `since` server-side. The mock always answered
the whole history, so the seeding pass fed an issue the real forge would
have filtered out and the new "a fresh watch seeds its cursor" assertion
saw one event.
The mock now returns the issue row only for the rewound cursor the test
sets, and nothing for any other `since`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The Gitea watch on
vhaudiquet/rhemahas never polled once: 5296 consecutive failures since it was created, all withThat is this bug.
comment_eventreads a comment's thread number fromissue_urland nothing else, and the instance behindgit.vhaudiquet.frsendsissue_url: ""on every row of the repo-wide/issues/commentsfeed (checked against the live API: all rows blank,pull_request_urlandhtml_urlpopulated). One blank row fails the whole pass withForgeError::Parse, so no issue event, no PR comment and no review from that repo has ever reached the dispatcher. Nothing else in the adapter is at fault.Commit 1 â the parse fix. The number comes from the first URL that carries one:
issue_url, thenpull_request_url, thenhtml_url. Any fragment is stripped first, because a comment'shtml_urlpoints at the comment (â¦/pulls/1#issuecomment-164) and its trailing segment is not a thread.is_prreads the same three URLs, so a PR comment with a blankissue_urlstill lands on the pull request's sequence rather than the issue one. A row with no number anywhere stays a loud parse error â the fallbacks must not turn into a silently skipped event. Covered by three unit tests and one wiremock poll test that was red before the fix.Commit 2 â the rest of the story, and the reason this could not ship alone. Fixing the parse is not enough, because the watcher's cursor lives in a
Mutex<HashMap>: it is per-process. Every daemon restart polled from scratch, andWatcher::pollreads "no cursor" as "feed everything the forge returns". The dispatcher does not dedup that away â it dedups against the pending inbox, so an event that was already drained re-ingests clean. Fixing commit 1 in isolation would therefore have fired the repository's entire history as dispatches, each one a comment posted on an old thread.So the cursor is a row now (
watch_cursors, besidewatch_health, samescope/forge/subjectkey): written after every successful poll, read before every one. A watch with no cursor yet â including one that has never polled, which is this watch â starts at now: a watch reports news, and a repository's history is not news. The seed is written before the poll so a forge that is down cannot walk the start line forward on every pass. Removing a watch forgets its cursor, so a re-add seeds afresh instead of resuming into a backlog.Watcher::poll_sinceis the seam that lets the daemon pass a cursor it keeps itself;Watcher::pollkeeps its in-memory behaviour for other embedders.Timestamp::from_epoch_millisspells an instant the way the forges spell theirs, which is what a seed needs.Review notes
e2e,continuity,http) now seed a cursor before the pass, since their subject is the dispatch, not the bootstrap. Inhttpthe "watch added over HTTP detects on the next pass" assertion is split in two: the first pass seeds (0 events, asserted), and a rewound cursor then detects the feed (1 event, asserted) â the behaviour change is pinned instead of quietly accommodated.fmt/clippynit.Not in this PR: the mention gate. Right now a repo watch dispatches every comment on the watched repo and posts the reply back as a comment, so once this watch starts working it will answer every comment in
vhaudiquet/rhema, including its own replies. That is the next PR; until then this watch should stay quiet (it has no cursor to replay, and a new comment will trigger a reply).`comment_event` read the thread number from `issue_url` alone and failed the whole poll when it could not. The instance behind git.vhaudiquet.fr sends `issue_url: ""` on every row of the repo-wide `/issues/comments` feed, so the first comment row failed the pass with malformed forge response: comment issue_url without a thread number: and kept failing on every poll since the watch was created — 5296 consecutive failures, no event ever reported, no comment, no pull request, nothing. The feed being broken was invisible: a watch that has never polled once looks exactly like a quiet repository. The number now comes from the first URL that carries one (`issue_url`, then `pull_request_url`, then `html_url`), and a fragment is dropped first: a comment's `html_url` points at the comment (`…/pulls/1#issuecomment-164`), not at its thread. `is_pr` reads the same three URLs, so a PR comment whose `issue_url` is blank still lands on the pull request's sequence. A row with no number anywhere is still a loud parse error — the fallbacks must not degrade into a silently skipped event.ba258a1f50tob6327a458fsince, as the forge does