source_health: next_due_at = later of streak-backoff and retry_after_at

Per Codex: the Next poll column computed only the streak-backoff time, so a
rate-limited source could show an earlier Next poll than the real gate (which
also requires retry_after_at <= now). Take the later of the two in the Python
post-process so the admin table agrees with due_source_rows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-09 11:45:54 -04:00
parent 38abc26ddd
commit 01de5a3ef0
2 changed files with 15 additions and 0 deletions
+4
View File
@@ -327,6 +327,10 @@ def source_health(conn: sqlite3.Connection) -> list[dict]:
# Curation quality: of what this source got ACCEPTED, how much was a
# duplicate of content already served (accepted_total served = accepted dupes).
d["accepted_dup_rate"] = round(100 * (accepted - d["served"]) / accepted) if accepted else None
# Match the REAL scheduler gate: due = the later of the streak-backoff time
# and any retry_after_at rest (UTC strings sort chronologically).
due_times = [t for t in (d["next_due_at"], d["retry_after_at"]) if t]
d["next_due_at"] = max(due_times) if due_times else None
out.append(d)
return out