fix: add rate_limit_event to Claude stream-json schema#6
Merged
nathanschram merged 1 commit intomasterfrom Feb 26, 2026
Merged
Conversation
Claude Code CLI v2.1.45+ emits rate_limit_event JSONL events when rate limits are hit. Without a schema entry, msgspec raises DecodeError and logs a noisy warning on every occurrence. - Add RateLimitInfo struct and StreamRateLimitMessage to schemas/claude.py - Include StreamRateLimitMessage in StreamJsonMessage union - Event is decoded cleanly and silently skipped (informational only) - Add fixture line, 2 decode tests, 1 translate test - Document event in stream-json cheatsheet - Bump version to 0.23.3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StreamRateLimitMessageandRateLimitInfomsgspec structs toschemas/claude.pyStreamJsonMessageunion so msgspec decodesrate_limit_eventcleanlyjsonl.msgspec.invalidwarning in logs (event was being dropped correctly but generating warnings)translate_claude_event(existingcase _: return [])Context
Claude Code CLI v2.1.45+ emits
{"type": "rate_limit_event", ...}JSONL events when rate limits are approached or hit. This is a purely informational event — the run continues. Without a schema entry, msgspec's tagged union decoder raisesDecodeError, which gets caught and logged as a warning.Test plan
test_decode_rate_limit_event_full— full payload decodes toStreamRateLimitMessagetest_decode_rate_limit_event_bare— bare{"type":"rate_limit_event"}decodes cleanlytest_rate_limit_event_returns_empty— translate returns[](no Untether events)🤖 Generated with Claude Code