Skip to content

Support fork pull requests in workspace PR status lookup #495

Description

@aidxun

Problem

Workspaces that have valid upstream pull requests opened from a fork do not show PR status in the top-right workspace header / inspector surfaces.

Observed examples in the local Helmor workspace list:

The PRs exist and are open, but the corresponding workspace rows remain with pr_sync_state = none and no pr_url, so the UI behaves as if no PR is linked.

Why it happens

The GitHub PR lookup uses pullRequests(headRefName: ...), then drops every result where isCrossRepository is true:

  • src-tauri/src/forge/github/pull_request.rs -> pick_in_repo_pr
  • src-tauri/src/forge/github/actions.rs -> pick_in_repo_action_pr

That was introduced in aa034942e28b7aa670adc8bd6633fcfef0af9c54 / #434 to avoid mis-associating a workspace on a shared branch like main with an unrelated fork PR using the same branch name.

That fix prevents false positives, but it also filters out legitimate fork PRs created by the bound forge account.

Suggested fix

Do not reject all cross-repository PRs. Instead, accept a cross-repository PR when its fork owner matches the repository's bound forge account.

Suggested matching rule:

The GraphQL query already has access to isCrossRepository; it likely needs to also select headRepositoryOwner { login } for both lookup and action-status queries.

Validation

A good regression test would cover:

  1. same-repository PR still matches
  2. cross-repository PR from unrelated owner is ignored
  3. cross-repository PR from the bound forge_login is matched and syncs pr_sync_state / pr_url
  4. action status uses the same matching behavior as PR lookup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions