Skip to content

実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #2172(Closes #2159)で構築した e2e performance benchmark 測定器の rerun-attempt 選択を、OWNER adversarial review P1-1 の指摘どおり決定論的にする"
change_kind: code

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は collector / performance gate の選択ロジックとスキーマ更新のみを対象とする純粋な静的変更であり、プロセス起動・外部通信・UI 操作は不要。uv run --locked pytest によるユニット/回帰テストと rg による doc grep のみで検証が完結する。

Parent Issue

なし(単独 follow-up。起点は PR #2172 / originating Issue #2159)

Parent Goal Ref

  • Goal: scripts/ci/collect_e2e_performance_benchmark.py::_dedupe_by_workflow_run_id および tests/ci/test_ci_performance_gate.py 内の同種選択ロジックの rerun attempt 選択を、入力配列の並び順に依存しない決定論的なものにする
  • Desired Destination: N/A(単独改善のため親 Issue のスコープなし)

Current Validated Scope

  • scripts/ci/collect_e2e_performance_benchmark.py の _dedupe_by_workflow_run_id(または同等の選択ロジック)を order-independent 化する
  • tests/ci/test_ci_performance_gate.py(production performance gate として run_evidence_gate() から使用される)の _dedupe_by_workflow_run_id / _pair_by_workflow_run_id / _cli_run_details_from_pairs を同じ決定論的ポリシーで order-independent 化し、"run_attempt": 1 のハードコードを廃止する
  • 選択した run_attempt と選択ポリシー(initial_attempt_only_v1 に固定)を manifest 出力・gate assessment の双方に記録する
  • schemas/e2e_performance_benchmark_manifest_v1.schema.json の RunRecord(unevaluatedProperties: false)に run_attempt / rerun_attempt_selection_policy を後方互換な optional field として追加する
  • run_attempt を _verify_run_record() 経由で trusted evidence に binding し、(workflow_run_id, job, run_attempt) の型/衝突を fail-closed で扱う
  • scripts/ci/tests/e2e_performance_benchmark/ および tests/ci/ に順序違いの回帰テストを追加する

Remaining Parent Gaps

なし

Outcome

scripts/ci/collect_e2e_performance_benchmark.py::_dedupe_by_workflow_run_id と tests/ci/test_ci_performance_gate.py 内の同種選択ロジック(_dedupe_by_workflow_run_id / _pair_by_workflow_run_id / _cli_run_details_from_pairs)の両方が、initial_attempt_only_v1 ポリシー(workflow_run_id ごとに run_attempt == 1 の成功レコードのみを候補とし、attempt 1 が失敗/欠落しているサンプルは除外する。入力配列内の出現順序には一切依存しない)に基づいて決定論的に選択を行うようになり、選択した run_attempt の値とポリシー識別子が manifest 出力・gate assessment の双方に記録された状態。run_attempt の値は artifact に紐づく GitHub API の attempt-specific jobs レスポンスと照合される。同一 underlying record 集合を異なる挿入順序で与えても、選択結果と runs の出力順序(workflow_run_id 昇順の canonical sort)が完全に一致することを検証する回帰テストが追加され、uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py と uv run --locked pytest tests/ci/test_ci_performance_gate.py が全件 PASS すること。

In Scope

  • _dedupe_by_workflow_run_id(collector 側・gate 側の両方、または名称変更後の同等関数)を、dict.setdefault() による first-seen-wins(挿入順依存)から、initial_attempt_only_v1 ポリシー(run_attempt == 1 かつ success のレコードのみを候補にする。attempt 1 が存在しない/失敗している場合はその workflow_run_id のサンプル自体をスキップする)へ変更する。現行の「non-success record を除外した後で dedupe する」順序では attempt-1-only を実現できないため、dedupe/filter の順序を見直す
  • tests/ci/test_ci_performance_gate.py の _pair_by_workflow_run_id()(dict comprehension による実質 last-seen-wins)を同じポリシーに統一し、_cli_run_details_from_pairs() にハードコードされている "run_attempt": 1 を、実際に選択された attempt 値を伝播する実装に置き換える
  • 選択された run_attempt の値と選択ポリシー識別子(rerun_attempt_selection_policy: "initial_attempt_only_v1")を manifest の該当 run エントリまたは job cohort に記録する。schemas/e2e_performance_benchmark_manifest_v1.schema.json の RunRecord(unevaluatedProperties: false)に run_attempt(integer >= 1)と rerun_attempt_selection_policy(string)を、既存 manifest との後方互換性を維持する optional field として追加する
  • run_attempt を trusted な必須フィールドとして扱い、_verify_run_record() の live verification 経路で attempt-specific jobs API(GET .../actions/runs/{run_id}/attempts/{attempt_number}/jobs 相当)と突き合わせて binding する。artifact payload 内の attempt 値と API 側 attempt 値が矛盾する場合は fail-closed で conflict 扱いにする
  • selection 後の runs 配列を workflow_run_id(必要なら (workflow_run_id, job, run_attempt))の固定キーでソートし、異なる workflow_run_id 間の出力順序も入力順に依存しないようにする
  • live artifact 取得(GET .../actions/runs/{run_id}/artifacts)が pagination されている場合に全ページを走査するようにする(現状は1ページのみ取得しており、rerun 回数が多い run で存在する artifact を artifact_not_found と誤判定し得る)
  • run_attempt の入力契約を integer >= 1 に正規化し、missing / 文字列型(例: "2")/ 0 / 負値 / 同一 (workflow_run_id, job, run_attempt) で artifact ID・digest が異なる衝突を、すべて fail-closed のテストケースとして扱う
  • docs/dev/e2e-performance-benchmark.md の「サンプル identity: workflow_run_id」節に、initial_attempt_only_v1 ポリシーの説明(attempt 1 失敗時はサンプル除外・新規 run で再取得する運用)を追記する
  • 同一 underlying record 集合を異なる挿入順序・iteration 順序で与えた場合に、選択結果と出力順序の両方が完全に一致することを確認する回帰テストを scripts/ci/tests/e2e_performance_benchmark/ と tests/ci/ に追加する

Out of Scope

Acceptance Criteria

  • AC1: collector 側 _dedupe_by_workflow_run_id(scripts/ci/collect_e2e_performance_benchmark.py)が、同一 workflow_run_id を持つ複数レコードに対して、入力リストの並び順を変えても常に同一のレコードを選択する(順序非依存性)。回帰テストは新規ファイル scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py に追加する
  • AC2: gate 側 _dedupe_by_workflow_run_id / _pair_by_workflow_run_id(tests/ci/test_ci_performance_gate.py)も同じ initial_attempt_only_v1 ポリシーで順序非依存になっており、_cli_run_details_from_pairs() の run_attempt: 1 ハードコードが実際の選択結果を伝播する実装に置き換わっている。回帰テストは既存の兄弟ファイル命名規則(test_ci_performance_gate_*.py)に従う新規ファイル tests/ci/test_ci_performance_gate_rerun_attempt_selection.py に追加し、tests/ci/test_ci_performance_gate.py から helper をインポートする
  • AC3: 選択ポリシーが initial_attempt_only_v1 という単一の明示的なルールとしてコード内に記述されており、dict.setdefault() の挿入順依存(first-seen-wins)にも _pair_by_workflow_run_id() の dict comprehension による実質 last-seen-wins にも依存していない
  • AC4: 選択された run_attempt の値が schemas/e2e_performance_benchmark_manifest_v1.schema.json の RunRecord(既存 manifest との後方互換性を維持する optional field として追加された run_attempt / rerun_attempt_selection_policy)に準拠する形で manifest 出力(または対応する job cohort エントリ)に記録され、schema validation を通過する
  • AC5: run_attempt が live verification 経路で attempt-specific jobs API 相当の trusted evidence と照合され、artifact payload 側の attempt 値と矛盾する場合に fail-closed で検出される回帰テストが追加されている
  • AC6: 採用した選択ポリシー(initial_attempt_only_v1)の名前・理由・attempt 1 失敗時のサンプル除外運用が docs/dev/e2e-performance-benchmark.md に明記されている
  • AC7: 同一 underlying record 集合を複数の異なる挿入順序(例: 元の順序 / 逆順 / シャッフル順)で与えるパラメタライズド回帰テストが scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py および tests/ci/test_ci_performance_gate_rerun_attempt_selection.py に追加されており、全順序で出力(選択されたレコード、run_attempt、runs 配列の canonical sort 順)が完全に一致することを検証している
  • AC8: artifact 一覧取得の pagination を全ページ走査するテスト(複数ページに跨る artifact が正しく発見されることを検証する回帰テスト)が scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py に追加されている
  • AC9: run_attempt の型正規化・欠落・衝突(missing / 文字列型 / 0 / 負値 / 同一キーで artifact ID・digest が異なる衝突)が fail-closed で検出される回帰テストが scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py に追加されている
  • AC10: 既存の test_collect_e2e_performance_benchmark.py と test_ci_performance_gate.py の全テストが引き続き PASS する

Verification Commands

# AC1
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py::test_dedupe_by_workflow_run_id_order_independent

# AC2
$ uv run --locked pytest tests/ci/test_ci_performance_gate_rerun_attempt_selection.py::test_dedupe_and_pair_by_workflow_run_id_order_independent

# AC3
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py::test_selection_policy_is_initial_attempt_only_v1

# AC4
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py::test_run_attempt_recorded_schema_conformant

# AC5
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py::test_run_attempt_trusted_binding_conflict_fails_closed

# AC6
$ rg -n "initial_attempt_only_v1" docs/dev/e2e-performance-benchmark.md

# AC7
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py::test_order_independent_parametrized_matches_canonical_sort
$ uv run --locked pytest tests/ci/test_ci_performance_gate_rerun_attempt_selection.py::test_order_independent_parametrized_matches_canonical_sort

# AC8
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py::test_artifact_listing_paginates_all_pages

# AC9
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py::test_run_attempt_type_normalization_and_conflict_fail_closed

# AC10
# baseline-expect: pass
$ uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py
# baseline-expect: pass
$ uv run --locked pytest tests/ci/test_ci_performance_gate.py

Allowed Paths

  • scripts/ci/collect_e2e_performance_benchmark.py
  • scripts/ci/tests/e2e_performance_benchmark/
  • docs/dev/e2e-performance-benchmark.md
  • schemas/e2e_performance_benchmark_manifest_v1.schema.json
  • tests/ci/test_ci_performance_gate.py
  • tests/ci/test_ci_performance_gate_rerun_attempt_selection.py(新規ファイル。既存の兄弟ファイル命名規則に従う)

Stop Conditions

  • schemas/e2e_performance_benchmark_manifest_v1.schema.json の後方互換 optional field 拡張だけでは表現できない破壊的スキーマ変更が必要と判明した場合(manifest_v2 への分離が必要と判明した場合は直ちに停止して報告する)
  • tests/ci/test_ci_performance_gate.py / tests/ci/test_ci_performance_gate_rerun_attempt_selection.py 以外の performance gate 関連ファイル(tests/ci/test_ci_performance_gate_clock_alignment.py 等の既存兄弟ファイル)への変更が必須と判明した場合
  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Required Design References

Scope Delta(任意)

Background

PR #2172(https://github.com/squne121/loop-protocol/pull/2172、merged to main as commit af47ed7、Closes #2159)で e2e performance benchmark 測定器を実装した。OWNER adversarial review(https://github.com/squne121/loop-protocol/pull/2172#issuecomment-5295659213)で finding P1-1 が指摘され、PR 本文に follow-up として明記の上、当該 PR ではスコープ外として明示的に見送られた。

P1-1: rerun attempt selection is input-order dependent. GitHub の GITHUB_RUN_ID は rerun しても変わらないが GITHUB_RUN_ATTEMPT は増分する(1, 2, 3...)。現在の _dedupe_by_workflow_run_id(scripts/ci/collect_e2e_performance_benchmark.py)は setdefault() による first-seen-wins セマンティクスを使っており、どの attempt が canonical として扱われるかが入力 JSON / API レスポンスでレコードがたまたま出現する順序に依存してしまう。固定の宣言されたポリシーではない。

本 Issue の初回起票版に対して OWNER が REQUEST_CHANGES レビュー(上記 issuecomment-5301621365)を行い、以下の欠陥を指摘した。

  1. P0: 初回契約は AC3(run_attempt を manifest に記録)と Allowed Paths が自己矛盾していた(schemas/e2e_performance_benchmark_manifest_v1.schema.json が unevaluatedProperties: false で run_attempt を許可していないのに、schema ファイルが Allowed Paths 外だった)。→ 本改訂で schema ファイルを Allowed Paths に追加し、後方互換 optional field として拡張する方針を明記した。
  2. P0: collector だけを修正しても、tests/ci/test_ci_performance_gate.py(run_evidence_gate() から production gate として使用される)に同型の順序依存バグと run_attempt: 1 のハードコードが残り、検証: #2119 AC9/AC10 の close-grade 実CI証跡を確認する #2155(この performance gate を実 CI データで実行して 実装: CI: Playwright E2E の responsive matrix を専用 lane へ分離し critical path を短縮する #2119 の close 可否を決める downstream Issue)の判定が非決定論的なままになる。→ 本改訂で gate 側ファイルを scope に含めた。
  3. P0: run_attempt を単純に追加して min()/max() すると、正しい artifact に偽の run_attempt を付けるだけで canonical selection を操作できてしまう(trusted binding が欠如)。→ 本改訂で attempt-specific jobs API との binding を AC5 として追加した。
  4. P0: 「具体的な selection policy は実装時に決める」は契約として弱く、job 単位の rerun により同一 workflow_run_id 内で実際には同時実行されていない job 同士を合成しうる。また現行の「non-success 除外後に dedupe」の順序では attempt-1-only を実現できない。→ 本改訂でポリシーを initial_attempt_only_v1 に固定し、dedupe/filter の順序見直しを In Scope に追加した。
  5. P1: 異なる workflow_run_id 間の出力順序が入力順のままで、AC5(旧)が意図する完全な order independence を保証できない。→ 本改訂で canonical sort を AC7 として追加した。
  6. P1: live artifact 取得が pagination に対応しておらず、rerun を多用した run で存在する artifact を誤検出し得る。→ 本改訂で AC8 として追加した。
  7. P1: run_attempt の型・重複衝突契約が未定義。→ 本改訂で AC9 として追加した。

Source

source_kind: post_merge_cleanup
source_url: "https://github.com/squne121/loop-protocol/pull/2172"
dedupe_key: "follow-up:squne121/loop-protocol:pr/2172:performance-benchmark-p1-1-rerun-dedup"

Delivery Rule

  • 1 Issue = 1 PR を原則とする
  • 作業は専用 worktree で行い、Draft PR を既定とする

Notes for Reviewer

Activity

  1. squne121 commented on Aug 15, 2026

    @squne121
    OwnerAuthor

    Verdict: REQUEST_CHANGES

    Issue #2179 の問題設定自体は妥当です。PR #2172 で defer された P1-1、すなわち「同じ workflow_run_id の rerun のうち、入力順で canonical record が変わる」という欠陥を正しく拾っています。現行 collector も実際に dict.setdefault() の first-seen-wins です。

    ただし、現在の Issue 契約のまま実装すると、局所的には AC が通っても、実 benchmark / #2155 の close gate 全体では rerun attempt が決定論的にならない可能性が高いです。実装開始前に Issue 本文を修正すべきです。

    1. P0 — AC3 と Allowed Paths が自己矛盾しており、そのままでは実装不能です。 Issue は「選択した run_attempt と選択ポリシーを manifest に記録」を In Scope/Outcome に置き、AC3 でも run_attempt の manifest 記録を要求しています。一方、現行 RunRecord schema は unevaluatedProperties: false で、許可フィールドに run_attempt も selection policy もありません。したがって単純に collector がフィールドを足すと schema validation に失敗します。ところが schema ファイルは Allowed Paths 外であり、「schema 変更が必要なら停止」が Stop Condition です。
      修正: schemas/e2e_performance_benchmark_manifest_v1.schema.json を Allowed Paths に加え、schema evolution を Issue 内で決定してください。新フィールドを必須契約化するなら manifest_v2 を切る方が明瞭です。v1 を拡張するなら「既存 manifest との互換性を維持する optional field とする」などを明示すべきです。また In Scope が要求する「selection policy 名/理由を manifest に記録」は、現 AC では検証されていません。schema-conformant manifest に policy identifier が存在することを独立 AC/VC にしてください。

    2. P0 — collector だけ修正しても、実際の performance gate に別の順序依存実装が残ります。 tests/ci/test_ci_performance_gate.py::_dedupe_by_workflow_run_id() も first-seen-wins です。さらに _pair_by_workflow_run_id() は dict comprehension で同一 ID の重複に対して実質 last-seen-wins となっています。しかも run_evidence_gate() はこの pairing を production gate として使い、_cli_run_details_from_pairs() は実際に選ばれた attempt と無関係に run_attempt: 1 をハードコードしています。
      検証: #2119 AC9/AC10 の close-grade 実CI証跡を確認する #2155 はまさにこの tests/ci/test_ci_performance_gate.py を実 CI データで実行して 実装: CI: Playwright E2E の responsive matrix を専用 lane へ分離し critical path を短縮する #2119 の close 可否を決める downstream Issue です。つまり 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179 の Allowed Paths のままでは、collector の manifest だけ決定論的になり、最終判定経路は非決定論的なままです。
      修正: tests/ci/test_ci_performance_gate.py と対応 regression test を 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179 の scope に含めるか、rerun canonicalization を shared production helper に切り出して collector/gate の双方から使ってください。assessment の run_details[].run_attempt も選択結果を伝播させ、1 の捏造は廃止する必要があります。

    3. P0 — 新しい選択キー run_attempt が trusted GitHub evidence に binding されません。 現 collector の _verify_run_record() は run_attempt を検査しておらず、live verification も run の artifact 一覧から artifact_id / digest / workflow_run.id / head_sha を照合するだけです。 GitHub の artifact REST response 自体にも run_attempt は含まれていません。([GitHub Docs]1)
      したがって、今の設計に単に run_attempt を追加して min() / max() すると、正しい artifact に偽の run_attempt を付けるだけで canonical selection を操作できます。GitHub は run_id + attempt_number を指定して、その attempt に属する jobs を取得する公式 API を提供しています。([GitHub Docs]2)
      修正: run_attempt を int >= 1 の必須 trusted field にし、attempt-specific jobs API で少なくとも job 名・head SHA・conclusion と binding してください。artifact payload 内の attempt と API attempt の照合も行うとさらに堅牢です。

    4. P0 — 「具体的な selection policy は実装時に決める」は benchmark 契約として弱すぎます。 GitHub では GITHUB_RUN_ID は同一 workflow run の identity で、GITHUB_RUN_ATTEMPT は 1 から rerun ごとに増えます。([GitHub Docs]3) さらに rerun は「全 job」だけでなく「失敗 job だけ」「特定 job だけ」が可能です。([GitHub Docs]4)
      そのため post-split benchmark で e2e-core は attempt 1、e2e-responsive-matrix は attempt 2 をそれぞれ「最新成功」として選ぶと、実際には同時実行されていない二つの job を同一 workflow_run_id の paired critical path として合成することができます。これは 実装: e2e performance benchmark の fixed-SHA cohort・paired critical path・cross-run collector・immutable manifest を再設計する(Issue A) #2159 で導入した exact-pairing の意味を壊します。
      加えて collector は現在、non-success record を除外した後で dedupe しています。したがって Issue が例示している attempt-1-only を選ぶ場合、attempt 1 が failure・attempt 2 が success なら、dedupe に到達した時点では attempt 1 が消えており、attempt-1-only を実現できません。
      修正: policy は OWNER contract として Issue 上で固定してください。実装者に統計的サンプリング規則を決めさせるべきではありません。

    5. P1 — 最小/最大 attempt を決めても、manifest 全体の order independence は成立しません。 現 _dedupe_by_workflow_run_id() は最後に list(seen.values()) を返すため、異なる workflow_run_id 間の順序は入力の初出順のままです。その list がそのまま manifest の runs へ書かれます。
      AC5 が意図する「同一 underlying record 集合なら output が完全一致」を本当に保証するには、winner を決めるだけでなく、canonical output ordering が必要です。
      修正: selection 後に workflow_run_id、必要なら (workflow_run_id, job, run_attempt) の固定 key で sort してください。テストでは「duplicate attempt の順序」だけでなく「別 workflow_run_id 同士の順序」も permutation してください。

    6. P1 — artifact pagination が rerun policy と衝突します。 現 live verifier は GET .../actions/runs/{run_id}/artifacts を1回だけ取得しています。 GitHub の当該 endpoint は既定 30 件/page、最大 100 件/page で pagination されます。([GitHub Docs]1) 一方 workflow run は最大 50 回 rerun でき、特定 job だけの rerun もできます。([GitHub Docs]4)
      したがって rerun を多用した run では、特に「最古 attempt」を選ぶ policy の artifact が page 2 以降へ落ち、存在する artifact を artifact_not_found と誤判定できます。
      修正: artifact lookup は全 page を traverse するか、artifact name/id を使った確実な lookup に変更し、page 2 以降の regression test を追加してください。

    7. P1 — run_attempt の型・重複衝突契約が不足しています。 現在の collector test fixture _record() 自体に run_attempt がなく、既存 rerun test も同じ workflow_run_id に別 artifact_id を入れて「2件になること」しか検証していません。どちらの record が canonical になるべきかはテストしていません。 一方、実 workflow の baseline producer は ${{ github.run_attempt }} を environment variable 経由で Python に渡しており、artifact 内では文字列として書かれます。
      修正: collector の canonical input contract を run_attempt: integer >= 1 と明記し、boundary で正規化してください。missing / "2" / 0 / negative / 同じ (workflow_run_id, job, run_attempt) なのに artifact ID/digest が異なる conflict をすべて fail-closed test にするべきです。同じ attempt 番号の相異なる record に対して単純な min() を使うと、再び入力順依存になります。

    採るべき selection policy

    この benchmark では initial_attempt_only_v1 を第一候補にするのが最も一貫しています。つまり workflow_run_id を独立 sample とし、run_attempt == 1 だけを候補にする。attempt 1 が失敗・不完全なら、その workflow run は performance sample から除外し、新しい workflow_dispatch run を1サンプルとして起動する方式です。

    これは GitHub の rerun が full workflow とは限らず specific job の再実行にもなり得ることから、attempt を跨いだ synthetic pair を原理的に防ぎます。([GitHub Docs]4) Repository 内でも reliability 側の #2170 は workflow_run_id を sample identity とし required_run_attempt: 1、rerun を介入として別扱いする契約を採っています。performance と reliability が必ず同じ規則である必要はありませんが、rerun semantics は metric contract で宣言するものという先例にはなっています。

    どうしても rerun を performance sample として救済したいなら、latest-successful-per-job は避け、全 required jobs が同一 attempt に揃った「単一 complete attempt」を workflow_run 単位で選ぶ必要があります。その場合は collector の job ごとの dedupe より上位で attempt selection を行わなければなりません。

    Issue #2179 を実装可能な契約にするなら

    最小でも、schema を Allowed Paths に追加し、policy を initial_attempt_only_v1 等に固定し、run_attempt を trusted API evidence に binding し、tests/ci/test_ci_performance_gate.py まで scope に入れ、manifest の runs を canonical sort するところまで必要です。また manifest には run_attempt だけでなく rerun_attempt_selection_policy のような versioned identifier を記録し、assessment まで実際の attempt を伝播させるべきです。

    現状の #2179 は「局所的な setdefault() 修正 Issue」としては成立していますが、「PR #2172 P1-1 を解消した」と主張できる契約にはなっていません。 特に P0 の3点――schema/Allowed Paths 矛盾、production gate 側の別 selector、run_attempt の provenance 未検証――を直してから refinement/implementation に回すのが妥当です。

  2. squne121 commented on Aug 15, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    • termination_reason: approved
    • issue_kind: implementation
    • 最終 VERDICT: approve(REVIEWED_BODY_SHA256: sha256:eddd7fb85e0ee8bb7116f04de49f815b871e637ee9a3e86383026ec1652eba01、BLOCKERS: 0)
    • iteration: 3 回の rewrite(1回目: OWNER REQUEST_CHANGES + C9 Runtime Verification Applicability 欠如を反映、2回目: VC の -k keyword フィルタが未実装テストで exit5 hard-block になる落とし穴を修正、3回目: 既存ファイルへの ::新規test名 追加が非正規 VC 形状のため新規テストファイルへ分離)

    起点

    anchor comment: https://github.com/squne121/loop-protocol/issues/2179#issuecomment-5301621365(OWNER squne121 による REQUEST_CHANGES)

    反映した主な変更

    • Allowed Paths に schemas/e2e_performance_benchmark_manifest_v1.schema.json と tests/ci/test_ci_performance_gate.py / tests/ci/test_ci_performance_gate_rerun_attempt_selection.py(新規)を追加(AC3/Allowed Paths 自己矛盾の解消、production performance gate 側の同型バグを scope に含める)
    • 選択ポリシーを initial_attempt_only_v1 に固定(OWNER 推奨)
    • run_attempt の trusted binding(AC5)、canonical sort(AC7)、artifact pagination(AC8)、型/衝突正規化(AC9)を新設
    • ## Runtime Verification Applicability セクションを追加(decision: not_applicable)
    LOOP_HANDOFF_RESULT_V1:
      status: blocked
      routing_action: blocked
      contract_review:
        status: blocked
        gate_result: missing_go
        latest_comment_url: none
        generated_at: none
        body_sha256: sha256:eddd7fb85e0ee8bb7116f04de49f815b871e637ee9a3e86383026ec1652eba01
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "本ループでは label 変更を行っていない"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers:
        - kind: contract_review_not_yet_run
          description: "issue-contract-review(実装着手直前の preflight)が本改訂版に対してまだ実行されていない。impl-review-loop への handoff 前に issue-contract-review を fresh body に対して実行し status: go を得る必要がある。"
      permissions:
        unavailable: []
      generated_at: 2026-08-15T09:55:33Z
      checked_body_sha256: sha256:eddd7fb85e0ee8bb7116f04de49f815b871e637ee9a3e86383026ec1652eba01
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []

    issue-refinement-loop(自律実行、人間承認省略)は本 Issue の contract を review-approve 済みの状態にした。次段階は issue-contract-review の実行である。

  3. squne121 commented on Aug 15, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-15T12:39:57Z)

  4. self-assigned this
    on Aug 15, 2026
  5. squne121 commented on Aug 15, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-15T13:05:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2182"
      head_sha: "c51a190cec723a93545f77b7d85f0d8f5092efc6"
      issue_number: 2179
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  6. squne121 commented on Aug 15, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-15T13:03:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2182"
      head_sha: "9aa6d2cf034bc475b9411475e25fccd20ba13f4d"
      issue_number: 2179
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  7. squne121 commented on Aug 15, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-15T14:35:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2182"
      head_sha: "0de7dc54b67d10414e1d407af80882c188fc6e9a"
      issue_number: 2179
      termination_reason: approved
      merge_ready: true
      iteration: 2
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:pr/2182:p0-4-ci-yml-head-sha-semantics"
          status: created
          issue:
            number: 2184
            url: "https://github.com/squne121/loop-protocol/issues/2184"
          reason: null
        - request_dedupe_key: "follow-up:squne121/loop-protocol:pr/2182:p0-3-gate-side-run-attempt-unification"
          status: created
          issue:
            number: 2187
            url: "https://github.com/squne121/loop-protocol/issues/2187"
          reason: null
      note_only_observations: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

phase/implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions