fix(orchestrator): 拆解未批准前冻结子任务——父任务 plan_review/analyzing 期间子任务不可领取
修复 bug:auto-approved 项目里 planner 拆解后子任务立即被领取执行,而父任务还在 plan_review 等人审批,导致拆解若被驳回则子任务已白跑。claimable 加闸:子任务的父任务 处于 plan_review(待审拆解)或 analyzing(拆解中)时冻结,批准(decomposed)后放行。 仅冻结这两态,不影响 todo-sync 等其它带 parentId 的流程。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -133,6 +133,11 @@ export function createOrchestrator(store: Store, log: OrchestratorLogger, deps:
|
||||
if (!CLAIMABLE.has(t.status)) return false;
|
||||
if (inflight.has(t.id)) return false; // 已有在途 run(executor/planner)
|
||||
if (parents.has(t.id)) return false; // 非叶子(容器)跳过
|
||||
// 父任务拆解待审批 / 拆解中 → 冻结子任务,避免拆解被驳回时子任务已白跑(仅冻结这两态,不影响 sync 等流程)
|
||||
if (t.parentId) {
|
||||
const ps = byId.get(t.parentId)?.status;
|
||||
if (ps === 'plan_review' || ps === 'analyzing') return false;
|
||||
}
|
||||
if (easyOnly && t.complexity !== 'easy') return false;
|
||||
if (t.nextEligibleAt && nowMs < Date.parse(t.nextEligibleAt)) return false; // 退避冷却中
|
||||
return t.deps.every((dep) => byId.get(dep)?.status === 'done');
|
||||
|
||||
Reference in New Issue
Block a user