fix(github): bound the default HTTP client with a timeout - #522
Merged
Conversation
The GitHub client fell back to http.DefaultClient, which has no timeout: a connection the server's edge silently abandons parks the request — and with it the whole review run — indefinitely. Observed in the wild as completed runs lingering ~27 minutes holding nothing but an ESTABLISHED github socket, until an external supervisor killed them. All requests on this client are REST/GraphQL JSON exchanges, so a 2-minute total-request timeout is generous. Callers that supply their own HTTPClient keep full control.
piekstra-dev
left a comment
Collaborator
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 7b64f25d0e0f
Profile: reviewer - Posting as: piekstra-dev
Summary
| Reviewer | Findings |
|---|---|
| go:implementation-tests | 0 |
Reviewer Coverage
| Reviewer | Status | Inspected | Skipped | Constraints |
|---|---|---|---|---|
| go:implementation-tests | incomplete_failed | unavailable | unavailable | structured output invalid after retry: first: llm: unsupported findings schema_version 0; second: llm: finding file "internal/gitprovider/github/app_auth_test.go" is not in changed files |
Reviewer Diagnostics
| Reviewer | Status | Diagnostic |
|---|---|---|
| go:implementation-tests | failed | structured output invalid after retry: first: llm: unsupported findings schema_version 0; second: llm: finding file "internal/gitprovider/github/app_auth_test.go" is not in changed files |
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 2m 54s | unavailable | claude-sonnet-5 | cr 0.10.259
| Field | Value |
|---|---|
| Model | claude-sonnet-5 |
| Reviewers | go:implementation-tests |
| Engine | claude_cli · claude-sonnet-5 |
| Reviewed by | cr · piekstra-dev |
| Duration | 2m 54s wall · 2m 32s compute |
| Cost | unavailable |
| Tokens | unavailable |
Per-workstream usage
| Workstream | Model | In | Out | Cache read | Cache create | Cost | Duration |
|---|---|---|---|---|---|---|---|
| orchestrator-selection | claude-sonnet-5 | unavailable | unavailable | unavailable | unavailable | unavailable | 12s |
| go:implementation-tests | claude-sonnet-5 | unavailable | unavailable | unavailable | unavailable | unavailable | 2m 08s |
| orchestrator-rollup | claude-sonnet-5 | unavailable | unavailable | unavailable | unavailable | unavailable | 11s |
…n paths Both the PAT and GitHub-App constructors now use one defaultBoundedHTTPClient helper, and the test covers the shared fallback directly.
piekstra-dev
approved these changes
Jul 19, 2026
piekstra-dev
left a comment
Collaborator
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 7dc91412eebf
Profile: reviewer - Posting as: piekstra-dev
Summary
| Reviewer | Findings |
|---|---|
| go:implementation-tests | 0 |
Reviewer Coverage
| Reviewer | Status | Inspected | Skipped | Constraints |
|---|---|---|---|---|
| go:implementation-tests | complete_broad | internal/gitprovider/github/app_auth.go, internal/gitprovider/github/client.go, internal/gitprovider/github/client_test.go | unavailable | unavailable |
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 1m 49s | unavailable | claude-sonnet-5 | cr 0.10.259
| Field | Value |
|---|---|
| Model | claude-sonnet-5 |
| Reviewers | go:implementation-tests |
| Engine | claude_cli · claude-sonnet-5 |
| Reviewed by | cr · piekstra-dev |
| Duration | 1m 49s wall · 1m 10s compute |
| Cost | unavailable |
| Tokens | unavailable |
Per-workstream usage
| Workstream | Model | In | Out | Cache read | Cache create | Cost | Duration |
|---|---|---|---|---|---|---|---|
| orchestrator-selection | claude-sonnet-5 | unavailable | unavailable | unavailable | unavailable | unavailable | 11s |
| go:implementation-tests | claude-sonnet-5 | unavailable | unavailable | unavailable | unavailable | unavailable | 42s |
| orchestrator-rollup | claude-sonnet-5 | unavailable | unavailable | unavailable | unavailable | unavailable | 16s |
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.
Problem
The GitHub client falls back to
http.DefaultClientwhen noHTTPClientis supplied (client.go,app_auth.go).http.DefaultClienthas no timeout, so a request on a connection that the server's edge has silently abandoned blocks forever —ctxonly helps when the caller's context carries a deadline, and the CLI's top-level contexts don't.Observed in production today (several occurrences under high parallel API load): review runs that had finished all local work (ledger complete, review posted) lingering ~27 minutes with everything closed except one ESTABLISHED socket to github.com, until an external supervisor's deadline killed them. Exit codes on reap were the processes' natural codes — they were parked, not crashed.
Fix
Replace the
http.DefaultClientfallback with&http.Client{Timeout: 2m}at both construction sites. Every request on this client is a REST/GraphQL JSON exchange, so two minutes is generous headroom; a caller-suppliedHTTPClientis untouched.Tests
TestDefaultHTTPClientIsBoundedasserts the fallback client has a positive timeout and is not the sharedhttp.DefaultClient.