Skip to content

feat(events): expose x-ratelimit-events-* headers and honor 429 Retry-After - #6

Merged
DeevsDeevs merged 6 commits into
feature/policy-targetingfrom
feature/events-rate-limit
Dec 2, 2026
Merged

DeevsDeevs merged 6 commits into
feature/policy-targetingfrom
feature/events-rate-limit

Conversation

@DeevsDeevs

Copy link
Copy Markdown
Collaborator

Stacked on fix/review-findings (#5). Exposes the per-second Event rate-limit headers from whitecircle/core-platform#982 and honors numeric Retry-After on HTTP 429 retries.

Commits

  • 10d5ee4 — feat(events): add frozen EventsRateLimit(limit, remaining, reset, window), populate EventCheckResult.rate_limit and EventsCheckResult.rate_limit from x-ratelimit-events-* headers on sync/async events.check() and events.check_many() (via internal _send_request/_post_with_headers, leaving public request() unchanged), and add APIStatusError.rate_limit.
  • 075c6ec — feat(client): honor numeric Retry-After seconds on HTTP 429 responses, clamped to [MIN_RATE_LIMIT_RETRY_DELAY, MAX_RETRY_DELAY], falling back to exponential backoff when absent or non-numeric; update README.md, docs/errors-and-testing.md, and AGENTS.md.
  • 669e32b — docs: add a Rate limits section to docs/errors-and-testing.md (what counts, 200 failed vs 429 skip-batch rejections, result.rate_limit, and a resend snippet) and CHANGELOG.md Added entries.

…StatusError

Add frozen EventsRateLimit(limit, remaining, reset, window) in
types/events.py and export it from whitecircle.types. Populate
rate_limit on EventCheckResult and EventsCheckResult in sync and async
events.check/check_many via an internal _send_request/_post_with_headers
hook (leaving public request() unchanged), and expose APIStatusError.rate_limit
from error.response.headers.
Parse numeric Retry-After seconds on HTTP 429 responses and clamp the
retry delay to [MIN_RATE_LIMIT_RETRY_DELAY, MAX_RETRY_DELAY], falling
back to exponential backoff when Retry-After is absent or non-numeric.
Update README, docs/errors-and-testing.md, and AGENTS.md.
Add a Rate limits section to docs/errors-and-testing.md covering what
counts toward the per-second Event limit, where rejections appear (200
failed vs 429 on skip batches), reading result.rate_limit and
error.rate_limit, and resending failed Events after rate_limit.reset.
Add Unreleased Added entries to CHANGELOG.md.
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 6de66ed0-a0e9-4dde-9c56-b3ae7f5c14a2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…ementation

Move _send_request above @overload def request on SyncAPIClient and
AsyncAPIClient so each overload group immediately precedes its
implementation as required by PEP 484 and mypy.
…9 retry

Verify Retry-After is ignored on HTTP 503, monthly-quota 429 with
Retry-After is still not retried, and events.check_many(..., skip=True)
retries a 429 with Retry-After and attaches rate_limit from the
subsequent 200 response.
Base automatically changed from fix/review-findings to feature/policy-targeting December 2, 2026 16:00
@DeevsDeevs
DeevsDeevs merged commit f026241 into feature/policy-targeting Dec 2, 2026
8 checks passed
@DeevsDeevs
DeevsDeevs deleted the feature/events-rate-limit branch December 2, 2026 16:00
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