Fix GitHub Enterprise host identity loss across PR/work-item paths

- Thread `host` through mobile PR RPC params, IPC work-item lookups, and
  RPC schemas so GHES identity survives the renderer/mobile/main boundary
  instead of silently falling back to a same-named github.com repo.
- Qualify `--repo`/`-R` args for github.com too (not just GHES), since
  gh resolves bare shorthand against a process-level GH_HOST that can
  redirect pinned github.com commands.
- Cache `getOriginGitHubApiRepository` to avoid a per-call uncached
  `git remote get-url` round trip on connection-backed repos.
- Add a local-fork fallback in `getWorkItemDetails` so PRs living on a
  base repo (not visible via the origin slug) still resolve via cwd.
- Centralize the github.com-vs-GHES host predicate in
  `isDefaultGitHubHost` so cache keys, quota scoping, and identity
  checks can't drift out of sync.
This commit is contained in:
Jinjing
2026-07-19 18:03:48 -07:00
parent 8ad7686fe3
commit bcb895bf43
28 changed files with 288 additions and 79 deletions
+8 -1
View File
@@ -26,6 +26,9 @@ const WorkItem = RepoSelector.extend({
const WorkItemByOwnerRepo = RepoSelector.extend({
owner: requiredString('Missing owner'),
ownerRepo: requiredString('Missing repo'),
// Why: Enterprise host identity must survive RPC parsing; Zod strips
// undeclared fields before the runtime can host-qualify gh requests.
host: OptionalString,
number: z.number().int().positive(),
type: z.enum(['issue', 'pr'])
})
@@ -345,7 +348,11 @@ export const GITHUB_METHODS: RpcMethod[] = [
handler: async (params, { runtime }) =>
runtime.getRepoWorkItemByOwnerRepo(
params.repo,
{ owner: params.owner, repo: params.ownerRepo },
{
owner: params.owner,
repo: params.ownerRepo,
...(params.host ? { host: params.host } : {})
},
params.number,
params.type
)