Skip to content

fix(pipeline): keep run event start/complete counts symmetric - #200

Open
ruanzhengxin-zhuxing wants to merge 1 commit into
mainfrom
harness/693b8c40
Open

fix(pipeline): keep run event start/complete counts symmetric#200
ruanzhengxin-zhuxing wants to merge 1 commit into
mainfrom
harness/693b8c40

Conversation

@ruanzhengxin-zhuxing

Copy link
Copy Markdown
Collaborator

问题

证据 Session 6bf1c83310104fbf9f21f7843bcbea10 的 run 事件统计中 step_completed=6 > step_started=5、pipeline_completed=2 > pipeline_started=1,完成事件多于开始事件,状态计数不对称。

根因

pipeline_runner._continue_from_current

  1. 等待输入步骤在用户输入恢复后重新完成时不补发 step_started
  2. rollback 分支未清除 resume_waiting_step/resume_running_step 标志,rollback 目标步骤(如 evaluate_candidates 校验失败修复后)走 resume 分支静默重完成;
  3. 管道已完成后再次进入 _continue_from_current 时尾部重发 pipeline_completed

修复

  • 等待输入步骤恢复重跑前补发配对 STEP_STARTEDresumed: true,attempt 不变);重启恢复不补发(journal 已有原 start)。
  • rollback 后清除 resume 标志,目标步骤走正常路径发新 attempt 的 STEP_STARTED
  • 入口已完成的管道不再重发 PIPELINE_COMPLETED

验证

  • 新增 TestStartCompleteEventPairing 4 个单测(resume 配对 / restart 不重复 / rollback 配对 / 不重发 terminal)。
  • tests/pipeline、tests/a2a、tests/web 全部通过;ruff + ty 通过。

Harness WorkItem: 693b8c40-74fc-4c4c-a8be-710fdb351e9f

- Re-emit a paired STEP_STARTED (marked resumed, same attempt) when a
  waiting-input step re-runs after user input, so its second
  STEP_COMPLETED no longer exceeds step_started in the a2a journal.
- Clear resume_waiting/resume_running flags after a rollback so the
  rollback target emits a fresh STEP_STARTED instead of silently
  re-completing (evaluate_candidates repeated completion case).
- Skip the trailing terminal block when the pipeline was already
  complete on entry, preventing a duplicate PIPELINE_COMPLETED while
  pipeline_started is only emitted once by run().

Ensures step_completed <= step_started and pipeline_completed <=
pipeline_started for session 6bf1c83310104fbf9f21f7843bcbea10 class of
runs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant