Skip to content

Add seven_day_overage_included to RateLimitType#1069

Closed
sarahdeaton wants to merge 1 commit into
mainfrom
sarah/seven-day-overage-included-type
Closed

Add seven_day_overage_included to RateLimitType#1069
sarahdeaton wants to merge 1 commit into
mainfrom
sarah/seven-day-overage-included-type

Conversation

@sarahdeaton

@sarahdeaton sarahdeaton commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

The Claude CLI added a per-model weekly usage limit window in 2.1.191 and reports it to the SDK as rateLimitType: "seven_day_overage_included" (main here already bundles CLI 2.1.193). This adds that value to the RateLimitType Literal in types.py.

Nothing changes at runtime. message_parser.py passes rateLimitType through unvalidated, so RateLimitInfo.rate_limit_type already carries the value on current CLI versions. The Literal is what type checkers see, so exhaustive narrowing on rate_limit_type currently treats a value the field can really hold as impossible. The value matches the published TypeScript SDK, whose rateLimitType union already includes 'seven_day_overage_included' (sdk.d.ts).

No CHANGELOG.md entry is included; changelog entries are written by the release automation (docs: update changelog for vX.Y.Z).

Test plan

  • ruff format is a no-op on the changed file and ruff check passes.
  • No runtime branch changes, so existing coverage in tests/test_message_parser.py::test_parse_rate_limit_event and tests/test_rate_limit_event_repro.py is unaffected; CI runs the full lint, mypy, and pytest matrix.

The Claude CLI added a per-model weekly usage limit window in 2.1.191
and reports it to the SDK as rateLimitType "seven_day_overage_included".
The message parser already passes the value through to
RateLimitInfo.rate_limit_type, so only the declared Literal was out of
date: exhaustive narrowing on rate_limit_type treated a value the field
can really hold as impossible. The TypeScript SDK already includes it.

No CHANGELOG entry; CHANGELOG.md is written by the release automation.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — trivial one-value addition to the RateLimitType Literal, matching the TypeScript SDK and current CLI behavior.

Extended reasoning...

Overview

This PR makes a single change to src/claude_agent_sdk/types.py: it adds "seven_day_overage_included" to the RateLimitType Literal union (and reformats the union members one-per-line, which ruff format accepts). No runtime logic is touched — message_parser.py already passes rateLimitType through unvalidated, so this only affects what type checkers consider exhaustive for RateLimitInfo.rate_limit_type.

Security risks

None. This is a pure type-annotation change with no executable behavior, no input handling, and no permission/auth implications.

Level of scrutiny

Minimal scrutiny is appropriate. The change is mechanical and self-contained, mirrors the published TypeScript SDK's rateLimitType union, and aligns with the value the bundled CLI (2.1.191+) already emits. The repository's recent history on main contains an identical change (commit titled "Add seven_day_overage_included to RateLimitType"), confirming this is the expected direction.

Other factors

The bug hunting system found no issues, there are no outstanding reviewer comments, and existing rate-limit parsing tests are unaffected since no runtime branches change. The omission of a CHANGELOG entry follows the repo's release-automation convention.

@aidand-ant aidand-ant left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

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.

2 participants