Skip to content

Agents - switch to using GraphQL for the PullRequestModel#309807

Merged
lszomoru merged 1 commit intomainfrom
lszomoru/dull-sawfish
Apr 14, 2026
Merged

Agents - switch to using GraphQL for the PullRequestModel#309807
lszomoru merged 1 commit intomainfrom
lszomoru/dull-sawfish

Conversation

@lszomoru
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 14, 2026 10:51
@lszomoru lszomoru enabled auto-merge (squash) April 14, 2026 10:51
@lszomoru lszomoru self-assigned this Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: b3a73624 Current: 8e902a11

Changed (3)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Dark
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after
agentSessionsViewer/NeedsInput/Dark
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Agents window GitHub PR integration to fetch a single “PR snapshot” via GraphQL (PR details + mergeability + review threads) and adjusts the reactive model, service usage, and tests accordingly.

Changes:

  • Replace the PR fetcher’s REST/GraphQL mix with a single GraphQL snapshot query and mapping.
  • Simplify GitHubPullRequestModel refresh behavior to one fetch + atomic observable updates (and remove refreshThreads).
  • Update CodeReviewService and browser tests to the new refresh/fetcher shape.
Show a summary per file
File Description
src/vs/sessions/contrib/github/browser/fetchers/githubPRFetcher.ts Switch to GraphQL snapshot query and derive PR/mergeability/threads from one response.
src/vs/sessions/contrib/github/browser/models/githubPullRequestModel.ts Refresh now fetches a full snapshot and updates observables in a transaction; refreshThreads removed.
src/vs/sessions/contrib/codeReview/browser/codeReviewService.ts Use prModel.refresh() for initial load (instead of threads-only refresh).
src/vs/sessions/contrib/github/test/browser/githubFetchers.test.ts Update tests to validate the new GraphQL snapshot behavior and return shape.
src/vs/sessions/contrib/github/test/browser/githubModels.test.ts Update model tests to match the new fetcher contract and refresh behavior.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/sessions/contrib/github/browser/fetchers/githubPRFetcher.ts:147

  • The GraphQL snapshot query hard-limits reviews, reviewThreads, and per-thread comments to first: 100 without any pagination. This can lead to missing threads/comments in the UI, and (more importantly) incorrect mergeability blocker detection when there are >100 reviews or threads. Consider adding pageInfo { hasNextPage endCursor } and paging with after, or at least requesting the most recent items explicitly (e.g. last: 100) and treating truncated data as Unknown mergeability.
	'      reviews(first: 100) {',
	'        nodes {',
	'          state',
	'          submittedAt',
	'          author {',
	'            login',
	'          }',
	'        }',
	'      }',
	'      reviewThreads(first: 100) {',
	'        nodes {',
	'          id',
	'          isResolved',
	'          path',
	'          line',
	'          comments(first: 100) {',
	'            nodes {',
  • Files reviewed: 5/5 changed files
  • Comments generated: 2

Comment on lines 705 to 709
// Start polling and initial fetch
prModel.refreshThreads().catch(err => {
prModel.refresh().catch(err => {
this._logService.error('[CodeReviewService] Failed to fetch PR review threads:', err);
data.state.set({ kind: PRReviewStateKind.Error, reason: String(err) }, undefined);
});
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prModel.refresh().catch(...) is unlikely to ever run because GitHubPullRequestModel.refresh() swallows fetch errors internally (it logs but doesn’t rethrow). As a result, the PR review UI won’t transition to Error on refresh failures, and the log message also no longer matches what’s being fetched (it’s a full PR snapshot, not just threads). Consider either propagating refresh errors from the model (rethrow / return a result) or handling failures via a dedicated observable/error signal; also update the log message accordingly.

See below for a potential fix:

		// Start polling and trigger the initial PR snapshot refresh.
		void prModel.refresh();

Copilot uses AI. Check for mistakes.
Comment thread src/vs/sessions/contrib/github/browser/fetchers/githubPRFetcher.ts
@lszomoru lszomoru merged commit 522c9dd into main Apr 14, 2026
44 of 45 checks passed
@lszomoru lszomoru deleted the lszomoru/dull-sawfish branch April 14, 2026 11:30
@vs-code-engineering vs-code-engineering bot added this to the 1.117.0 milestone Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants