Fix PR webview stuck loading when switching between sessions in agents window - #8943
Merged
Merged
Conversation
Dirk Bäumer (dbaeumer)
approved these changes
Sep 9, 2026
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The new resolver can incorrectly choose the remote-only manager while a matching workspace repo is still initializing, which can break local-repo actions for restored/opened overviews.
Review tier: Lite
Findings: None
What changed in this PR
This PR addresses PR/issue overview webviews getting stuck in a loading state when switching sessions (e.g., in the agents window) by improving webview restoration and by resolving PR/issue data through a repository-manager resolver that can fall back to a remote-only manager.
Changes:
- Prefer serializer-provided webview panels during restore by disposing stale cached panels for the same PR/issue identity.
- Rework
OverviewRestorerto resolve PRs/issues viaFolderRepositoryManagerResolver(remote-only fallback) instead of depending on existing workspace GitHub repositories. - Thread the new resolver through extension initialization and command registration; add/extend tests for restoration and remote-only resolution.
| File | Description |
|---|---|
| src/test/uriHandler.test.ts | Adds coverage ensuring remote-only manager selection when no workspace manager matches. |
| src/test/github/pullRequestOverview.test.ts | Adds coverage for using a serializer-provided WebviewPanel and replacing stale cached panels. |
| src/test/github/overviewRestorer.test.ts | New test validating PR restoration uses a resolver-provided remote-only manager. |
| src/github/pullRequestOverview.ts | Disposes cached panel when a different serializer-provided panel is supplied for the same identity. |
| src/github/overviewRestorer.ts | Resolves PRs/issues via FolderRepositoryManagerResolver and removes dependency on preloaded workspace GitHub repos. |
| src/github/issueOverview.ts | Mirrors the PR panel behavior for issues when restoring panels. |
| src/github/folderRepositoryManagerResolver.ts | Changes default manager selection behavior to create/cache a remote-only manager when no match is found. |
| src/extension.ts | Creates the resolver once and wires it into command registration and overview restoration. |
| src/commands.ts | Switches certain PR/issue resolution paths to use the resolver instead of folderManagers[0] fallback. |
Suppressed comments (1)
src/github/folderRepositoryManagerResolver.ts:35
getManagerForRepositorynow falls back to the remote-only manager wheneverRepositoriesManager.getManagerForRepositoryreturns undefined. During startup/session switches, a workspaceFolderRepositoryManagercan exist but not yet have populatedgitHubRepositories, so this can incorrectly choose the remote-only manager even when a local repo for the target owner/repo is open (which can break local actions like checkout). Consider first matching an existing workspace manager by inspecting its git remotes for the requestedowner/repobefore falling back to the remote-only manager.
getManagerForRepository(owner: string, repo: string): FolderRepositoryManager {
const existingManager = this._repositoriesManager.getManagerForRepository(owner, repo);
if (existingManager) {
return existingManager;
}
if (this._remoteFolderRepositoryManager) {
return this._remoteFolderRepositoryManager;
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
No description provided.