Skip to content

Preserve nil timeouts through request transport#293

Open
fallintoplace wants to merge 2 commits into
openai:mainfrom
fallintoplace:fix/timeout-nil-disables-request-timeouts
Open

Preserve nil timeouts through request transport#293
fallintoplace wants to merge 2 commits into
openai:mainfrom
fallintoplace:fix/timeout-nil-disables-request-timeouts

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

  • preserve timeout: nil as "no timeout" instead of coercing it to 0.0
  • skip deadline and x-stainless-timeout handling when a request disables timeouts
  • reset pooled Net::HTTP socket timeouts and add regressions for default and per-request nil timeout behavior

Why

The README documents timeout: nil as disabling timeouts, but the transport currently calls to_f on the timeout value. In Ruby, nil.to_f becomes 0.0, which turns the computed deadline into "right now" rather than removing the deadline.

Validation

  • ASDF_RUBY_VERSION=3.4.9 asdf exec bundle exec ruby -Itest test/openai/client_test.rb --name=/timeout/
  • ASDF_RUBY_VERSION=3.4.9 asdf exec bundle exec ruby -Itest test/openai/client_test.rb

@fallintoplace fallintoplace requested a review from a team as a code owner June 26, 2026 22:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28a082a4b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


pool.with(timeout: timeout, &blk)
if deadline.nil?
pool.with(&blk)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve nil timeout while waiting for pooled connections

When timeout: nil is used and all connections for an origin are checked out, calling pool.with without an explicit timeout falls back to connection_pool's default checkout timeout (5 seconds). That means a request that disabled timeouts can still raise a timeout while queued for a pooled connection, even though README says queue time counts toward the request timeout and nil disables it.

Useful? React with 👍 / 👎.

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.

1 participant