Sessions: fix stale CI checks when switching active session#304062
Merged
Sessions: fix stale CI checks when switching active session#304062
Conversation
…efresh on session change
…ctiveSessionRefreshContribution
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes stale GitHub PR/CI status in the Sessions window when switching the active session, especially for merged PRs where the head branch may be deleted.
Changes:
- Add
headShato the Sessions GitHub PR model and map it from the REST API response. - Switch CI check lookups in the Changes view from
headRef(branch) toheadSha(commit SHA). - Add a workbench contribution to immediately refresh PR data when the active session changes.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/github/common/types.ts | Adds headSha to IGitHubPullRequest so CI can be queried by commit. |
| src/vs/sessions/contrib/github/browser/fetchers/githubPRFetcher.ts | Maps data.head.sha into the PR model. |
| src/vs/sessions/contrib/github/browser/github.contribution.ts | Adds a contribution that refreshes PR data immediately on session change. |
| src/vs/sessions/contrib/changes/browser/changesView.ts | Uses headSha for CI lookups and starts/stops CI polling tied to the active session. |
| src/vs/sessions/contrib/github/test/browser/githubModels.test.ts | Updates test helper PR objects to include headSha. |
ulugbekna
approved these changes
Mar 23, 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.
Problem
When switching between sessions, CI checks could display stale "running" status even though the PR had already been merged. Two root causes:
headRef) — After a PR is merged and the head branch is deleted, GitHub's API returns 404 for the branch-based CI check lookup, leaving stale data in the observables.Fix
Use commit SHA for CI lookups
headShafield toIGitHubPullRequest(mapped fromdata.head.shain the API response)pr.headRef(branch name) topr.headSha(commit SHA), which remains valid even after branch deletionImmediate refresh on session change
GitHubActiveSessionRefreshContributionworkbench contribution in the GitHub sessions contribution that watches the active session and immediately callsprModel.refresh()when the session changes_lastSessionResourceto only refresh when the session actually changesCI polling lifecycle
ciModel.startPolling()/stopPolling()lifecycle management viareader.storein the CI model derived, ensuring polling is properly started for the active session and stopped when switching awayFiles changed
src/vs/sessions/contrib/github/common/types.ts— AddedheadShatoIGitHubPullRequestsrc/vs/sessions/contrib/github/browser/fetchers/githubPRFetcher.ts— Maphead.shafrom API responsesrc/vs/sessions/contrib/github/browser/github.contribution.ts— NewGitHubActiveSessionRefreshContributionsrc/vs/sessions/contrib/changes/browser/changesView.ts— UseheadShafor CI lookups, manage CI polling lifecyclesrc/vs/sessions/contrib/github/test/browser/githubModels.test.ts— Updated test helper