🐛 fix(vscode): worktree 还在的工单也能启动测试会话,不再强制要求 PR
handleStartTestSession 早就允许在工单 worktree 里测——代码就在工作目录, 不需要 PR 做参考;只有 worktree 已清理、回退主工作区时才要靠 PR 了解 合并进来的改动。详情面板的 ▶ 按钮却只看 pr,导致「有 worktree、没 PR」 的工单点不了,实际后端跑得起来。按钮条件补上 worktreeExists,与后端对齐。
This commit is contained in:
1 parent
dbb7aa8a59
commit
4ae508aee3
1 file changed
+7
-5
@@ -379,10 +379,12 @@ export function IssueDetailPanel({
|
|||||||
// 测试会话 id 行有三种状态(照搬头脑风暴行的三态):
|
// 测试会话 id 行有三种状态(照搬头脑风暴行的三态):
|
||||||
// 1. testSessionId 已存在 + testTabOpen=true → 显示 id + X 关闭 tab
|
// 1. testSessionId 已存在 + testTabOpen=true → 显示 id + X 关闭 tab
|
||||||
// 2. testSessionId 已存在 + testTabOpen=false → 显示 id,双击 resume
|
// 2. testSessionId 已存在 + testTabOpen=false → 显示 id,双击 resume
|
||||||
// 3. testSessionId 为空 + issue.pr 存在 → 显示 Play 启动新测试 cc tab
|
// 3. testSessionId 为空 + 有 worktree 或有 PR → 显示 Play 启动新测试 cc tab
|
||||||
// (prompt 依赖已合并的 PR 号,没有 PR 不显示启动按钮)
|
// 条件与 handleStartTestSession 一致:worktree 还在就进 worktree 测,
|
||||||
|
// 代码本就在工作目录,不需要 PR;worktree 已清理才回退主工作区,
|
||||||
|
// 那条路径要靠 PR 让 cc 了解合并进来的改动。
|
||||||
const hasSession = !!(issue?.testSessionId && issue.testSessionId.length > 0)
|
const hasSession = !!(issue?.testSessionId && issue.testSessionId.length > 0)
|
||||||
const canStart = !hasSession && !!issue?.pr
|
const canStart = !hasSession && (!!issue?.worktreeExists || !!issue?.pr)
|
||||||
const secondaryActions: RowAction[] = []
|
const secondaryActions: RowAction[] = []
|
||||||
if (hasSession && issue?.testTabOpen) {
|
if (hasSession && issue?.testTabOpen) {
|
||||||
secondaryActions.push({
|
secondaryActions.push({
|
||||||
@@ -410,8 +412,8 @@ export function IssueDetailPanel({
|
|||||||
type: 'action' as const,
|
type: 'action' as const,
|
||||||
pending: hasSession ? isSessionTabPending(issue!.testSessionId!) : false,
|
pending: hasSession ? isSessionTabPending(issue!.testSessionId!) : false,
|
||||||
description: hasSession
|
description: hasSession
|
||||||
? '双击在新终端运行 claude --resume <id> 在工作区根(main)恢复测试对话'
|
? '双击在新终端运行 claude --resume <id> 恢复测试对话(worktree 在则用之,否则工作区根)'
|
||||||
: '工单 PR 合并后点击右侧 ▶ 在工作区根(main)启动一个测试 cc tab(让 cc 了解代码后告诉你怎么测试)',
|
: '点击右侧 ▶ 启动测试 cc tab(让 cc 了解代码后告诉你怎么测试):worktree 还在就在 worktree 里测,已清理则需要工单有已合并的 PR',
|
||||||
actionIcon: <Terminal className="size-3.5" />,
|
actionIcon: <Terminal className="size-3.5" />,
|
||||||
onAction: (v: unknown) => {
|
onAction: (v: unknown) => {
|
||||||
if (typeof v !== 'string' || v.length === 0 || !issue)
|
if (typeof v !== 'string' || v.length === 0 || !issue)
|
||||||
|
|||||||
Reference in new issue
Block a user