feat: add streaming support for transparent cert rotation retries - #2
feat: add streaming support for transparent cert rotation retries#2agrawalradhika-cell wants to merge 14 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements automatic mTLS channel refreshing and retrying on UNAUTHENTICATED errors in the gRPC transport by introducing custom interceptors and a refreshing channel wrapper. It also updates an asynchronous test in the aiohttp transport tests to be properly defined and awaited. However, a critical issue was identified where several standard library modules (collections.abc, random, threading, time) used in the new classes are not imported, which will cause runtime NameErrors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| import logging | ||
| import logging | ||
|
|
||
| _LOGGER = logging.getLogger(__name__) |
There was a problem hiding this comment.
Several standard library modules (collections.abc, random, threading, time) are used in the newly added classes but are not imported in this file, which will cause NameError exceptions at runtime. Additionally, there is a duplicate import of logging and duplicate definition of _LOGGER that should be cleaned up.
| import logging | |
| import logging | |
| _LOGGER = logging.getLogger(__name__) | |
| import collections.abc | |
| import logging | |
| import random | |
| import threading | |
| import time |
…fresh_logic fallback behavior
Signed-off-by: Radhika Agrawal <agrawalradhika@google.com>
- Handled race conditions when old streams fail during cert rotation by tracking `attempt_cert`. - Dropped the flawed `_channel.close()` that abruptly killed in-flight streams. Subscriptions are now safely migrated and the old channel is allowed to drain. - Implemented `_ReplayableIterator` with dual-lock synchronization and `_can_replay` checks. This guarantees zombie threads gracefully abort context handoffs instead of dropping data or deadlocking. - Fixed the `IndentationError` in `test_aiohttp_requests.py`. - Added new test suite to cover the tricky streaming handoff concurrency bugs.
2fa4713 to
5447aad
Compare
* Implemented ThreadPoolExecutor on _MTLSCallInterceptor for async retry * Corrected callback threading deadlocks by breaking apart Future resolution * Resolved ABC TypeError omission of traceback() method * Prevented stream data-loss by restoring can_replay restrictions * Fixed bidi callback destruction with inner_call ID checks
* Resolved re-entrant deadlock in refresh_logic channel migration * Added cancellation state guards to prevent zombie pipeline revivals * Introduced 5-second IO throttle TTL cache to check_parameters_for_unauthorized_response to handle thundering herd.
No description provided.