Skip to content

fix(github): pace mutations through the clock seam #4666

Closed

Description

@dan-petty

Problem or Motivation

src/devops_cli/github/rate_limiter.py:1103 calls time.sleep directly for mutation pacing, so ClockFake cannot answer it. An audit hook recorded 4.28 s of real sleep in 21 calls in tests/commands/test_pr_status.py. It recorded about 88 s in the pr and gh command tests (measured): test_pr_cmd 37.9 s, test_pr_update 21.0 s, test_pr_title_labels 12.4 s, test_gh_cmd 7.2 s, test_pr_form_check 4.5 s and test_pr_status 4.3 s. No open issue covers it.

Saving: About 88 s of worker time (measured), which is 5-10 s per shard (estimated).

Found by the CI and test audit of 2026-11-11. The account runs at most 20 hosted jobs at one time (measured), so each job that does no work makes the queue of each pull request longer.

Proposed Solution & Architectural Design

  • Call devops_cli.core.clock.sleep at rate_limiter.py:1103.

Risk: None.

Target Subsystem

SDLC, Git & PR Governance (src/devops_cli/github/rate_limiter.py).

Existing Tool Considered

The existing clock seam devops_cli.core.clock and the shared ClockFake (tests/support/fakes/clock.py). No new tool. Cost: about 5,000 tokens and 30 minutes.

Acceptance Criteria

  • An audit hook records 0 real sleep in tests/commands/test_pr_*.py and tests/commands/test_gh_cmd.py.
  • The pacing test proves the wait length through ClockFake.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/github
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 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 fix prefix of the title gives the type.
    • Scope: scope/github. The (github) scope of the title gives the scope.
    • Priority: P2-Medium. Saves about 88 s of CI time but does not block releases or affect users.
    • Value: Medium. Reduces CI wall-clock time by about 88 s per full test run.
    • Effort: Low. One call-site change from time.sleep to devops_cli.core.clock.sleep plus one test assertion.
    • Related: refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320, which asks for a different change. Both make tests avoid real-time waits, but #1320 is the umbrella for all clock fakes while this fixes one specific sleep call in rate_limiter.py.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 11, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    The first acceptance criterion of this issue is not fully met after #5063. Two tests in tests/commands/test_pr_update.py still sleep 6.2 s for real in total. The PR did not change that file, because the deletion of devops pr update changes it now. #4669 records the two tests, their measured times and the fix: #4669 (comment)

  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 15:46 UTC

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/lowpriority/p2-mediumscope/githubsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions