feat(executor): 人工驳回意见喂回返工 agent prompt (tsk_BJLguXuWkyq4)
照搬现有 L1「上次失败原因」链路,新增平行的「人工驳回意见」注入链路: - store.lastRejectReasonOf(taskId, gate?):从 approvals 取最近一次 reject reason, 支持按闸过滤(exec/spec/plan),无 reject 返回 null - orchestrator.claimOne:按返工角色对应闸装配 task.lastRejectReason 下发 job (executor→exec / planner-spec→spec / planner-decompose→plan) - runner.lastRejectLines + buildPrompt/buildPlannerPrompt 拼接驳回段 (紧接失败段之后,2000 字截断);buildConflictPrompt 不注入 - types.Task 新增 lastRejectReason 临时装配字段(仅注入 prompt,不持久化) - test/memory-inject.test.ts:覆盖 store gate 过滤、三处注入、截断、边界、顺序 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1070,6 +1070,23 @@ export class Store {
|
||||
return row?.error ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取某任务最近一次「被人审驳回」的改进意见(approvals 里 action='reject')。
|
||||
* 供把人工驳回意见喂回返工 agent 的 prompt,避免重复犯同样的问题。
|
||||
* gate 可选:传入则只取该闸的最近一次 reject(exec/spec/plan),与返工角色对齐;
|
||||
* 不传则取任意闸最近一次。无 reject 返回 null。
|
||||
*/
|
||||
lastRejectReasonOf(taskId: string, gate?: GateKind): string | null {
|
||||
const row = (gate
|
||||
? this.db.prepare(
|
||||
`SELECT reason FROM approvals WHERE task_id = ? AND action = 'reject' AND gate = ? AND reason IS NOT NULL ORDER BY at DESC LIMIT 1`,
|
||||
).get(taskId, gate)
|
||||
: this.db.prepare(
|
||||
`SELECT reason FROM approvals WHERE task_id = ? AND action = 'reject' AND reason IS NOT NULL ORDER BY at DESC LIMIT 1`,
|
||||
).get(taskId)) as { reason?: string | null } | undefined;
|
||||
return row?.reason ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* L3 拆解背景:取某任务的父任务拆解意图(parent.plan)+ 同层兄弟任务概览(标题/状态/复杂度)。
|
||||
* 无 parentId → null。仅做便宜的 DB 读,不做 git/RAG 检索。
|
||||
|
||||
Reference in New Issue
Block a user