Skip to content

util: share a default-settings HTTP transport - #14461

Open
vito wants to merge 1 commit into
mainfrom
httptransport-cleanup
Open

vito wants to merge 1 commit into
mainfrom
httptransport-cleanup

Conversation

@vito

@vito vito commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Several places build their own HTTP transport by cloning http.DefaultTransport through an unchecked type assertion:

http.DefaultTransport.(*http.Transport).Clone()

That panics if anything has replaced http.DefaultTransport with a different RoundTripper. package core tests already do this (core/lazy_operation_execution_test.go).

This adds util/httptransport.New(), which returns a new transport with Go's DefaultTransport settings and its own connection pool. The settings come from the hand-written copy the Cloud exporters adopted in 2d57a93. It replaces:

  • core/llm_otel.go: local LLM endpoints dialed through the session tunnel
  • dagql/cache_part_content.go: the offered part-content transport
  • engine/remotecache/remotecache.go: the blob upload client
  • core/sdk/dang/shared/shared.go and its test: Dang nested clients (fix(dang): drain the nested client's connection pool before shutdown #14180)
  • engine/telemetry/cloud_export_sequence.go: the Cloud exporters' copy of these settings

A test checks that New() keeps matching DefaultTransport's settings, so it notices if Go changes them.

Not changed here: .dagger/modules/cli-dev/release_github.go (CI tooling in a separate module) and the registry resolver, which already checks its type assertion.

No behavior change is intended, so there's no changelog fragment.

Add httptransport.New, which builds a transport with Go's DefaultTransport
settings and its own pool, and use it wherever we cloned
http.DefaultTransport through an unchecked *http.Transport assertion (LLM
local tunnels, offered part content, remote cache uploads, Dang nested
clients). That assertion panics if anything swaps the variable, as some core
tests do. The Cloud exporters' hand-written copy of the same settings now
uses it too.

Signed-off-by: Alex Suraci <[email protected]>
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