Make repository identity host-aware across all GitHub surfaces

Generalize the auth-gated enterprise resolver to any remote and build a
cached hosted-identity family (origin/issue/candidates/source) on top of
it, then migrate every github.com-only consumer: Tasks listing/counting,
branch-to-PR discovery, push targets, fork upstream, issue operations,
Projects, web links, avatars, and PR-link facts. Scope the rate-limit
breaker probe per runtime:host and classify WSL UNC cwds correctly.

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 bcb895bf43
commit 9a2af96ccc
39 changed files with 1663 additions and 568 deletions
+36 -3
View File
@@ -207,6 +207,9 @@ const ProjectOwnerType = z.enum(['organization', 'user'])
const ProjectViewTable = z.object({
owner: requiredString('Missing owner'),
// Why: Enterprise host identity must survive RPC parsing; Zod strips
// undeclared fields before the runtime can host-qualify gh requests.
host: OptionalString,
ownerType: ProjectOwnerType,
projectNumber: z.number().int().positive(),
viewId: OptionalString,
@@ -221,17 +224,26 @@ const ProjectWorkItemDetailsBySlug = SlugRepo.extend({
})
const ProjectRef = z.object({
input: requiredString('Missing project reference')
input: requiredString('Missing project reference'),
// Why: Enterprise host identity must survive RPC parsing; Zod strips
// undeclared fields before the runtime can host-qualify gh requests.
host: OptionalString
})
const ProjectViews = z.object({
owner: requiredString('Missing owner'),
// Why: Enterprise host identity must survive RPC parsing; Zod strips
// undeclared fields before the runtime can host-qualify gh requests.
host: OptionalString,
ownerType: ProjectOwnerType,
projectNumber: z.number().int().positive()
})
const ProjectItemField = z.object({
projectId: requiredString('Missing project ID'),
// Why: Enterprise host identity must survive RPC parsing; Zod strips
// undeclared fields before the runtime can host-qualify gh requests.
host: OptionalString,
itemId: requiredString('Missing item ID'),
fieldId: requiredString('Missing field ID'),
value: z.any()
@@ -239,6 +251,9 @@ const ProjectItemField = z.object({
const ClearProjectItemField = z.object({
projectId: requiredString('Missing project ID'),
// Why: Enterprise host identity must survive RPC parsing; Zod strips
// undeclared fields before the runtime can host-qualify gh requests.
host: OptionalString,
itemId: requiredString('Missing item ID'),
fieldId: requiredString('Missing field ID')
})
@@ -246,6 +261,9 @@ const ClearProjectItemField = z.object({
const SlugIssueUpdate = z.object({
owner: requiredString('Missing owner'),
repo: 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(),
updates: IssueUpdate
})
@@ -253,6 +271,9 @@ const SlugIssueUpdate = z.object({
const SlugPullRequestUpdate = z.object({
owner: requiredString('Missing owner'),
repo: 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(),
updates: z.object({
state: z.enum(['open', 'closed']).optional(),
@@ -264,6 +285,9 @@ const SlugPullRequestUpdate = z.object({
const SlugIssueTypeUpdate = z.object({
owner: requiredString('Missing owner'),
repo: 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(),
issueTypeId: z.string().nullable()
})
@@ -271,6 +295,9 @@ const SlugIssueTypeUpdate = z.object({
const SlugIssueComment = z.object({
owner: requiredString('Missing owner'),
repo: 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(),
body: requiredString('Comment body required')
})
@@ -278,6 +305,9 @@ const SlugIssueComment = z.object({
const SlugIssueCommentEdit = z.object({
owner: requiredString('Missing owner'),
repo: 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,
commentId: z.number().int().positive(),
body: requiredString('Comment body required')
})
@@ -285,6 +315,9 @@ const SlugIssueCommentEdit = z.object({
const SlugIssueCommentDelete = z.object({
owner: requiredString('Missing owner'),
repo: 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,
commentId: z.number().int().positive()
})
@@ -554,8 +587,8 @@ export const GITHUB_METHODS: RpcMethod[] = [
}),
defineMethod({
name: 'github.project.listAccessible',
params: z.object({}),
handler: async (_params, { runtime }) => runtime.listGitHubProjects()
params: z.object({ host: OptionalString }),
handler: async (params, { runtime }) => runtime.listGitHubProjects(params)
}),
defineMethod({
name: 'github.project.listLabelsBySlug',