fix(a2a): merge candidate step skeletons through the run-id index - #199
Open
ruanzhengxin-zhuxing wants to merge 1 commit into
Open
fix(a2a): merge candidate step skeletons through the run-id index#199ruanzhengxin-zhuxing wants to merge 1 commit into
ruanzhengxin-zhuxing wants to merge 1 commit into
Conversation
`candidate_started` carries a pending skeleton of the candidate's sub-steps. The reducer wrote that list straight into `candidate["steps"]` as part of the coordinate merge without registering the entries in `_candidate_steps_by_run_id`. Later `candidate_step_started` / `candidate_step_completed` events therefore missed the index, appended a second dict with the same `runId`, and the snapshot ended up exposing the same candidate sub-step twice: one pending copy with no conclusion next to the completed one. That is the `steps.*.candidates.*.steps.0` state ambiguity seen in the pipeline snapshot. Split `steps` out of the candidate coordinate and merge the skeletons through the run-id index instead, so lifecycle events reuse the tracked dict. The skeleton status is only used as the initial value, which keeps a re-delivered skeleton (candidate restart, snapshot rehydration) from rewinding a working/completed/failed step back to pending or dropping its conclusion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修正
pipeline_snapshot.pyreducer 合并候选子步骤骨架的方式,消除「候选下同 id 子步骤 pending(空结论)与 completed 并存」的状态歧义。问题
candidate_started事件携带候选子步骤的 pending 骨架(status=pending、无conclusion)。reducer 把这个列表当作普通坐标字段直接写进candidate["steps"],却没有把骨架项登记到_candidate_steps_by_run_id索引。因此后续
candidate_step_started/candidate_step_completed在_upsert_candidate_step查索引时查不到,会再新建一个同runId的 dict 并 append。同一个候选子步骤在 snapshot 里出现两份:status=pending,conclusion缺失status=completed,带conclusion这正是 pipeline snapshot 中
steps.*.candidates.*.steps.0的状态歧义(template_generating、cost_estimating各出现 pending 空结论 + completed 两份)。同一缺陷在候选重启时还会丢弃已跟踪的子步骤状态,因为骨架列表每次都被整体替换。
改动
steps从候选坐标中分离,骨架改为经 run-id 索引做 upsert 合并,生命周期事件复用同一 dict,不再产生同 id 副本。status仅作首次创建时的初始值:重复投递的骨架(候选重启、snapshot 重新水合)不会把已进入 working/completed/failed 的子步骤打回 pending,也不会清空其conclusion。name/index/total)仍会补齐到已跟踪的条目。公开 snapshot schema 不变,
SNAPSHOT_SCHEMA_VERSION未改动。验证
tests/a2a全量 1434 通过。ruff check与ty check src/全通过。