fix(github): preserve GHES non-default auth ports
Summary
- require an exact authenticated
host:portfor GHES HTTP(S) remotes with an explicit non-default port - preserve scheme-specific non-default ports such as HTTPS
:80and HTTP:443, while leaving protocol-default ports equivalent to portless hosts - retain unique ported endpoint discovery for hostname-only SSH remotes and reject ambiguous inventories
- add deterministic coverage for inventory ordering, cache isolation, and propagation through repository execution into
gh api --hostname
Impact
This fixes a regression introduced in #8932 where https://ghe.acme.com:8443/team/orca.git could authenticate against a portless ghe.acme.com inventory entry and then execute API calls against the wrong endpoint. Explicit non-default web ports can no longer be downgraded, preventing wrong-host API routing and credential use. Default-port and SSH hostname-only behavior remains supported.
Validation
pnpm exec vitest run --config config/vitest.config.ts src/main/github/github-enterprise-repository.test.ts src/main/github/github-api-repository.test.ts src/main/github/github-remote-identity-parsing.test.ts src/main/github/client-pr-local-runtime.test.ts src/main/git/runner-gh-host-args.test.ts— 5 files passed, 75 tests passedpnpm exec vitest run --config config/vitest.config.ts src/main/github src/main/git/runner-gh-host-args.test.ts src/main/git/runner-gh-rate-limit-breaker.test.ts src/main/git/runner-wsl-gh-fallback.test.ts— 39 files passed, 566 tests passedpnpm run typecheck— passed (node, CLI, and web)pnpm exec oxlint src/main/github/github-enterprise-repository.ts src/main/github/github-enterprise-repository.test.ts src/main/github/github-api-repository.test.ts src/main/github/client-pr-local-runtime.test.ts src/main/git/runner-gh-host-args.test.ts— passed- commit hooks (
oxlint, React Doctor lint,oxfmt) — passed
Repository-wide check notes
pnpm run lintreaches two pre-existing switch-exhaustiveness errors insrc/renderer/src/components/skills/skill-freshness-group.tsxandsrc/main/daemon/daemon-server.ts; both files are unchanged fromorigin/main.- A sanitized
pnpm testrun completed 33,284 tests successfully and hit two full-suite-only WebSocket connection failures insrc/shared/remote-runtime-shared-control-connection.test.ts; the file passed independently (23/23). The first unsanitized run also exposed inherited Orca terminalGIT_CONFIG_*entries in a relay environment assertion; that file passed independently with the inherited variables removed (10/10). These files are outside this diff.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7601d1c9-0702-420c-9af7-f7c809233962
📥 Commits
Reviewing files that changed from the base of the PR and between 6c9be228ad92805c9bc227d575de05facd4dac06 and e500ccc40eccdc13dc01743a7d125805fd982a82.
📒 Files selected for processing (5)
src/main/git/runner-gh-host-args.test.tssrc/main/github/client-pr-local-runtime.test.tssrc/main/github/github-api-repository.test.tssrc/main/github/github-enterprise-repository.test.tssrc/main/github/github-enterprise-repository.ts
📝 Walkthrough
Walkthrough
GitHub Enterprise host normalization now preserves explicit ports and requires exact port matches against authentication inventory. Tests cover multiple authenticated hosts, default-port handling, ambiguous SSH host mappings, and cache separation. Repository execution, pull request runtime, and GitHub CLI argument tests now verify that Enterprise ports remain present in URLs, host options, and injected command arguments.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly and concisely states the main change: preserving non-default GHES auth ports. |
| Description check | ✅ Passed | The PR description covers summary, impact, validation, and notes, but omits screenshots and the AI review/security audit sections. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
📝 Generate docstrings
- [ ] Create stacked PR
- [ ] Commit on current branch
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.