镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Bug]: gh stack ignores per-host api_host (go-gh pinned at v2.13.0) #549

Description

@kaimallea

Describe the bug

gh lets you override a host's API endpoint with api_host in hosts.yml:

example.ghe.com:
    api_host: api-proxy.example.com

gh itself honors it, but gh stack does not. It pins github.com/cli/go-gh/v2 at v2.13.0, and per-host api_host support was added to go-gh in v2.15.0. As a result, gh stack sends its REST and GraphQL requests to the host's default API endpoint.

When that endpoint isn't reachable, for example because the network only allows the configured API host, gh stack submit fails with a misleading message: Stacked PRs are not enabled for this repository.

Fix: bump github.com/cli/go-gh/v2 from v2.13.0 to v2.16.1, the latest release. No code changes are needed: go-gh resolves api_host when the clients in internal/github are created. The other go.mod/go.sum changes are transitive updates. A one-commit fix is on kaimallea/gh-stack branch bump-go-gh-api-host. I tried to open a PR, but outside contributors can't create PRs on this repo. Happy to open one if you can enable that.

Affected command

gh stack submit (also gh stack view, and any command that calls the API)

gh-stack version

gh stack version 0.2.0

GitHub CLI version

gh version 2.102.0 (2026-09-30)

Operating system

macOS 27.0.1

Shell

zsh

Steps to reproduce

  1. Configure a host with an api_host override in ~/.config/gh/hosts.yml (see above), on a network where only the configured API host is reachable.
  2. In a repository on that host, run GH_DEBUG=api gh stack submit --auto (or GH_DEBUG=api gh stack view).
  3. Observe the request URL in the debug output.

Expected behavior

gh stack sends API requests to the configured api_host, as gh does.

Actual behavior

gh stack sends API requests to the host's default API endpoint. The request fails, and submit reports that stacked PRs aren't enabled for the repository.

With go-gh bumped to v2.16.1, the same GH_DEBUG=api gh stack view sends requests to the configured api_host and succeeds. go build ./... and go vet ./... pass. Hosts without api_host are unaffected: go-gh only changes the endpoint when the setting is present.

Terminal output

$ GH_DEBUG=api gh stack submit --auto
Checking stack state...
* Request to https://api.example.ghe.com/repos/OWNER/REPO/stacks?per_page=100&page=1
> GET /repos/OWNER/REPO/stacks?per_page=100&page=1 HTTP/1.1
> Host: api.example.ghe.com
* remote error: tls: access denied
⚠ Stacked PRs are not enabled for this repository

Preflight checks

  • I searched the existing issues for duplicates.
  • I ran gh extension upgrade stack and reproduced this issue on the latest stable release.

Activity

  1. kaimallea commented on Oct 8, 2026

    @kaimallea
    Author

    @ktravers thank you! is it possible to cut a release so that people can upgrade their extensions to receive this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions