Skip to content

Open PR links from chat without a workspace - #8933

Merged
Alex Ross (alexr00) merged 5 commits into
mainfrom
copilot/fix-pr-link-chat-open-issue
Sep 7, 2026
Merged

Open PR links from chat without a workspace#8933
Alex Ross (alexr00) merged 5 commits into
mainfrom
copilot/fix-pr-link-chat-open-issue

Conversation

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Opening a PR link from chat could show an empty overview and throw when the Agents window had no repository manager.

Extension runtime error

  • Manager resolution
    • Adds a shared provider that uses a workspace manager when available and lazily creates a remote-only manager otherwise.
  • Link handling
    • Routes both external links and extension URIs through the provider.
    • Prevents undefined managers and duplicate remote-only manager instances.
  • Fixes #334873

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with opening PR link from chat in Agents window Open PR links from chat without a workspace Sep 7, 2026
@alexr00
Alex Ross (alexr00) marked this pull request as ready for review September 7, 2026 15:13
Copilot AI lite review requested due to automatic review settings September 7, 2026 15:13

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.

🟢 Approval recommended

The changes consistently centralize manager resolution for no-workspace scenarios and include targeted tests validating the new behavior.

Pull request overview

This PR fixes opening GitHub issue/PR links (including from chat) when no workspace is open by centralizing “folder repository manager” resolution. Instead of assuming a workspace-backed RepositoriesManager.folderManagers[0] exists, it lazily creates (and reuses) a remote-only FolderRepositoryManager so webviews can be opened reliably in “no workspace” scenarios.

Changes:

  • Introduces FolderRepositoryManagerResolver to return an existing workspace manager when available, or lazily create/reuse a remote-only manager otherwise.
  • Routes both UriHandler (vscode:// extension URIs) and ExternalUriOpener (https:// links) through the shared resolver to avoid undefined managers and duplicate remote-only instances.
  • Adds/updates tests to cover the “no workspace open” behavior for both URI handling and external URI opening.
File summaries
File Description
src/uriHandler.ts Uses the shared resolver to obtain a valid manager when opening issue/PR overview webviews via extension URIs.
src/github/externalUriOpener.ts Replaces ad-hoc remote-only manager creation with the shared resolver for opening GitHub links externally.
src/github/overviewRestorer.ts Wires the external URI opener registration through the new resolver.
src/github/folderRepositoryManagerResolver.ts New shared resolver that returns an existing manager or creates/reuses a remote-only FolderRepositoryManager.
src/extension.ts Instantiates and disposes the resolver via context.subscriptions, then injects it into OverviewRestorer and UriHandler.
src/test/uriHandler.test.ts New test validating PR link opening uses a remote-only manager when no workspace is open.
src/test/github/externalUriOpener.test.ts Updates test wiring to use/dispose the resolver and validates remote-only behavior remains correct.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@alexr00
Alex Ross (alexr00) merged commit c0d6020 into main Sep 7, 2026
7 checks passed
@alexr00
Alex Ross (alexr00) deleted the copilot/fix-pr-link-chat-open-issue branch September 7, 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.

Opening a PR link from chat in Agents window sometimes fails

4 participants