Carry the project host on GitHub item dialog origins

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinjing
2026-07-19 18:06:08 -07:00
co-authored by Orca
parent 83938758ac
commit 65be43d9bc
8 changed files with 64 additions and 18 deletions
+9 -3
View File
@@ -134,13 +134,19 @@ vi.mock('./github-api-repository', async (importOriginal) => {
// Mirror production: dotcom origin slugs come back pinned to github.com.
return slug ? { host: 'github.com', ...slug } : slug
},
getIssueGitHubApiRepository: (repoPath: string, connectionId?: string | null) =>
getIssueOwnerRepoMock(repoPath, connectionId),
getIssueGitHubApiRepository: async (repoPath: string, connectionId?: string | null) => {
const slug = await getIssueOwnerRepoMock(repoPath, connectionId)
// Mirror production: issue slugs come back host-qualified to github.com.
return slug ? { host: 'github.com', ...slug } : slug
},
resolveIssueGitHubApiRepositorySource: async (
repoPath: string,
_preference: unknown,
connectionId?: string | null
) => ({ source: await getIssueOwnerRepoMock(repoPath, connectionId), fellBack: false })
) => {
const slug = await getIssueOwnerRepoMock(repoPath, connectionId)
return { source: slug ? { host: 'github.com', ...slug } : slug, fellBack: false }
}
}
})
+16
View File
@@ -65,6 +65,11 @@ export async function getIssue(
connectionId,
localGitOptions
)
// Why: a connection-backed request has no local cwd, so the non-GitHub
// fallback below would let gh target its default repository. Refuse instead.
if (connectionId && !ownerRepo) {
return null
}
await acquire()
try {
if (ownerRepo) {
@@ -126,6 +131,17 @@ export async function listIssues(
connectionId,
localGitOptions
)
// Why: a connection-backed request has no local cwd, so the non-GitHub
// fallback below would let gh list its default repository. Refuse instead.
if (connectionId && !ownerRepo) {
return {
items: [],
error: {
type: 'not_found',
message: 'Could not resolve GitHub owner/repo for this repository'
}
}
}
await acquire()
try {
if (ownerRepo) {