Skip to content

Conversation

@Pulkit0110
Copy link
Member

Integrate all the components required for bidi writes retries

@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. api: storage Issues related to the googleapis/python-storage API. labels Dec 24, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Pulkit0110, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the robustness of asynchronous object operations in Google Cloud Storage by implementing a sophisticated retry and resumption system for bidirectional streaming. It introduces dedicated strategies to manage the state of ongoing read and write operations, automatically re-establishing streams and continuing data transfer from the last known good state in the event of transient network issues or server-side redirects. This ensures that applications using these experimental APIs can handle intermittent failures gracefully, leading to more reliable data transfers.

Highlights

  • Bidirectional Stream Retry Mechanism: Introduced a comprehensive retry mechanism for asynchronous bidirectional (bidi) streaming operations, specifically for object reads and writes, to enhance resilience against transient errors and redirects.
  • New Retry Strategies and Manager: Implemented a generic _BidiStreamRetryManager and specific _ReadResumptionStrategy and _WriteResumptionStrategy classes to manage the state, generate requests, and recover from failures during bidi stream retries.
  • Integration into Async Writers/Readers: Refactored AsyncAppendableObjectWriter and AsyncMultiRangeDownloader to integrate the new retry logic, allowing their open, append, and download_ranges methods to automatically handle retries and stream re-establishment.
  • Error Handling and State Recovery: Added predicates (_is_write_retryable, _is_read_retryable) to identify retryable exceptions and _on_open_error methods to extract routing tokens and handles from redirect errors, enabling intelligent state recovery.
  • Extensive Testing: Included new conformance tests for bidi reads to validate retry behavior under various fault injection scenarios, alongside new unit tests for the retry manager and both read/write resumption strategies.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant and well-designed refactoring to integrate retry strategies for bidirectional reads and writes, enhancing the robustness of experimental asyncio features. The abstraction of retry logic into a _BidiStreamRetryManager and specific _WriteResumptionStrategy and _ReadResumptionStrategy classes is a solid architectural choice. The accompanying unit and conformance tests are comprehensive and provide good coverage for the new functionality. My review comments focus on improving error handling by replacing broad except Exception blocks with more specific ones and avoiding print() statements in library code.

@Pulkit0110 Pulkit0110 force-pushed the bidi-writes-retry-integrate branch from c3ba20d to 36a02d7 Compare January 2, 2026 10:57
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: xl Pull request size is extra large. labels Jan 2, 2026
@Pulkit0110 Pulkit0110 force-pushed the bidi-writes-retry-integrate branch from 36a02d7 to 5d39296 Compare January 13, 2026 06:53
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Jan 13, 2026
@Pulkit0110 Pulkit0110 marked this pull request as ready for review January 13, 2026 06:59
@Pulkit0110 Pulkit0110 requested review from a team as code owners January 13, 2026 06:59
@Pulkit0110 Pulkit0110 force-pushed the bidi-writes-retry-integrate branch from fb9c976 to 8347af2 Compare January 21, 2026 11:35
@Pulkit0110 Pulkit0110 force-pushed the bidi-writes-retry-integrate branch from 637019e to 359a23c Compare January 23, 2026 06:30
@Pulkit0110
Copy link
Member Author

/gcbrun

chandra-siri
chandra-siri previously approved these changes Jan 27, 2026
@Pulkit0110
Copy link
Member Author

/gcbrun

@Pulkit0110 Pulkit0110 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 28, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 28, 2026
@Pulkit0110
Copy link
Member Author

/gcbrun

@Pulkit0110 Pulkit0110 merged commit dbd162b into googleapis:main Jan 28, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/python-storage API. size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants