refactor: centralize HTTP client in internal/httpx (#1503 partial 8.3)#1533
Merged
Conversation
- New internal/httpx package: shared Client with timeout, retry, and
audit hook configuration. Single network policy across the codebase.
- Migrate contract/llm_judge, forge/detect, github, onboarding to consume
httpx.Client. forge probes and github use single-shot mode (their
callers handle retry/rate-limit). llm_judge keeps 60s timeout, retries
twice on transient 5xx.
- Verify formatDuration consolidation (8.5): tui/pipeline_list,
webui/embed, webui/handlers_runs all use internal/humanize. Only
audit/logger keeps a private formatDuration ("%.3fs" trace format) by
design — different output shape from humanize.
Closes #1503.
This was referenced Apr 29, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New
internal/httpxpackage: shared HTTPClientwith timeout, retry (exponential backoff with cap), and audit-emitter hooks. Eliminates 7 of 9&http.Client{}constructions across the codebase. 8.5 formatDuration verified — already consolidated by PR #1408.Public API
Defaults
MaxRetries: 0+ non-zero retry-wait fields = explicit single-shot intentPer-site policy migrated
contract/llm_judgeforge/detect.probeHTTPClientgithub.Clientonboarding.probeOllamaModels8.5 formatDuration verification
tui/pipeline_list.go: removed by PR refactor(humanize): consolidate duration formatters into internal/humanize #1408webui/embed.go,webui/handlers_runs.go: usehumanize.DurationSecondsaudit/logger.go:144: keeps privateformatDurationreturning"%.3fs"(millisecond precision) — intentional per specspecs/1163-consolidate-humanizers/spec.md:33. No migration needed.Out of scope (deferred follow-up)
internal/hooks/{http,webhook_runner}.go— 2 remaining&http.Client{}. Trivial follow-up.Validation
go build ./...+go vet ./...cleango test -race ./internal/httpx/... ./internal/contract/... ./internal/forge/... ./internal/github/... ./internal/onboarding/...all passgolangci-lint0 issuesTest plan
wave runwith agent_review contract)wave init)Partial of #1503 (subset 8.3 + 8.5 verify). Parent: #1494.