Repository navigation
Open
Labels
bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorspriority-3Affects a small number of users or is largely cosmetic
Description
Problem
The telemetryDisablerTransport in api/http_client.go:165-170 checks every outgoing HTTP request with ghauth.IsEnterprise(host). If the host is not github.com, it calls telemetryDisabler.Disable(), which permanently disables telemetry for the entire CLI invocation.
func (t telemetryDisablerTransport) RoundTrip(req *http.Request) (*http.Response, error) {
if ghauth.IsEnterprise(getHost(req)) {
t.telemetryDisabler.Disable()
}
return t.wrappedTransport.RoundTrip(req)
}Several commands make legitimate HTTP requests to non-GitHub hosts through the factory HTTP client, triggering this check incorrectly.
Affected commands
| Command | Non-GitHub Host | How |
|---|---|---|
gh cs ports forward/list/visibility |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for port management |
gh cs ssh |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for SSH tunnel |
gh cs logs |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for log streaming |
gh cs jupyter |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for Jupyter forwarding |
gh cs rebuild |
global.rel.tunnels.api.visualstudio.com |
Dev-tunnels API for rebuild connection |
gh api <full-url> |
Any host | User can pass arbitrary URLs |
gh attestation download/verify/inspect |
Bundle URLs | Fetches attestation bundles directly |
gh extension install/upgrade |
Release asset URLs | Downloads from asset.APIURL |
How to reproduce
GH_TELEMETRY=log gh cs ports forward 3000:3000
# ctrl+c after ports are forwarded (requires signal handler fix from #13401)
# Output: "Telemetry payload: none"Impact
All codespace tunnel commands produce zero telemetry even for github.com users. The gh api command also loses telemetry whenever a user passes a full non-GitHub URL.
Possible fixes
- Allowlist known non-GitHub hosts - skip the enterprise check for known hosts like
visualstudio.com - Only check on GitHub API requests - only run the enterprise check when the request is to a host that looks like a GitHub API endpoint
- Check the configured host instead of request host - the intent is to detect GHES users, which is already done by
mightBeGHESUser()at startup. The transport-level check could be removed or narrowed to only trigger on hosts that match the configuredGH_HOSTor auth hosts
References
api/http_client.go:160-170-telemetryDisablerTransportinternal/ghcmd/cmd.go:88-mightBeGHESUser()(startup check)internal/ghcmd/cmd.go:103-104-telemetryService.Disable()(startup disable)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorspriority-3Affects a small number of users or is largely cosmetic
Activity
babakks commentedon May 12, 2026
I think another solution, which involves deeper investigation, is to limit the use of
f.HttpClientto GitHub API calls. There's no reason to use the same HTTP client for non-GH calls.eyupcanakman commentedon May 17, 2026
Looked into this.
GHES detection already runs once at startup via
mightBeGHESUser(), so the per-requestIsEnterprisecheck intelemetryDisablerTransportis redundant and fires on unrelated hosts. Option 3 (drop or narrow the transport-level check) would fix the reported commands without touching the github.com telemetry path.@babakks also mentioned not reusing
f.HttpClientfor non-GitHub calls. Is the intent here the narrow transport fix, or the larger client split? Either way I'll hold off until it's labeledhelp wanted.williammartin commentedon May 19, 2026
This isn't true. There are commands that accept hostname either via flags or arguments where
mightBeGHESUseris not true, for examplegh api https://my.ghes.com/api/v3orgh api --hostname my.ghes.com /userI agree we should probably have a different http client though.
eyupcanakman commentedon May 20, 2026
You're right, I missed the flag/arg hostname case. The per-request check has to stay, so non-GitHub calls go to their own client and the telemetry transport stays on the GitHub one.