Agents - revert the adoption of GraphQL for polling#312758
Merged
Conversation
This reverts commit 3981b5d.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reverts a prior change that adopted GraphQL for PR polling in the Agents (sessions) GitHub integration, moving PR snapshot/mergeability fetching back toward REST while keeping GraphQL where still needed (review threads).
Changes:
- Split PR fetching into separate calls for PR details, mergeability, and review threads (instead of a single combined GraphQL snapshot).
- Update reactive models to refresh threads independently and simplify polling logic.
- Adjust tests to match the new fetcher/model API shapes.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/github/browser/fetchers/githubPRFetcher.ts | Reworks PR fetching to REST for PR + mergeability, and GraphQL for review threads. |
| src/vs/sessions/contrib/github/browser/models/githubPullRequestModel.ts | Updates refresh/polling and adds refreshThreads() to refresh threads independently. |
| src/vs/sessions/contrib/github/browser/models/githubPullRequestCIModel.ts | Simplifies refresh/polling behavior for CI checks. |
| src/vs/sessions/contrib/codeReview/browser/codeReviewService.ts | Switches initial PR review loading to use refreshThreads(). |
| src/vs/sessions/contrib/github/test/browser/githubFetchers.test.ts | Updates fetcher tests/helpers to align with REST PR responses + GraphQL threads. |
| src/vs/sessions/contrib/github/test/browser/githubModels.test.ts | Updates model tests for the new fetcher/model API split and refreshThreads(). |
Copilot's findings
Comments suppressed due to low confidence (2)
src/vs/sessions/contrib/codeReview/browser/codeReviewService.ts:711
- After switching the initial fetch to
refreshThreads(), this still starts polling viaprModel.startPolling(), whose poll cycle refreshes all PR data (PR details + mergeability + threads). If CodeReviewService only needs review threads, consider using a threads-only polling path to avoid extra REST calls and reduce risk of GitHub API rate limiting.
prModel.refreshThreads().catch(err => {
this._logService.error('[CodeReviewService] Failed to fetch PR review threads:', err);
data.state.set({ kind: PRReviewStateKind.Error, reason: String(err) }, undefined);
});
prModel.startPolling();
src/vs/sessions/contrib/github/browser/fetchers/githubPRFetcher.ts:194
- The code/comment says it checks the "most recent review per reviewer", but the implementation just overwrites map entries in iteration order and ignores
submitted_at. If the API returns reviews newest-first (or any non-guaranteed ordering), this can misclassify changes-requested/approval blockers. Track the latest review per user by comparing timestamps (similar to the previous GraphQL-based logic) so blocker detection is order-independent.
// Changes requested — check most recent review per reviewer
const latestReviewByUser = new Map<string, string>();
for (const review of reviews) {
if (review.state === 'APPROVED' || review.state === 'CHANGES_REQUESTED' || review.state === 'DISMISSED') {
latestReviewByUser.set(review.user.login, review.state);
}
}
- Files reviewed: 6/6 changed files
- Comments generated: 5
bpasero
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reverts commit 522c9dd.
This reverts commit 3981b5d.
Reduce duplicate calls to get the details of a pull request.