Skip to content

fix(service): the last rate limit of a request holds every worker, and tests cover the gh hold and the serve state wiring #2523

Description

@dan-petty

Problem Description

A review of pull request #2515 (issue #2474) found these gaps on origin/main 6a5447a:

  • The last rate limit of a request holds no other worker. The session sets the hold only in retry_wait, and handle_rate_limit_error returns before it calls retry_wait when the retries are spent (src/devops_cli/github/session_transport.py:263). run_gh returns from _handle_attempt_backoff before limiter.hold_requests when attempt >= max_retries (src/devops_cli/github/rate_limiter.py:1727). The refusal that fails the round with GitHubRateLimitError therefore holds nothing, and the other workers send requests at once, although GitHub asked for retry-after seconds with no request.
  • No test fails when the call limiter.hold_requests(backoff) in run_gh's backoff is removed. The roadmap store sends the Service's own writes through gh api.
  • No test fails when devops serve --service stops giving state_dir to create_service_app. Then a restart clears the halt and the budget window again.
  • The rule comment above RoadmapServiceIdentityRefused in k8s/monitoring/prometheus-values.yaml still says that a refusal stops every round until the pod restarts. The alert description below it says that the halt stays after a restart.
  • The output string ServeMessages.state_unreadable uses the contraction "can't". ASD-STE100 does not allow contractions.

Reproduction Steps

  1. Route three 403 answers with retry-after: 60 to one GitHub session request, and let each retry wait move the clock.
  2. The request fails with GitHubRateLimitError after the waits [60, 60].
  3. Send a second request of the same identity. It waits about 0.24 s, not 60 s.
  4. For gh: call _handle_attempt_backoff with a secondary-limit stderr for attempts 0, 1 and 2 of max_retries=2. Attempt 2 returns False and does not extend the hold.
  5. Remove limiter.hold_requests(backoff) from rate_limiter.py, or state_dir=state_dir, from serve.py. tests/test_github_rate_limiter.py, tests/test_service_limits.py, tests/test_roadmap_run.py, tests/test_server_service.py and tests/test_github_session.py all pass.

Expected vs Actual Behavior

Expected: every rate-limit answer holds every request of the identity until the wait that GitHub asks for ends, also when the request is not sent again. A test fails when the gh backoff or the serve wiring loses its part. The rule comment and the output string agree with the change and with ASD-STE100.

Actual: the last refusal holds nothing, and the two wiring mutations pass the tests.

Environment Diagnostics

origin/main 6a5447a, Python 3.14, gidgethub 6.0.0.

Source: #2515

Activity

  1. added
    source/agent
    type/bug
    status/new
    value/medium
    effort/medium
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The primary change fixes a bug where the last rate-limit refusal does not hold other workers.
    • Priority: P2-Medium. The final refusal lets all workers fire at once, which can escalate GitHub throttling, but earlier refusals still hold correctly.
    • Value: Medium. It closes a gap in rate-limit protection that can cause a burst of requests against GitHub.
    • Effort: Medium. The fix touches the hold logic, adds tests for two wiring paths, and corrects a comment and a string across several files.
    • Related: fix(service): a restart keeps the halt, the budget window and the failure ledger, and a secondary limit or a suspended installation stops every worker #2474, which asks for a different change. Both address service-wide rate-limit holds, but #2474 built the hold mechanism and the candidate fixes a gap where the final refusal does not extend the hold.
  3. added
    priority/p2-medium
    on Oct 28, 2026
  4. added 2 commits that reference this issue on Oct 28, 2026
    657b03d
    1d80585
  5. removed
    status/new
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions