Skip to content

Fix chat context providers in agents composer - #9260

Merged
Alex Ross (alexr00) merged 2 commits into
mainfrom
alexr00/experienced-cougar
Dec 4, 2026
Merged

Alex Ross (alexr00) merged 2 commits into
mainfrom
alexr00/experienced-cougar

Conversation

@alexr00

Copy link
Copy Markdown
Member

Fixes #9259

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Repository matching omits GitHub server identity, allowing incorrect PR attachments or failed lookups, while deduplication can silently hide distinct PRs across servers.

2 open issues
What changed in this PR

Addresses #9259 by improving GitHub issue and pull request attachment loading in the Agents composer.

Changes:

  • Scopes attachments to active session folders and adds user-related searches for folderless chats.
  • Updates repository discovery and issue refresh handling for session changes.
  • Adds regression tests for discovery, attachment resolution, and loading failures.
File Description
src/​test/​lm/​chatContextProviders.test.ts Tests attachment scope, search, resolution, and failures.
src/​test/​issues/​stateManager.test.ts Tests issue loading for repositories opened later.
src/​test/​github/​repositoryDetection.test.ts Tests discovery after workspace changes.
src/​lm/​pullRequestContextProvider.ts Adds scoped PR enumeration and lazy search-result resolution.
src/​lm/​issueContextProvider.ts Adds scoped issue enumeration and lazy search-result resolution.
src/​lm/​chatContextScope.ts Shares workspace filtering and GitHub.com search logic.
src/​issues/​stateManager.ts Registers refresh listeners for newly added managers.
src/​github/​repositoryDetection.ts Handles repository opens and workspace-folder additions.
src/​extension.ts Wires discovery and provider dependencies.

Review effort: Balanced

Comment thread src/lm/pullRequestContextProvider.ts Resolved
Comment thread src/lm/pullRequestContextProvider.ts Resolved
@alexr00
Alex Ross (alexr00) marked this pull request as ready for review December 4, 2026 15:19
Copilot AI balanced review requested due to automatic review settings December 4, 2026 15:19
@alexr00
Alex Ross (alexr00) enabled auto-merge (squash) December 4, 2026 15:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unresolved host matching can load Enterprise content for GitHub.com attachments, while repository-initialization races can leave context pickers empty.

No open issues 🎉

3 previously missed issues

In code that hasn't changed since last review

Medium severity Fetch issues for repositories ready before listener registration

src/​issues/​stateManager.ts:312

If a previously ignored Git repository is added while the initial setAllIssueData is pending, it can finish resolving remotes before this listener is installed. Its issues are absent from the initial fetch and never retried, leaving the picker empty until another refresh. Check already-ready managers when subscribing, as well as future events.

Medium severity Wait for repository readiness before filtering providers

src/​lm/​chatContextScope.ts:33

While a newly discovered folder's remotes are still resolving, this filter removes its manager and both providers return [] despite a workspace folder being open. The picker does not reload those results, so it remains at “Go back” even after initialization finishes. Await repository readiness, honoring cancellation, before treating the folder as having no GitHub repository.

Medium severity Match repository host when resolving attachment managers

src/​lm/​pullRequestContextProvider.ts:133

With a same-named Enterprise repository still open, opening a GitHub.com search attachment can load an Enterprise issue or refresh the PR from Enterprise. Match the attachment's host in both openDescriptionCommand's manager lookup and the overview's remote-to-local manager upgrade. Same issue in src/lm/issueContextProvider.ts:134.

2 resolved since last review

Review effort: Balanced

@alexr00
Alex Ross (alexr00) merged commit 9232a66 into main Dec 4, 2026
6 checks passed
@alexr00
Alex Ross (alexr00) deleted the alexr00/experienced-cougar branch December 4, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents window: GitHub Issues and Pull Requests attachment pickers intermittently show only Go back

4 participants