Skip to content

[Bug][github_graphql] Collect Pull Requests fails every run when a stored OPEN PR no longer resolves #9438

Open

Description

@ahnazary

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

The github_graphql Collect Pull Requests subtask fails the whole pipeline when one stored OPEN pull request can no longer be resolved by GitHub. It then fails on every scheduled run, because the PR stays OPEN in _tool_github_pull_requests and is re-fetched each time.

[Collect Pull Requests] the first error of them
	caused by: graphql query got error
	Wraps: (2) Could not resolve to a PullRequest with the number of 5329.
	Error types: (1) *hintdetail.withDetail (2) graphql.DataError
subtask Collect Pull Requests ended unexpectedly

In our case the PR still exists (closed, not merged) for a regular user token. For the connection's GitHub App, GET /repos/{owner}/{repo}/pulls/{number} returns 404 for that one PR, while neighbouring PRs in the same repo, and other PRs by the same author, return 200. So GitHub can hide a single PR from an App, and the PR can also be deleted outright, as in #8817.

What do you expect to happen

An unresolvable PR is skipped with a warning, the other PRs in the same batched query are still refreshed, and the pipeline succeeds. This is already how issues are handled.

How to reproduce

  1. Collect a GitHub repo with github_graphql while some PR is OPEN.
  2. Make that PR unresolvable for the connection (delete it, or have it hidden from the GitHub App) after it was closed.
  3. Run the blueprint again: the refetch-open-PRs query in plugins/github_graphql/tasks/pr_collector.go gets a Could not resolve to a PullRequest data error, and GraphqlCollector.fetchAsync fails the subtask.

Anything else

Root cause is in backend/helpers/pluginhelper/api/graphql_collector.go: isIgnorableGraphqlQueryError only matches Could not resolve to an Issue (#8820) and Linear's Entity not found: Issue (#9322), so the PR equivalent is a hard error.

Minimal fix: also match Could not resolve to a PullRequest. The missing alias comes back as a zero-value entry, and the PR refetch ResponseParser already drops it because its UpdatedAt is not after the stored value. This is the same idea as #8817, which was reported for the REST collector and auto-closed as stale. Optional follow-up: clean up the stale PR row, as #8820 does for issues.

Workaround: set the PR's state to CLOSED in _tool_github_pull_requests.

Version

v1.0.3-beta19; still present on main (43b323c)

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

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

Metadata

Metadata

Assignees

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

    ⌂ Proxy