chat: fix GitHub context repository selection - #334594
Merged
Megan Rogge (meganrogge) merged 9 commits intoSep 4, 2026
Merged
Conversation
Avoid waiting for unresolved local Git metadata in the Agents window, and initialize every workspace root before choosing a repository in multi-root editor windows.\n\nFixes microsoft#334563\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Megan Rogge (meganrogge)
September 4, 2026 19:33
View session
Keep multi-root workspace folders as distinct Issue and Pull Request picker entries, even when they resolve to the same GitHub repository.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Multi-root repository discovery can hang indefinitely when any repository lacks resolved HEAD metadata.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/vs/workbench/contrib/chat/browser/actions/chatContext.ts — IGitService.openRepository is not safe to await for every workspace folder here: its main-thread… |
What changed in this PR
Fixes GitHub issue/PR repository scoping across editor and Agents windows.
Changes:
- Adds folder-aware repository choices for multi-root workspaces.
- Avoids waiting for local Git metadata in Agents sessions.
- Adds regression coverage for repository-selection scenarios.
| File | Description |
|---|---|
chatContext.ts |
Adds multi-root repository choices. |
chatContext.test.ts |
Tests distinct and shared repositories. |
copilotChatSessionsProvider.ts |
Removes blocking local metadata lookup. |
copilotChatSessionsProvider.test.ts |
Tests immediate repository selection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Show multi-root workspace folders before resolving GitHub metadata so Issue and Pull Request attachment never skips folder selection while repository state is still loading.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build multi-root choices from workspace folders and already-known repositories so unresolved Git state cannot prevent the Issue or Pull Request picker from opening.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pass unresolved workspace folder selections to Copilot Chat and resolve their remotes without waiting for repository HEAD state. This keeps issue and pull request searches limited to the chosen repository even while Git discovery is incomplete.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Follow Git worktree directory pointers and common directories when resolving the selected folder's remote. Preserve normal remote preference ordering so origin is chosen consistently when repository discovery is unavailable.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Martin Aeschlimann (aeschli)
previously approved these changes
Sep 4, 2026
Pass a single selected local folder directly to Issue and Pull Request attachment commands. Only offer repository selection when that folder cannot be resolved.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make the repository quick pick explicitly single-select and pass a mutable pick array so Compile & Hygiene resolves the correct overload.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Anthony Kim (anthonykim1)
approved these changes
Sep 4, 2026
roblourens
reviewed
Sep 4, 2026
roblourens
left a comment
Member
There was a problem hiding this comment.
[Experimental performance review bot]
Automated experimental performance review.
(Written by Copilot)
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.

Fixes GitHub issue and pull request attachment selection across the Agents window and editor window.
HEADstate, including direct.git/configlookupgitdirandcommondirpointersFixes #334603
Validation:
npm run transpile-client./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/actions/chatContext.test.ts --run src/vs/sessions/contrib/providers/copilotChatSessions/test/browser/copilotChatSessionsProvider.test.ts(92 passing)npm --prefix extensions/copilot run test:unit -- src/extension/chatSessions/vscode-node/test/copilotCloudSessionsProvider.spec.ts(37 passing)npm --prefix extensions/copilot run typecheck