Don't show incorrect "cant find commit" error (especially in agents window) - #8931
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is small, targeted, and includes tests validating the new behavior; the only feedback is a minor localization consistency improvement.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/view/gitContentProvider.ts — The user-facing error message here isn't localized, while other messages in this provider use… |
What changed in this PR
This PR prevents a misleading “couldn’t find … locally” error from being shown when a review URI points at a repository root that is no longer part of the active workspace (e.g., after switching workspaces, including scenarios like the agents window).
Changes:
- Gate the “couldn’t find an open repository…” UI error behind a
vscode.workspace.getWorkspaceFolder(...)check, and log a debug message when skipping due to the repo no longer being in the workspace. - Add unit tests to verify the error is suppressed for previous-workspace paths and still shown for current-workspace paths.
| File | Description |
|---|---|
| src/view/gitContentProvider.ts | Avoids showing an error toast when the requested repo root is no longer in the active workspace; logs debug instead. |
| src/test/view/gitContentProvider.test.ts | Adds coverage for the new workspace-vs-previous-workspace behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (!repository) { | ||
| vscode.window.showErrorMessage(`We couldn't find an open repository for ${commit} locally.`); | ||
| if (vscode.workspace.getWorkspaceFolder(vscode.Uri.file(rootPath))) { | ||
| vscode.window.showErrorMessage(`We couldn't find an open repository for ${commit} locally.`); |
Ulugbek Abdullaev (ulugbekna)
approved these changes
Sep 7, 2026
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.