Fix git repository cache to skip untitled workspaces #292822
Closed
+36
−1
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.
Opening a PR from a URI handler link after VS Code restart showed "Path does not exist" error with a numeric path like
\1761808101585.Root cause:
RepositoryCache._findWorkspaceForRepocalled.fsPathonworkspace.workspaceFilewithout checking its scheme. For untitled workspaces (untitled:1761808101585),.fsPathreturns just the numeric timestamp ID. This invalid path was cached and later passed toUri.file(), creatingfile:///1761808101585.Changes:
workspaceFile.fsPath- only use workspace files withfileschemeOriginal prompt
This section details on the original issue you should resolve
<issue_title>Error message on second open of PR from a link</issue_title>
<issue_description>Testing #274805
Repro Steps
Actual Result
Expected Result
No Error</issue_description>
Comments on the Issue (you are @copilot in this section)
@dmitrivMS NOTE: If you open PR explorer pane first, it does not seem to happen. Logs: ``` 2025-11-04 14:07:50.691 [info] [Activation] Extension version: 0.121.2025110404 2025-11-04 14:07:50.704 [info] [Authentication] Creating hub for .com 2025-11-04 14:07:50.903 [info] [Activation] Looking for git repository 2025-11-04 14:07:50.903 [info] [Activation] Found 0 repositories during activation 2025-11-04 14:07:50.903 [info] [Activation] Git repository found, initializing review manager and pr tree view. 2025-11-04 14:07:50.904 [info] [GitAPI] Registering git provider 2025-11-04 14:07:50.918 [info] [GitAPI] Repository file:///c%3A/Users/dmitriv/repos/vscode has been opened 2025-11-04 14:07:54.989 [info] [Review+0] Validate state in progress 2025-11-04 14:07:54.989 [info] [Review+0] Validating state... 2025-11-04 14:07:54.989 [info] [FolderRepositoryManager+0] Cannot updates repositories as git is uninitialized 2025-11-04 14:07:54.989 [info] [Activation] Repo state for file:///c%3A/Users/dmitriv/repos/vscode changed. 2025-11-04 14:07:54.989 [info] [Activation] Repo file:///c%3A/Users/dmitriv/repos/vscode has already been setup. 2025-11-04 14:07:55.869 [info] [Activation] Git initialization state changed: state=initialized 2025-11-04 14:07:55.869 [info] [Review+0] Validate state in progress 2025-11-04 14:07:55.869 [info] [Review+0] Validating state... 2025-11-04 14:07:55.871 [info] [FolderRepositoryManager+0] Found GitHub remote for folder c:\Users\dmitriv\repos\vscode 2025-11-04 14:07:56.325 [info] [FolderRepositoryManager+0] Trying to use globalState for assignableUsers. 2025-11-04 14:07:56.421 [info] [Review+0] Found matching pull request metadata for current branch dev/dmitriv/glob-2. Repo: microsoft/vscode PR: 273860 2025-11-04 14:07:56.421 [info] [Review+0] current branch dev/dmitriv/glob-2 is associated with pull request #273860 2025-11-04 14:07:56.421 [info] [Review+0] Resolving pull request 2025-11-04 14:07:56.439 [info] [FolderRepositoryManager+0] Using globalState assignableUsers for 1. 2025-11-04 14:07:57.148 [info] [FolderRepositoryManager+0] Using in-memory cached assignable users. 2025-11-04 14:07:57.699 [info] [GitHubRepository+0] Fetch branch main - enter 2025-11-04 14:07:58.140 [info] [GitHubRepository+0] Fetch branch main - done: true 2025-11-04 14:07:58.148 [info] [Review+0] Resolved PR #273860, state is OPEN 2025-11-04 14:07:58.148 [info] [Review+0] Fetching pull request data 2025-11-04 14:07:58.148 [info] [PullRequestTree] Adding PR #273860 to tree 2025-11-04 14:07:58.167 [info] [Review+0] Register comments provider 2025-11-04 14:07:58.168 [info] [Review+0] Register in memory content provider 2025-11-04 14:07:59.175 [info] [Review+0] Display pull request status bar indicator. 2025-11-04 14:07:59.175 [info] [Review+0] Using focus mode = true. 2025-11-04 14:07:59.175 [info] [Review+0] State validation silent = true. 2025-11-04 14:07:59.175 [info] [Review+0] PR show should show = false. ``` @alexr00 I haven't been able to repro this, and it's strange because where that error comes from there must be a `file` scheme URI, which points to the workspace we're trying to open being incorrect. Adding some logging. @alexr00 New pre-release is building now. @dmitrivMS, could you please install the new pre-release once it's available, repro the bug, then share the output of GitHub Pull Request? @dmitrivMS @alexr00 Still repros.One correction to the repro steps above (not sure if it matters): I am opening a PR for which I have a local branch and it is ...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.