feat(agent): L1 记忆注入——重试任务带上次失败原因喂回 prompt

- store.lastRunErrorOf(taskId):取最近一次失败 run 的 error(任意 kind)
- orchestrator.claimOne:写 job.json 时填充 task.lastRunError 下发 worker
- runner 三处 prompt(executor/planner/conflict)注入「## 上次失败原因」段(截断 2000 字符)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-24 22:09:06 +08:00
parent 7a6c826610
commit ecea1ae9b6
4 changed files with 97 additions and 2 deletions
+4 -1
View File
@@ -174,9 +174,12 @@ export function createOrchestrator(store: Store, log: OrchestratorLogger, deps:
const run = store.startRun(task.id, dbKind, { worktree: isPlanner ? project.repoPath : dir, branch });
runId = run.id;
// L1 记忆注入:重试任务带上「上次失败原因」,worker 端拼进 prompt(见 runner.buildPrompt*
const lastRunError = store.lastRunErrorOf(task.id);
d.writeJobSpec({
runId: run.id,
task: { ...task, status: isPlanner ? task.status : 'executing' },
task: { ...task, status: isPlanner ? task.status : 'executing', lastRunError },
project, worktreeDir: dir, branch, runKind,
});