fix(api): 项目状态点严格化——running 只数真实活跃 run(status=started)
之前 running 按任务状态(executing/analyzing/speccing)计,导致被冻结/排队的子任务 也让点变青。改为只数真实在途 run(runs.status='started' JOIN 本项目任务),只有活 agent 才青。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user