中断状态记住迭代号,从下一轮继续
恢复的粒度是 ReAct 迭代。中断状态里存着被打断时的 iteration,恢复时先给挂起的工作流补记反馈,等所有工作流都跑完,再把 resume_iteration + 1 写进 ctx.extra 的 RESUME_START_ITERATION_KEY——主循环的 for range 正是从这个值起步(见「主循环形态」一行)。也就是说中断点被对齐到迭代边界,不会从半轮中间接续。
resume_iteration = interruption_state.iteration
logger.info(f"Resuming ReAct from iteration {resume_iteration + 1}")
# Step 1: record feedback for the current pending workflow
pending_wf_id = interruption_state.pending_workflow_id
pending_comp_id = interruption_state.pending_component_id
# ...(1760-1800 行:补记反馈、重放已完成工作流、检查是否再次中断)
# All workflows completed — continue ReAct loop from next iteration
ctx.extra[RESUME_START_ITERATION_KEY] = resume_iteration + 1