From 4ae508aee348d7ca3ffde6a841fc5a1c33f513ad Mon Sep 17 00:00:00 2001 From: cruldra Date: Sun, 20 Sep 2026 18:00:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(vscode):=20worktree=20?= =?UTF-8?q?=E8=BF=98=E5=9C=A8=E7=9A=84=E5=B7=A5=E5=8D=95=E4=B9=9F=E8=83=BD?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=B5=8B=E8=AF=95=E4=BC=9A=E8=AF=9D=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E5=BC=BA=E5=88=B6=E8=A6=81=E6=B1=82=20PR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handleStartTestSession 早就允许在工单 worktree 里测——代码就在工作目录, 不需要 PR 做参考;只有 worktree 已清理、回退主工作区时才要靠 PR 了解 合并进来的改动。详情面板的 ▶ 按钮却只看 pr,导致「有 worktree、没 PR」 的工单点不了,实际后端跑得起来。按钮条件补上 worktreeExists,与后端对齐。 --- .../webview-ui/src/components/IssueDetailPanel.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vscode/webview-ui/src/components/IssueDetailPanel.tsx b/vscode/webview-ui/src/components/IssueDetailPanel.tsx index 51fe728..d750117 100644 --- a/vscode/webview-ui/src/components/IssueDetailPanel.tsx +++ b/vscode/webview-ui/src/components/IssueDetailPanel.tsx @@ -379,10 +379,12 @@ export function IssueDetailPanel({ // 测试会话 id 行有三种状态(照搬头脑风暴行的三态): // 1. testSessionId 已存在 + testTabOpen=true → 显示 id + X 关闭 tab // 2. testSessionId 已存在 + testTabOpen=false → 显示 id,双击 resume - // 3. testSessionId 为空 + issue.pr 存在 → 显示 Play 启动新测试 cc tab - // (prompt 依赖已合并的 PR 号,没有 PR 不显示启动按钮) + // 3. testSessionId 为空 + 有 worktree 或有 PR → 显示 Play 启动新测试 cc tab + // 条件与 handleStartTestSession 一致:worktree 还在就进 worktree 测, + // 代码本就在工作目录,不需要 PR;worktree 已清理才回退主工作区, + // 那条路径要靠 PR 让 cc 了解合并进来的改动。 const hasSession = !!(issue?.testSessionId && issue.testSessionId.length > 0) - const canStart = !hasSession && !!issue?.pr + const canStart = !hasSession && (!!issue?.worktreeExists || !!issue?.pr) const secondaryActions: RowAction[] = [] if (hasSession && issue?.testTabOpen) { secondaryActions.push({ @@ -410,8 +412,8 @@ export function IssueDetailPanel({ type: 'action' as const, pending: hasSession ? isSessionTabPending(issue!.testSessionId!) : false, description: hasSession - ? '双击在新终端运行 claude --resume 在工作区根(main)恢复测试对话' - : '工单 PR 合并后点击右侧 ▶ 在工作区根(main)启动一个测试 cc tab(让 cc 了解代码后告诉你怎么测试)', + ? '双击在新终端运行 claude --resume 恢复测试对话(worktree 在则用之,否则工作区根)' + : '点击右侧 ▶ 启动测试 cc tab(让 cc 了解代码后告诉你怎么测试):worktree 还在就在 worktree 里测,已清理则需要工单有已合并的 PR', actionIcon: , onAction: (v: unknown) => { if (typeof v !== 'string' || v.length === 0 || !issue)