fix(ui): pass sourceRepo to PR/issue context calls for fork workflows (#2090) (#2091)

Fixes GitHub PR/issue context endpoints returning 404 when working
from a fork because they resolved the repo from origin remote only.

- Pass sourceRepo: status?.repo ?? null to all prContext() calls in
  PullRequestSection.tsx (5 call sites)
- Pass sourceRepo: args.pr.sourceRepo ?? null / args.issue.sourceRepo
  ?? null to NewWorktreeDialog.tsx (3 call sites: prContext, issueGet,
  issueComments)
- Add status?.repo to dependency arrays to prevent stale closures

The prStatus endpoint already resolves the correct repo through the
fork network; this change wires it through to the downstream API calls.

Closes #2090

Co-authored-by: bashrusakh <bashrusakh@users.noreply.github.com>
This commit is contained in:
Leonid
2026-07-11 14:37:33 +03:00
committed by GitHub
co-authored by bashrusakh
parent cd1ffa8b66
commit d01126cf3c
2 changed files with 13 additions and 10 deletions
@@ -496,12 +496,12 @@ export function NewWorktreeDialog({
return;
}
const issueRes = await github.issueGet(projectDirectory, args.issue.number);
const issueRes = await github.issueGet(projectDirectory, args.issue.number, { sourceRepo: args.issue.sourceRepo ?? null });
if (issueRes.connected === false || !issueRes.repo || !issueRes.issue) {
throw new Error('Failed to load issue context');
}
const commentsRes = await github.issueComments(projectDirectory, args.issue.number);
const commentsRes = await github.issueComments(projectDirectory, args.issue.number, { sourceRepo: args.issue.sourceRepo ?? null });
if (commentsRes.connected === false) {
throw new Error('Failed to load issue comments');
}
@@ -542,6 +542,7 @@ export function NewWorktreeDialog({
}
const prContext = await github.prContext(projectDirectory, args.pr.number, {
sourceRepo: args.pr.sourceRepo ?? null,
includeDiff: args.includeDiff,
includeCheckDetails: false,
});