Skip to content

Poll GitHub PR metadata for agent sessions#315415

Draft
roblourens wants to merge 3 commits intomainfrom
agents/48fa5362-b12d-4152-98b6-88cce4afffdf
Draft

Poll GitHub PR metadata for agent sessions#315415
roblourens wants to merge 3 commits intomainfrom
agents/48fa5362-b12d-4152-98b6-88cce4afffdf

Conversation

@roblourens
Copy link
Copy Markdown
Member

Summary

  • add PR-metadata-only refresh/polling on the shared GitHub pull request model
  • have the GitHub contribution observe non-archived sessions and start PR metadata polling when PR info appears
  • cover delayed PR info, archive/unarchive, and metadata-only polling behavior

Validation

  • npm run compile-check-ts-native
  • npm run valid-layers-check
  • hygiene check on touched files
  • GitHubPullRequest unit tests

Use the shared GitHub pull request model to refresh and poll PR metadata for non-archived sessions once a PR number is known. This keeps Agent Host session list PR icons current through the existing ETag-backed polling path without row-render-triggered requests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 9, 2026 01:03
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 adds a lightweight “PR-metadata-only” refresh/polling path for agent sessions so the sessions list can update PR state (open/closed/merged/draft) without continuously fetching heavier PR data (reviews/mergeability), while keeping richer active-session polling for CI and review threads separate.

Changes:

  • Added refreshPullRequest() and startPullRequestPolling() to GitHubPullRequestModel to fetch only PR metadata (reusing ETag).
  • Updated the GitHub sessions contribution to observe non-archived sessions and start metadata polling once PR info becomes available (including delayed PR info and archive/unarchive behavior).
  • Added unit tests covering metadata-only refresh/polling and session observation behavior.
Show a summary per file
File Description
src/vs/sessions/README.md Documents the new PR-metadata polling behavior for sessions.
src/vs/sessions/contrib/github/test/browser/githubModels.test.ts Adds tests for metadata-only refresh and polling semantics in the PR model.
src/vs/sessions/contrib/github/test/browser/githubContribution.test.ts Adds tests for session observation and archive/unarchive polling behavior.
src/vs/sessions/contrib/github/browser/models/githubPullRequestModel.ts Introduces metadata-only refresh/polling APIs and scheduler/disposable tracking.
src/vs/sessions/contrib/github/browser/github.contribution.ts Switches to observing session state and starting/stopping metadata polling per PR across sessions.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment on lines +92 to +104
* Refresh only the pull request metadata. Use this when a caller only needs
* lightweight state such as open/closed/merged/draft and does not need
* reviews or mergeability.
*/
refreshPullRequest(): Promise<void> {
if (!this._pullRequestRefreshPromise) {
this._pullRequestRefreshPromise = this._refreshPullRequest()
.finally(() => {
this._pullRequestRefreshPromise = undefined;
});
}

return this._pullRequestRefreshPromise;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in the follow-up commit: refreshPullRequest() now updates the PR payload and recomputes mergeability in the same transaction when cached reviews are available. Added a regression test that first computes mergeability with reviews, then refreshes PR metadata only and verifies mergeability updates without refetching reviews.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

blocks-ci screenshots changed

Replace the contents of test/componentFixtures/blocks-ci-screenshots.md with:

Updated blocks-ci-screenshots.md
<!-- auto-generated by CI — do not edit manually -->

#### editor/codeEditor/CodeEditor/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/67bfb687fd2818bd53771a60660541b9ed6f38b80d37da0aac15d267ecaeacec)

#### editor/codeEditor/CodeEditor/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/0469dd8d0a587d94a1eaec514c79917b93b9a38694ef2b767bb1892819ae0a55)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/97162fc53c861ee13dc78a18e41fe3a25a42f62dc52a560510ebf084a418e1c3)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/3b7e2eb5cc9ba727e2bc1c5113c3e17d8e9a6ce9a37b77519be3716ceb9a9afa)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/97162fc53c861ee13dc78a18e41fe3a25a42f62dc52a560510ebf084a418e1c3)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/3b7e2eb5cc9ba727e2bc1c5113c3e17d8e9a6ce9a37b77519be3716ceb9a9afa)

Recompute mergeability inside the PR metadata refresh transaction when cached reviews are available, so the shared PR model does not expose a new pull request payload with stale mergeability.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Briefly keep listed non-archived Agent Host session state alive so git metadata can hydrate before a session is opened. This lets the existing GitHub PR lookup and ETag-backed metadata polling update sessions-list PR icons without relying on openSession.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants