Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: >-
finalized python-test-core topology に対して、trusted GitHub Actions
job/step timing と raw benchmark evidence を用い、base/head の
performance claim を fail-closed に判定する
change_kind: workflow-and-instrumentation
depends_on:
- 1782
readiness: blocked_until_dependencies_mergedParent Issue
none(#1059 の child にはしない。related: #1059, #1064, #1538, #1724, #1760, #1782)
Parent Goal Ref
N/A(親 Issue なし。#1059 は completed で close 済み)
Current Validated Scope
- CI python-test pytest実行phase高速化: test lane分類・pytest統合・Ruff導入・Skill化 #1059 の性能証拠は
pytest_parallel_ms + pytest_serial_msに限定される。 - PR 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1824 により
python-test-coreは Python-only job、codex-execpolicyは別 job に分離され、python-testaggregate はneeds: [python-test-core, codex-execpolicy]かつif: always()である(.github/workflows/ci.ymlで確認済み)。python_test_benchdispatch ではcodex-execpolicyを含む他 job が skip され、python-test-core単独測定・専用 aggregate ポリシー(scripts/ci/evaluate_python_test_aggregate.py)で評価される既存 authority が存在する。 python-test-core内の各 step timing はdate +%s%3Nによる shell instrumentation でmeasurements.jsonlに記録される(GitHub Workflow Jobs API 由来の trusted timestamp は未使用)。- 通常 CI の runtime baseline artifact はファイル未生成時に
if-no-files-found: warnで継続する(docs/dev/ci-performance.md対象外の他 job も同様)。 CI_TEST_PERFORMANCE_ASSESSMENT_V2(schemas/ci_test_performance_assessment_v2.schema.json/.claude/skills/ci-test-performance/scripts/validate_ci_performance_assessment_v2.py)は存在し、cohort 比較はrunner_image/workers/scheduler/command_manifest_digest/test_selection_digestの一致判定と run count/run_ids 整合のみを行う。rawrun_details[].duration_secondsからの P50/P95 独立再計算、およびminimum_improvement_pct/maximum_regression_pctと実測 delta の比較処理は同 validator に実装されていない(producer が投入した aggregate 値をそのまま信頼する)。- 実装: CI test-lane current-state manifest と projection verifier を追加する #1782(CI test-lane current-state manifest / projection verifier、依存: 実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725/実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760(closed)/実装: python-test-planをstrict schema化し期限付きquarantine契約を導入する #1761/実装: 全test inventoryとcross-job証跡をfail-close化する #1762)が open で、本 Issue が前提とする最終 topology の current-state authority を確定させる役割を持つ。
Remaining Parent Gaps
なし(本 Issue は独立 follow-up。#1059 の Closure には影響しない)
Outcome
既存 ci.yml の workflow_dispatch.inputs.python_test_bench benchmark authority を拡張し(新規 duplicate workflow ファイルは追加しない)、python-test-core job の trusted GitHub Actions job/step timing と raw benchmark evidence(base/head 各 20 run、計 40 run)を用いて environment_fingerprint と treatment_manifest を分離した cohort 比較を行い、固定した percentile 算出方式で raw samples から独立に P50 delta が minimum_improvement_pct 閾値を満たすか、P95 delta が maximum_p95_regression_pct 閾値以内かを判定し、その結果を trusted projection として既存 CI_TEST_PERFORMANCE_ASSESSMENT_V2 へ生成・検証する状態になる。
In Scope
- 既存
workflow_dispatch.inputs.python_test_benchbenchmark authority の拡張(新規 duplicate workflow ファイルを追加しない) python_test_core_job_total_msの境界を GitHub Workflow Jobs API(jobstarted_at/completed_at、steps[].started_at/completed_at)で machine-readable に定義する(shell instrumentation 単独に依存しない)- base/head 各 20 run(計 40 run)分の raw benchmark evidence schema(exact commit SHA、run ID、run attempt、job ID、job conclusion、runner image fingerprint、duration、artifact ID、artifact digest を含む)の新設
environment_fingerprint(runner image・arch・Python/uv/pytest/xdist version・workers・scheduler・harness revision 等の invariant 項目)とtreatment_manifest(plan/lockfile/workflow digest 等、意図的に変更しうる項目)の分離- 固定した percentile algorithm(P50/P95)、
minimum_improvement_pct、maximum_p95_regression_pctの明示と、raw samples からの独立再計算による判定 - artifact の semantic validation(
measurements: []のみの非空ファイルを liveness として誤検出しない)→test -s→ upload の順序化、upload 後の artifact ID / digest の evidence への記録 - raw benchmark verifier の結果を trusted projection として既存
CI_TEST_PERFORMANCE_ASSESSMENT_V2の生成・検証に接続する配線 - immutable workflow artifact + GitHub Step Summary を evidence authority とする(PR HEAD を変更する committed summary は採用しない)
- 上記契約に対する pytest 由来の negative test 群(19/20 samples、duplicate run、same run 別 attempt、wrong SHA、wrong runner image、empty measurements、artifact digest mismatch、undeclared treatment drift、P50 threshold miss、P95 regression 等)
Out of Scope
CI_TEST_PERFORMANCE_ASSESSMENT_V2の既存 schema そのものの破壊的再設計(trusted projection の生成先として利用するのみ)- pytest scheduler の再選定
- unrelated CI job の性能最適化
- GitHub-hosted runner の種類変更
- 実装: CI test-lane current-state manifest と projection verifier を追加する #1782(CI test-lane current-state manifest / projection verifier)のスコープそのものの実装
Acceptance Criteria
- AC1: 既存
ci.ymlのworkflow_dispatch.inputs.python_test_benchbenchmark authority を拡張しており、新規 duplicate benchmark workflow ファイルを追加していない - AC2:
python_test_core_job_total_msの境界が GitHub Workflow Jobs API 由来の timestamp(shell instrumentation 単独ではない)で machine-readable に定義される - AC3: raw benchmark evidence schema が exact commit SHA・run ID・run attempt・job ID・job conclusion・runner image fingerprint・duration・artifact ID・artifact digest を含む
- AC4: base/head 各 20 件未満・run ID 重複・同一 run の異なる attempt の不正利用・runner image 不一致の cohort を拒否する
- AC5:
environment_fingerprintとtreatment_manifestが分離されており、宣言された treatment 以外の環境差分のみを incomparable と判定する - AC6: benchmark mode では semantic validation →
test -s→ upload の順で実行し、measurements: []のみの空 evidence を liveness として誤検出しない - AC7: benchmark mode の upload が
if-no-files-found: errorであり、upload 後の artifact ID / digest を evidence に記録する - AC8: 通常 CI の runtime baseline artifact は
if-no-files-found: warnの optional telemetry のまま継続可能である - AC9: raw benchmark verifier の結果が trusted projection として既存
CI_TEST_PERFORMANCE_ASSESSMENT_V2の生成・検証に使われる - AC10: percentile algorithm・P50 判定用閾値定数・P95 判定用閾値定数が明示され、raw samples からの独立再計算により両閾値それぞれの充足有無(P50 delta が閾値を満たすか、P95 delta が上限以内か)が判定される
- AC11: run ID・cohort fingerprint・P50/P95・delta が immutable workflow artifact + GitHub Step Summary に記録され、PR HEAD を変更する committed summary ファイルは使用しない
- AC12: 19/20 samples・duplicate run・same run 別 attempt・wrong SHA・wrong runner image・empty measurements・artifact digest mismatch・undeclared treatment drift・P50 threshold miss・P95 regression の negative test を持つ
Verification Commands
# AC1
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_python_test_bench_authority.py::test_uses_existing_workflow_dispatch_input_no_duplicate_workflow# AC2
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_python_test_core_job_total.py::test_job_total_boundary_uses_workflow_jobs_api_timestamps# AC3
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_evidence.py::test_raw_evidence_schema_required_fields# AC4
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_evidence.py::test_rejects_undersized_or_duplicate_or_attempt_reuse_or_image_mismatch_cohort# AC5
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_cohort.py::test_environment_fingerprint_and_treatment_manifest_are_separated# AC6
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_evidence.py::test_semantic_validation_precedes_test_s_and_upload_and_rejects_empty_measurements# AC7
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_evidence.py::test_upload_records_artifact_id_and_digest_with_if_no_files_found_error# AC8
# baseline-expect: pass
$ rg -n "if-no-files-found: warn" .github/workflows/ci.yml# AC9
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_evidence.py::test_raw_verifier_pass_produces_trusted_v2_projection_that_also_validates# AC10
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_statistics.py::test_fixed_percentile_algorithm_and_thresholds_recomputed_from_raw_samples# AC11
# baseline-expect: fail
$ uv run --locked pytest scripts/ci/tests/test_ci_python_test_benchmark_evidence.py::test_results_stored_as_immutable_artifact_and_step_summary_not_committed_file# AC12
# baseline-expect: fail
$ test -f scripts/ci/tests/test_ci_python_test_benchmark_negative.pyAllowed Paths
.github/workflows/ci.ymlscripts/ci/scripts/ci/tests/schemas/ci_test_performance_assessment_v2.schema.jsondocs/dev/ci-performance.mddocs/dev/ci-runtime-baseline-*.md.claude/skills/ci-test-performance/SKILL.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- GitHub native dependency と本文の
depends_on/Dependencies記述が一致しない場合 - 実装: CI test-lane current-state manifest と projection verifier を追加する #1782 の実装 PR merge commit が現在の
mainの ancestor でない場合 CI_TEST_PERFORMANCE_ASSESSMENT_V2の schema 自体を破壊的に変更する必要が生じた場合
Required Skills
ci-test-performance
Required Design References
docs/dev/workflow.mddocs/dev/ci-performance.md.claude/skills/ci-test-performance/SKILL.md
Dependencies
- Depends on 実装: CI test-lane current-state manifest と projection verifier を追加する #1782
- 着手条件は 実装: CI test-lane current-state manifest と projection verifier を追加する #1782 の対応 PR merge commit が current
mainの ancestor であり、GitHub native dependency とこの記述が一致すること。
Scope Delta(任意)
Current Validated Scope は既存ファイル・Issue 番号ベースの事実記述、In Scope は追加する契約要素(algorithm・fingerprint・treatment 等の抽象語彙)の記述であり、語彙が異なるのは意図的である。対象ファイルは共通して .github/workflows/ci.yml(Allowed Paths 参照)・schemas/ci_test_performance_assessment_v2.schema.json・.claude/skills/ci-test-performance/scripts/validate_ci_performance_assessment_v2.py の3点であり、範囲の乖離はない。
Runtime Verification Applicability
decision: not_applicable
reason: repository-local verifier・pytest fixture・workflow static validation で検証するためNotes for Reviewer
- 本 Issue は当初 OWNER コメント(https://github.com/squne121/loop-protocol/issues/1059#issuecomment-5079148059)の「Issue案5」を再構成したものだったが、起票後の 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760/実装: Ruff設定をpyproject.tomlへ集約し対象path集合を維持する #1764 系変更・実装: CI test-lane current-state manifest と projection verifier を追加する #1782 の分離により前提が stale化した。
- Anchor comment(OWNER, REQUEST_CHANGES /
contract_reconstruction_required): 実装: python-test job total benchmark workflowを追加しci_runtime_baselineをfail-closed化する #1765 (comment) - 本改訂は上記 anchor comment の P0/P1 指摘(prerequisite graph 不整合、
python_test_job_total_msの意味変化、新規 workflow の重複・bootstrap paradox、既存 V2 validator が P50/P95 delta を独立再計算しない点、cohort fingerprint が treatment と invariant を混同していた点、test -sが liveness を証明しない点、grep ベースの弱い Verification Commands)を反映し、issue-refinement-loop control-plane が human-context lane(OWNER 明示指示)として full rewrite した。 - 実施順序: 実装: CI test-lane current-state manifest と projection verifier を追加する #1782(現状は依然 open)マージ後に着手すること。
Activity
squne121 commentedon Aug 12, 2026
結論
REQUEST_CHANGES /
contract_reconstruction_requiredです。現状の #1765 は実装開始すべき状態ではありません。方向性そのもの――「通常 CI の telemetry は optional のまま、性能主張用 benchmark は fail-closed にする」――は妥当です。しかし、#1765 は起票後の #1760/#1764 系変更によって前提が大きく stale になり、さらに既存
CI_TEST_PERFORMANCE_ASSESSMENT_V2が AC4/AC5/AC10 を実際には保証できないという契約上の穴があります。敵対的レビュー
P0 — prerequisite graph が壊れています。 OWNER 原案は 実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725 → 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760 → 実装: python-test-planをstrict schema化し期限付きquarantine契約を導入する #1761 → 実装: 全test inventoryとcross-job証跡をfail-close化する #1762 → 案4 → 実装: python-test job total benchmark workflowを追加しci_runtime_baselineをfail-closed化する #1765 の順序を要求していますが、現在 実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725 は open かつ test: external manifest publish の Stop/SubagentStop stderr 契約と scope-rollup 環境分離を修正する #1828 に blocked、実装: python-test-planをstrict schema化し期限付きquarantine契約を導入する #1761/実装: 全test inventoryとcross-job証跡をfail-close化する #1762 も open です。さらに 実装: Ruff設定をpyproject.tomlへ集約し対象path集合を維持する #1764 は途中でスコープを Ruff SSOT に縮小し、元の「CI current-state manifest / parity verifier」を 実装: CI test-lane current-state manifest と projection verifier を追加する #1782 へ移しています。実装: CI test-lane current-state manifest と projection verifier を追加する #1782 はそのために 実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725/実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760/実装: python-test-planをstrict schema化し期限付きquarantine契約を導入する #1761/実装: 全test inventoryとcross-job証跡をfail-close化する #1762 を prerequisite として持ったまま open です。
一方 実装: python-test job total benchmark workflowを追加しci_runtime_baselineをfail-closed化する #1765 は Notes で「Machine-Readable Contract の
depends_onは 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760」と明記しているのに、実際の MRC にはdepends_onキーそのものがありません。GitHub native dependency も現在 active blocker は 0 なので、自動実装系から見ると着手可能に見えます。これは fail-close 契約として致命的です。最小修正は 実装: CI test-lane current-state manifest と projection verifier を追加する #1782 を直接 prerequisite にすることです。実装: CI test-lane current-state manifest と projection verifier を追加する #1782 が transitive に前段を束ねています。P0 —
python-test job totalの意味が 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760 後には別物です。 実装: python-test job total benchmark workflowを追加しci_runtime_baselineをfail-closed化する #1765 の Current Validated Scope は「Node/Codex setup・execpolicy を含む job total が未計測」としていますが、PR 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1824 により現在はpython-test-coreが Python-only、codex-execpolicyが別 job、python-testはneeds: [python-test-core, codex-execpolicy]の aggregate check です。 現行 workflow でもその topology が確認できます。したがって
python_test_job_total_msを「Node/Codex 込み」と定義すると、もはや単一 job の時間ではありません。Python 性能を測るならpython_test_core_*、required lane 全体を測るなら cross-job critical path と別 metric にする必要があります。P0 — 新規 benchmark workflow は既存 authority と重複します。 現在の
ci.ymlにはすでにworkflow_dispatch.inputs.python_test_benchがあり、benchmark 時には unrelated jobs とcodex-execpolicyを skip してpython-test-core単独測定を行い、aggregate も benchmark 専用ポリシーで評価します。つまり AC1 の「workflow_dispatch または明示 input」はすでにかなり実装済みです。それにもかかわらず Verification Command は
.github/workflows/ci-python-test-benchmark.ymlの新設を必須化しています。これは AC と VC の自己矛盾です。さらに GitHub はworkflow_dispatchについて、workflow file が default branch に存在しない限り trigger しません。したがって 新規 workflow 自身の PR で、その新規 workflow を使った pre-merge benchmark を要求すると bootstrap paradox になります。 (GitHub Docs)P0 — 「既存 V2 validator で AC4/AC5/AC10 を保証する」は成立しません。 現行 validator の cohort 比較対象は
runner_image / workers / scheduler / command_manifest_digest / test_selection_digestの5項目だけで、20-run と run ID overlap/count は見ます。しかし P50/P95 は 入力された aggregate P50/P95 から delta を再計算するだけです。rawrun_details[].duration_secondsは読んでいません。さらにclaim.minimum_improvement_pctやmaximum_regression_pctと実測 delta を比較する処理自体がありません。つまり producer がobservation: improvedと書けば、AC10 の「P50 改善かつ P95 非退行」を既存 validator が独立に導出するわけではありません。しかも standalone
ci_runtime_delta_v2は「raw sample は optional / validator 未使用」と明記されています。 PR 実装: CI performance decision契約をversioned schema (CI_TEST_PERFORMANCE_ASSESSMENT_V2) 化する #1739 の最終修正も、その非保証を明示するためのものでした。 現在の embedded assessment schema だけは逆に「validator が raw sample から再計算する」と古い説明へ戻っており、実装と schema description が再び drift しています。よって AC9 は「V2 validator を呼ぶ」だけでは不足です。benchmark raw evidence 専用 verifier が必要です。
P0 — cohort fingerprint が treatment と nuisance variable を混同しています。 AC5 は
plan/lockfile/workflow digestの不一致を全て incomparable としています。しかし Python test plan、dependency lock、workflow 自体を高速化したい場合、それらはまさに 比較したい変更変数です。同一 digest を要求すると「plan を変えて高速化した PR」は永久に比較不能になります。OWNER 原案にも plan/lockfile/workflow/action revision の fingerprint はありますが、これは単純な全項目 equality ではなく、固定すべき環境と意図的に変更した treatment を分離すべきです。environment_fingerprintとtreatment_manifestを分け、「宣言された treatment 以外は一致」を検証する方が正しいモデルです。P1 —
test -s+if-no-files-found:errorは evidence liveness の証明になりません。 現行 collector はmeasurements.jsonlが存在しなくてもmeasurements: []を持つ 非空 JSON ファイルを常に生成します。そのためtest -s ci_runtime_baseline_v1.jsonは空 evidence を検出できません。upload-artifactのif-no-files-found:errorも「upload 対象ファイルがある」ことしか保証しません。一方upload-artifact@v7は successful upload 後にartifact-idと SHA-256artifact-digestを返せます。benchmark authority ではその ID/digest まで evidence に束縛するべきです。 (GitHub)P1 — 統計判定と Verification Commands が弱すぎます。 20 samples の P95 は quantile algorithm の選択に敏感なので、少なくとも percentile 定義を固定する必要があります。Python 標準
statistics.quantiles()ですらexclusiveとinclusiveで定義が異なります。 (Python documentation) またpyperfも benchmark が不安定なら runs/values を増やし、metadata や分布を調べる設計を推奨しています。 (pyperf)現状 AC10 の VC は単に
rg "p95"、AC4 はrg "cohort"、AC11 はrg "committed"、AC12 はテストファイルの存在確認だけです。コメントに文字列を書くだけでも PASS します。fail-close benchmark の Issue 自身が grep-based false-green です。推奨する再設計
項目 | 推奨 -- | -- Readiness | #1782 を direct prerequisite にして blocked_until_dependencies_merged。#1782 の実装 PR merge commit が main ancestor であることまで start gate にする Benchmark authority | 新しい workflow_dispatch authority を二重化せず、既存 ci.yml / python_test_bench を原則再利用 Metric | python_test_core_job_total_ms と python_test_core_required_span_ms を区別。後者なら「first required step → final required evidence step」を明示 時刻 authority | shell の date +%s%3N だけで job total を自称せず、完了後に GitHub Workflow Jobs API の job.started_at/completed_at または steps[].started_at/completed_at を取得する。API はこれらを正式に返します。 (GitHub Docs) Raw evidence | 新規 CI_PYTHON_TEST_BENCHMARK_EVIDENCE_V1 相当を追加し、40 run の raw records、run attempt、exact SHA、job ID、conclusion、runner fingerprint、artifact ID/digest を保存 Cohort | environment_fingerprint と treatment_manifest を分離。ImageVersion・arch・Python/uv/pytest/xdist・workers・scheduler・harness revision 等は invariant。plan/lockfile/workflow は「変更対象なら差を許容」 V2 | raw benchmark verifier の結果を V2 へ projection する。V2 validator は第二段の契約検証であって raw benchmark authority にはしない 統計 | P50/P95 の quantile algorithm を固定し、minimum_improvement_pct と maximum_p95_regression_pct を明示。post-hoc な外れ値除外は禁止または事前定義 rule のみにする Artifact | benchmark では semantic validator → test -s → upload の順。upload 後は artifact-id / artifact-digest を記録 結果保存 | AC11 の「committed summary」は撤去推奨。summary commit を追加すると PR head SHA が変わり、自分で stale-head を作ります。immutable workflow artifact + Step Summary を authority とし、必要なら merge 後に historical doc を生成 Verification | rg ではなく pytest fixture。19/20 samples、duplicate run、same run different attempt、wrong SHA、wrong ImageVersion、empty measurements、artifact digest mismatch、undeclared treatment drift、P50 threshold miss、P95 regression をすべて negative test にする特に metric は、現行 GitHub API を使えば base 側に新しい job-total instrumentation がなくても job/step timestamps を取得できます。これなら「計測コードを追加した head と、計測コードを持たない base をどう比較するのか」という自己参照問題もかなり小さくできます。GitHub-hosted runner は各 run が新しい VM であり、runner image 自体も更新されるため、
ubuntu-latestというラベルだけで cohort 一致とせず、現在行っているImageVersionの完全一致は維持すべきです。 (GitHub Docs)Issue 本文で最低限直す契約
MRC は少なくとも次の方向に直すべきです。
そして Outcome の
python_test_job_total_msはpython-test-coreの metric に限定して再定義し、AC9 は「既存 V2 validator で検証」から「raw benchmark verifier が PASS し、その trusted projection として生成した V2 assessment も validator を PASS」に変更するのが安全です。現状の #1765 は refinement をもう一度通す価値があります。特に P0 は「実装後レビューで直す」種類ではなく、Issue 契約を直さないと実装者が正しいものを作れない問題です。
## 結論REQUEST_CHANGES /
contract_reconstruction_requiredです。現状の #1765 は実装開始すべき状態ではありません。方向性そのもの――「通常 CI の telemetry は optional のまま、性能主張用 benchmark は fail-closed にする」――は妥当です。しかし、#1765 は起票後の #1760/#1764 系変更によって前提が大きく stale になり、さらに既存
CI_TEST_PERFORMANCE_ASSESSMENT_V2が AC4/AC5/AC10 を実際には保証できないという契約上の穴があります。敵対的レビュー
P0 — prerequisite graph が壊れています。 OWNER 原案は 実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725 → 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760 → 実装: python-test-planをstrict schema化し期限付きquarantine契約を導入する #1761 → 実装: 全test inventoryとcross-job証跡をfail-close化する #1762 → 案4 → 実装: python-test job total benchmark workflowを追加しci_runtime_baselineをfail-closed化する #1765 の順序を要求していますが、現在 実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725 は open かつ test: external manifest publish の Stop/SubagentStop stderr 契約と scope-rollup 環境分離を修正する #1828 に blocked、実装: python-test-planをstrict schema化し期限付きquarantine契約を導入する #1761/実装: 全test inventoryとcross-job証跡をfail-close化する #1762 も open です。さらに 実装: Ruff設定をpyproject.tomlへ集約し対象path集合を維持する #1764 は途中でスコープを Ruff SSOT に縮小し、元の「CI current-state manifest / parity verifier」を 実装: CI test-lane current-state manifest と projection verifier を追加する #1782 へ移しています。実装: CI test-lane current-state manifest と projection verifier を追加する #1782 はそのために 実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725/実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760/実装: python-test-planをstrict schema化し期限付きquarantine契約を導入する #1761/実装: 全test inventoryとcross-job証跡をfail-close化する #1762 を prerequisite として持ったまま open です。
一方 実装: python-test job total benchmark workflowを追加しci_runtime_baselineをfail-closed化する #1765 は Notes で「Machine-Readable Contract の
depends_onは 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760」と明記しているのに、実際の MRC にはdepends_onキーそのものがありません。GitHub native dependency も現在 active blocker は 0 なので、自動実装系から見ると着手可能に見えます。これは fail-close 契約として致命的です。最小修正は 実装: CI test-lane current-state manifest と projection verifier を追加する #1782 を直接 prerequisite にすることです。実装: CI test-lane current-state manifest と projection verifier を追加する #1782 が transitive に前段を束ねています。P0 —
python-test job totalの意味が 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760 後には別物です。 実装: python-test job total benchmark workflowを追加しci_runtime_baselineをfail-closed化する #1765 の Current Validated Scope は「Node/Codex setup・execpolicy を含む job total が未計測」としていますが、PR 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1824 により現在はpython-test-coreが Python-only、codex-execpolicyが別 job、python-testはneeds: [python-test-core, codex-execpolicy]の aggregate check です。 現行 workflow でもその topology が確認できます。したがって
python_test_job_total_msを「Node/Codex 込み」と定義すると、もはや単一 job の時間ではありません。Python 性能を測るならpython_test_core_*、required lane 全体を測るなら cross-job critical path と別 metric にする必要があります。P0 — 新規 benchmark workflow は既存 authority と重複します。 現在の
ci.ymlにはすでにworkflow_dispatch.inputs.python_test_benchがあり、benchmark 時には unrelated jobs とcodex-execpolicyを skip してpython-test-core単独測定を行い、aggregate も benchmark 専用ポリシーで評価します。つまり AC1 の「workflow_dispatch または明示 input」はすでにかなり実装済みです。それにもかかわらず Verification Command は
.github/workflows/ci-python-test-benchmark.ymlの新設を必須化しています。これは AC と VC の自己矛盾です。さらに GitHub はworkflow_dispatchについて、workflow file が default branch に存在しない限り trigger しません。したがって 新規 workflow 自身の PR で、その新規 workflow を使った pre-merge benchmark を要求すると bootstrap paradox になります。 ([GitHub Docs]1)P0 — 「既存 V2 validator で AC4/AC5/AC10 を保証する」は成立しません。 現行 validator の cohort 比較対象は
runner_image / workers / scheduler / command_manifest_digest / test_selection_digestの5項目だけで、20-run と run ID overlap/count は見ます。しかし P50/P95 は 入力された aggregate P50/P95 から delta を再計算するだけです。rawrun_details[].duration_secondsは読んでいません。さらにclaim.minimum_improvement_pctやmaximum_regression_pctと実測 delta を比較する処理自体がありません。つまり producer がobservation: improvedと書けば、AC10 の「P50 改善かつ P95 非退行」を既存 validator が独立に導出するわけではありません。しかも standalone
ci_runtime_delta_v2は「raw sample は optional / validator 未使用」と明記されています。 PR 実装: CI performance decision契約をversioned schema (CI_TEST_PERFORMANCE_ASSESSMENT_V2) 化する #1739 の最終修正も、その非保証を明示するためのものでした。 現在の embedded assessment schema だけは逆に「validator が raw sample から再計算する」と古い説明へ戻っており、実装と schema description が再び drift しています。よって AC9 は「V2 validator を呼ぶ」だけでは不足です。benchmark raw evidence 専用 verifier が必要です。
P0 — cohort fingerprint が treatment と nuisance variable を混同しています。 AC5 は
plan/lockfile/workflow digestの不一致を全て incomparable としています。しかし Python test plan、dependency lock、workflow 自体を高速化したい場合、それらはまさに 比較したい変更変数です。同一 digest を要求すると「plan を変えて高速化した PR」は永久に比較不能になります。OWNER 原案にも plan/lockfile/workflow/action revision の fingerprint はありますが、これは単純な全項目 equality ではなく、固定すべき環境と意図的に変更した treatment を分離すべきです。environment_fingerprintとtreatment_manifestを分け、「宣言された treatment 以外は一致」を検証する方が正しいモデルです。P1 —
test -s+if-no-files-found:errorは evidence liveness の証明になりません。 現行 collector はmeasurements.jsonlが存在しなくてもmeasurements: []を持つ 非空 JSON ファイルを常に生成します。そのためtest -s ci_runtime_baseline_v1.jsonは空 evidence を検出できません。upload-artifactのif-no-files-found:errorも「upload 対象ファイルがある」ことしか保証しません。一方upload-artifact@v7は successful upload 後にartifact-idと SHA-256artifact-digestを返せます。benchmark authority ではその ID/digest まで evidence に束縛するべきです。 ([GitHub]2)P1 — 統計判定と Verification Commands が弱すぎます。 20 samples の P95 は quantile algorithm の選択に敏感なので、少なくとも percentile 定義を固定する必要があります。Python 標準
statistics.quantiles()ですらexclusiveとinclusiveで定義が異なります。 ([Python documentation]3) またpyperfも benchmark が不安定なら runs/values を増やし、metadata や分布を調べる設計を推奨しています。 ([pyperf]4)現状 AC10 の VC は単に
rg "p95"、AC4 はrg "cohort"、AC11 はrg "committed"、AC12 はテストファイルの存在確認だけです。コメントに文字列を書くだけでも PASS します。fail-close benchmark の Issue 自身が grep-based false-green です。推奨する再設計
blocked_until_dependencies_merged。#1782 の実装 PR merge commit が main ancestor であることまで start gate にするworkflow_dispatchauthority を二重化せず、既存ci.yml / python_test_benchを原則再利用python_test_core_job_total_msとpython_test_core_required_span_msを区別。後者なら「first required step → final required evidence step」を明示date +%s%3Nだけで job total を自称せず、完了後に GitHub Workflow Jobs API のjob.started_at/completed_atまたはsteps[].started_at/completed_atを取得する。API はこれらを正式に返します。 ([GitHub Docs]5)CI_PYTHON_TEST_BENCHMARK_EVIDENCE_V1相当を追加し、40 run の raw records、run attempt、exact SHA、job ID、conclusion、runner fingerprint、artifact ID/digest を保存environment_fingerprintとtreatment_manifestを分離。ImageVersion・arch・Python/uv/pytest/xdist・workers・scheduler・harness revision 等は invariant。plan/lockfile/workflow は「変更対象なら差を許容」minimum_improvement_pctとmaximum_p95_regression_pctを明示。post-hoc な外れ値除外は禁止または事前定義 rule のみにするtest -s→ upload の順。upload 後はartifact-id/artifact-digestを記録rgではなく pytest fixture。19/20 samples、duplicate run、same run different attempt、wrong SHA、wrong ImageVersion、empty measurements、artifact digest mismatch、undeclared treatment drift、P50 threshold miss、P95 regression をすべて negative test にする特に metric は、現行 GitHub API を使えば base 側に新しい job-total instrumentation がなくても job/step timestamps を取得できます。これなら「計測コードを追加した head と、計測コードを持たない base をどう比較するのか」という自己参照問題もかなり小さくできます。GitHub-hosted runner は各 run が新しい VM であり、runner image 自体も更新されるため、
ubuntu-latestというラベルだけで cohort 一致とせず、現在行っているImageVersionの完全一致は維持すべきです。 ([GitHub Docs]6)Issue 本文で最低限直す契約
MRC は少なくとも次の方向に直すべきです。
そして Outcome の
python_test_job_total_msはpython-test-coreの metric に限定して再定義し、AC9 は「既存 V2 validator で検証」から「raw benchmark verifier が PASS し、その trusted projection として生成した V2 assessment も validator を PASS」に変更するのが安全です。現状の #1765 は refinement をもう一度通す価値があります。特に P0 は「実装後レビューで直す」種類ではなく、Issue 契約を直さないと実装者が正しいものを作れない問題です。
squne121 commentedon Aug 12, 2026
issue-refinement-loop 実行結果(自律実行・停止)
anchor comment: #1765 (comment)
run_refinement_preflight.py(Step 0f)の結果:STATUS: needs_fixNEXT_ACTION: apply_deterministic_repair検出内容: Verification Commands 内の 10 個の
rgコマンドに# baseline-expect: failアノテーションが欠落している(insert_baseline_expect_fail, confidence: high, safety: mutation-free-dry-run)。対象行は本文中の以下のコマンド:rg -n "workflow_dispatch" .github/workflows/ci-python-test-benchmark.ymlrg -n "job_total" .github/workflows/ci-python-test-benchmark.ymlrg -n "cohort" .github/workflows/ci-python-test-benchmark.ymlrg -n "lockfile_digest" .github/workflows/ci-python-test-benchmark.ymlrg -n "test -s" .github/workflows/ci-python-test-benchmark.ymlrg -n "if-no-files-found: error" .github/workflows/ci-python-test-benchmark.ymlrg -n "CI_TEST_PERFORMANCE_ASSESSMENT_V2" .github/workflows/ci-python-test-benchmark.ymlrg -n "p95" .github/workflows/ci-python-test-benchmark.ymlrg -n "committed" .github/workflows/ci-python-test-benchmark.ymltest -f scripts/ci/tests/test_ci_python_test_benchmark_negative.pyissue-refinement-loopは現時点でapply_deterministic_repairの auto-apply consumer を持たないため(SKILL.md 記載の既知の設計方針)、本文への自動修正は行わず informational route として停止する。修正候補(dry-run, mutation-free):
.claude/artifacts/issue-refinement-loop/1765/repair_diagnostics.json.claude/artifacts/issue-refinement-loop/1765/repaired_issue_body.mdsha256:014959bc9c3e318a7933570f5cf2568d391b0f78b838ba92ef4a497351e8803bsha256:3334e6b2dc0887fe6f1fe5ef553b01f92c222eb2ffc58ea6382972dbc5e15834termination_cause: human_judgment_requiredsqune121 commentedon Aug 12, 2026
推奨アクションは
repaired_issue_body.mdの10個の注釈だけを直接適用するのではなく、anchor comment を trusted human context として #1765 の契約を全面再構成し、その中に deterministic repair も吸収する です。理由は、現行
issue-refinement-loopがapply_deterministic_repairの auto-apply consumer を明示的に持たない一方、現在はpreflight.run.with_human_context→contract_update.run.with_human_context→ 必要ならissue_editor_requiredで Step 4 相当の controlled full rewrite に移れる契約が存在するためです。 また、anchor review は注釈不足より上位の問題としてcontract_reconstruction_requiredを出しています。特に現行
ci.ymlには既にworkflow_dispatch.inputs.python_test_benchがあり、新規 benchmark workflow を前提にした現 #1765 の契約は実態とずれています。 さらに推奨 prerequisite の #1782 は現在も open で、#1725/#1760/#1761/#1762 を依存として束ねています。したがって refinement 完了後にimplementation_readyではなく dependency-blocked になるのは正常であり、人間承認待ちとは区別すべきです。以下をそのまま Claude Code / Codex 系の親 control-plane に渡すのが適切です。
Issue #1765 — issue-refinement-loop 自律再実行
対象リポジトリ:
https://github.com/squne121/loop-protocol対象 Issue:
https://github.com/squne121/loop-protocol/issues/1765OWNER / adversarial review anchor:
https://github.com/squne121/loop-protocol/issues/1765#issuecomment-5265227804目的
Issue #1765 に対して
issue-refinement-loopを実行し、Issue contract を current main / current repository reality に整合するまで自律的に改善してください。通常の loop iteration、deterministic な Issue 本文修正、anchor comment に明示された contract reconstruction、controlled issue-editor rewrite について、人間への途中承認確認は不要です。
ただしこれは Claude Code / Codex 自体の permission bypass を許可する指示ではありません。
--dangerously-skip-permissions、hook bypass、force push、権限昇格、秘密情報の取得などを行ってはいけません。最重要判断
前回 Step 0f は次の結果で停止しています。
検出された repair は Verification Commands 10箇所への
# baseline-expect: fail追加です。既存 artifact:
旧 snapshot:
ただし、この旧
repaired_issue_body.mdをそのまま最終本文として適用してはいけません。anchor comment は #1765 を単なる annotation 不足ではなく、
と判定しています。
したがって今回の推奨 route は:
です。
今回のこの指示自体を、上記 anchor comment を operator-selected direct human context として使用する明示的 authorization として扱ってください。
実行規則
1. 親 control-plane を authority にする
privileged preflight / Issue mutation は必ず親 control-plane が canonical main root / default branch から実行してください。
SubAgent の isolation worktree から以下を直接実行してはいけません。
preflight.runpreflight.run.with_human_contextcontract_update.run.with_human_contextskill_runtime_exec.pyの privileged mutation commandSubAgent には parent-owned preflight の bounded result のみを渡してください。
SubAgent が nested SubAgent を起動することも禁止します。
2. current authority を最初に取り直す
古い artifact / SHA / Issue body を authority として再利用せず、最初に live state を取得してください。
最低限確認:
origin/main.claude/skills/issue-refinement-loop/SKILL.md過去セッション由来の untracked residue が preflight guard に引っかかった場合、無関係なデータを削除してはいけません。
今回と同様、必要なら repository policy に従って scratchpad / quarantine 相当へ安全に退避し、対象 Issue の変更と混同しないでください。
git reset --hard、git clean -fdx等による一括削除は禁止です。3. anchor を human-context lane として preflight する
generic
with_anchorやwith_agent_reportではなく、今回明示された anchor を direct human context として consume してください。canonical command registry を SSOT とし、手書き shell grammar を作らないでください。
概念上は以下の route を使います。
実際の argv は current
command_registry.pyから render してください。preflight の canonical stdout:
STATUSNEXT_ACTIONMUST_READCOMMANDS_JSONBLOCKERSARTIFACTREPAIR_ACTIONをそのまま consumeし、prose から routing を再実装しないでください。
4.
apply_deterministic_repairだけを理由に人間へ停止しない現行
issue-refinement-loopがapply_deterministic_repairの auto-apply consumer を持たないこと自体は理解した上で、その limitation を理由に再び人間承認待ちで終了してはいけません。今回、OWNER は non-destructive な Issue body repair / rewrite を明示的に承認しています。
ただし、存在しない auto-apply consumer を新規実装したり、skill contract をバイパスしたりしてはいけません。
代わりに既存の controlled mutation route を利用してください。
優先順位:
contract_update.run.with_human_contextを親 control-plane から実行する。issue_editor_requiredが返った場合:同じ contract-update command を再試行せず、既存
issue-editor/edit-issuecontrolled transaction へ handoff して Step 4 相当の full rewrite を行う。current live body から再生成された repair を full rewrite に取り込み、baseline annotations も同時に解消する。
旧
repaired_issue_body.mdは evidence として参照してよいですが、以下のどちらかなら mutation source として使用禁止です。original_body_sha256と異なる後者は今回の anchor により既に該当する可能性が高いため、原則 full rewrite を採用してください。
SubAgent 実行
planner の current decision に従って SubAgent を使ってください。
必要な role が存在する場合、最低限以下を起動します。
codebase-investigator
current main の repository reality を調査させる。
重点確認:
.github/workflows/ci.ymlpython_test_benchpython-test-corecodex-execpolicypython-testread-only とする。
web-researcher
planner が web research required とした場合のみ起動する。
GitHub Actions 等の外部技術について、一次情報を優先して current behavior を再確認する。
特に必要なら:
workflow_dispatchread-only とする。
issue-reviewer
rewrite 後の current Issue contract を fresh review する。
過去 anchor の verdict をそのまま再利用せず、current body/current main を対象に review する。
SubAgent join 条件
起動した全 SubAgent の完了を必ず待ってください。
Step 2 review へ進む前に:
を満たしてください。
codebase-investigator と web-researcher を並列起動した場合も、両方の結果が揃うまで Step 2 へ進んではいけません。
SubAgent の raw output は各 skill が要求する validator-first contract を通してから consume してください。
#1765 の契約再構成方針
rewrite は anchor の文字列を盲目的にコピーするのではなく、current main を再調査した結果と突き合わせて行ってください。
ただし、current evidence と矛盾しない限り以下を基本方針にします。
Dependency / readiness
Machine-Readable Contract に少なくとも次の意味を持たせる。
#1782 が #1725/#1760/#1761/#1762 の prerequisite を transitive に束ねていることを current live state で再確認してください。
GitHub native dependency と Issue body dependency の同期を repository の canonical mechanism が要求する場合は、それも controlled route で同期し readback してください。
#1782 が未完了なら refinement 自体を human_review_required にしてはいけません。
Issue contract が approve 可能なら:
と区別してください。
Benchmark authority
新規
.github/workflows/ci-python-test-benchmark.ymlを最初から前提にしないでください。current
.github/workflows/ci.ymlに既存workflow_dispatch.inputs.python_test_benchが存在する場合は、原則として既存 authority の拡張を優先してください。新規 workflow を本当に必要とする場合は:
を contract に明記できる場合だけ採用してください。
Metric
旧
python_test_job_total_msを曖昧なまま維持しないでください。current topology に基づいて少なくとも:
等、対象 job を一意に特定できる metric にするか、
cross-job critical path を本当に測る場合は別 metric として明示してください。
「Python performance」と「required aggregate 全体」を同じ metric に混ぜないでください。
Timing authority
測定用 shell instrumentation の存在だけで job-total authority を主張しないでください。
current GitHub API / workflow metadata が使用可能なら、
started_atcompleted_atなど trusted timing source の利用を検討してください。
base 側に新 instrumentation がないため比較不能、という自己参照問題を避けられる設計を優先します。
Raw benchmark evidence
既存 V2 assessment を raw evidence authority とみなさないでください。
必要なら raw benchmark evidence 契約を明示し、base/head の各 sample に最低限:
等を持たせることを検討してください。
raw verifier が PASS
→ trusted projection を生成
→
CI_TEST_PERFORMANCE_ASSESSMENT_V2validator も PASSという責務分離を優先してください。
Cohort
単純な digest 全一致を要求しないでください。
比較中に意図的に変更する treatment と、固定すべき環境を分離します。
概念的には:
を分け、
を検証する設計を優先してください。
plan / lockfile / workflow 自体を性能改善対象にする場合、それらの digest 差分を無条件
incomparableにすると benchmark の目的を破壊する点に注意してください。Statistics
P50/P95 の算出方法を固定してください。
少なくとも:
を contract に明記してください。
raw samples から verifier が independently recompute する構成を優先してください。
producer が自己申告した aggregate P50/P95 や
observation: improvedだけを信頼してはいけません。Artifact semantics
benchmark mode は単なる:
だけで evidence liveness を証明しないでください。
semantic validation を先に行い、その後に upload し、利用可能なら artifact ID / digest も evidence chain に含めてください。
Result storage
旧 AC11 の
committed summaryは再検討してください。benchmark summary commit により PR HEAD 自身が変化して stale-head を発生させる設計なら採用しないでください。
原則:
を evidence とし、必要なら merge 後の historical documentation を別途生成する設計を検討してください。
Verification Commands
単純な:
だけで semantic AC を PASS させないでください。
destination-state の behavioral pytest / verifier を中心に再構成してください。
negative control の例:
baseline で fail すべき destination-state VC には、preflight contract が要求する
# baseline-expect: failを必ず付けてください。既存状態で pass が正しい regression VC には
# baseline-expect: passまたは current repository contract に対応する annotation を使用してください。つまり、今回検出された10箇所の deterministic annotation defect も 新しい VC 全体を設計し直したうえで解消してください。
Rewrite 後の必須 postcondition
Issue mutation が成功しても、そこで終了してはいけません。
必ず順に:
preflight.run/ appropriate human-context preflightissue-reviewerを実行してください。
stale な pre-rewrite planner result / reviewer verdict / repair candidate を post-rewrite authority として再利用してはいけません。
ループ方針
issue-refinement-loopの既定 bounded iteration 契約は維持してください。通常の needs-fix iteration で人間承認を求めず、自動継続してください。
このプロンプトを理由に:
human_judgment_requiredを文字列置換で approve にすることは禁止です。
max iteration 到達、環境故障、schema/validator failure 等の 真の terminal condition が発生した場合は、途中で「どうしますか」と質問せず、そこで安全に停止して evidence を最終報告してください。
一方、今回すでに明示承認されている:
については、再度 human confirmation を要求しないでください。
禁止事項
以下は禁止です。
issue-refinement-loop自体を今回のためだけに変更今回は Issue refinement の完了まで がスコープです。
最終出力
最後に次の形式で concise に報告してください。
特に #1782 が未完了で、それ以外の Issue contract review が approve なら:
としてください。
これを
human_review_requiredと混同してはいけません。squne121 commentedon Aug 12, 2026
issue-refinement-loop: approved(自律実行・human-context anchor 反映)
anchor comment(OWNER, REQUEST_CHANGES /
contract_reconstruction_required): #1765 (comment)3 iteration(rewrite → fresh review)を経て、issue-reviewer の独立 fresh review が
VERDICT: approveに到達しました。python_test_job_total_msの意味変化、新規 workflow の重複・bootstrap paradox、既存 V2 validator の限界、cohort の environment/treatment 混同、test -sの liveness 不備、grep ベース VC の弱さ)を反映して本文を全面 rewrite → review: needs-fix(AC10 の主観表現改善/非退行)minimum_improvement_pctという identifier 内の部分文字列 "improve" が subjective-phrasing checker の正規表現improved?に誤マッチ)sha256:8abe37859f156bb4b432ba9a68a907af0a254b236b8a5197980c0b0692017ae5、独立 fresh readback で一致確認済み)Readiness
Machine-Readable Contract に
depends_on: [1782]/readiness: blocked_until_dependencies_mergedを明記しました。#1782(CI test-lane current-state manifest / projection verifier)は現時点で OPEN のため、refinement は approved ですが実装着手は #1782 の実装 PR merge commit がmainの ancestor になるまで blocked です。squne121 commentedon Aug 12, 2026
Disposition: CLOSED / not_planned
#1782 の敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1782#issuecomment-5266277591)に基づき close する。
根拠: