Repository navigation
Description
Context & Rationale
run_gh (src/devops_cli/github/rate_limiter.py:1646) is already the single gh seam, with quota-derived pacing, a read cache and a retry loop. calculate_backoff_delay (:1013) never checks remaining: whenever a future reset is tracked it sleeps until the primary reset, and one almost always is, because missing or stale state is refreshed before a request is paced (:711). Otherwise it retries after 2 to 5 s with no secondary floor. Retry-After is never parsed (:562), and the only tracked-reset test (tests/test_github_rate_limiter.py:791) uses remaining=0. AGENTS.md's 'Zero Bare gh Invocations' claims jittered secondary backoff, and nothing enforces its bare-gh ban. The httpx2 GraphQL path raises on 403/429 (graphql.py:780). vibes records a 20-PR triage stalled for an hour by a retry loop.
Scope & Deliverables
- Context & Rationale*:
run_gh(src/devops_cli/github/rate_limiter.py:1646) is already the singleghseam, with quota-derived pacing, a read cache and a retry loop.calculate_backoff_delay(:1013) never checksremaining: whenever a future reset is tracked it sleeps until the primary reset, and one almost always is, because missing or stale state is refreshed before a request is paced (:711). Otherwise it retries after 2 to 5 s with no secondary floor.Retry-Afteris never parsed (:562), and the only tracked-reset test (tests/test_github_rate_limiter.py:791) uses remaining=0. AGENTS.md's 'Zero BareghInvocations' claims jittered secondary backoff, and nothing enforces its bare-ghban. The httpx2 GraphQL path raises on 403/429 (graphql.py:780). vibes records a 20-PR triage stalled for an hour by a retry loop. - Deliverable*: PR1 (the P0): classify primary (remaining zero), secondary and
Retry-After. Wait for the reset only on a primary limit. On a secondary limit wait a configured floor (default 60 s, PyGithubGithubRetry'sDEFAULT_SECONDARY_RATE_WAIT, asclient.py:42gets), then tenacitywait_random_exponentialunder a local cap. Return a serverRetry-Afterunchanged. Declare tenacity inpyproject.toml(today only transitive), and do not reusepydantic_ai'swait_retry_after, which clamps. Add throttle and wait counters to the persisted quota meta (_save_disk_quota) sodevops gh rate-limit, a separate process, shows them. Correct the AGENTS.md sentence. P1 follow-ups: route GraphQL 403/429 through the same classifier via the existingHTTPX2TenacityTransportseam, and add an AST invariant totests/test_architectural_invariants.pyallowlisting onlydevcontainer.py'sgh auth tokenandgh auth login --with-token(credential migration, no API quota). P2: replaceratelimit(:54) and the hardcodedAsyncLimiter(max_rate=60, time_period=60)(:650), both contradicting the docstring at:6, with one configured pyrate-limiter ceiling (sync and async). Pre-flight bulk budgeting stays with Proportional API Rate Budgeting & GraphQL Circuit Breaker Guard. - Constraint*: Clamping to
min(retry_after, cap)retries early and turns a primary limit into a secondary one; sleeping silently through the primary window looks like a hang. When the required wait exceeds a configured maximum, raiseGitHubRateLimitErrorstating the wait and reset time, asGithubRetry'smax_rate_limit_waitdoes when set (it defaults to None). Two tests pin both halves: a serverRetry-Afteris returned unchanged, and the local cap bounds only the client's own growth; the remaining=0 test keeps passing. The invariant must be AST-based: grep flags docstrings and cannot tell whether a command list reachesrun_ghor a raw subprocess. - Measured*:
uv run python probe/rewrite_backoff.py: afterupdate_quota('core', remaining=4999, limit=5000, reset_epoch=now+3000),calculate_backoff_delayon a secondary-limit message returns 3000.0 s. Same probe with no tracked quota: attempt 1 waits 2.2–3.0 s, attempt 2 waits 4.2–5.0 s.grep -n -A6 '^name = "ratelimit"' uv.lock: 2.2.1, upload-time 2018-12-17. - Source*: vibes
observations/devops-cli/06-rate-limits-and-anti-brittle-heuristics.md, vibesexamples/fastmcp-token-bucket-gateway/README.md, vibesexamples/fastmcp-token-bucket-gateway/gateway.py, vibesexamples/fastmcp-token-bucket-gateway/test_gateway.py
Strategic Alignment
- Milestone:
v0.2.24(Reactive Workstation Command Center, Interactive TUI & Unified Operations Hub) - Roadmap Reference:
docs/ROADMAP.md
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(github): correct secondary-limit backoff and retry-after handlin…
dan-petty commentedon Sep 28, 2026
Resolved and verified via PR #714 into release/v0.2.24 (commit 3359e36).
feat(release): v0.2.24 (#905)