Skip to content

Conversation

@Klaudioz
Copy link

@Klaudioz Klaudioz commented Jan 4, 2026

Summary

  • Adds request-timeout configuration option (in seconds)
  • Defaults to 10 minutes if not specified
  • Fixes timeout errors with Claude Opus extended thinking

Problem

When using Claude Opus 4.5 with extended thinking (thinking.budget_tokens: 32000+), requests can fail with:

context deadline exceeded (Client.Timeout or context cancellation while reading body)

Extended thinking requests can take 2-10+ minutes to complete. Several executors passed 0 as the timeout to newProxyAwareHTTPClient(), which meant upstream requests relied solely on context cancellation and could terminate before the response completed.

Solution

  • Add request-timeout field to Config
  • Pass configured timeout (or a 10-minute default) to the upstream HTTP client
  • Apply consistently across HTTP-based executors

Usage

# config.yaml
request-timeout: 600  # 10 minutes

Testing

  • go test ./...

Related

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Klaudioz, 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 implements a crucial enhancement by introducing a configurable request timeout for all HTTP-based executors. This addresses a common issue where long-running AI model requests, particularly those involving 'extended thinking' like Claude Opus, would prematurely time out. By allowing users to define a 'request-timeout' in the configuration, or by defaulting to a generous 10-minute period, the system can now reliably handle requests that require more processing time, preventing 'context deadline exceeded' errors and improving the stability of interactions with various upstream providers.

Highlights

  • Configurable Request Timeout: Introduced a new 'request-timeout' configuration option, allowing users to specify the maximum duration for upstream API requests in seconds.
  • Default Timeout: If the 'request-timeout' is not explicitly set or is zero, it defaults to 10 minutes (600 seconds) to accommodate longer-running model requests.
  • Resolves Timeout Errors: This change directly addresses and fixes 'context deadline exceeded' errors that occurred with extended thinking models like Claude Opus, which can take several minutes to complete.

🧠 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 configurable request-timeout to address issues with long-running model requests, which is a great addition. The implementation is solid, adding the configuration option and a helper function to resolve the timeout, which is then consistently applied across all relevant HTTP executors. My feedback is minor, focusing on improving the clarity of comments in the configuration file and the config struct to make the new option easier for users and developers to understand.

# Maximum wait time in seconds for a cooled-down credential before triggering a retry.
max-retry-interval: 30

# Maximum duration in seconds for upstream provider requests. Set to 0 to use the default (10 minutes).
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The comment is a bit ambiguous. It says to use 0 for the default, but the example value 600 is the same as the default (10 minutes). This might be confusing for users. Let's rephrase it to be more explicit about the default value and how to use it.

# Maximum duration in seconds for upstream provider requests. Defaults to 600s (10 minutes) if omitted or set to 0.

Klaudioz and others added 2 commits January 4, 2026 15:42
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@kdcokenny
Copy link

+1

@Klaudioz
Copy link
Author

Klaudioz commented Jan 6, 2026

Any change to get it reviewed @luispater ?

HsnSaboor added a commit to HsnSaboor/CLIProxyAPI that referenced this pull request Jan 6, 2026
…auto-update, request timeout, multi-candidate, auth persistence

Applied features from upstream PRs:
- PR router-for-me#878: Usage statistics persistence (SetPersistPath, LoadStatistics, SaveStatistics)
- PR router-for-me#877: Codex plan type credential filename handling
- PR router-for-me#868: Claude request cloaking utilities (obfuscation, fake user IDs)
- PR router-for-me#715: Auto-update command for self-updating binary
- PR router-for-me#860: Configurable request timeout with RequestTimeout config
- PR router-for-me#879: Gemini multi-candidate support (n param -> candidateCount)
- PR router-for-me#869: Auth token persistence for non-Google OAuth providers

Fixed build issues:
- Added applyPayloadConfig wrapper function
- Added originalTranslated computation in claude/antigravity/codex executors
- Fixed model registry hook methods
- Removed duplicate SanitizeFunctionName
- Fixed gemini_schema placeholder logic for nested object properties

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants