Poll GitHub PR metadata for agent sessions#315415
Conversation
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>
There was a problem hiding this comment.
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()andstartPullRequestPolling()toGitHubPullRequestModelto 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
| * 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; |
There was a problem hiding this comment.
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.
blocks-ci screenshots changedReplace the contents of Updated blocks-ci-screenshots.md<!-- auto-generated by CI — do not edit manually -->
#### editor/codeEditor/CodeEditor/Dark

#### editor/codeEditor/CodeEditor/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
 |
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>
Summary
Validation