feat: Phase2 完整管线——score 调度 + 自动复审 + 模型分级 + 归档与详情
调度: - model/scoring.ts: score = 自身分(P0=3/P1=2/P2=1) + 已完成依赖分(链条惯性) + 等待解锁的 blocked 任务分(解锁加权),编排器与 nextExecutable 同一打分 - createTask 校验 deps 存在且同项目(依赖图天然无环) - daemon 重启中断自愈: executing 任务标 failed run 后重新入队(reconcileInterrupted) 执行管线: - executor/cc.ts: 公共 headless CC 执行器(转录/超时/模型回退重试) - executor/reviewer.ts: 执行后自动复审(只读 CC 审 diff),固定模板 summary (做了什么/怎么做/测试/CodeReview/安全Review/结论) + VERDICT 解析 - executor/models.ts: 按复杂度选模型(easy→sonnet/medium→opus/hard→fable5), env 可覆盖、project.model 最优先、不可用自动回退链 - runner: 测试/构建命令白名单(npm/go/shellcheck/make/pytest),prompt 要求实跑测试 - TaskResult 加 summary/verdict; RunKind 加 reviewer - 容器收口: 已拆解 Hard 子任务全 done → 容器自动 done(afterDone 逐级向上) 看板: - 五徽章组(待审批/待执行/执行中/被阻塞/总量,hover 展开,均不含已完成) - 归档区: 深度1整树完成沉底,时间倒序分页(10/20/50/100 chip 选择) - 归档详情对话框: 全属性/执行历史与时长/审批记录/状态流转时间线(含相关人或事) - Agent 面板显示调度模式 + 各复杂度实际模型 - 结果闸展示复审 summary + 建议通过/拒绝徽章 - 筛选修复(组选与单选分离、已拆解移出进行中)、同步按钮收进配置面板、 保存配置自动收起、预览全宽、被依赖阻塞→被阻塞 - API: GET /api/tasks/:id/events(任务级事件时间线)、/api/agents 带 scheduling/models 测试: 49/49(新增 scoring/复审/模型/容器收口/deps 校验/中断恢复) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+45
-1
@@ -96,7 +96,7 @@ test('exec_review 结果闸:accept → done', () => {
|
||||
s.setOperations(t.id, 'op');
|
||||
s.transition(t.id, 'queued');
|
||||
s.transition(t.id, 'executing');
|
||||
s.setResult(t.id, { branch: 'maestro/run', worktree: '/wt', diffSummary: '+1 -0', commits: ['abc'], prUrl: null });
|
||||
s.setResult(t.id, { branch: 'maestro/run', worktree: '/wt', diffSummary: '+1 -0', commits: ['abc'], prUrl: null, summary: null, verdict: null });
|
||||
s.transition(t.id, 'exec_review');
|
||||
const done = s.decide(t.id, 'accept', 'user');
|
||||
assert.equal(done.status, 'done');
|
||||
@@ -164,3 +164,47 @@ test('reconcileDeps:存量 ready 但依赖未满足 → 纠正为 blocked(
|
||||
assert.equal(r2.blocked + r2.released, 0);
|
||||
s.close();
|
||||
});
|
||||
|
||||
test('score 调度:解锁加权 > 链条惯性 > 自身分;nextExecutable 取最高分', () => {
|
||||
const s = freshStore();
|
||||
const p = s.createProject({ name: 'sc', repoPath: '/tmp/sc-' + Math.random() });
|
||||
// A:P1 无依赖,但有两条 P0 blocked 任务等它 → score = 2 + 3 + 3 = 8
|
||||
const a = s.createTask({ projectId: p.id, title: 'A', complexity: 'easy', priority: 1 });
|
||||
s.createTask({ projectId: p.id, title: 'W1', complexity: 'easy', priority: 0, deps: [a.id] });
|
||||
s.createTask({ projectId: p.id, title: 'W2', complexity: 'easy', priority: 0, deps: [a.id] });
|
||||
// B:P0 无依赖无人等 → score = 3
|
||||
s.createTask({ projectId: p.id, title: 'B', complexity: 'easy', priority: 0 });
|
||||
const next = s.nextExecutable(p.id);
|
||||
assert.equal(next?.title, 'A'); // 解锁两条 P0 的 A(8) 压过孤立 P0 的 B(3)
|
||||
s.close();
|
||||
});
|
||||
|
||||
test('createTask:deps 引用不存在/跨项目任务被拒绝', () => {
|
||||
const s = freshStore();
|
||||
const p1 = s.createProject({ name: 'd1', repoPath: '/tmp/d1-' + Math.random() });
|
||||
const p2 = s.createProject({ name: 'd2', repoPath: '/tmp/d2-' + Math.random() });
|
||||
const other = s.createTask({ projectId: p2.id, title: 'x', complexity: 'easy' });
|
||||
assert.throws(() => s.createTask({ projectId: p1.id, title: 'bad', complexity: 'easy', deps: ['tsk_nope'] }), StoreError);
|
||||
assert.throws(() => s.createTask({ projectId: p1.id, title: 'bad2', complexity: 'easy', deps: [other.id] }), StoreError);
|
||||
s.close();
|
||||
});
|
||||
|
||||
test('容器收口:已拆解 Hard 的子任务全 done → 容器自动 done(逐级向上)', () => {
|
||||
const s = freshStore();
|
||||
const p = s.createProject({ name: 'cc', repoPath: '/tmp/cc-' + Math.random() });
|
||||
const root = s.createTask({ projectId: p.id, title: 'epic', complexity: 'hard' });
|
||||
s.setPlan(root.id, '拆 2 子');
|
||||
s.transition(root.id, 'plan_review');
|
||||
s.decide(root.id, 'accept', 'user'); // decomposed
|
||||
const c1 = s.createTask({ projectId: p.id, parentId: root.id, title: '子1', complexity: 'easy' });
|
||||
const c2 = s.createTask({ projectId: p.id, parentId: root.id, title: '子2', complexity: 'easy' });
|
||||
const finish = (tid) => {
|
||||
s.transition(tid, 'queued'); s.transition(tid, 'executing');
|
||||
s.transition(tid, 'exec_review'); s.decide(tid, 'accept', 'user');
|
||||
};
|
||||
finish(c1.id);
|
||||
assert.equal(s.getTask(root.id).status, 'decomposed'); // 还有子没完,容器不动
|
||||
finish(c2.id);
|
||||
assert.equal(s.getTask(root.id).status, 'done'); // 子全 done → 容器自动 done
|
||||
s.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user