Skip to content

fix(client): apply no response-header timeout by default - #614

Open
Benehiko wants to merge 1 commit into
mainfrom
fix/client-indefinite-timeout-defaults
Open

fix(client): apply no response-header timeout by default#614
Benehiko wants to merge 1 commit into
mainfrom
fix/client-indefinite-timeout-defaults

Conversation

@Benehiko

Copy link
Copy Markdown
Member

Problem

The Go client defaults ResponseHeaderTimeout to 1 second (DefaultClientResponseHeaderTimeout). Any request where the daemon takes more than a second to start responding fails at the transport layer — and a request can legitimately block far longer than that on user interaction daemon-side: a store unlock, an authorization prompt, or a plugin waiting on input.

The request timeout already defaults to 0 (no limit) for exactly this reason, and the docker pass CLI already overrides both timeouts to 0 when it builds its client. Every other consumer of the SDK silently inherits the 1s cliff unless they know to call WithResponseTimeout(0) — wield just hit this (docker/wield#109).

Change

DefaultClientResponseHeaderTimeout is now 0 (no limit), matching the request-timeout default. Doc comments on WithResponseTimeout and the transport construction updated to match.

Consumers that pass explicit timeouts are unaffected; WithTimeout / WithResponseTimeout still apply a hard bound, as does a per-call context deadline.

Testing

  • go build ./... and go test ./... in the x, client, and plugin modules — all pass.

🤖 Generated with Claude Code

The client defaulted ResponseHeaderTimeout to 1 second, so any request
where the daemon took more than a second to start responding failed at
the transport layer. A request can legitimately block far longer than
that on user interaction daemon-side: a store unlock, an authorization
prompt, or a plugin waiting on input.

The request timeout already defaults to 0 (no limit) for exactly this
reason, and the docker pass CLI already overrides both timeouts to 0.
Make that the default for every consumer: DefaultClientResponseHeaderTimeout
is now 0 as well. Callers that need a hard bound can still set one with
WithResponseTimeout or a per-call context deadline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

The change is correct and well-reasoned. DefaultClientResponseHeaderTimeout was causing real failures for legitimate slow-start interactions (store unlock, auth prompts, plugin input — referenced in wield#109). Setting it to 0 aligns with the existing DefaultClientRequestTimeout = 0 design, matches what the docker pass CLI already explicitly does, and correctly reflects the secrets-engine domain where blocking on user interaction is expected.

What was checked:

  • The behavioral change from time.Secondtime.Duration(0) is intentional and correctly implemented via http.Transport.ResponseHeaderTimeout
  • Both RequestTimeout and ResponseHeaderTimeout now default to 0, consistent with each other and the PR rationale
  • Updated doc comments in WithResponseTimeout and the New() inline comment accurately describe the new default and correctly point callers to WithResponseTimeout or per-call context deadlines as opt-in bounds
  • No compilation issues; API contract for WithResponseTimeout (rejects negatives, 0 = no limit) is unchanged
  • The concern about non-interactive callers losing an implicit 1s safety net was evaluated and found to be a pre-existing design tradeoff the PR explicitly and correctly addresses — not a regression

No actionable issues found.

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