Skip to content

fix(a2a): finalize dangling candidate steps in pipeline snapshot - #202

Open
ruanzhengxin-zhuxing wants to merge 1 commit into
mainfrom
harness/219d1d2a
Open

fix(a2a): finalize dangling candidate steps in pipeline snapshot#202
ruanzhengxin-zhuxing wants to merge 1 commit into
mainfrom
harness/219d1d2a

Conversation

@ruanzhengxin-zhuxing

Copy link
Copy Markdown
Collaborator

问题

Session eadbf79d597b4e929827475e01612717 的 pipeline_snapshot 中,候选 evaluate_candidate_ea1b4215 标记 completed,但其子步骤 template_generatingcost_estimating 仍为 pending 且 conclusion 为 null。

根因

src/iac_code/a2a/pipeline_snapshot.py 快照 reducer:

  1. candidate_started 携带的子步骤骨架未按 runId 登记进 _candidate_steps_by_run_id,后续 candidate_step_* 事件另建条目,留下重复的 pending 骨架;
  2. candidate_completed/candidate_failed 不收尾非终态子步骤。

修复

  • 骨架子步骤按 runId 去重登记,lifecycle 事件复用同一条记录;
  • 候选进入终态时,将仍为 pending/working 的子步骤显式标记 canceled(含 canceledAt / cancelReason)。

测试

  • 新增 3 个回归测试;tests/a2a 全量 1435 通过;下游快照消费方测试 105 通过;ruff/ty 通过。

Aone 需求 #84501215 | Harness WorkItem 219d1d2a

A completed/failed candidate could still carry pending sub-steps with a
null conclusion (e.g. evaluate_candidate_ea1b4215 in session
eadbf79d597b4e929827475e01612717):

1. candidate_started skeleton steps were merged into candidate["steps"]
   without registering their runIds, so later candidate_step_* lifecycle
   events appended duplicate entries and the pending skeleton twin was
   never closed out.
2. candidate_completed/candidate_failed only updated the candidate itself
   and never reconciled non-terminal sub-steps.

Now skeleton steps are deduplicated by runId through
_candidate_steps_by_run_id, and any sub-step still pending/working when
its candidate reaches a terminal state is explicitly marked canceled
with a cancelReason, so completed candidates can no longer contain
non-terminal sub-steps.
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