Skip to content

Workspaces: show PRs opened from a fork against the upstream repository #8732

Open

Description

@mjspeck

Summary

  • A workspace on a fork can't show the PR that its branch opened against the upstream repository
  • The PR's source is the workspace's branch, but GitHub stores the PR in the upstream repository, and Superset only looks for PRs in the project's own repository
  • This affects every open-source contribution made from a fork: the sidebar PR status, the Board columns, and the PR pane all show no PR

Today

  • Project repo: github.com/mjspeck/xcore, a fork of SapienzaNLP/xcore
  • The workspace branch pr/transformers-5-support is pushed to the fork. Its PR is Support transformers 5.x and fix empty coreference clusters SapienzaNLP/xcore#16, with source mjspeck:pr/transformers-5-support
  • Superset reports no PR for the branch. The project's repository has no PR from that branch, which is correct, since the PR is upstream
  • The GitHub CLI finds the PR from the same worktree (gh pr view), because it resolves the fork's parent repository
  • Workaround: create a task, set its PR URL, and link the workspace to the task. The PR then appears on the task, but not as the workspace's PR status

Proposal

  • When the project's repository is a fork, also search its parent repository for PRs whose source is :
  • Or accept a full PR URL from another repository through Link PR on an existing workspace, not only in the new-workspace flow
  • Include those PRs in the sidebar PR status, the Board columns, and the Pull requests list

Environment
Superset 1.39.0, macOS (Darwin arm64)

Activity

  1. github-actions commented on Oct 21, 2026

    @github-actions
    Contributor

    Triage summary

    This is a feature gap, not a regression. On a project whose origin is a fork (here mjspeck/xcore, forked from SapienzaNLP/xcore), the v2 host-service PR runtime only looks for PRs in the project's own repository. PRs from fork contributions live in the parent repo with head mjspeck:<branch>, so the lookup never finds them. The workspace then shows no PR in the sidebar status, the Board columns or the PR pane. gh pr view does find the PR because the GitHub CLI resolves the fork's parent. The older desktop code path already handles forks the same way, but the host-service runtime never got that logic.

    Affected code

    • packages/host-service/src/runtime/pull-requests/pull-requests.ts:1052-1112: getProjectRepository builds the repo identity from projects.repoOwner/repoName or by parsing origin. It never asks GitHub whether the repo is a fork, and never records a parent.
    • packages/host-service/src/runtime/pull-requests/pull-requests.ts:950-988: performProjectRefresh builds wantedRefs from each workspace's upstream (mjspeck/xcore#pr/transformers-5-support). That head ref is correct, but it passes the same repo (the fork) as the base for the lookup.
    • packages/host-service/src/runtime/pull-requests/pull-requests.ts:1399-1436: getCachedPullRequestByHead calls repos/{repo.owner}/{repo.name}/pulls?head=owner:branch, which here is repos/mjspeck/xcore/pulls?head=mjspeck:pr/transformers-5-support. The open-PR fallback sweep (:1523-1549) has the same scope. Both return nothing, because the PR's base is SapienzaNLP/xcore.
    • packages/host-service/src/runtime/pull-requests/utils/github-query/github-query.ts:229-276: the gh/Octokit pulls list calls themselves, which take the base repo as a parameter.
    • packages/host-service/src/runtime/pull-requests/pull-requests.ts:1149-1163 and :1180-1267: findPullRequestRow and upsertPullRequestRow key rows on the project's repoOwner/repoName. The details fetch (getCachedPullRequestDetails, :1438) also queries the reviews, checks and merge queue against repo. All of these would need to use the PR's real base repo.

    Existing fork handling (desktop, not host-service)

    The desktop has the logic this needs: apps/desktop/src/lib/trpc/routers/workspaces/utils/github/repo-context.ts:6-60 runs gh repo view --json url,isFork,parent and builds { repoUrl, upstreamUrl, isFork }. getPullRequestRepoArgs (:149-163) then adds --repo <parent>. apps/desktop/src/lib/trpc/routers/changes/utils/pull-request-discovery.ts:137-144 does the same. The host-service runtime does not use either.

    Second proposal (Link PR on an existing workspace)

    The host-service pullRequests router only exposes unlink for existing workspaces (packages/host-service/src/trpc/router/pull-requests/pull-requests.ts:62). The one explicit link path is linkWorkspaceToCheckoutPullRequest (pull-requests.ts:593-652), which is used by the new-workspace checkout flow. Even that path stores the PR row under the project's repo (findPullRequestRow(repo, …), upsertPullRequestRow({ repo, … })). So linking a cross-repo PR URL would also need the base repo stored per PR row, not taken from the project.

    Suggested reproduction

    1. Fork any public repo, clone the fork, and add it as a project in Superset (origin = fork).
    2. Create a workspace, push a branch to the fork, and open a PR against the parent repo.
    3. Run a PR refresh. The sidebar shows no PR, while gh pr view in the worktree shows it.

    A sketch for pull-requests.test.ts: seed a project with repoOwner: "fork-owner" and a workspace with upstreamOwner: "fork-owner". Stub execGh so that repos/fork-owner/x/pulls returns [] and repos/parent-owner/x/pulls?head=fork-owner:branch returns one PR. Today the workspace's pullRequestId stays null.

    Suggested fix direction

    1. Resolve and cache the parent repo once per project, for example gh api repos/{owner}/{name} --jq .parent.full_name with an Octokit repos.get fallback. It could be stored as nullable columns on projects, next to repoOwner/repoName. A host-service schema change would need the migration skill checklist.
    2. In fetchRepoPullRequests, when a head lookup against the project repo misses and a parent exists, repeat the head lookup against the parent. Keep this to head lookups only, not the open-PR sweep over the parent, which would be costly on large upstreams. It should go through the same cachedGitHubFetch and availability gate.
    3. Pass the base repo the PR was actually found in down to getCachedPullRequestDetails, findPullRequestRow and upsertPullRequestRow. That makes pullRequests.repoOwner/repoName the upstream (SapienzaNLP/xcore) and stops a fork PR add electron installation fix documentation #16 from colliding with the fork's own PR add electron installation fix documentation #16.
    4. Optionally, add a host-service procedure to link an existing workspace to a PR URL from any repo, built on a generalized linkWorkspaceToCheckoutPullRequest.

    Before changing any procedure inputs, read packages/trpc/AGENTS.md, because released clients still call these procedures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions