GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — github-backup(drain): ack webhook events only after a successful fetch by dezren39 · Pull Request #3290 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes #3219

The bug

drain_queue.py appended every event id to the ack list up front and POSTed it to the Worker at the end of the run — including events whose fetch had just returned "fail" or "missing". The Worker deletes acked events from KV, so a transient fetch failure silently converted into up-to-a-week of staleness: the failure was written to no log, the 15-min coalesce stamp was advanced anyway, and the run summary printed the repo under fetched regardless of outcome.

The fix

An event is now acked only once the drainer has made the mirror reflect it:

  • Planned repo, fetch attempted: ack iff fetch_repo returned "ok". On "fail"/"missing" the event stays queued for the next drain tick, the failure is appended to fetch.log in the daily pass's leading format (plus drain context: oldest event age, consecutive-failure count), and the coalesce stamp is not advanced.
  • Planned repo inside its coalesce window: the event stays queued (not acked); a drain after the window passes fetches and acks it. Coalesce stamps are written only on success.
  • Unplanned repo: acked + fetch.log note — preserved behavior (mirror creation is the weekly reconcile's decision).
  • Retry guard: consecutive drain failures are counted per repo (state.json key drain_fail::<repo>). At 5 consecutive failures the failure is logged loudly (DRAIN-CHRONIC … event(s) kept queued, needs attention) and the run exits non-zero so systemd surfaces it — mirroring the daily pass's chronic-failure pattern. The event is kept, never silently dropped; a later success clears the counter.
  • Run summary now distinguishes fetched vs failed (with per-repo result + failure count) vs unplanned vs coalesced_pending, plus the acked count. plan.json is loaded once instead of per repo.

Tests — before / after

New regression test infra/github-backup/tests/test_drain_queue.py drives the real drain_queue.main() with a stub Worker + stub fetch_repo (same shape as the probe in #3219): 32 checks across success / fail / missing / unplanned / coalesce-window / coalesce-expired / chronic / recovery / mixed-batch cases.

Before (test run against the pre-fix drain_queue.py on this branch's base):

{"events": 1, "fetched": ["owner/repo"]}      <- summary claims success on a failed fetch
PASS success: exit 0
PASS success: event acked
PASS success: coalesce stamp set
PASS success: no fetch.log
FAIL fail: event NOT acked                     <- the bug: acked despite fetch failure
AssertionError: fail: event NOT acked

After:

32/32 checks passed

including: fail → not acked + fetch.log line with event age + no stamp + counter incremented; missing → same; coalesce window → not acked and no fetch attempted, fetched+acked once the window passes; 5th consecutive failure → exit 1 + DRAIN-CHRONIC in fetch.log + event still queued; success after failures clears the counter.

Run locally on the laptop: python3 infra/github-backup/tests/test_drain_queue.py.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dezren39
github-backup(drain): ack webhook events only after a successful fetch
50bf3c5
Events were acked (deleted from the Worker KV queue) even when the
fetch failed or the mirror was missing, and the coalesce stamp was
advanced anyway — a transient failure silently became up to a week
of staleness with no log. Now: ack only on fetch ok; failures stay
queued, are appended to fetch.log with the oldest event age, and are
counted per repo; at 5 consecutive failures the run logs DRAIN-CHRONIC
and exits non-zero (event still kept). Coalesce-window events stay
queued until a drain fetches them. Unplanned repos keep the previous
behavior (acked + noted for the weekly reconcile).

Regression test: infra/github-backup/tests/test_drain_queue.py (32 checks).

Fixes #3219
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 01:58
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d06d9408-7e10-4a5a-996d-adcee8150cdc
Commits

Reviewing files that changed from the base of the PR and between cf1b243 and 50bf3c5.

Files selected for processing: 3
  • infra/github-backup/README.md
  • infra/github-backup/bin/drain_queue.py
  • infra/github-backup/tests/test_drain_queue.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T02:00:09.285780Z 50bf3c5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 merged commit 1a7366f into main Nov 1, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the github-backup/fix-drain-ack-3219 branch November 1, 2026 02:00
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Nov 1, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50bf3c579c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread infra/github-backup/bin/drain_queue.py
Comment on lines +147 to +148
failed.append({"repo": repo, "result": res,
"consecutive_failures": fs["count"]})

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 1, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow queue polling to progress past retained failed events

If the queue contains 500 older events for unavailable planned mirrors, retaining those events now prevents later events for healthy repositories from being processed. The Worker in infra/github-backup/worker/src/index.js:55–61 returns only the first 500 entries and neither follows nor exposes a pagination cursor, so every drain retries the same failed batch until recovery or expiration of the seven-day TTL. I reproduced this with 500 missing-mirror events followed by one healthy-repository event: repeated drains never attempted the healthy repository. Preserve failed events, but add pagination or another mechanism that allows polling to advance past them.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Nov 1, 2026
github-backup(queue): retained failed events starve polling — /queue returns only the first 500 events with no pagination #3476
Closed
Design: a mirror is what it can prove — one validity, outcome and alarm contract for the github-backup estate mirror #3282
Closed
@dezren39 dezren39 mentioned this pull request Nov 21, 2026
Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried #7079
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

github-backup(drain): webhook events are acked even when the fetch failed or the mirror is missing — freshness signal silently dropped

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.