Approve and resolve act on the wrong folder when a repository and its worktrees are open in one window

未关闭
#8,969 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@alexr00 已经在做这个了。

开始于 2026年9月19日。

评估

这个 Issue 还没有评估数据。

描述

  • Extension version: 0.166.1
  • VSCode Version: 1.138.0 (Windows client, WSL 2 remote)
  • OS: Windows 11 host, Ubuntu on WSL 2 running the extension host
  • Repository Clone Configuration: single repository, with eight git worktrees under worktrees/ opened as additional repositories via git.autoRepositoryDetection: "subFolders" and git.scanRepositories
  • GitHub Product: GitHub.com

When several open folders are checkouts of the same GitHub repository (a repository plus its worktrees, each on a different pull request branch), two actions go to the wrong folder:

1. Approving from the pull request overview fails although the checkout is in sync.
Opening a description resolves the folder manager by owner and repository name (RepositoriesManager.getManagerForRepository) and takes the first folder with that remote, not the folder the clicked node belongs to. The overview panel is bound to that folder, so PullRequestModel.approve compares another worktree's checked out HEAD with the pull request's remote head and rejects with:

Submitting review failed. The remote head of the pull request branch has changed. Please pull the latest changes from the remote branch before approving.

Which folder is "first" depends on repository discovery order, so the same setup can work in one window and fail after a reload. Approving from the sidebar's active pull request view works, because ReviewManager passes its own folder manager.

2. Resolving a comment thread on the left side of a diff appears to do nothing.
Every ReviewCommentController.hasCommentThread returns true for any review: scheme thread, and resolveCommentHandler picks the handler with the longest root path, so a worktree's controller handles a thread from the main repository. It calls resolveReviewThread on its own pull request model, which does not know the thread. The GitHub mutation still runs (the thread is resolved on github.com), but no change event fires and the editor never updates.

Steps to Reproduce:

  1. Open a repository root as the workspace folder. Add worktrees under worktrees/2, worktrees/3, ... and list them in git.scanRepositories so the git extension opens them; check out a different open pull request branch in each.
  2. In the "Changes in Pull Request" view of a worktree that is not the first discovered folder, click the description node and press Approve in the overview. Observe the "remote head ... has changed" error even though git status shows the branch in sync with its upstream.
  3. In the same window, open a file diff from the main repository's changes view and click Resolve Conversation on a thread shown in the left editor. Observe that nothing changes in the editor, while the thread is resolved on github.com.

Fix proposed in #8967: resolve the folder from the pull request model (the folder whose GitHub repository owns the model, then the folder that has the pull request checked out, then the remote match), and have review controllers only claim review: threads whose recorded root path is their own repository.

主要语言
TypeScript
星标
2.6k
派生
796
平均合并
16 小时 26 分钟
30 天内合并 PR
44

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/vscode-pull-request-github 的其他 Issue

查看 microsoft/vscode-pull-request-github 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。