Skip to content

fix: add rate_limit_event to Claude stream-json schema#6

Merged
nathanschram merged 1 commit intomasterfrom
fix/v0.23.3-rate-limit-event
Feb 26, 2026
Merged

fix: add rate_limit_event to Claude stream-json schema#6
nathanschram merged 1 commit intomasterfrom
fix/v0.23.3-rate-limit-event

Conversation

@nathanschram
Copy link
Contributor

Summary

  • Add StreamRateLimitMessage and RateLimitInfo msgspec structs to schemas/claude.py
  • Include in StreamJsonMessage union so msgspec decodes rate_limit_event cleanly
  • Eliminates noisy jsonl.msgspec.invalid warning in logs (event was being dropped correctly but generating warnings)
  • Event is silently skipped in translate_claude_event (existing case _: return [])
  • 3 new tests (2 decode + 1 translate), fixture line, docs update
  • Bump to v0.23.3

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 raises DecodeError, which gets caught and logged as a warning.

Test plan

  • test_decode_rate_limit_event_full — full payload decodes to StreamRateLimitMessage
  • test_decode_rate_limit_event_bare — bare {"type":"rate_limit_event"} decodes cleanly
  • test_rate_limit_event_returns_empty — translate returns [] (no Untether events)
  • Fixture parses without errors
  • Full suite: 870 passed, 80.86% coverage
  • Ruff clean, format clean

🤖 Generated with Claude Code

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>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@nathanschram nathanschram merged commit fe6d065 into master Feb 26, 2026
16 checks passed
@nathanschram nathanschram deleted the fix/v0.23.3-rate-limit-event branch February 26, 2026 08:35
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