feat(worker): 暂停/重跑续接先前 LLM 对话,不再从头开始

Worker 的 Execute 在创建 session 后尝试 Resume 先前的 transcript,
如果存在则续接对话而非重建全新会话,避免浪费已积累的 LLM 上下文。

Claude-Session: https://claude.ai/code/session_014TfZWeVGhjXqZD3vcj44mz
This commit is contained in:
Autumn-27 committed 2026-08-20 09:15:53 -04:00
1 parent 06a8f64b5e
commit 56101b46e8
3 files changed
+19 -6

No files matched your search

+2 -1
View File
@@ -926,7 +926,8 @@ func (e *Engine) runWorkerStep(ctx context.Context, t *Task, name string, worker
return true
}
// if a pause cancelled this run mid-flight, return the intent to the frontier
// so it is re-claimed (and re-run from scratch) on resume — not marked done.
// so it is re-claimed on resume — the worker will resume the prior LLM
// conversation from its transcript instead of restarting from scratch.
if ectx.Err() != nil && e.IsPaused(t.ID) {
_ = t.Store.SetIntentState(intent.ID, "open")
return true