Skip to content

fix(pipeline): re-emit step_started when resuming a waiting-input step - #207

Open
ruanzhengxin-zhuxing wants to merge 1 commit into
mainfrom
harness/72e769e3
Open

fix(pipeline): re-emit step_started when resuming a waiting-input step#207
ruanzhengxin-zhuxing wants to merge 1 commit into
mainfrom
harness/72e769e3

Conversation

@ruanzhengxin-zhuxing

Copy link
Copy Markdown
Collaborator

问题

证据 Session eadbf79d597b4e929827475e01612717 的 run 事件聚合计中 step_completed=6step_started=5,主步骤 started/completed 不配对。

根因

等待输入步骤(auto_advance=false,如 confirm_and_select)在暂停前已 yield STEP_COMPLETED;用户回复后 resume()resume_waiting_step 路径重入该步骤,恢复分支不再发 STEP_STARTED,但处理完用户输入后又会再次 yield STEP_COMPLETED,导致同一步骤 1 个 started 对应 2 个 completed。候选子步骤 candidate_* 事件计数不受影响。

修复

  • resume() 传入 reemit_step_started=True_continue_from_currentresume_current_step 分支据此补发与原步骤同 step_id/attempt 的 STEP_STARTEDdata.resumed=true)。
  • resume_ask_user_question(暂停前未发 STEP_COMPLETED)保持默认不补发,避免反向不配对。
  • 同 runId 的补发事件对 A2A translator / snapshot / web transcript 是幂等的原位更新。

测试

  • 新增 test_resume_waiting_step_reemits_step_started_so_counts_stay_pairedtest_resume_ask_user_question_does_not_reemit_step_started
  • tests/pipeline + tests/a2a + web transcript 套件 3051 passed(唯一失败的 test_prerequisites 用例在未修改基线上同样失败,环境相关)。
  • ruff 通过。

Harness WorkItem: 72e769e3-f852-4006-ac2a-ee04a6fd2d55

…p so run-event started/completed counts stay paired

A waiting-input step (auto_advance=false, e.g. confirm_and_select) emits
step_completed before pausing for user input, and emits step_completed
again after the resume run processes the answer, while the resume path
skipped step_started. Aggregated run-event counts then showed one more
step_completed than step_started (observed 6:5 in session
eadbf79d597b4e929827475e01612717).

resume() now passes reemit_step_started=True so _continue_from_current
re-emits STEP_STARTED for the same attempt (data.resumed=true) before
re-running the step. resume_ask_user_question keeps the default because
that flow never emitted step_completed before pausing.
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