Sessions: derive PR icon from live GitHubPullRequestModel#308304
Merged
Sessions: derive PR icon from live GitHubPullRequestModel#308304
Conversation
f191a5b to
adbcb9e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Sessions’ pull request status icon rendering to use the live, reactive GitHubPullRequestModel (polled by the core sessions GitHub feature) instead of relying solely on extension-written, static session metadata—so PR icons can update automatically as PR state changes.
Changes:
- Added a shared
computePullRequestIcon(state, isDraft?)helper to map PR state/draft → themed codicon. - Made
AgentSessionAdapter.gitHubInforeactive viaderived(), combining metadata seed info with liveIGitHubServicePR model state. - Wired
IGitHubServiceintoCopilotChatSessionsProviderto supply adapters with the live PR model.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/github/common/types.ts | Introduces shared PR state → icon mapping helper used by sessions UI. |
| src/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsProvider.ts | Switches PR icon derivation to a reactive observable that reads from GitHubPullRequestModel when available. |
| extensions/copilot/package-lock.json | Lockfile metadata updates (adds dev: true flags on some entries). |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
Contributor
0cbf4be to
164df36
Compare
Make AgentSessionAdapter.gitHubInfo a derived observable that reads from the live GitHubPullRequestModel when available, falling back to the extension-provided metadata icon. This lets session card PR icons update reactively when polling detects state changes (e.g. merged, closed) without an extension round-trip. - Add computePullRequestIcon() to github/common/types.ts as the single source of truth for PR state → icon mapping - Replace inline icon switch in _extractPullRequestStateIcon with a call to the shared helper - Inject IGitHubService into CopilotChatSessionsProvider and pass it to AgentSessionAdapter for PR model access Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
164df36 to
da84a7a
Compare
dmitrivMS
approved these changes
Apr 7, 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.
Summary
Fixes: #308242
Migrates PR state detection from static extension metadata to a reactive core feature. Session card PR icons now update automatically when the
GitHubPullRequestModelpolling detects state changes (e.g. merged, closed, draft) — no extension round-trip needed.Changes
src/vs/sessions/contrib/github/common/types.tscomputePullRequestIcon(state, isDraft?)— single source of truth for PR state → icon mappingGitHubPullRequestStateenum values and the string states the extension writes to metadata (including'draft')src/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsProvider.tsAgentSessionAdapter.gitHubInfois now aderived()observable that combines:IGitHubService— readsprModel.pullRequestreactively_extractPullRequestStateIconwith a call to the sharedcomputePullRequestIconhelperIGitHubServiceintoCopilotChatSessionsProviderand passed to adaptersArchitecture
Notes
GitHubActiveSessionRefreshContributiontriggers refresh on session open, and existing polling handles the restIGitHubService(keyed by owner/repo/prNumber), so multiple sessions for the same PR share a model