Repository navigation
fix(google-api-core): report background polling failures - #18863
JackyHsu-X wants to merge 1 commit into
Conversation
Assisted-by: OpenAI Codex <noreply@openai.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new _background_poll helper method in AsyncFuture to handle background polling failures by catching exceptions and setting them on the future, ensuring that registered callbacks are correctly invoked when background polling fails. It also includes comprehensive unit tests to verify error handling during background polling, cancelled polling, and foreground polling. There are no review comments to address, and I have no additional feedback to provide.
When an
AsyncOperationrefresh raises a non-retryable error such asForbidden, background polling fails without resolving the future. Completion callbacks never run, leaving callback-based callers waiting indefinitely.Run background polling through a wrapper that stores ordinary polling exceptions on the future. This notifies existing callbacks and makes the original error available through
result()andexception(). Preserve an already completed future, foreground polling behavior, and task cancellation.Regression coverage includes both the base future and an actual
AsyncOperation, plus completion racing with a polling failure and cancellation. On unchanged code, the two affected test modules have 4 failures and 22 passes; with the fix, all 26 pass.Validation on Windows:
google-api-coreunit and asyncio suites: 1,643 passed, 1 skipped.Cloud system tests, other packages in the monorepo, and other operating systems were not run locally.
Fixes #18862 🦕
AI assistance: OpenAI Codex investigated, generated and self-reviewed the patch, and ran the local checks under the account owner's authorization. No separate human review is claimed.