Triggering Ad-Hoc Sync between SonarQube and GitHub API

Hi, everyone

A question based on this topic.

Copilot usage can take up to 24 hours to be reflected in GitHub’s API, which SonarQube will query once a day. 
If you want, you can query the user_ai_tool_usages table of your SonarQube database to see if any data has been synced.

I’m wondering if it’s possible to trigger an ad-hoc sync between SonarQube and GitHub API. We are using SonarQube Server Enterpriser v2025.3.

Hey @IuriGarcia

It’s not possible to trigger an ad-hoc sync.

As you’ve been exploring the feature, have you seen the table populate?

Hello, @Colin

Yeah, i’ve checked the table and it’s still empty. I followed this steps in order to achieve AI code autodetection but even after several scans SonarQube is not displaying the AI code detected status for any project.

Autodetect AI-Generated Code setting is activated at both the project and global levels, and some projects are already using the new Quality Gate “Sonar way for AI code”. However, the same happens for those. the same issue occurs for those projects as well. All necessary permissions listed in the documentation have been granted to the GitHub App used for this integration, and the email approval has also been completed.

I don’t know what I am missing here.

1 Like

@IuriGarcia

I’ll admit this has been a tricky feature to get working in other’s environments.

As a first step, do you see any log messages in your web.log like:

2025.06.21 01:16:30 INFO  web[][com.sonar.D.P.P.Q] Fetching Copilot seats information for 2 Github App configurations
2025.06.21 01:16:30 INFO  web[][com.sonar.D.P.P.P.D] Github App installation <ID> for organization <ORG> does not have required permissions to access Copilot usage data
2025.06.21 01:16:32 INFO  web[][com.sonar.D.P.P.P.D] Fetched 396 Copilot seats for organization <ORG> and installation <ID>
2025.06.21 01:16:32 INFO  web[][com.sonar.D.P.P.Q] Successfully fetched 396 Copilot seats information

I’d suggest searching for the word “Copilot” or “seats”

@Colin

So, I’ve got some info here:

2025.06.30 21:20:22 INFO  web[][com.sonar.B.J.J.V] [Copilot] Fetching Copilot seats information for 1 Github App configurations
2025.06.30 21:20:25 INFO  web[][com.sonar.B.J.J.J.B] [Copilot] Fetched 241 Copilot seats for organization <ORG> and installation <ID>
2025.06.30 21:20:25 INFO  web[][com.sonar.B.J.J.V] [Copilot] Successfully fetched 241 Copilot seats information
2025.06.30 21:20:25 INFO  web[][com.sonar.B.J.J.V] [Copilot] Found 0 users matching Copilot seat assignment
2025.06.30 21:20:25 INFO  web[][com.sonar.B.J.J.V] [Copilot] Updated Copilot AI tool usage for 0 users

It looks like it’s fetching almost all seats (there should be 242), but it’s not finding any matching Copilot seats. This is strange, because when I generate an app token for the GitHub App used in this configuration and make a request with curl, the request returns information about the user and Copilot seat association.

Hi @IuriGarcia,

Good news—we know that part of the integration is working! :grinning_face_with_smiling_eyes:

For any of those 241 Copilot seats to be “matched” with a SonarQube user, the developers must:

  • Already have an account on your SonarQube instance
  • Match by login, email, or SCM account between GitHub and SonarQube

Do you currently have users in SonarQube that should match these criteria? The easiest thing to verify would be that you have a SonarQube user with the same e-mail as a GitHub user with a copilot seat.