Skip to content

verify-superset: retry transient 429/5xx before failing closed#42

Open
davanstrien wants to merge 1 commit into
mainfrom
gate-retry-429
Open

verify-superset: retry transient 429/5xx before failing closed#42
davanstrien wants to merge 1 commit into
mainfrom
gate-retry-429

Conversation

@davanstrien
Copy link
Copy Markdown
Owner

The org-card sync failed once today on a transient HTTP 429 from the Hub tree API — the superset gate correctly failed closed, but a momentary rate-limit shouldn't block a legitimate sync.

Fix: retry the tree fetch up to 3× with linear backoff (1s, 2s, 3s) on 429/5xx; 200/404 stay terminal. If it's still transient after the last try, it falls through to the existing "fail closed" — so the safety guarantee is unchanged; we just ride out blips.

Not likely in steady state (today's 429 came from merging several PRs in seconds + manual API calls), but cheap insurance against a launch-day flurry of migration merges. ~6 lines, fail-closed semantics intact.

Tested: syntax OK, smoke-tested green against uv-scripts/jobs-utils.

Comment thread tools/verify-superset.sh
# backoff so a momentary rate-limit doesn't hard-block a legitimate sync. 200/404 are
# terminal; a still-transient code after the last try falls through to "fail closed".
code=000
for attempt in 1 2 3; do
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

maybe a better check is to diff before trying to update?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good call — captured for later as #44 (diff to preview the real add/update/delete set + skip no-op syncs, which also cuts tree-API pressure). Keeping this PR's retry as the immediate fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant