From f0f8f8042521f021a67051626b83f71b5731ced8 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Mon, 29 Jun 2026 11:18:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E9=A1=B9=E7=9B=AE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=82=B9=E4=B8=A5=E6=A0=BC=E5=8C=96=E2=80=94=E2=80=94?= =?UTF-8?q?running=20=E5=8F=AA=E6=95=B0=E7=9C=9F=E5=AE=9E=E6=B4=BB?= =?UTF-8?q?=E8=B7=83=20run(status=3Dstarted)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前 running 按任务状态(executing/analyzing/speccing)计,导致被冻结/排队的子任务 也让点变青。改为只数真实在途 run(runs.status='started' JOIN 本项目任务),只有活 agent 才青。 Co-Authored-By: Claude Opus 4.8 --- src/store/store.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/store/store.ts b/src/store/store.ts index 14a366b..aa1b676 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -225,7 +225,10 @@ export class Store { for (const r of rows) by[r.status] = r.n; const g = (s: string): number => by[s] || 0; const executing = g('executing'); - const running = executing + g('analyzing') + g('speccing'); // agent 在跑:executor + planner + // 严格「活 agent」:真实在途 run(status='started'),而非按任务状态——冻结/排队/待审中的都不算 + const running = (this.db.prepare( + `SELECT COUNT(*) AS n FROM runs r JOIN tasks t ON r.task_id = t.id WHERE t.project_id = ? AND r.status = 'started'`, + ).get(projectId) as { n: number }).n; const attention = g('plan_review') + g('spec_review') + g('exec_review') + g('needs_attention'); // 待审批闸 + 需人工 const TERMINAL = new Set(['done', 'cancelled']); let alive = 0;