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 再试 */