Skip to content

fix: 固定SHA benchmark artifactのhead_sha意味論をmeasured_head_sha/workflow_run_head_sha分離で修正 - #2493

Merged
squne121 merged 6 commits into
mainfrom
worktree-issue-2184-sha-benchmark-artifact-head-sha-measured
Sep 4, 2026
Merged

squne121 merged 6 commits into
mainfrom
worktree-issue-2184-sha-benchmark-artifact-head-sha-measured

Conversation

@squne121

@squne121 squne121 commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #2184。固定SHA E2E benchmark artifact の head_sha が「計測対象コミット(measured)」と「GitHub API 上の workflow run 自体の head SHA(workflow run)」を単一 field に混同していた問題(PR #2182 OWNER adversarial review P0-4、Issue #2184 reframe review)を、measured_head_sha / workflow_run_head_sha の分離で修正した。

  • .github/workflows/ci.yml: e2e-core / e2e-responsive-matrix 両ジョブの Collect ci_runtime_baseline_v1 artifact ステップに、git rev-parse HEAD で独立観測する measured_head_sha を対称に追加。既存 head_sha / merge_sha は計算式・値とも変更なし。
  • scripts/ci/collect_e2e_performance_benchmark.py: workflow_run_head_sha を既存 merge_sha フィールドから導出(_derive_workflow_run_head_sha)。live API 照合(verify_run_record_against_live_api)は expected_head_sha との比較を廃止し、record 自身の workflow_run_head_sha との自己整合性チェックに変更。_verify_run_record に measured_head_sha 専用の新規構造 binding 検証を追加し、measured_head_sha を持つ record には既存の head_sha != expected_head_sha 検証を適用しない。トラステッド record の両 field を manifest RunRecord へ伝播(_optional_head_sha_provenance_fields)。
  • schemas/e2e_performance_benchmark_manifest_v1.schema.json: RunRecord に measured_head_sha / workflow_run_head_sha を optional field として追加(required は変更なし、既存 head_sha は required のまま維持)。
  • docs/dev/e2e-performance-benchmark.md / docs/dev/ci-performance.md: 新field の意味論、workflow_digest/workflow_sha の既知の限界(解消は 実装: frozen E2E benchmark を layout A/B/A/B dispatch 契約へ置換する #2422 に委ねる)を追記。

Checks

  • pnpm typecheck: PASS
  • pnpm lint: PASS
  • pnpm test: PASS(1874 passed, 105 files)
  • pnpm build: PASS
  • uv run --locked ruff check scripts/ci/collect_e2e_performance_benchmark.py scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py: PASS
  • uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py(AC4 VC): PASS(38 passed)
  • uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/(同ディレクトリ全体、非 Allowed Path の 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179/fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182 回帰スイート含む): PASS(76 passed, 0 failed, 変更ゼロで非回帰)
  • uv run --locked pytest tests/ci/ scripts/ci/: PASS(476 passed, 4 skipped, 0 failed)
  • uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py: PASS(24 passed)
  • actionlint .github/workflows/ci.yml: PASS(0 issues)
  • AC1 VC(grep -n -e measured_head_sha -e MEASURED_HEAD_SHA .github/workflows/ci.yml): PASS(e2e-core / e2e-responsive-matrix 両ジョブに対称的に出現)
  • AC2 VC(grep -n -e "\"workflow_run_head_sha\"" scripts/ci/collect_e2e_performance_benchmark.py): PASS
  • AC3 VC(jq schema property/required チェック): PASS
  • AC5 VC(grep -n "measured_head_sha" docs/dev/e2e-performance-benchmark.md): PASS
  • AC7 VC(grep -n "measured_head_sha" docs/dev/ci-performance.md): PASS
  • AC6 VC(4環境変数未設定時の SKIP exit 77 fallback): PASS(SKIP、下記「AC6 runtime verification」参照)

fix_delta(2回目 REQUEST_CHANGES 対応、commit 57a898c)

  • .github/workflows/ci.yml の e2e-core / e2e-responsive-matrix 両ジョブに git config --global --add safe.directory "$GITHUB_WORKSPACE" を追加し、git rev-parse HEAD(measured_head_sha 独立観測)実行時の "dubious ownership" CI 失敗を解消した。CI run https://github.com/squne121/loop-protocol/actions/runs/33864489280 で e2e-core / e2e-responsive-matrix / e2e すべて success を確認済み。
  • AC4(iii)(legacy record の trusted cohort からの hard exclusion)を実装した。LEGACY_AMBIGUOUS_HEAD_SHA_JOBS = ("e2e-core", "e2e-responsive-matrix") にスコープし、当該 2 ジョブについて measured_head_sha / workflow_run_head_sha を両方とも持たない legacy record を legacy_ambiguous_head_sha 理由で hard exclude する。新規回帰テスト test_ac4e_legacy_record_lacking_both_head_sha_fields_is_hard_excluded / test_ac4f_legacy_record_with_derivable_merge_sha_is_not_hard_excluded / test_ac4g_legacy_ambiguous_exclusion_scoped_to_e2e_core_responsive_matrix_jobs を追加。
  • Allowed Paths 外 scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py(38 tests)が上記 hard-exclude 実装後も非回帰であることを再確認済み。

Schema Change Applicability

  • decision: schema_change
  • reason: schemas/e2e_performance_benchmark_manifest_v1.schema.json の RunRecord に measured_head_sha / workflow_run_head_sha を optional field として追加した(required 配列は変更していない)。既存の head_sha / workflow_sha 等の required field・型・意味論は一切変更していない。

Schema Consumer Inventory

before(変更前のスキーマ状態)

変更前は RunRecord.required = [workflow_run_id, job, head_sha, artifact_id, artifact_digest, conclusion, workflow_digest, workflow_sha] のみで、measured_head_sha / workflow_run_head_sha という field 自体が未定義(存在しない field)だった。

after(変更後のスキーマ状態)

変更後も RunRecord.required は変更なし(上記と同一配列を維持)。properties に measured_head_sha(pattern ^[0-9a-f]{40}$)と workflow_run_head_sha(同 pattern)を optional field として追加した。

Consumer ファイル 更新有無 備考
scripts/ci/collect_e2e_performance_benchmark.py 更新あり producer(_collect_arm の runs エントリ組み立て)・validator(_verify_run_record / verify_run_record_against_live_api)の両方が新 field を認識するよう本PRで更新済み
scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py 更新あり 新field を exercise する回帰テストを追加(本PR内)
scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py 更新なし Allowed Paths 外。新 field を一切使わない既存 record 形状のまま非回帰(本PRの _verify_run_record/verify_run_record_against_live_api 変更は additive-only + fallback 設計で、この既存回帰スイート 43 tests を無編集のまま green 維持することを確認済み)
docs/dev/e2e-performance-benchmark.md 更新あり 新field の意味論セクション追加
docs/dev/ci-performance.md 更新あり フィールド定義表に行追加

このスキーマの他の consumer(rg/grep で e2e_performance_benchmark_manifest_v1 を検索)は上記以外に存在しない。

Safety Claim Matrix

.github/workflows/ci.yml を変更しているため safety-sensitive 判定(SAFETY_SENSITIVE_PATH_PATTERNS に .github/workflows/ を含む)に該当する。

Claim Implemented? Not controlled Evidence Follow-up
ci.yml の変更は既存 head_sha/merge_sha の計算式・値を変更せず、新規 env var(GH_MEASURED_HEAD_SHA)の追加のみ yes N/A git diff .github/workflows/ci.yml — 既存行は削除・改変されず、追記のみ N/A
新規追加ロジックは permission・secrets・auth・sandbox には触れない(git rev-parse HEAD の読み取りのみ) yes N/A git diff .github/workflows/ci.yml に権限昇格・secrets 参照の追加なし N/A
actionlint による構文検証を実施済み yes N/A actionlint .github/workflows/ci.yml exit 0 N/A
動作検証(AC6, workflow_dispatch 実行)は実装完了時点では未実施(別途 orchestrator が実施) partial 動作検証は本 SubAgent の実装フェーズでは実施しない方針(Issue #2184 記載どおり) Issue #2184 本文「AC6 (Runtime Verification, decision: immediate) について」 #2184

VISUAL_IMPACT_DECLARATION_V1

schema: VISUAL_IMPACT_DECLARATION_V1
surfaces:
  - surface_id: combat-hud-critical
    disposition: verified_unchanged
  - surface_id: combat-hud-running
    disposition: verified_unchanged

.github/workflows/ci.yml は resolver の META_POLICY_PATHS に含まれるため、CI 配線のみの変更でも全登録 surface が affected 判定される。本 PR は tests/component/combat-hud-critical.vrt.test.ts / tests/component/combat-hud-running.vrt.test.ts を一切変更していないため、両 surface とも verified_unchanged を宣言する。

Notes

Allowed Paths 遵守状況(Compliance)

変更ファイルは Issue #2184 の Allowed Paths と完全一致(違反なし):

  • .github/workflows/ci.yml
  • scripts/ci/collect_e2e_performance_benchmark.py
  • scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py
  • schemas/e2e_performance_benchmark_manifest_v1.schema.json
  • docs/dev/e2e-performance-benchmark.md
  • docs/dev/ci-performance.md

…run_head_sha分離で修正 (#2184)

e2e-core/e2e-responsive-matrixのci_runtime_baseline_v1 producerに、
target_shaのコピーではなくgit rev-parse HEADで独立観測するmeasured_head_shaを
両ジョブ対称に追加した。collector側はworkflow_run_head_shaを既存merge_sha
フィールドから導出し、live API照合はexpected_head_shaとの比較ではなく
record自身のworkflow_run_head_shaとの自己整合性チェックに変更した
(workflow_run_head_shaを導出できないpre-#2184 legacy recordへは
既存のexpected_head_sha比較へフォールバックし、Allowed Paths外の
scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark_rerun_attempt.py
の既存回帰スイートを完全に非破壊のまま維持する)。

schemaにmeasured_head_sha/workflow_run_head_shaをoptional fieldとして追加し
(既存head_sha/requiredは変更なし)、docsのtarget_sha/workflow_sha/workflow_digest
分離セクションと ci-performance.md のフィールド定義表を更新した。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2493/

The preview will be removed when this PR is closed.

…egacy hard-exclude (fix_delta #2493)

Blocker 1: `git config --global --add safe.directory "$GITHUB_WORKSPACE"`
before the new unconditional `git rev-parse HEAD` (measured_head_sha)
invocation in both containerized jobs' "Collect ci_runtime_baseline_v1
artifact" step -- the pre-existing "Verify checked-out HEAD..." step
never hit this because it's gated on target_sha and only ran on an
actual dispatch; this step's unconditional git call runs on every
push/pull_request CI run.

Blocker 2: implements AC4(iii) (legacy_ambiguous_head_sha hard-exclude)
in `_collect_arm`, scoped to `LEGACY_AMBIGUOUS_HEAD_SHA_JOBS`
(e2e-core/e2e-responsive-matrix -- the only jobs #2184's producer change
touches). Also fixes test_collect_e2e_performance_benchmark.py's
`_record()` fixture default: `merge_sha` now defaults to `head_sha`
(auto-derived) instead of always-absent, matching real CI history where
merge_sha has been recorded unconditionally since #2159 (well before
#2184) -- this keeps the file's many unrelated fixtures (dedup,
pairing, schema, CLI) trusted-cohort-eligible under the new hard-exclude
without touching the out-of-Allowed-Paths rerun_attempt regression
suite (its legacy fixtures all use the retired, out-of-scope `e2e` job
name, which the exclusion never targets).

Adds 3 new regression tests (AC4e/f/g) covering the hard-exclude, the
merge_sha-present backward-compat path, and the job-name scoping.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121

squne121 commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

fix_delta: pr-reviewer REQUEST_CHANGES 対応(reviewed_head_sha 8e84ff41)

新規 commit 57a898c9 を push しました。2 件の blocker に対応しています。

Blocker 1: e2e-core / e2e-responsive-matrix の "dubious ownership" 修正

.github/workflows/ci.yml の両ジョブ(e2e-core / e2e-responsive-matrix)の "Collect ci_runtime_baseline_v1 artifact" ステップで、新規追加した無条件の git rev-parse HEAD(measured_head_sha 取得用)の直前に git config --global --add safe.directory "$GITHUB_WORKSPACE" を追加しました。両ジョブとも container: 内で実行されるため、checkout 済みワークスペースの所有者が git の想定と異なり dubious ownership エラー(exit 128)になっていました。既存の "Verify checked-out HEAD matches dispatched target_sha" ステップは if: target_sha != '' でガードされており、通常の push/pull_request 実行では一度も git を呼んでいなかったため、このバグは今回追加した無条件呼び出しで初めて顕在化しました。

CI 実行結果(このブランチへの push で実際に確認):

以前の run(fix 前、head 8e84ff41, https://github.com/squne121/loop-protocol/actions/runs/33862670323 )ではこの 3 ジョブすべてが failure でしたが、今回すべて success に変わったことを確認しました。

Blocker 2: AC4(iii)(legacy record の trusted cohort からの hard-exclude)を実装

scripts/ci/collect_e2e_performance_benchmark.py の _collect_arm に、measured_head_sha も workflow_run_head_sha(merge_sha から導出)も持たない record を legacy_ambiguous_head_sha reason で trusted cohort から除外するロジックを追加しました(新規定数 LEGACY_AMBIGUOUS_HEAD_SHA_JOBS = ("e2e-core", "e2e-responsive-matrix"))。

スコープ設計(なぜ job 名で限定したか):

Allowed Paths 内のテストファイル自体の既存 fixture も同じ理由で 6 件失敗することが判明したため、test_collect_e2e_performance_benchmark.py の _record() ヘルパーの merge_sha デフォルトを「常に absent」から「明示指定がなければ head_sha と同値で auto 補完」に変更しました(実 CI では merge_sha は #2159 以降常に収集されているため、これは実態に即した変更です)。真に ambiguous な record を作りたいテストは merge_sha=None を明示的に渡します。

新規に追加した回帰テスト:

検証結果

既知の残課題(このfix_deltaのスコープ外・Allowed Paths外)

このブランチの CI run(https://github.com/squne121/loop-protocol/actions/runs/33864489280 )で visual-impact-policy と、それに依存する ci-verdict-summary(overall_status='blocked')が failure でした。ただし これは今回の fix_delta 前の run(head 8e84ff41, https://github.com/squne121/loop-protocol/actions/runs/33862670323 )でも同様に failure だった、本 Issue #2184 の変更とは無関係な pre-existing の問題です(visual-impact-policy job 自身が計算する base/head SHA 解決が stale なため、無関係な docs/dev/agent-capability-gaps.md の削除まで diff に含めてしまっている模様)。この 2 job は Issue #2184 の Allowed Paths 外であり、本 fix_delta では対応していません。別途の調査・Issue 化が必要と思われます。

squne121 and others added 2 commits September 4, 2026 20:38
…et_sha step (fix_delta #2493 AC6 live)

Live workflow_dispatch AC6 verification (run
https://github.com/squne121/loop-protocol/actions/runs/33869974220)
surfaced the same "dubious ownership" failure (exit 128) previously
fixed for the "Collect ci_runtime_baseline_v1 artifact" step, but in
the pre-existing "Verify checked-out HEAD matches dispatched
target_sha (#2159 P0-2)" step: its bare `git rev-parse HEAD` runs
inside the container image and the checked-out workspace is owned by
a different UID than the container's git config sees by default.
This step is gated `if: target_sha != ''` and only runs on an actual
dispatched benchmark run, so it was never exercised by normal
push/pull_request CI until this live dispatch.

Adds `git config --global --add safe.directory "$GITHUB_WORKSPACE"`
immediately before the bare `git rev-parse HEAD` call, symmetrically
in both e2e-core and e2e-responsive-matrix jobs. Per Issue #2184 AC1,
the step's `if` condition, name, and comparison logic are unchanged.
@squne121

squne121 commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

fix_delta: AC6 live workflow_dispatch で新たな "dubious ownership" バグを発見・修正

AC6 の要求どおり実装 branch に対して実際に workflow_dispatch を実行したところ
(run: https://github.com/squne121/loop-protocol/actions/runs/33869974220)、
e2e-core / e2e-responsive-matrix の "Verify checked-out HEAD matches dispatched target_sha (#2159 P0-2)" ステップが
fatal: detected dubious ownership in repository at '/__w/loop-protocol/loop-protocol' (exit 128) で FAILURE になりました。

これは前回修正した「Collect ci_runtime_baseline_v1 artifact」ステップの同種バグとは別の、より前段の既存ステップです。
このステップは if: target_sha != '' でガードされており通常の push/pull_request CI では skip されるため、
今回が初めての実行時検証でした(=これまで未発見だった)。

修正内容

.github/workflows/ci.yml の両ジョブ(e2e-core / e2e-responsive-matrix)で、
resolved_head="$(git rev-parse HEAD)" の直前に
git config --global --add safe.directory "$GITHUB_WORKSPACE" を追加しました(対称的に2箇所)。

Issue #2184 AC1 の制約どおり、当該ステップの if: 条件・名前・比較ロジック(構造)は変更していません。

New head SHA: 609fcba42630886a7b438da8884304ed6cdd4423

再検証結果(全 PASS)

  • AC1: grep -n -e measured_head_sha -e MEASURED_HEAD_SHA .github/workflows/ci.yml — PASS
  • AC2: grep -n -e "\"workflow_run_head_sha\"" scripts/ci/collect_e2e_performance_benchmark.py — PASS
  • AC3: jq -e '...' schemas/e2e_performance_benchmark_manifest_v1.schema.json — PASS
  • AC4: uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py — 41 passed
  • AC5: grep -n "measured_head_sha" docs/dev/e2e-performance-benchmark.md — PASS
  • AC7: grep -n "measured_head_sha" docs/dev/ci-performance.md — PASS
  • actionlint .github/workflows/ci.yml — PASS(構文エラーなし)
  • pnpm typecheck — PASS
  • pnpm lint — PASS(ESLint: No issues found)
  • pnpm test — PASS(105 files / 1874 tests)
  • pnpm build — PASS

実際の workflow_dispatch による再確認(AC6 の再実行)は今回のスコープ外とし、別途 orchestrator が実施します。

@squne121

squne121 commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

AC6 Runtime Verification Evidence(live workflow_dispatch, 2回目の再実行・fix適用後)

実装branch worktree-issue-2184-sha-benchmark-artifact-head-sha-measured(PR #2493, head 609fcba42630886a7b438da8884304ed6cdd4423)に対し、branch tipと異なる target_sha を指定して実際の workflow_dispatch を実行しました。

取得・照合した実値

項目 値
指定した target_sha 57a898c9e86b66c067fa1e8f512eaf22889e7d4d
artifact measured_head_sha(e2e-core / e2e-responsive-matrix とも一致) 57a898c9e86b66c067fa1e8f512eaf22889e7d4d
artifact merge_sha(workflow_run_head_sha の導出元) 609fcba42630886a7b438da8884304ed6cdd4423
GitHub API から独立取得した run head SHA(gh run view --json headSha) 609fcba42630886a7b438da8884304ed6cdd4423
GitHub API から独立取得した job head SHA(gh api .../actions/jobs/<id> の head_sha) 609fcba42630886a7b438da8884304ed6cdd4423

照合結果

  • measured_head_sha == target_sha: 一致(57a898c9e8... == 57a898c9e8...)
  • workflow_run_head_sha == GitHub API head SHA: 一致(609fcba426... == 609fcba426...)
  • measured_head_sha != workflow_run_head_sha: 不一致(想定通り)(57a898c9e8... != 609fcba426...)

以上により、AC6 が要求する3条件(measured_head_sha が実 checkout HEAD/target_sha と一致すること・workflow_run_head_sha が GitHub API head SHA と一致すること・両者が意図通り異なること)を live 実行の実値で確認しました。

(1回目の実行 https://github.com/squne121/loop-protocol/actions/runs/33869974220 は、既存の「Verify checked-out HEAD matches dispatched target_sha」ステップのコンテナ内 dubious-ownership バグにより e2e-core/e2e-responsive-matrix が失敗し、これを commit 609fcba4 で修正した後の再実行が本結果です。)

@squne121

squne121 commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

結論

PR #2493 は設計方向・実測検証ともかなり改善されており、元の #2182 P0-4 を解消するアプローチ自体は妥当です。ただし、現 head 609fcba42630886a7b438da8884304ed6cdd4423 に対しては REQUEST_CHANGES を推奨します。

マージを止める理由は大量のハーネス追加ではなく、SHA provenance の正本を1本に固定するための小さな修正1件です。その修正と、意味論ドキュメントの矛盾2件を直せば、個人趣味開発の前提では十分 merge-ready と判断します。

現在の通常 PR CI run 33871178870 は head 609fcba4 に対して conclusion: success です。

敵対的レビュー findings

Severity | Finding | 判定 -- | -- | -- P1 / Blocker | workflow_run_head_sha の provenance source を caller が上書きできる | 修正必須 P1 / Contract | schema の legacy 説明と実装・テストが矛盾 | 同PRで修正推奨 P1 / Contract | ci-performance.md が measured_head_sha を「固定SHA時のみ」と誤記 | 同PRで修正推奨 P2 | live-binding 周辺コメントに古い expected_head_sha 意味論が残存 | ついでに整理 Follow-up | benchmark dispatch が無関係な CI/harness を大量に走らせて失敗する | #2422で解決。#2493は止めない

P1 Blocker — workflow_run_head_sha が merge_sha の正本性を迂回できる

#2184 AC2 の契約は明確で、workflow_run_head_sha は raw ci_runtime_baseline_v1 artifact の既存 merge_sha から導出することになっています。これは前身 #2182 の provenance laundering 問題を踏まえた設計です。#2182 の OWNER adversarial review でも、固定SHA benchmark では workflow の ref と実 checkout commit が異なることが P0-4 として指摘され、それが #2184 に分離されています。

ところが現実装は、

explicit = record.get("workflow_run_head_sha")
if explicit is not None:
    return explicit
return record.get("merge_sha")

となっており、caller が workflow_run_head_sha を付ければ merge_sha より優先されます。

これは例えば raw record が、

merge_sha=C(誤り)、head_sha=B、workflow_run_head_sha=B(後付け)、live API head=B

だった場合、merge_sha=C の不整合を検出せずに live verification を通せます。つまり manifest に出る値が「artifact の既存 merge_sha 由来」という AC2 の provenance claim を満たさなくなります。

推奨修正は単純です。

_derive_workflow_run_head_sha() は return record.get("merge_sha") のみにしてください。互換性のため explicit field をどうしても許すなら、merge_sha と explicit の両方がある場合に 完全一致を要求し、不一致なら fail-closed にするべきです。ただ、producer が explicit field を出す設計ではないので、前者の方が小さく明瞭です。

GitHub の REST artifact response 自体が workflow_run.head_sha を返し、workflow job response にも head_sha があるので、merge_sha → workflow_run_head_sha → live API head_sha という一本の binding chain は自然です。(GitHub Docs)

P1 — schema の legacy 説明が実装と逆

schema の workflow_run_head_sha description は、

pre-#2184 record は field を omit し、legacy record には infer/synthesize しない

という意味になっています。

一方、追加された test_ac4f_legacy_record_with_derivable_merge_sha_is_not_hard_excluded は、#2159〜#2184 の legacy record で measured_head_sha がなくても、merge_sha があればそこから workflow_run_head_sha を導出して manifest に書くことを明示的に保証しています。

実装側の方が合理的です。したがって schema description を、

という実態に合わせるべきです。

コードを変える必要はありません。contract documentation をコードへ合わせれば十分です。

P1 — ci-performance.md の「固定SHA benchmark 時のみ」は事実と異なる

docs/dev/ci-performance.md は現在、

measured_head_sha は e2e-core / e2e-responsive-matrix の「固定SHA benchmark 実行時にのみ追加」

と記載しています。

しかし workflow 実装は明示的に、

regardless of whether target_sha was provided

として git rev-parse HEAD を常時実行しています。通常の PR/push の e2e job artifact にも measured_head_sha が出ます。

むしろ e2e-performance-benchmark.md 側の「通常 pull_request では synthetic merge commit を指しうる」という説明が正しいです。GitHub 公式にも、pull_request の GITHUB_SHA は PR merge branch の merge commit、workflow_dispatch の GITHUB_SHA は dispatch された ref の latest commit と定義されています。(GitHub Docs)

ここは、

e2e-core / e2e-responsive-matrix の artifact に追加される optional field。target_sha の有無を問わず actual checkout HEAD を記録する。他 job には出現しない。

程度へ直すのが正確です。

なお #2184 AC7 自体にも「固定SHA時のみ」という古い記述が残っており、PRだけのミスではなく Issue contract 内部の不整合です。AC1/AC5・実装・live evidence の方を authoritative として直すのが適切です。

実測 evidence は強い

このPRで最も評価できるのは AC6 を本当に実行した点です。

fix 後の live workflow_dispatch run 33872587585 では、

  • branch/run head: 609fcba426...

  • target / measured: 57a898c9e8...

  • e2e-core: success

  • e2e-responsive-matrix: success

  • target SHA verification step: success

  • artifact collection: success

が実行されています。

GitHub の仕様上も workflow_dispatch の GITHUB_SHA は dispatch 先 ref の commit なので、checkout を target_sha に差し替えた場合に

measured_head_sha != workflow_run_head_sha

となるのは期待通りです。(GitHub Docs)

また git safe.directory の fix も過剰な security workaround ではありません。actions/checkout 自体には set-safe-directory: true が既定で存在しますが、container context では異なる HOME/user により後続 git command が dubious ownership になる既知事例があります。GitHub Actions 側でも、container 内で git config --global --add safe.directory "$GITHUB_WORKSPACE" を実行する workaround が示されています。したがって、この修正を撤去・複雑化する理由はありません。(GitHub)

ハーネスについては #2493 を肥大化させない方がよい

AC6 の live dispatch は目的の e2e 2ジョブには成功しましたが、同じ workflow 内では python-test-core、node-backed-hook-tests、visual-impact-policy、その aggregate が別理由で failure になっています。例えば python-test-core は本体 pytest を完走した後の Generate ci_test_selection/v1 artifact で落ち、node-backed-hook-tests も selection artifact producer で落ちています。

これは #2493 の SHA 分離をさらに policy/harness で囲む理由ではなく、benchmark dispatch に通常CIの unrelated jobsを巻き込んでいること自体が問題です。

ここは既に #2422 が正しい解決を持っています。#2422 は #2184 を blocker としたうえで、benchmark_layout != '' の dispatch では benchmark provider jobs だけを起動し、typecheck/lint/build 等の unrelated jobs を起動しない dedicated benchmark route へ置き換える契約です。

したがって、#2493 に追加ハーネスや conditional logic を積むのは非推奨です。#2493 は provenance vocabulary の修正だけ完成させ、hybrid route の構造問題は #2422 に渡す方が保守性・完走率とも良いです。

推奨アクション

このPRに対する私のレビュー verdict は次です。

verdict: REQUEST_CHANGES
reviewed_head_sha: "609fcba42630886a7b438da8884304ed6cdd4423"

blockers:

  • "workflow_run_head_sha must have a single provenance source. Remove the explicit record.workflow_run_head_sha precedence from _derive_workflow_run_head_sha(), or fail closed when it disagrees with raw artifact merge_sha."

required_contract_fixes:

  • "Update schema description: #2159-era pre-#2184 records with merge_sha may derive workflow_run_head_sha; only truly source-less legacy records are not synthesized."
  • "Update docs/dev/ci-performance.md: measured_head_sha is emitted by e2e-core/e2e-responsive-matrix regardless of target_sha, not only during fixed-SHA benchmark runs."

non_blocking:

  • "Clean stale comments/docstrings that still describe live API job head_sha as matching expected_head_sha."
  • "Do not expand #2493 to fix unrelated workflow_dispatch harness failures; #2422 already owns benchmark-only job isolation."

positive_evidence:

  • "Normal PR CI is green at reviewed head."
  • "Live fixed-SHA dispatch independently demonstrated measured_head_sha != workflow_run_head_sha with both target e2e jobs successful."
  • "Explicit safe.directory setup is a justified container-runtime compatibility fix."

修正量は小さいです。 Blocker 1件 + ドキュメント2箇所を直し、merge_sha != explicit workflow_run_head_sha の negative regression test を追加する程度で十分です。新しい security framework、署名、provenance framework、追加承認ゲートは不要です。#2422 も SLSA/OIDC 等を明示的に Out of Scope にしており、この方向性と整合しています。

## 結論

PR #2493 は設計方向・実測検証ともかなり改善されており、元の #2182 P0-4 を解消するアプローチ自体は妥当です。ただし、現 head 609fcba42630886a7b438da8884304ed6cdd4423 に対しては REQUEST_CHANGES を推奨します。

マージを止める理由は大量のハーネス追加ではなく、SHA provenance の正本を1本に固定するための小さな修正1件です。その修正と、意味論ドキュメントの矛盾2件を直せば、個人趣味開発の前提では十分 merge-ready と判断します。

現在の通常 PR CI run 33871178870 は head 609fcba4 に対して conclusion: success です。

敵対的レビュー findings

Severity Finding 判定
P1 / Blocker workflow_run_head_sha の provenance source を caller が上書きできる 修正必須
P1 / Contract schema の legacy 説明と実装・テストが矛盾 同PRで修正推奨
P1 / Contract ci-performance.md が measured_head_sha を「固定SHA時のみ」と誤記 同PRで修正推奨
P2 live-binding 周辺コメントに古い expected_head_sha 意味論が残存 ついでに整理
Follow-up benchmark dispatch が無関係な CI/harness を大量に走らせて失敗する #2422で解決。#2493は止めない

P1 Blocker — workflow_run_head_sha が merge_sha の正本性を迂回できる

#2184 AC2 の契約は明確で、workflow_run_head_sha は raw ci_runtime_baseline_v1 artifact の既存 merge_sha から導出することになっています。これは前身 #2182 の provenance laundering 問題を踏まえた設計です。#2182 の OWNER adversarial review でも、固定SHA benchmark では workflow の ref と実 checkout commit が異なることが P0-4 として指摘され、それが #2184 に分離されています。

ところが現実装は、

explicit = record.get("workflow_run_head_sha")
if explicit is not None:
    return explicit
return record.get("merge_sha")

となっており、caller が workflow_run_head_sha を付ければ merge_sha より優先されます。

これは例えば raw record が、

merge_sha=C(誤り)、head_sha=B、workflow_run_head_sha=B(後付け)、live API head=B

だった場合、merge_sha=C の不整合を検出せずに live verification を通せます。つまり manifest に出る値が「artifact の既存 merge_sha 由来」という AC2 の provenance claim を満たさなくなります。

推奨修正は単純です。

_derive_workflow_run_head_sha() は return record.get("merge_sha") のみにしてください。互換性のため explicit field をどうしても許すなら、merge_sha と explicit の両方がある場合に 完全一致を要求し、不一致なら fail-closed にするべきです。ただ、producer が explicit field を出す設計ではないので、前者の方が小さく明瞭です。

GitHub の REST artifact response 自体が workflow_run.head_sha を返し、workflow job response にも head_sha があるので、merge_sha → workflow_run_head_sha → live API head_sha という一本の binding chain は自然です。([GitHub Docs]1)

P1 — schema の legacy 説明が実装と逆

schema の workflow_run_head_sha description は、

pre-#2184 record は field を omit し、legacy record には infer/synthesize しない

という意味になっています。

一方、追加された test_ac4f_legacy_record_with_derivable_merge_sha_is_not_hard_excluded は、#2159〜#2184 の legacy record で measured_head_sha がなくても、merge_sha があればそこから workflow_run_head_sha を導出して manifest に書くことを明示的に保証しています。

実装側の方が合理的です。したがって schema description を、

という実態に合わせるべきです。

コードを変える必要はありません。contract documentation をコードへ合わせれば十分です。

P1 — ci-performance.md の「固定SHA benchmark 時のみ」は事実と異なる

docs/dev/ci-performance.md は現在、

measured_head_sha は e2e-core / e2e-responsive-matrix の「固定SHA benchmark 実行時にのみ追加」

と記載しています。

しかし workflow 実装は明示的に、

regardless of whether target_sha was provided

として git rev-parse HEAD を常時実行しています。通常の PR/push の e2e job artifact にも measured_head_sha が出ます。

むしろ e2e-performance-benchmark.md 側の「通常 pull_request では synthetic merge commit を指しうる」という説明が正しいです。GitHub 公式にも、pull_request の GITHUB_SHA は PR merge branch の merge commit、workflow_dispatch の GITHUB_SHA は dispatch された ref の latest commit と定義されています。([GitHub Docs]2)

ここは、

e2e-core / e2e-responsive-matrix の artifact に追加される optional field。target_sha の有無を問わず actual checkout HEAD を記録する。他 job には出現しない。

程度へ直すのが正確です。

なお #2184 AC7 自体にも「固定SHA時のみ」という古い記述が残っており、PRだけのミスではなく Issue contract 内部の不整合です。AC1/AC5・実装・live evidence の方を authoritative として直すのが適切です。

実測 evidence は強い

このPRで最も評価できるのは AC6 を本当に実行した点です。

fix 後の live workflow_dispatch run 33872587585 では、

  • branch/run head: 609fcba426...
  • target / measured: 57a898c9e8...
  • e2e-core: success
  • e2e-responsive-matrix: success
  • target SHA verification step: success
  • artifact collection: success

が実行されています。

GitHub の仕様上も workflow_dispatch の GITHUB_SHA は dispatch 先 ref の commit なので、checkout を target_sha に差し替えた場合に

measured_head_sha != workflow_run_head_sha

となるのは期待通りです。([GitHub Docs]2)

また git safe.directory の fix も過剰な security workaround ではありません。actions/checkout 自体には set-safe-directory: true が既定で存在しますが、container context では異なる HOME/user により後続 git command が dubious ownership になる既知事例があります。GitHub Actions 側でも、container 内で git config --global --add safe.directory "$GITHUB_WORKSPACE" を実行する workaround が示されています。したがって、この修正を撤去・複雑化する理由はありません。([GitHub]3)

ハーネスについては #2493 を肥大化させない方がよい

AC6 の live dispatch は目的の e2e 2ジョブには成功しましたが、同じ workflow 内では python-test-core、node-backed-hook-tests、visual-impact-policy、その aggregate が別理由で failure になっています。例えば python-test-core は本体 pytest を完走した後の Generate ci_test_selection/v1 artifact で落ち、node-backed-hook-tests も selection artifact producer で落ちています。

これは #2493 の SHA 分離をさらに policy/harness で囲む理由ではなく、benchmark dispatch に通常CIの unrelated jobsを巻き込んでいること自体が問題です。

ここは既に #2422 が正しい解決を持っています。#2422 は #2184 を blocker としたうえで、benchmark_layout != '' の dispatch では benchmark provider jobs だけを起動し、typecheck/lint/build 等の unrelated jobs を起動しない dedicated benchmark route へ置き換える契約です。

したがって、#2493 に追加ハーネスや conditional logic を積むのは非推奨です。#2493 は provenance vocabulary の修正だけ完成させ、hybrid route の構造問題は #2422 に渡す方が保守性・完走率とも良いです。

推奨アクション

このPRに対する私のレビュー verdict は次です。

verdict: REQUEST_CHANGES
reviewed_head_sha: "609fcba42630886a7b438da8884304ed6cdd4423"

blockers:
  - "workflow_run_head_sha must have a single provenance source. Remove the explicit record.workflow_run_head_sha precedence from _derive_workflow_run_head_sha(), or fail closed when it disagrees with raw artifact merge_sha."

required_contract_fixes:
  - "Update schema description: #2159-era pre-#2184 records with merge_sha may derive workflow_run_head_sha; only truly source-less legacy records are not synthesized."
  - "Update docs/dev/ci-performance.md: measured_head_sha is emitted by e2e-core/e2e-responsive-matrix regardless of target_sha, not only during fixed-SHA benchmark runs."

non_blocking:
  - "Clean stale comments/docstrings that still describe live API job head_sha as matching expected_head_sha."
  - "Do not expand #2493 to fix unrelated workflow_dispatch harness failures; #2422 already owns benchmark-only job isolation."

positive_evidence:
  - "Normal PR CI is green at reviewed head."
  - "Live fixed-SHA dispatch independently demonstrated measured_head_sha != workflow_run_head_sha with both target e2e jobs successful."
  - "Explicit safe.directory setup is a justified container-runtime compatibility fix."

修正量は小さいです。 Blocker 1件 + ドキュメント2箇所を直し、merge_sha != explicit workflow_run_head_sha の negative regression test を追加する程度で十分です。新しい security framework、署名、provenance framework、追加承認ゲートは不要です。#2422 も SLSA/OIDC 等を明示的に Out of Scope にしており、この方向性と整合しています。

@squne121

squne121 commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

確認した限り、次の一手は Issue #2184 の再 refinement ではなく、PR #2493 の現在ブランチをそのまま impl-review-loop の次 iteration に入れることです。

指定コメントの blocker は限定的です。workflow_run_head_sha の provenance を raw artifact の merge_sha に一本化し、schema/doc の矛盾を修正し、provenance laundering を防ぐ negative regression test を追加すればよいです。現在の通常 PR CI は reviewed head 609fcba4... で green、AC6 の live dispatch も意図した measured_head_sha != workflow_run_head_sha を実証済みです。

また、GitHub の現行仕様でも workflow_dispatch の GITHUB_SHA は dispatch された ref の最新 commit、pull_request では merge branch の merge commit です。artifact API も workflow_run.head_sha を返すため、merge_sha → workflow_run_head_sha → live API head_sha の一本化は妥当です。([GitHub Docs]1)

impl-review-loop 自体も implementation-worker → test-runner → pr-reviewer を繰り返し、REQUEST_CHANGES は fix_delta として次 iteration に戻し、APPROVE + live mergeability 成立時に「人間が merge 判断する直前」で終了する設計です。 特に test-runner は terminal completed と final result の両方を確認するまで Step 4 に進んではならないという契約があります。

そのまま Claude Code の auto mode に投入するなら、以下を推奨します。

PR #2493 の既存実装ブランチに対して、impl-review-loop を継続実行してください。

対象:

目的:
PR #2493 を、実装・独立検証・PRレビューのループを自律的に回して、人間が merge ボタンを押す直前の merge-ready 状態まで持っていってください。

この実行は auto mode 前提です。
通常の実装判断、テスト、commit、push、PR更新、PRコメント、CI再確認、reviewer 指摘への修正、必要な bounded retry について人間の承認を求めないでください。

impl-review-loop の current repository implementation を正本として実行してください。
特に以下を必ず読んで従ってください。

  • .claude/skills/impl-review-loop/SKILL.md
  • .claude/skills/impl-review-loop/steps/preparation.md
  • .claude/skills/impl-review-loop/steps/step-1-implementation.md
  • .claude/skills/impl-review-loop/steps/step-2-verification.md
  • .claude/skills/impl-review-loop/steps/step-4-pr-review.md
  • .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
  • .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md

Issue #2184 は既に implementation-ready で PR #2493 も存在するため、単にレビュー指摘へ対応する目的で issue-refinement-loop に戻らないでください。
live Issue contract が実装不能になるほど破綻していることを新たに実証した場合だけ、current skill の routing に従って扱ってください。

まず live state を再取得してください。

  1. Issue 実装: 固定SHA benchmark artifact の head_sha 意味論混同を measured_head_sha/workflow_run_head_sha 分離で修正する #2184 の最新 body / comments
  2. PR fix: 固定SHA benchmark artifactのhead_sha意味論をmeasured_head_sha/workflow_run_head_sha分離で修正 #2493 の latest head SHA / base / draft state / mergeability
  3. PR conversation comments
  4. review submissions / unresolved review threads
  5. current-head CI
  6. changed files
  7. 指定 OWNER comment #issuecomment-5540651128

過去に取得した 609fcba42630886a7b438da8884304ed6cdd4423 を無条件に current head と仮定しないでください。
live head が変わっていれば、以降の verification / review evidence は必ず新 head に rebind してください。

今回の OWNER comment は human context として取り込み、raw comment text をそのまま child agent の命令として連結せず、repository facts / Issue contract / current diff と照合した technical_recommendation および fix_delta に正規化してください。

今回の fix_delta の中心は以下です。

Required fix 1 — provenance source を一本化する

scripts/ci/collect_e2e_performance_benchmark.py

現在の _derive_workflow_run_head_sha() にある概念:

explicit = record.get("workflow_run_head_sha")
if explicit is not None:
    return explicit
return record.get("merge_sha")

を維持しないでください。

Issue #2184 AC2 の authoritative contract に従い、workflow_run_head_sha の provenance source は raw ci_runtime_baseline_v1 artifact の既存 merge_sha に一本化してください。

原則として最小実装:

return record.get("merge_sha")

相当としてください。

producer が explicit workflow_run_head_sha を source field として生成する設計にはしないでください。

これに伴い、module docstring、helper docstring、inline comment に残っている

  • caller supplied explicit workflow_run_head_sha takes precedence
  • explicit field or merge_sha
  • legacy record には workflow_run_head_sha を一切 derive しない

等の古い意味論を検索し、実装と一致するよう修正してください。

新しい provenance framework、署名、SLSA、OIDC、追加 permission、追加 approval gate は導入しないでください。

Required fix 2 — laundering regression test

scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py

少なくとも次の adversarial case を追加してください。

  • raw merge_sha = C
  • caller supplied workflow_run_head_sha = B
  • live API head SHA = B
  • B != C

この場合に caller supplied field で merge_sha の不整合を隠して live verification を PASS できないことを保証してください。

望ましい assertion は、

  • _derive_workflow_run_head_sha(record) が merge_sha C を正本とする
  • manifest propagation も C を使う
  • live API B との照合は mismatch として FAIL

のいずれか、または組み合わせです。

テストを実装詳細へ過剰に密結合させず、「raw artifact の merge_sha が唯一の provenance source」という contract を直接守る regression にしてください。

Required fix 3 — schema description

schemas/e2e_performance_benchmark_manifest_v1.schema.json

workflow_run_head_sha の description を実際の backward compatibility contract に合わせてください。

意味論:

measured_head_sha の backward-compatible optional semantics まで壊さないでください。

Required fix 4 — ci-performance.md

docs/dev/ci-performance.md

現在の
「固定SHA benchmark 実行時にのみ追加」
という measured_head_sha の説明を修正してください。

実装どおり、

  • e2e-core / e2e-responsive-matrix の artifact に追加される optional field
  • target_sha の有無にかかわらず collecting step が actual checkout HEAD を git rev-parse HEAD で取得する
  • fixed-SHA dispatch 専用 field ではない
  • 他 job の artifact には出現しない

という意味にしてください。

Issue #2184 AC7 の文章自体には古い「固定SHA時のみ」という記述がありますが、AC1、AC5、workflow 実装、live AC6 evidence と矛盾しています。
今回この矛盾を理由に Issue 全体を再 refinement したり、PR scope を拡張したりしないでください。
AC1 / AC5 / 実装 / live evidence を authoritative として PR 内 documentation を実態へ合わせてください。

Non-blocking cleanup

同じ変更箇所周辺に、

api_workflow_run.head_sha / api_job.head_sha を expected_head_sha と比較するという pre-#2184 の古い説明がコメント/docstringとして残っていれば整理してください。

ただしコード・doc の意味を明瞭にする範囲だけに限定してください。

明示的に変更しないもの

以下は今回 #2493 へ取り込まないでください。

特に .github/workflows/ci.yml の既存 safe.directory fix は、現在の container runtime compatibility 上必要な修正なので撤去しないでください。

レビュー対応に .github/workflows/ci.yml の追加変更が不要なら、触らないでください。

#2422 は #2184 を blocker として、benchmark-only provider route と unrelated jobs isolation を別途所有しています。
その責務を #2493 に逆流させないでください。


Step 1 — Implementation

implementation-worker SubAgent を起動して今回の fix_delta のみを実装させてください。

root thread 自身が直接 file edit を代行しないでください。

SubAgent message には placeholder ではなく、実際の以下の値を materialize してください。

Allowed Paths は Issue #2184 の live body を正本として使用してください。

今回必要な変更は原則として:

  • scripts/ci/collect_e2e_performance_benchmark.py
  • scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.py
  • schemas/e2e_performance_benchmark_manifest_v1.schema.json
  • docs/dev/ci-performance.md

です。

P2 cleanup が必要なら既存 Allowed Paths 内の docs だけを使用してください。

implementation-worker の作業完了を必ず待ってください。

単に agent を launch して先へ進まないでください。
current impl-review-loop の Common Completion Protocol に従い、canonical task が terminal completed になったことと final result の両方を確認してから Step 2 へ進んでください。

worker が recoverable なテスト失敗や lint failure を返した場合は、人間へ質問せず bounded retry / fix iteration を継続してください。


Step 2 — Independent Verification

実装 commit/push 後、PR の live current head SHA を再取得してください。

その head に束縛して test-runner SubAgent を起動してください。

Issue #2184 の現在の Acceptance Criteria と Verification Commands を live body から取得し、Verification Commands を literal contract として一字一句の実行文字列を保持したまま test-runner に渡してください。

最低でも AC1〜AC7 の全 current VC を実行・adjudicate してください。

特に:

  • AC4 pytest
  • AC6 runtime verification

を省略しないでください。

AC6 は runtime-only evidence です。
以前の run 33872587585 は reviewed head 609fcba4... に対する強い positive evidence ですが、新しい fix commit によって PR head が変わった場合は、それだけを current-head PASS として流用しないでください。

必要なら current implementation branch に対して branch tip と異なる target_sha を指定した workflow_dispatch を再実行し、

  • run URL
  • target SHA
  • measured_head_sha
  • workflow_run_head_sha
  • GitHub API run head SHA
  • GitHub API job head SHA
  • measured == target
  • workflow_run_head_sha == API head
  • measured != workflow_run_head_sha

を current-head evidence として取得してください。

AC6 の live dispatch で unrelated jobs が失敗しても、目的の e2e-core / e2e-responsive-matrix と AC6 evidence が成功し、その unrelated failure が #2422 所有の既知問題である場合、そのために #2493 の scope を拡大しないでください。

ただし通常の pull_request current-head required CI failure は別です。
PR に required な CI は merge-ready 判定前に current head で PASS させてください。

test-runner の完了を必ず待ってください。

Step 4 に進む条件は必ず:

  1. test-runner task が terminal completed
  2. final read-only report を取得済み
  3. report の head_sha == live PR current head
  4. literal Verification Command hashes が live Issue と一致
  5. VC_ADJUDICATION_RESULT_V1.blocking == false

の全てです。

terminal completed だけ、または final result だけで Step 2 完了扱いにしないでください。

head/body/Verification Commands が変化したら stale evidence とし、人間確認を求めず Step 2 を current state で再実行してください。


Current-head CI gate

Step 4 前および最終判定前に、current PR head の repository-required CI を確認してください。

pending の間に reviewer を先行起動しないでください。

failure が今回の変更によるものなら implementation-worker に戻して修正してください。

flaky/retry-safe と客観的に判断できる場合は bounded rerun を行ってください。

正常な PR CI と、AC6 用 workflow_dispatch の unrelated job failures を混同しないでください。


Step 4 — PR Review

current-head verification gate が nonblocking になった場合のみ pr-reviewer SubAgent を起動してください。

reviewer には最低限:

を渡してください。

過去 head に対する review verdict を current head に流用しないでください。

pr-reviewer の完了を必ず待ってください。

canonical task が terminal completed になったことと final LOOP_VERDICT の両方を確認してから Step 5 に進んでください。

pr-reviewer が REQUEST_CHANGES を返した場合:

  • 人間へ承認を求めない
  • blockers を fix_delta として LOOP_STATE に保存
  • iteration を進める
  • implementation-worker に戻す
  • commit/push
  • current-head test-runner
  • current-head CI
  • current-head pr-reviewer

を再実行してください。

このループを APPROVE まで自律継続してください。


Step 5 — Merge-readiness routing

route_loop_verdict_v2() と live mergeability を使って current skill の routing を実行してください。

以下は人間へ聞かず自動処理してください。

  • REQUEST_CHANGES
    → fix_delta iteration
  • stale reviewed head
    → current-head re-review
  • BEHIND
    → prescribed implementation-worker update_branch route
    → head が変わるため verification + CI + review を再実行
  • recoverable UNKNOWN
    → bounded retry
  • ordinary CI/test failure
    → 原因を修正または bounded rerun
  • draft PR が merge readiness の唯一の機械的 blocker
    → repository の open-pr.mark_ready_for_review / equivalent prescribed mechanical action で ready for review にし、その後 live CI/mergeability を再評価する
  • advisory artifact / scope-rollup / launch-ledger / snapshot freshness 等だけの異常
    → warning として記録し、実コード・実テスト・live CI・live review を優先して継続

SubAgent の単なる human_review_required: true 自己申告だけでは停止しないでください。
current impl-review-loop の root-level routing / #1860 Owner Decision を優先し、recoverable な harness・artifact・discovery 問題は自動回復してください。

agent discovery failure があれば current Step 4 recovery contract の Stage A → Stage B → 必要時 Stage C を bounded に実行し、回復可能な not found だけで人間へ戻さないでください。


人間への停止条件

マージ直前までは原則として承認を求めないでください。

ただし次の場合だけ停止してください。

  1. 実際の secret / credential / token 内容を人間から取得・開示する必要がある
  2. force push、history rewrite、remote branch 強制更新、重要データ削除などの破壊的・不可逆操作が必要
  3. mergeable == CONFLICTING または merge_state_status == DIRTY で、bounded mechanical reconciliation では安全に解消できない
  4. Issue 実装: 固定SHA benchmark artifact の head_sha 意味論混同を measured_head_sha/workflow_run_head_sha 分離で修正する #2184 の Allowed Paths / fixed contract を破らなければ blocker を解消できないことを具体的 diff evidence 付きで実証した
  5. impl-review-loop の bounded iteration を使い切っても同一 blocker が解消せず no-progress になった
  6. 最終 merge 実行そのもの

単なる permission prompt、通常の commit/push、GitHub Actions dispatch、CI rerun、PR comment、draft→ready、review iteration は停止理由にしないでください。利用可能な既存権限の範囲で自動実行してください。

秘密情報をログ・Issue・PR・artifact に書かないでください。

force push はしないでください。


完了条件

以下を全て満たすまで作業を継続してください。

ここまで到達したら merge は実行しないでください。

人間が最終的に merge する直前の状態で停止し、最後に簡潔に以下だけ報告してください。

  • final PR URL
  • final head SHA
  • commits added in this run
  • changed files
  • test-runner result
  • literal VC result AC1〜AC7
  • AC6 run URL と4 SHAの照合結果
  • required CI result
  • pr-reviewer final verdict / reviewed_head_sha
  • live mergeability
  • unresolved review threads 数
  • Closes #2184 の存在確認
  • remaining warnings(あれば)
  • READY FOR HUMAN MERGE か否か

最終 merge 以外について、途中で人間の確認を求めず完走してください。

このケースでは max_iterations はデフォルト3でも足りそうですが、auto mode の完走性を優先するなら 5 iteration に明示的に増やすのも妥当です。変更量が小さいので、通常は1回の fix + 再レビューで収束する想定です。

OWNER adversarial review (PR #2493 issuecomment-5540651128) の
REQUEST_CHANGES 対応。`_derive_workflow_run_head_sha()` が
caller-supplied な明示的 `workflow_run_head_sha` フィールドを
`merge_sha` より優先していたため、artifact の真の provenance
(`merge_sha`) と食い違う自己申告値で live-API self-consistency
チェックを迂回できる laundering path になっていた。

- `merge_sha` のみを正本の derivation source とし、explicit
  `workflow_run_head_sha` の precedence を撤去
- 該当箇所の module docstring / helper docstring / inline comment を
  実装の意味論に合わせて修正
- laundering regression test
  (`test_ac2_explicit_workflow_run_head_sha_field_cannot_override_merge_sha_provenance`)
  を追加。既存 80 テスト(rerun_attempt スイート含む)は非回帰
- schema `RunRecord.properties.workflow_run_head_sha` の description を
  「#2159-era merge_sha 保持 record からは derive 可能、merge_sha 自体を
  持たない truly legacy record のみ omit」という実装の実態に合わせて修正
- `docs/dev/ci-performance.md` の `measured_head_sha` 説明を、固定SHA
  dispatch 専用ではなく通常の pull_request/push 実行を含め常時
  `git rev-parse HEAD` で収集される optional field である旨に修正

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121
squne121 marked this pull request as ready for review September 4, 2026 13:13
@squne121
squne121 merged commit 59d132f into main Sep 4, 2026
25 checks passed
@squne121
squne121 deleted the worktree-issue-2184-sha-benchmark-artifact-head-sha-measured branch September 4, 2026 21:50
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.

実装: 固定SHA benchmark artifact の head_sha 意味論混同を measured_head_sha/workflow_run_head_sha 分離で修正する

1 participant