Skip to content

fix(googleapi): replace Client.Timeout with transport-level ResponseHeaderTimeout#425

Merged
steipete merged 3 commits intoopenclaw:mainfrom
laihenyi:fix/transport-timeout-large-downloads
Mar 7, 2026
Merged

fix(googleapi): replace Client.Timeout with transport-level ResponseHeaderTimeout#425
steipete merged 3 commits intoopenclaw:mainfrom
laihenyi:fix/transport-timeout-large-downloads

Conversation

@laihenyi
Copy link
Copy Markdown
Contributor

@laihenyi laihenyi commented Mar 7, 2026

Summary

  • Replace the global http.Client.Timeout (30s) with http.Transport.ResponseHeaderTimeout (30s) so that large Drive file downloads (videos, backups, etc.) are not interrupted mid-transfer
  • The former timeout applied to the entire request lifecycle; the new one only limits the time waiting for the server to start responding — once streaming begins, there is no hard cap
  • OAuth2 token refresh exchanges retain a dedicated 30s timeout via tokenExchangeTimeout

Motivation

Downloading large files from Drive (e.g. 1GB+ videos) consistently timed out at 30s because http.Client.Timeout caps the entire request including body transfer. This is the idiomatic Go fix: use transport-level ResponseHeaderTimeout to guard against unresponsive servers while allowing streaming transfers to complete naturally.

Test plan

  • New test TestNewBaseTransport_SetsResponseHeaderTimeout verifies transport config
  • New test TestOptionsForAccountScopes_NoClientTimeout verifies no hard client timeout
  • All existing tests pass (go test ./...)

🤖 Generated with Claude Code

laihenyi and others added 3 commits February 23, 2026 12:39
Add shortcutDetails to the Drive Get API fields to enable resolving
shortcut target file IDs and MIME types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eaderTimeout

The global http.Client.Timeout (30s) applied to the entire request
lifecycle, causing large Drive file downloads (videos, backups, etc.)
to time out. Replace it with http.Transport.ResponseHeaderTimeout
which only limits the time waiting for the server to begin responding.
Once response headers arrive and the body starts streaming, there is
no hard cap — large transfers complete naturally.

- Set ResponseHeaderTimeout=30s on the base transport
- Remove http.Client.Timeout from the API client
- Keep a dedicated tokenExchangeTimeout=30s for OAuth2 token refreshes
- Add tests verifying the new transport configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@steipete steipete merged commit 449beff into openclaw:main Mar 7, 2026
2 of 5 checks passed
@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 7, 2026

Landed via squash merge onto main, then applied a follow-up fixup on main because the merged PR content still included an unrelated Drive field change.

Thanks @laihenyi!

klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
…eaderTimeout (openclaw#425)

* feat(drive): include shortcutDetails in drive get fields

Add shortcutDetails to the Drive Get API fields to enable resolving
shortcut target file IDs and MIME types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(googleapi): replace Client.Timeout with transport-level ResponseHeaderTimeout

The global http.Client.Timeout (30s) applied to the entire request
lifecycle, causing large Drive file downloads (videos, backups, etc.)
to time out. Replace it with http.Transport.ResponseHeaderTimeout
which only limits the time waiting for the server to begin responding.
Once response headers arrive and the body starts streaming, there is
no hard cap — large transfers complete naturally.

- Set ResponseHeaderTimeout=30s on the base transport
- Remove http.Client.Timeout from the API client
- Keep a dedicated tokenExchangeTimeout=30s for OAuth2 token refreshes
- Add tests verifying the new transport configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
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