Repository navigation
[CHA-0] fix: read rate limit headers case-insensitively; poll in hide/show test - #243
Merged
Merged
Conversation
The async client passes response headers as a plain dict, which keeps the case the server sent, so rate_limit() returned None when the server sent X-Ratelimit-* instead of x-ratelimit-*. Also poll in test_channel_hide_show: the backend unhides a channel in a background task after a new message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nijeesh-stream
requested review from
10printhello and
slavabobik
as code owners
October 15, 2026 02:15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Update after CI: the async |
nijeesh-stream
enabled auto-merge (squash)
October 15, 2026 09:39
slavabobik
approved these changes
Oct 15, 2026
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.
TLDR
🧪 Test & lintfails on every PR (e.g. docs-only #241) and on the scheduled master runs. This PR fixes two of the three causes. One is a real SDK bug: with the async client,StreamResponse.rate_limit()returnsNone. The other is a test race. Risk is low:rate_limit()now finds the headers whatever their case, andheaders()is unchanged.Ticket
Summary
async_chat/test_client.py::test_stream_response:'NoneType' object has no attribute 'limit'.StreamChatAsync._parse_responsepassesdict(response.headers), which loses aiohttp's case-insensitive lookup. The server now sendsX-Ratelimit-Limitetc., soheaders.get("x-ratelimit-limit")misses. The sync client passes therequestscase-insensitive dict, so it was unaffected.StreamResponsenow looks these headers up case-insensitively. A new offline unit test (test_stream_response_headers.py) fails without the change.test_channel_hide_show(sync and async):assert 0 == 1on the last assertion. When a message is sent, the backend unhides the channel for other members in a background task (ShowChannelForAllUsersAsync), not inline. The tests now pollquery_channelsfor up to 30s (10s was not always enough for the async test on the shared app).Not fixed here:
test_delete_channels(task did not succeed) fails intermittently on master. The task result shape is unchanged ({"status": "ok"}), so the task either errors or takes longer than 300s on the shared test app. Finding out which needs access to the test app's task results.Checklist
base/exceptions.py, from a newer flake8-bugbear than CI pins)./docs) has been updated (n/a)🤖 Generated with Claude Code