From fcefecd10de1a2e64759f731a1fe6696c76d45f9 Mon Sep 17 00:00:00 2001 From: Blizzard Date: Mon, 29 Jun 2026 16:48:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(desktop):=20=E8=BD=AE=E8=AF=A2=E5=91=BD?= =?UTF-8?q?=E4=B8=AD=E7=BB=88=E6=80=81=E6=97=B6=E5=90=8C=E6=AD=A5=20phase?= =?UTF-8?q?=20=E2=80=94=E2=80=94=20=E8=BF=90=E8=A1=8C=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=B0=B8=E5=8D=A1=E3=80=8C=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E4=B8=AD=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit attachRun 的状态轮询此前只更新 lifecycle、不动 phase。token 流没收到 done 的场景 (如恢复的在途任务、或任务被外部置终态)→ phase 永卡 streaming → Studio 运行按钮 永远禁用「运行中…」,看似不能跑新编排。 修复:轮询命中终态(done/failed/timeout/rejected)时把 phase 也置 done/error, 释放运行按钮。 Co-Authored-By: Claude Opus 4.8 --- sundynix-desktop/frontend/src/App.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sundynix-desktop/frontend/src/App.tsx b/sundynix-desktop/frontend/src/App.tsx index b15d966..eddd0e8 100644 --- a/sundynix-desktop/frontend/src/App.tsx +++ b/sundynix-desktop/frontend/src/App.tsx @@ -110,7 +110,17 @@ export default function App() { pollRef.current = window.setInterval(async () => { try { const s = await taskStatus(taskId); - setRun((r) => (r.taskId === taskId ? { ...r, lifecycle: s.status, detail: s.detail } : r)); + setRun((r) => { + if (r.taskId !== taskId) return r; + // 命中终态:同时把 phase 也置终态,否则 token 流没收到 done(如恢复的任务/外部置终态) + // 时 phase 会永卡 streaming → 运行按钮永远禁用「运行中…」。 + const phase = terminal.has(s.status) + ? s.status === "failed" || s.status === "timeout" + ? "error" + : "done" + : r.phase; + return { ...r, lifecycle: s.status, detail: s.detail, phase }; + }); if (terminal.has(s.status)) stopPoll(); } catch { /* 忽略瞬时失败,下个 tick 再试 */