Bound GHES identity caches and preserve non-default ports in host identity

Cap the origin-repo and host-auth caches like ownerRepoCache; keep ports
from remote/link URLs so GHES on a non-default port is a distinct
identity; make positional github.com slugs explicit against GH_HOST;
compare work-item sources by host-aware identity key; bail cwd-less
branch lookups when no repository candidate resolved; thread host
through the renderer work-item slug lookup.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinjing
2026-07-19 18:03:49 -07:00
co-authored by Orca
parent e2df39ab75
commit bcc39bc9d6
17 changed files with 124 additions and 41 deletions
+8 -6
View File
@@ -1539,12 +1539,9 @@ async function countWorkItemsForQuery(
function sameOwnerRepo(left: OwnerRepo | null, right: OwnerRepo | null): boolean {
// Why: GitHub treats owner and repo names as case-insensitive, so remotes
// with different casing (StablyAI/Orca vs stablyai/orca) point at the same
// repo and should not split into two search queries.
return (
left?.owner.toLowerCase() === right?.owner.toLowerCase() &&
left?.repo.toLowerCase() === right?.repo.toLowerCase()
)
// with different casing point at the same repo, but identical slugs on
// github.com and GHES are independent repositories.
return Boolean(left && right && githubRepoIdentityKey(left) === githubRepoIdentityKey(right))
}
function defaultOpenWorkItemQuery(): ParsedTaskQuery {
@@ -3017,6 +3014,11 @@ export async function getPRForBranchOutcome(
connectionId,
localGitOptions
)
// Why: connection-backed gh runs without a repository cwd. A bare lookup
// here can honor process GH_REPO/GH_HOST and return an unrelated PR.
if (connectionId && candidates.length === 0) {
return { kind: 'no-pr', fetchedAt: Date.now() }
}
let data: PullRequestLookupData | null = null
let dataRepo: OwnerRepo | null = null
let dataHeadRepo: OwnerRepo | null = headRepo