Skip to content

[Bug][Github] Some GitHub pull-request domain records are missing or remain OPEN after successful collection #9150

Description

@cedriclecoz

Search before asking

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

What happened

The GitHub tool-layer pull-request records are current, but corresponding DevLake domain records in pull_requests are missing or remain OPEN after GitHub reports the PR as closed or merged.

This causes incorrect dashboard data despite successful GitHub collection.

Most pull requests are represented correctly in the pull_requests domain table. We found these inconsistencies while investigating a small number of dashboard records, then ran the comparison query to determine whether the behavior was isolated. The results show affected records across multiple repositories and two deployments, but do not imply that all PR conversions are failing, 60k+ are ok.

Observed in two independent deployments:

  • Deployment A: 124 affected PRs across 50 repositories: 88 missing domain records and 36 stale OPEN records.
  • Deployment B: 479 affected PRs across 55 repositories: 421 missing domain records and 58 stale OPEN records.

The GitHub tool record has the correct state and timestamps. The domain record is absent, or has status = 'OPEN' and no close/merge dates.

What do you expect to happen

After GitHub collection completes, every GitHub tool pull-request record should have a corresponding pull_requests domain record. Closed or merged GitHub PRs should not remain OPEN in the domain table, and their close/merge dates should be populated.

A full sync should reconcile previously missing or stale domain records.

How to reproduce

This query identifies closed or merged GitHub tool records whose domain representation is missing or still open. Replace [CONNECTION_ID] with the GitHub connection being investigated.

SELECT
  repo.name AS repository,
  tool_pr.number AS pull_request_number,
  tool_pr.github_id,
  tool_pr.state AS github_state,
  tool_pr.merged AS github_merged,
  tool_pr.github_updated_at,
  tool_pr.merged_at AS github_merged_at,
  tool_pr.closed_at AS github_closed_at,
  domain_pr.id AS domain_pull_request_id,
  domain_pr.status AS domain_status,
  domain_pr.original_status AS domain_original_status,
  domain_pr.merged_date AS domain_merged_date,
  domain_pr.closed_date AS domain_closed_date,
  domain_pr.updated_at AS domain_updated_at
FROM _tool_github_pull_requests AS tool_pr
LEFT JOIN pull_requests AS domain_pr
  ON domain_pr.id = CONCAT(
    'github:GithubPullRequest:',
    tool_pr.connection_id,
    ':',
    tool_pr.github_id
  )
LEFT JOIN _tool_github_repos AS repo
  ON repo.connection_id = tool_pr.connection_id
  AND repo.github_id = tool_pr.repo_id
WHERE tool_pr.connection_id = [CONNECTION_ID]
  AND (tool_pr.merged = 1 OR tool_pr.state = 'closed')
  AND (domain_pr.id IS NULL OR domain_pr.status = 'OPEN')
ORDER BY repo.name, tool_pr.number;

The expected domain ID convention is:

github:GithubPullRequest:[CONNECTION_ID]:[GITHUB_PULL_REQUEST_ID]

Anything else

Stale domain record

GitHub tool record
  state: closed
  merged: true
  merged_at: 2026-09-16 09:45:46
  closed_at: 2026-09-16 09:45:46

Domain record
  status: OPEN
  original_status: open
  merged_date: null
  closed_date: null
  updated_at: 2026-09-16 16:24:00.910

Missing domain record

GitHub tool record
  state: closed
  merged: true
  closed_at: 2026-09-16 20:55:37

Domain record
  no row exists for github:GithubPullRequest:[CONNECTION_ID]:[GITHUB_PULL_REQUEST_ID]

Question:

  • Is there a supported way to re-run or reconcile only the GitHub pull-request domain conversion stage?

Version

v1.0.3-beta17

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

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

    type/bugThis issue is a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions