Skip to content

Conversation

@fuki01
Copy link

@fuki01 fuki01 commented Feb 10, 2026

Summary

  • PR Make OpenAPI tool async #2872 migrated OpenAPI tools from requests to httpx.AsyncClient, but did not specify a timeout
  • requests defaults to no timeout, while httpx defaults to 5 seconds
  • This causes httpx.ReadTimeout for API calls taking longer than 5 seconds

This PR sets timeout=None to restore the previous requests behavior as a minimal fix.

Note: None (no timeout) matches the previous behavior, but the team may want to choose a more appropriate default value in a follow-up.

Closes #4431

@google-cla
Copy link

google-cla bot commented Feb 10, 2026

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fuki01, 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 addresses an issue where OpenAPI tool HTTP requests were failing due to an unexpected timeout. The underlying HTTP client library, httpx, introduced a default 5-second timeout after a recent migration, which was not present in the previously used requests library. The change ensures that API calls are no longer prematurely terminated by setting the timeout to None, effectively reverting to the prior behavior of allowing requests to complete without an explicit timeout limit.

Highlights

  • Timeout Discrepancy: Identified that the migration from requests to httpx.AsyncClient in PR Make OpenAPI tool async #2872 introduced a default 5-second timeout in httpx, unlike requests which defaults to no timeout.
  • ReadTimeout Errors: This change caused httpx.ReadTimeout errors for API calls that exceeded the new 5-second default timeout.
  • Timeout Restoration: Implemented a fix by explicitly setting timeout=None for httpx.AsyncClient, thereby restoring the original behavior of no timeout, consistent with the previous requests implementation.

🧠 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.

Changelog
  • src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py
    • Set timeout=None for httpx.AsyncClient to prevent ReadTimeout errors and restore previous behavior.
Activity
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.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Feb 10, 2026
@adk-bot
Copy link
Collaborator

adk-bot commented Feb 10, 2026

Response from ADK Triaging Agent

Hello @fuki01, thank you for creating this PR!

Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

In addition, could you please provide a testing plan and logs or screenshot after the fix is applied?

This information will help reviewers to review your PR more efficiently. Thanks!

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 addresses a httpx.ReadTimeout issue by setting an explicit timeout=None for the httpx.AsyncClient, restoring the previous behavior of the requests library. While this fixes the immediate problem, I have a significant concern about disabling timeouts altogether, as it can lead to service instability. I've added a high-severity comment recommending the use of a large default timeout as a safety measure instead of completely disabling it.

async with httpx.AsyncClient(
verify=request_params.pop("verify", True)
verify=request_params.pop("verify", True),
timeout=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

high

While setting timeout=None restores the previous behavior of requests and fixes the immediate httpx.ReadTimeout issue, it introduces a significant risk. Disabling timeouts can cause requests to hang indefinitely if the remote API is unresponsive, potentially leading to resource exhaustion and service instability.

Even though a follow-up is mentioned in the pull request description, I strongly recommend addressing this now by setting a generous default timeout (e.g., 10 minutes) instead of None. This would provide a crucial safety net. A truly indefinite timeout should be an explicit choice by the user of the tool, not the default behavior.

The migration from `requests` to `httpx.AsyncClient` in PR google#2872 did not
specify a timeout parameter. Since `requests` defaults to no timeout
while `httpx` defaults to 5 seconds, this causes `ReadTimeout` errors
for API calls that take longer than 5 seconds.

Set timeout to `None` to restore the previous behavior.

Closes google#4431
@fuki01 fuki01 force-pushed the fix/openapi-tool-timeout branch from 415aa5a to 69d0179 Compare February 11, 2026 07:57
@ryanaiagent ryanaiagent self-assigned this Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: OpenAPI tool _request missing timeout causes ReadTimeout with default httpx 5s

3 participants