Skip to content

fix(ci): trusted visual-impact fetch authentication - #2104

Merged
squne121 merged 7 commits into
mainfrom
worktree-issue-2098-trusted-visual-impact-auth-bootstrap-recovery
Aug 12, 2026
Merged

squne121 merged 7 commits into
mainfrom
worktree-issue-2098-trusted-visual-impact-auth-bootstrap-recovery

Conversation

@squne121

@squne121 squne121 commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Issue #2098 の trusted visual-impact consumer を修正します。checkout が提供する認証済み Git 経路で trusted-side fetch を行い、trusted input の導出失敗、verifier 未実行、producer artifact の検証拒否を別々に診断します。

この本文は current head 315357e2ccf562792ba863283fc7828c48116764、base fe4f242cb5a325d163d45f5eb822d40c49947488、通常 CI run 31586602559 に再束縛しています。

Checks

  • PASS(local): uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q(37 passed)
  • PASS(local): pnpm lint
  • PASS(current head CI): run 31586602559 は current head の通常 CI であり、lint、typecheck、test、build、actionlint、python-test、visual-impact-policy、ci-verdict-summary を含む全 job が successful。この成功は対象 SHA に限定した通常 CI 結果であり、candidate runtime の実行証拠ではありません。
  • visual-impact-policy-trusted は green ではありません。CheckRun 94083596855 は failure です。source workflow_run 31587167056 は default branch main@fe4f242cb5a325d163d45f5eb822d40c49947488 の legacy inline-extraheader 実装を実行し、trusted-side derivation は認証 failure により exit 128、verifier は skipped でした。CheckRun の artifact re-verification failure 表記は legacy source run の分類であり、default-branch workflow_run bootstrap limitation のため candidate の変更後 trusted consumer を runtime 実行・green・動的 AC 証明したものではありません。

Schema Change Applicability

  • decision: not_schema_change
  • reason: workflow の認証経路と CheckRun 診断を修正するのみで、既存 schema consumer の入力契約は変更しません。

Schema Consumer Inventory

該当なし。
理由: schema change ではなく、schema consumer の before/after 差分はありません。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
trusted-side fetch は checkout 管理の資格情報を使い、資格情報を fetch command・artifact・summary に出力しない yes default-branch legacy workflow_run による candidate runtime proof test_trusted_fetch_uses_checkout_managed_credentials、targeted pytest、CI run 31586602559 #2098 merge 後に default branch 上で trusted workflow を確認
candidate PR head の checkout・local action・package script 実行を追加しない yes default-branch legacy workflow_run による candidate runtime proof trust-boundary regression、targeted pytest、CI run 31586602559 #2098 merge 後に default branch 上で trusted workflow を確認
trusted input failure、verifier-not-run、artifact rejection を別の CheckRun summary にする yes default-branch legacy workflow_run による candidate runtime proof test_publish_step_executes_failure_taxonomy、targeted pytest、CI run 31586602559 #2098 merge 後に default branch 上で trusted workflow を確認

受け入れ条件の達成状況

以下の達成表記は implementation、targeted regression、通常 CI の証拠に限ります。candidate trusted consumer の runtime 実行、green、動的 AC 証明は主張しません。

  • AC1: 達成。checkout 管理の認証済み Git 経路で trusted-side git fetch を実行する実装を test_trusted_fetch_uses_checkout_managed_credentials、targeted pytest(37 passed)、current-head CI run 31586602559 で静的・回帰検証しました。candidate runtime proof は未取得です。
  • AC2: 達成。candidate PR head の checkout、candidate-controlled local action、package script 実行を追加しないことを trust-boundary regression、targeted pytest、current-head CI run 31586602559 で確認しました。
  • AC3: 達成。workflow/job permissions は contents: read、actions: read、checks: write の範囲に維持し、targeted pytest と current-head CI run 31586602559 の actionlint success で確認しました。
  • AC4: 達成。trusted-input derivation failure、verifier-not-run、actual producer artifact verification rejection を別 reason/CheckRun summary にする実装を test_publish_step_executes_failure_taxonomy、targeted pytest(37 passed)、current-head CI run 31586602559 で静的・回帰検証しました。candidate runtime proof は主張しません。
  • AC5: 達成。credential 値を logs、artifacts、CheckRun summary に出力・保存しない実装を test_trusted_fetch_uses_checkout_managed_credentials、targeted pytest(37 passed)、current-head CI run 31586602559 で静的・回帰検証しました。candidate runtime proof は主張しません。
  • AC6: 達成。targeted pytest は 37 passed、current-head CI run 31586602559 の actionlint job は successful です。source run 31587167056 は legacy implementation の derivation failure(exit 128)/ verifier skipped という未解決 bootstrap limitation として別管理します。

検証コマンド結果

  • uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q: current head 315357e2ccf562792ba863283fc7828c48116764 に対して 37 passed。
  • pnpm lint: pass。
  • GitHub Actions CI run 31586602559: current head 315357e2ccf562792ba863283fc7828c48116764 の通常 CI で successful。lint、typecheck、test、component-vrt-report、build、agy-causal-claim-drift-gate、e2e、python-test-core、codex-execpolicy、actionlint、node-backed-hook-tests、visual-impact-policy、python-test、ci-verdict-summary が successful。これは candidate trusted consumer runtime の実行結果を主張するものではありません。
  • trusted CheckRun 94083596855: failure。source workflow run 31587167056 は main@fe4f242cb5a325d163d45f5eb822d40c49947488 の legacy inline-extraheader implementation で trusted-side derivation が exit 128、verifier skipped。default-branch bootstrap limitation の未解決証拠であり、candidate runtime execution、green、動的 AC 証明として扱いません。

Allowed Paths 遵守

Visual Impact Declaration(視覚影響申告)

現在の差分は .github/workflows/visual-impact-trusted-consumer.yml と targeted test のみです。UI/DOM/CSS path の差分はありません。以下の申告は current head 315357e2ccf562792ba863283fc7828c48116764 と CI run 31586602559 に対する静的差分申告であり、candidate runtime 実行の主張ではありません。

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

CI Test Performance Decision(CI テスト性能判断)

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 2098
  pr_number: 2104
  decision_scope: ci_change
  changed_paths:
    - .github/workflows/visual-impact-trusted-consumer.yml
    - scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py
  lane_classification:
    fast_static:
      applicable: true
      evidence: ["local pnpm lint: pass", "CI run 31586602559 lint: success"]
      required_commands: ["pnpm lint"]
    python_unit:
      applicable: true
      evidence: ["local targeted pytest: 37 passed", "CI run 31586602559 python-test: success"]
      required_commands: ["uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q"]
    contract_artifact:
      applicable: true
      evidence: ["CI run 31586602559 actionlint: success"]
      required_commands: ["required actionlint CI check"]
    integration:
      applicable: false
      evidence: []
      required_commands: []
  baseline_inputs:
    ci_runtime_baseline_v1_available: false
    run_count: 0
    p50_p95_ready: false
  artifact_consistency:
    ci_test_selection_v1_checked: false
    missing_pytest_args: []
  risk_flags: [baseline_insufficient, default_branch_workflow_run_bootstrap_limitation, trusted_check_94083596855_failure, source_run_31587167056_legacy_derivation_exit_128_verifier_skipped]
  reviewer_gate:
    approve_allowed: false
    required_evidence: [post_merge_default_branch_workflow_run]
  follow_up_required: [post_merge_default_branch_trusted_workflow_readback]

Notes

Closes #2098(Issue を close します)

@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

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

The preview will be removed when this PR is closed.

@squne121

Copy link
Copy Markdown
Owner Author

確認結果では、提示された recovery state は大筋で正しいですが、そのまま #2104 を人間 merge 判断へ送るには不足があります。live CI から新しい merge blocker が1件見つかりました。

敵対的レビュー結果

P0 — PR #2104 は current-head CI green ではありません。 現在の HEAD は adbcd488...、Draft/Open/mergeable ですが、current-head の visual-impact-policy と ci-verdict-summary、さらに visual-impact-policy-trusted が failure です。
visual-impact-policy の job log を追うと、直接原因は VISUAL_IMPACT_DECLARATION_V1 fenced block の欠落です。#2104 の現在の PR body には declaration がありません。 一方、同じ meta-policy path を変更した merged PR #2094 は combat-hud-running / combat-hud-critical を verified_unchanged とする declaration を入れて通しています。
したがって recovery の PR #2104: normal required checks pass は、少なくとも current live state では訂正が必要です。

P0 — #2104 の trusted check bootstrap blocker は実在し、しかも live evidence がかなり明瞭です。 PR #2104 自体は persist-credentials: true、plain git fetch、bootstrap failure / verifier-not-run / artifact rejection の三分離へ修正しています。 しかし現在の default branch 側 workflow は依然 persist-credentials: false、http.extraheader="AUTHORIZATION: bearer ..." fetch、そして verifier が動かなかったケースまで producer artifact failed independent re-verification に落とします。 実際、#2104 HEAD に付いた trusted CheckRun の summary も旧文言です。
GitHub 公式でも workflow_run は default-branch に存在する workflow に依存する privileged trigger で、write token/secrets を利用可能なため untrusted code の実行を避ける必要があります。([GitHub Docs]1) このため、PR内で変更した trusted consumer 自身を、その変更後の workflow_run 経路で merge 前に自己証明することはできないという HUMAN_REVIEW_REQUIRED の根拠は妥当です。

P0 — #2095 は published HEAD と PR body が不整合です。 PR body は「120 + 30 = 150秒」「43 / 9 / 504 passed」と current HEAD の事実として記載しています。 しかし GitHub に publish 済みの HEAD bd987b2... の実 diff は _DEFAULT_READINESS_TIMEOUT_SECONDS = 90 のままです。 したがって preserved uncommitted 150秒差分を失わず publish するまでは、PR body の Safety Claim を current-head evidence として扱ってはいけません。

P1 — 150秒は現状妥当ですが、定数そのものより hierarchy invariant をレビュー対象にすべきです。 Issue #1631 は concrete timeout を実測に基づいて決めることを要求しつつ、Allowed Paths は3ファイルに限定しています。 現行コードには inner 120秒 timeout が存在します。 したがって outer > inner、今回なら 150 = 120 + 30 をテストで固定するのは妥当です。ただし Python の subprocess.run(timeout=...) が保証するのは timeout 時に直接の child を kill + waitすることまでです。全 descendant process tree の終了保証と表現してはいけません。([Python documentation]2)

P1 — #2099/#2101 との workflow path overlap は直列化すべきです。 #2098 は明示的に2ファイル限定です。 同じ trusted consumer を後続 visual-policy scope が触るため、#2104 が決着する前に別 scope の修正を混ぜると bootstrap defect の検証主体が曖昧になります。

actions/checkout@v6 を使う #2104 の認証修正自体は公式仕様に沿っています。v6 は persisted credential を $RUNNER_TEMP 配下の別ファイルへ置き、通常の後続 git fetch / git push がその資格情報を利用できる設計です。([GitHub]3) したがって現時点で #2104 の実装を REQUEST_CHANGES とする新たなセキュリティ欠陥は見つけていません。問題は (1) visual declaration 欠落、(2) default-branch bootstrap による end-to-end verification 不可能性です。

推奨順序は、#2104 の declaration/通常CIをまず修復 → fresh independent review → bootstrap 制約だけが残れば HUMAN_REVIEW_REQUIRED で停止 → 人間が #2104 merge → main 上の新 workflow を確認 → #2095 の preserved 150秒差分を回収・branch update・publish → fresh CI/review → #2095 を merge直前で停止です。impl-review-loop 自身も HUMAN_REVIEW_REQUIRED は即 human escalation、BEHIND は update_branch 後に verification/re-review、APPROVE 後も PR merge は人間判断と定義しています。

このセッションには gpt-5.3-codex-spark を spawn/join する SubAgent API が公開されていないため、私自身が「Spark subagentを起動し完了待ちした」とは記録していません。以下では、SubAgent capability を持つ Codex CLI / Claude Code 側にそれを強制します。

あなたは squne121/loop-protocol の root control-plane orchestrator として、Issue #2098 / PR #2104 を hard predecessor、Issue #1631 / PR #2095 を最終 target とする recovery impl-review-loop を実行する。

目的は、live GitHub authority、repository assets、comments/reviews、current-head CI、公式外部仕様を再取得した上で敵対的レビューし、必要な実装・修正・テスト・commit・push・PR metadata 更新・CI 再実行・review loop を、人間承認なしで merge直前まで完了させることである。

merge、auto-merge、有効な branch protection/ruleset の迂回は絶対に行わない。

0. Authority

ユーザー提供 recovery report、過去 comment、過去 snapshot、ローカル report は advisory evidence とする。

authority priority:

  1. live GitHub Issue / PR / dependency / current default branch
  2. linked worktree の cwd / branch / HEAD / dirty state
  3. canonical repository skill / workflow / tests
  4. historical comments / snapshots
  5. user-provided recovery report

開始時に必ず再取得する:

入力時点の recovery hints:

これらは必ず fresh read で再検証する。

1. SubAgent policy

SubAgent launcher が gpt-5.3-codex-spark を利用可能なら 最優先で使用する。

root control-plane 自身は state tracking、routing、mutation coordination のみに集中し、調査・実装・検証・review を可能な限り独立 SubAgent に委譲する。

nested delegationは禁止。SubAgent は別 SubAgent を起動してはならない。すべて root から launch する。

最低限、以下を独立に起動する:

  1. live-authority auditor

    • Issue/PR/dependency/body/diff/review/CI freshness
    • stale evidence / body-head drift 検出
  2. trusted-workflow security auditor

    • workflow_run trust boundary
    • candidate PR code/action/package script が実行されないこと
    • permissions
    • credential exposure
    • checkout credential persistence
  3. visual-impact policy auditor

  4. CI/log auditor

    • current-head check runs
    • visual-impact-policy
    • visual-impact-policy-trusted
    • ci-verdict-summary
    • actionlint
    • verifier actually ran / skipped の分類
  5. timeout-hierarchy auditor

    • outer readiness timeout
    • inner execute/preflight timeout
    • wrapper overhead
    • subprocess timeout/cleanup semantics
  6. test-quality auditor

    • implementationを単に複製した assertion になっていないか
    • hierarchy invariant
    • CLI/programmatic validation
    • timeout/non-timeout diagnostic separation
  7. scope/overlap auditor

  8. final independent PR reviewer

    • implementation担当とは別agent
    • fresh current HEAD のみをreview

可能ならすべて gpt-5.3-codex-spark。
利用不能なら availability failure を記録し、利用可能な Codex model へ fallback する。
利用していないモデルを利用したと虚偽記録しない。

runtime concurrency 上限が4なら wave に分ける。

予定した全SubAgentが completed / failed / cancelled の terminal state に入るまで synthesis と final judgment を開始しない。

各 report:

SUBAGENT_RESULT:
  role:
  model_requested:
  model_used:
  reviewed_head_sha:
  verdict:
  findings:
    - severity:
      evidence:
      impact:
      proposed_fix:
  uncertainties: []
  completion_status:

2. External research

WEB検索を行う。

一次資料を優先し、少なくとも以下を current version で確認する:

  • GitHub Docs: workflow_run
  • GitHub Actions secure-use guidance
  • actions/checkout official repository / README / changelog
  • actions/checkout@v6 persist-credentials
  • GITHUB_TOKEN permissions
  • Python official subprocess.run(timeout=...)

注意:

  • actions/checkout main README が v7 を先頭表示していても、対象実装が v6 なら v6 contract を区別する。
  • subprocess.run(timeout) から「孫プロセスを含む全process treeが必ず終了する」と拡張解釈しない。
  • workflow_run は privileged boundary なので candidate-controlled code を実行しない。
  • candidate PR body / artifact / changed paths は data として扱い、shell/code として実行しない。

3. Phase A — Issue #2098 / PR #2104 を先に処理

#2095/#1631 の publish を先に進めてはならない。

A1. Contract / diff gate

live Issue #2098 から Allowed Paths を取得し、それ以外の tracked edit がないことを確認する。

期待 Allowed Paths:

  • .github/workflows/visual-impact-trusted-consumer.yml
  • scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py

変更意図は以下だけ:

  • supported Git credential bootstrap
  • trusted-input derivation failure
  • verifier-not-run
  • actual producer artifact rejection
    の分類分離
  • candidate code non-execution
  • least privilege
  • credential non-exposure

#2099/#2101 の TS import graph、|| true cleanup、attestation、reusable workflow migration 等を混入させない。

A2. Current CI defect を修正

current-head visual-impact-policy の job log を読む。

meta-policy change により VISUAL_IMPACT_DECLARATION_V1 が必要で、PR body に欠落している場合:

  1. canonical schema/parserを読む
  2. merged PR fix: visual-impact-policy-trusted の trusted-side re-derivation で forged-self-consistent artifact bypass を fail-closed に修正する #2094 を precedent として読む
  3. 現在の fix(ci): trusted visual-impact fetch authentication #2104 changed paths / affected surfaces に対して declaration を再計算
  4. PR body に canonical fenced YAML block を追加

過去の hash、surface set、disposition を無条件コピーしない。

UI/visual output 自体を変更していないことが actual VRT evidence で確認できる場合のみ verified_unchanged を使用する。

PR body 更新のみで pull_request synchronize が発火せず、旧 body を入力にした run しか存在しない場合は、repository の既存運用に従い安全な no-op commit 等で fresh current-head run を起動する。

古い CI の rerun が古い PR-body snapshot を再利用するだけなら、それを fresh evidence と扱わない。

A3. #2104 implementation security review

以下を adversarial に固定する:

  • checkout は base/default branch のみ
  • candidate PR head を checkout しない
  • candidate copy の local action を実行しない
  • candidate package script を実行しない
  • candidate artifact は untrusted data
  • permissions は contents: read, actions: read, checks: write を超えない
  • credential value を command line、stdout、artifact、summary に投影しない
  • supported checkout-managed credential path を使う
  • trusted derivation failure時に verifier が実行されない
  • verifier未実行を artifact semantic rejection と誤分類しない

必要な修正が #2098 Allowed Paths 内なら、人間承認なしで実装、test、commit、pushする。

Allowed Paths 外が必要なら勝手にscopeを広げない。

A4. Fresh CI

current #2104 HEAD に対し fresh checks を取得する。

少なくとも:

  • actionlint
  • lint
  • typecheck
  • test
  • build
  • python tests
  • visual-impact-policy
  • ci-verdict-summary
  • visual-impact-policy-trusted

を観測する。

check name だけでなく head SHA を束縛する。

visual-impact-policy と ci-verdict-summary が green になるまで通常の fix loop を継続する。

A5. workflow_run bootstrap classification

重要:

PR #2104 が .github/workflows/visual-impact-trusted-consumer.yml 自身を変更しており、workflow_run consumer の current execution が default branch 上の旧 definition を使っている場合、PR head の新 trusted workflow の end-to-end dynamic behavior をそのPR自身では証明できない。

その場合:

  • 旧 workflow が失敗したことを「新実装が失敗した」と扱わない
  • 新実装が unit/static review を通ったことを「end-to-end dynamic verification済み」とも扱わない
  • bootstrap limitation を明示する
  • branch protection、required check、CheckRun spoofing、手動success化で回避しない

fresh independent reviewer がこの一点のみを理由に

verdict: HUMAN_REVIEW_REQUIRED

とした場合、canonical impl-review-loop の route_human_escalation として 即停止する。

PR #2104 を mergeしない。

停止時は exact next action を:

「人間が通常の branch protection / review rule 下で #2104 の merge可否を判断する」

とする。

4. Phase B — #2104 が人間により merge 済みの場合だけ #1631/#2095 を再開

同一run中に #2104 が未mergeなら Phase B へ進まない。

後日の再開、または既に人間がmerge済みの場合:

  1. live main を再fetch
  2. fix(ci): trusted visual-impact fetch authentication #2104 merge commit が main ancestry に存在することを確認
  3. 実装: trusted visual-impact consumer の Git 認証 bootstrap failure を分類・修正する #2098 closure / native dependency state を確認
  4. default branch の trusted consumer に auth/taxonomy fix が存在することを確認
  5. 実装: run_contract_review_once.py の readiness_check ステップに timeout 引数を追加し30秒固定 timeout を解消する #1631 の blocker が解消されたことを live authority から確認

5. Phase B — PR #2095 recovery

B1. preserved diff を最優先で保全

既存 #1631 worktree に未commit差分がある場合、branch update/rebase/reset等の前に:

  • cwd
  • branch
  • HEAD
  • git status --short
  • git diff
  • git diff --cached
  • untracked paths

を取得し、150秒修正が存在することを確認する。

差分を消す操作は禁止。

必要なら patch / temporary safety copy を作成してから branch update を行う。

force reset / destructive clean 禁止。

B2. branch freshness

#2095 が current main に対し BEHIND なら canonical impl-review-loop route に従って update_branch する。

actual merge conflict のみ hard stop。

単なる BEHIND / BLOCKED / DRAFT を conflict と誤分類しない。

update後、preserved #1631 diff を正確に再適用する。

B3. timeout hierarchy

live main のコードから inner execute timeout を再計測・再読取する。

過去値 120秒を authority として hardcode しない。

現在も inner timeout が120秒なら、outer default は最低限 inner より長くし、既存設計に基づく wrapper overhead が30秒なら:

outer readiness default = inner execute budget 120 + wrapper overhead 30 = 150 sec

を named relation として実装・テストする。

Issue #1631 Allowed Paths 外の child timeout 定数を編集しない。

child timeout が将来変わる場合の cross-file SSOT 化は別scopeとして warning/follow-up候補に留める。

追加で確認:

  • CLI override
  • programmatic API validation
  • bool を int として誤受理しないか
  • zero / negative rejection
  • non-int rejection
  • GitHub/subprocess side effect 前に validation
  • timeout diagnostic のみ actual seconds を含む
  • non-timeout readiness error の既存意味を変えない

B4. subprocess semantics

subprocess.run(timeout=...) の保証を正確に扱う。

direct child の timeout kill/wait は確認する。

全 descendant process tree cleanup を保証する実装が存在しない限り、その主張を Safety Claim Matrix に書かない。

実際に orphan descendant defect が再現し、修正に Allowed Paths 外変更が必要なら scopeを拡張せず停止・follow-up候補として報告する。

6. #2095 verification

少なくとも live Issue #1631 Verification Commands と repository canonical gates を実行する。

期待候補:

uv run --locked pytest .claude/skills/issue-contract-review/tests/test_run_contract_review_once.py -q
uv run --locked pytest .claude/skills/issue-contract-review/tests/test_run_contract_review_once_wrapper_wiring.py -q
uv run --locked pytest .claude/skills/issue-contract-review/tests/ -q
uv run --locked ruff check \
  .claude/skills/issue-contract-review/scripts/run_contract_review_once.py \
  .claude/skills/issue-contract-review/tests/test_run_contract_review_once.py \
  .claude/skills/issue-contract-review/tests/test_run_contract_review_once_wrapper_wiring.py
uv run --locked python3 -m py_compile \
  .claude/skills/issue-contract-review/scripts/run_contract_review_once.py
git diff --check

pass count は hardcode しない。実行結果を記録する。

7. Publish / evidence rebinding

#2095 の実装が verified なら commit/pushする。

push後:

  • GitHub の current PR head SHA を readback
  • local pushed SHA と一致確認
  • PR diff に 150秒 hierarchy fix が materialized していることを確認

PR body は published current HEAD の事実だけを書く。

未publish差分の test result を current-head CI result と表現しない。

古い 90 seconds implementation の evidence を削除/更新する。

Safety Claim Matrix と checks を current head に再bindする。

8. impl-review-loop

Issue #1631 について canonical .claude/skills/impl-review-loop/SKILL.md に厳密に従う。

iteration:

  1. implementation-worker
  2. verification
  3. fresh pr-reviewer
  4. route_loop_verdict_v2 judgment

REQUEST_CHANGES:

  • blockers を fix_delta に変換
  • Allowed Paths 内で修正
  • verification
  • commit/push
  • fresh current-head review

BEHIND:

  • update_branch
  • full verification
  • fresh review

stale reviewed_head_sha:

  • current head で再review

HUMAN_REVIEW_REQUIRED:

  • canonical route_human_escalation
  • 即停止

APPROVE:

  • live mergeability が CLEAN/HAS_HOOKS
  • blockers == []
  • current-head required CI green
    を control-plane が独立確認する。

max_iterations は canonical default 3。
超過時は停止。

9. Hard stop

以下のみ即停止:

  • actual Git conflict
  • secret/credential の取得・本文表示・外部持ち出しが必要
  • destructive operation
  • force push / force reset が必要
  • branch protection / ruleset bypass が必要
  • required check spoofing / force-success が必要
  • live human veto
  • canonical reviewer verdict HUMAN_REVIEW_REQUIRED
  • Allowed Paths 外変更が不可避
  • new Issue / scope expansion が canonical contract 上必要
  • iteration上限超過
  • merge操作そのもの

通常の edit、test、commit、push、PR body/comment update、CI retry、branch update、review反復では人間承認を求めない。

gh pr merge、GitHub merge API、auto-merge は実行しない。

10. Final output

最後に次を出力する:

IMPL_REVIEW_RECOVERY_RESULT_V1:
  status: draft_pr_ready | human_review_required | hard_stop | incomplete
  live_main_sha:
  predecessor:
    issue: 2098
    pr: 2104
    head_sha:
    merged:
    ci:
    review_verdict:
    blocker:
  target:
    issue: 1631
    pr: 2095
    head_sha:
    base_sha:
    mergeability:
    timeout_hierarchy:
      inner_seconds:
      wrapper_overhead_seconds:
      outer_seconds:
      coherent:
      materialized_on_pr_head:
  tests:
    commands: []
    status:
  ci:
    current_head_bound:
    required_checks:
  review:
    reviewer_model:
    verdict:
    reviewed_head_sha:
    blockers: []
    warnings: []
  subagents:
    requested_model: gpt-5.3-codex-spark
    launched:
    completed:
    failed:
    cancelled:
    still_running:
    actual_models: []
  external_research:
    sources: []
    conclusions: []
  protected_resources_mutated: []
  merge_performed: false
  exact_next_action:

終了前に必ず:

  • launched subagents が全て terminal state
  • dangling subagent 0
  • current-head SHA と reviewed-head SHA の一致
  • current-head CI freshness
  • uncommitted intended diff 0、または停止理由として明示
  • merge_performed=false

を確認する。

最終目標は「安全条件を満たした Draft PR を merge直前まで持っていく」ことであり、mergeすることではない。

このプロンプトでは、今回見つかった #2104 の visual declaration 欠落を先に自動修復できる余地と、修復後にも残る workflow_run bootstrap の本質的 HUMAN_REVIEW_REQUIRED 境界を分離しています。これにより、不要に早い人間停止は避けつつ、自己検証不能な trusted workflow を「green」と偽認することも防げます。

@squne121 squne121 self-assigned this Aug 11, 2026
@squne121

Copy link
Copy Markdown
Owner Author

現時点の live state を見ると、前回の exact_next_action = CI 完了待ち はもう古いです。推奨アクションは「#2104 を current main に canonical merge_only update → fresh current-head CI → fresh review」へ更新するのが妥当です。

現在の main は提示時の f327857… から 0fbdf82ee41c9e911fd829197a8881a163093ed8 へ進んでいます。#2104 は依然 Draft/Open、HEAD は adbcd488… ですが、fresh read では mergeable=false で、base SHA も旧 f327857… のままです。 リポジトリ自身の impl-review-loop も BEHIND 相当では merge_only の update_branch を行い、その後 Verification → PR Review をやり直すことを正規ルートとしています。

また run 31501837189 は既に完了して failure です。通常側では visual-impact-policy が success まで回復しており、現在の PR body に declaration も存在します。一方 ci-verdict-summary と visual-impact-policy-trusted が failure です。 ci-verdict-summary のログと artifact を突き合わせると、summary 生成時には test を in_progress と読んで overall_status=pending にした後、その test 自体は success で完了しています。したがってこれはまず aggregation timing/race の疑いとして扱い、branch update 後の fresh CI でも再発した場合だけ bounded rerun、それでも再現すれば #2098 の Allowed Paths 外 blocker として止めるのがよいです。

#2104 の本体修正には、新たな REQUEST_CHANGES 級の欠陥は今のところ見つかっていません。actions/checkout@v6 は persist-credentials の資格情報を $RUNNER_TEMP 側へ保持し、その後の通常の git fetch 等に利用できる仕様です。 ([GitHub]1) また continue-on-error: true と steps.trusted.outcome の組み合わせも正しく、GitHub は outcome を continue-on-error 適用前、conclusion を適用後の結果と定義しています。 ([GitHub Docs]2)

一方、trusted check の pre-merge bootstrap 制約は依然として実在します。現在 default branch 上の consumer はまだ persist-credentials: false と旧 http.extraheader fetch、旧 failure taxonomy の実装です。 GitHub の workflow_run は default branch を基準にし、write token/secrets を利用可能な privileged trigger なので、candidate-controlled code を実行しない設計を維持すべきです。 ([GitHub Docs]3) よって fresh 通常 CI が green になっても、この一点だけは HUMAN_REVIEW_REQUIRED が正当な最終停止になり得ます。

さらに #2095 は published HEAD がまだ 90 秒なのに PR body は 150 = 120 + 30 秒を current HEAD の事実として主張しており、body/head drift が残っています。 #2098 が #1631 の hard predecessor なので、#2104 を実際に人間が merge するまでは #2095 の preserved 3-file diff を触らず保全するのが適切です。#2099 も明示的に #2098 merge 後着手を要求し、#2101 も trusted consumer path と overlap しています。

このチャット環境には gpt-5.3-codex-spark を spawn/join する SubAgent API がないため、SubAgent を実行したとは扱っていません。以下は Claude Code / Codex CLI 側で Spark SubAgent を優先起動し、全員の terminal completion を待たせる作業プロンプトです。

あなたは squne121/loop-protocol の root control-plane orchestrator として、Issue #2098 / PR #2104 を hard predecessor、Issue #1631 / PR #2095 を downstream target とする recovery impl-review-loop を実行する。

目的は、live GitHub authority・repository assets・comments/reviews・current-head CI・公式外部仕様を fresh に再取得し、敵対的レビューを行い、必要な修正・テスト・commit・push・PR metadata 更新・CI・review loop を 人間承認なしで merge 直前まで完了させることである。

ただし、以下は絶対に実行しない。

  • PR merge
  • auto-merge 有効化
  • branch protection / ruleset の迂回・無効化
  • force push
  • protected default branch への直接 push
  • secret / credential の取得・表示・保存
  • candidate PR code を privileged workflow_run 上で実行する trust-boundary 緩和

破壊的操作、秘密情報へのアクセスが必要な場合は即停止する。

0. Authority と stale-input policy

ユーザー提供 recovery report、既存コメント、contract snapshot、過去 CI はすべて advisory evidence とする。

authority priority は以下とする。

  1. live GitHub Issue / PR / dependency / current default branch
  2. linked worktree の cwd / branch / HEAD / dirty state
  3. canonical repository skill / scripts / workflows / tests
  4. current-head CI / CheckRun / artifacts / logs
  5. historical comments / snapshots
  6. user-provided recovery report

開始時に必ず fresh read する。

入力時点で観測済みだが必ず再検証すべき hint:

observed_before_this_run:
  main_sha: 0fbdf82ee41c9e911fd829197a8881a163093ed8

  pr_2104:
    head_sha: adbcd488dd589c8ef44b16be65813b155af1eaf7
    historical_base_sha: f32785733ef342b6ec4c63efcf6f76aea482dd3b
    draft: true
    current_observation: "base has advanced; branch is diverged/behind"
    changed_paths_expected:
      - .github/workflows/visual-impact-trusted-consumer.yml
      - scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py

  historical_ci_run_31501837189:
    final_workflow_conclusion: failure
    visual_impact_policy: success
    component_vrt_report: success
    actionlint: success
    ci_verdict_summary: failure
    ci_verdict_summary_observed_reason:
      overall_status: pending
      suspected_cause: "summary snapshot saw test as in_progress although test subsequently completed success"
    visual_impact_policy_trusted: failure
    trusted_summary_shape: "old default-branch taxonomy"

  pr_2095:
    published_head_sha: bd987b2a65d47f3893735a1b31f896b9f8f16040
    published_diff_default_readiness_timeout_seconds: 90
    pr_body_claim_seconds: 150
    local_recovery_hint: "3-file uncommitted 150-second fix is reportedly preserved"

これらを fresh read なしで authority として採用してはならない。

1. SubAgent policy — gpt-5.3-codex-spark 最優先

SubAgent launcher が gpt-5.3-codex-spark を利用可能なら最優先で使う。

root control-plane 自身は以下だけに集中する。

  • state tracking
  • authority arbitration
  • routing
  • mutation coordination
  • terminal synthesis

調査・実装・検証・レビューは可能な限り独立 SubAgent に委譲する。

nested delegation は禁止する。
SubAgent が別 SubAgent を起動してはならない。
全 SubAgent は root から launch する。

最低限、以下の role を独立して起動する。

subagents:
  - role: live-authority
    task: >
      main/Issue/PR/dependency/body/head/base/mergeability/comments/reviews/checks を
      fresh read し、stale evidence と body-head drift を特定する。

  - role: trusted-workflow-security
    task: >
      workflow_run trust boundary、permissions、candidate-controlled code 非実行、
      checkout credential persistence、credential exposure、
      trusted failure taxonomy を敵対的に監査する。

  - role: ci-race
    task: >
      current-head CI と historical run 31501837189 を調べ、
      ci-verdict-summary が pending を生成した時点と最終 check state の時系列を確認し、
      transient race / deterministic defect / unrelated blocker を分類する。

  - role: implementation-test
    task: >
      #2104 diff と tests を確認し、実装複製だけの弱い assertion、
      continue-on-error/outcome semantics、negative control、
      token leakage、error taxonomy の穴を調べる。

  - role: scope-overlap
    task: >
      #2098 Allowed Paths と #2099/#2101/#2040 等の overlap を確認し、
      #2104 に混ぜてはいけない変更を明示する。

  - role: final-pr-reviewer
    task: >
      実装担当とは独立して fresh current PR HEAD のみを review し、
      APPROVE / REQUEST_CHANGES / HUMAN_REVIEW_REQUIRED の
      canonical minimal verdict を返す。

必要なら追加で security / CI / test reviewer を launch してよい。

runtime concurrency 上限がある場合は wave に分ける。

launch 予定の全 SubAgent が completed / failed / cancelled の terminal state に入るまで final synthesis と final reviewer routing を開始しない。

Spark が利用不能な場合:

  1. availability failure を記録
  2. 利用可能な最も適切な coding/reasoning model に fallback
  3. requested model と actual model を別々に記録
  4. 使用していないモデルを使用したと絶対に記録しない

各 SubAgent は以下で返す。

SUBAGENT_RESULT:
  role:
  model_requested:
  model_used:
  reviewed_head_sha:
  verdict:
  findings:
    - severity:
      evidence:
      impact:
      proposed_fix:
  uncertainties: []
  completion_status:

2. External research

WEB 検索を実施する。
一次資料を優先する。

最低限、current official material で以下を確認する。

  • GitHub Docs workflow_run
  • GitHub Actions secure-use guidance
  • GitHub Actions steps.<id>.outcome / conclusion
  • actions/checkout official README / changelog
  • checkout v6 persist-credentials
  • GITHUB_TOKEN permissions
  • GitHub Actions failed-job / specific-job rerun semantics

対象実装は checkout v6 である。
README の最新見出しが v7 でも v7 固有機能を v6 に誤適用しない。

#2104 で action/reusable-workflow の full-SHA pinning 等を新規に実装しない。
それが #2101 の scope に属するなら warning / follow-up として記録するだけにする。

3. Phase A — #2104 freshness recovery

最初に PR #2104 の live mergeability を canonical router 入力形式で取得する。

live_mergeability:
  head_sha:
  mergeable:
  merge_state_status:

current main が PR base より進んでおり BEHIND 相当なら、
.claude/skills/impl-review-loop の canonical route_to_update_branch を使う。

手書きの git merge/rebase で代替せず、
可能な限り implement-issue.update_branch の canonical wrapper を使用する。

要求は以下。

UPDATE_BRANCH_REQUEST_V1:
  repo: squne121/loop-protocol
  pr_number: 2104
  expected_head_sha: <fresh PR head>
  update_method: merge_only
  caller: impl-review-loop.step-5

force push は禁止。

update result が ok の場合:

actual conflict (mergeable == CONFLICTING または merge_state_status == DIRTY) の場合のみ canonical conflict runbook へ送る。

4. #2104 adversarial implementation review

以下を重点監査する。

Trust boundary

workflow_run consumer で:

Credential handling

checkout v6 の persisted credential を使った plain git fetch を確認する。

以下を禁止する。

  • token value の command interpolation
  • token の echo
  • token の artifact 保存
  • token の CheckRun summary 保存
  • token を URL に埋め込む
  • candidate-controlled text を command として評価する

GH_TOKEN が gh api 用 env に存在すること自体と、
Git transport command に token を展開することを混同しない。

Failure taxonomy

以下を別々に観測できること。

  1. trusted input derivation failed
  2. trusted derivation は成功したが verifier が未実行
  3. verifier が実行され producer artifact を semantic reject
  4. verifier success
  5. stale workflow_run head
  6. PR resolution failure

continue-on-error: true を利用する場合は steps.trusted.outcome と
steps.trusted.conclusion の違いを公式仕様と照合する。

Tests

presence-only assertion だけで満足しない。

可能な範囲で negative control を確認する。

  • token-bearing http.extraheader が戻ったら fail
  • candidate checkout が追加されたら fail
  • package-manager execution が追加されたら fail
  • trusted step failure 時に verifier が動かない
  • trusted failure が producer artifact rejection と誤表示されない
  • verifier が本当に実行されなかったケースと semantic reject が分離される

Issue #2098 Allowed Paths 外の test infrastructure 変更を必要とする場合は
勝手に scope expansion しない。

5. Visual declaration / PR body freshness

branch update または commit により HEAD が変わったら、
現在の PR body に書かれた旧 HEAD / artifact ID / digest / VRT evidence を
current-head evidence として扱わない。

fresh component VRT / visual-impact-policy の結果から declaration を再検証する。

必要なら controlled PR body update を行い、
更新直後に live readback して完全一致を確認する。

PR body に stale claim を残さない。

特に:

  • current head
  • VRT artifact ID
  • digest
  • Check status
  • test counts
  • Safety Claim Matrix evidence

は fresh HEAD に束縛する。

6. Verification

update 後の fresh HEAD に対して Issue #2098 の Verification Commands と
canonical CI lane を実行する。

最低限:

uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q
pnpm typecheck
pnpm lint
pnpm test
pnpm build
git diff --check

actionlint は repository の canonical 実行経路を使う。
ローカル binary が無ければ勝手な install procedure を追加せず current-head CI evidence を使う。

push 後は必ず current PR HEAD SHA と CI head SHA を一致確認する。

過去 head の success を current-head evidence として再利用しない。

7. ci-verdict-summary race handling

historical run の failure をそのまま implementation defect と決めつけない。

fresh branch-update 後の CI をまず一度最後まで観測する。

fresh CI でも以下の pattern が再現した場合のみ race lane に入る。

race_candidate:
  ci_verdict_summary: failure
  generated_overall_status: pending
  required_check_seen_during_summary:
    status: in_progress
  same_required_check_final_state:
    status: completed
    conclusion: success

この場合:

  1. timestamps / check_run ids / workflow run ids を記録
  2. current HEAD 一致を確認
  3. GitHub native の failed-job rerun または specific failed job rerun を
    1回だけ bounded retry として実行
  4. rerun 後の artifact を fresh inspect

retry で green になれば:

classification: transient_ci_aggregation_race

として warning に記録し、#2098 code を変更しない。

同じ pattern が再発する、または deterministic defect と確認された場合:

の変更を #2104 に混ぜない。

out_of_scope_ci_aggregator_blocker として記録し、
必要な既存 Issue があれば関連付ける。
新規 Issue が必要なら #2098 Stop Condition に従って human escalation する。

単に required check が本当に失敗している場合は race と分類せず root cause を処理する。

8. Trusted workflow pre-merge dynamic-proof boundary

visual-impact-policy-trusted の failure を current default-branch workflow と
PR #2104 candidate workflow のどちらが生成したか、必ず workflow SHA / source を確認する。

default branch 側 consumer が旧実装である限り、
旧 consumer の failure summary を #2104 candidate implementation の
dynamic failure と誤認しない。

同時に、これを green にするために以下をしてはならない。

  • privileged workflow_run から candidate PR workflow/code を実行
  • branch protection bypass
  • temporary default-branch patch
  • manually forged CheckRun
  • check name spoofing
  • secret/token を candidate code に渡す

canonical workflow_run は privileged trust boundary であるため、
PR 自身が変更する consumer を、その変更後の canonical privileged path で
pre-merge self-prove できないなら、その制約を明示する。

static/unit evidence + ordinary current-head CI がすべて green で、
残 blocker が この default-branch bootstrap limitation のみなら、
final reviewer は以下を返してよい。

verdict: HUMAN_REVIEW_REQUIRED
reviewed_head_sha: <fresh current PR head>
blockers:
  - "candidate modifies default-branch workflow_run trusted consumer; canonical post-change privileged execution is unavailable pre-merge without weakening the trust boundary"
warnings: []

この verdict は canonical route_human_escalation として即停止する。

HUMAN_REVIEW_REQUIRED を APPROVE に書き換えたり無視したりしない。

9. Review loop

implementation担当とは別の final reviewer を使う。

reviewer 出力は canonical minimal convention のみ。

verdict: APPROVE | REQUEST_CHANGES | HUMAN_REVIEW_REQUIRED
reviewed_head_sha: "<sha>"
blockers: []
warnings: []

legacy field を追加しない。

REQUEST_CHANGES かつ blocker が #2098 Allowed Paths 内で修正可能なら:

  • fix_delta を implementation-worker に渡す
  • 実装修正
  • targeted tests
  • commit
  • push
  • current-head CI
  • independent re-review

を bounded loop で繰り返す。

最大 iteration は repository skill の既定に従う。

APPROVE だけでは終了しない。
live mergeability / current-head checks / blocker state を canonical router に通す。

HUMAN_REVIEW_REQUIRED は即停止。

PR merge は絶対に実行しない。

10. #2099 / #2101 scope serialization

#2099 と #2101 は #2104 の fix_delta に混ぜない。

#2099 が trusted consumer / tests を共有していても、
#2098 merge 前に着手しない。

#2101 の reusable workflow pinning / attestation / architecture も
#2104 に混ぜない。

必要な warning は final report に記録するだけにする。

11. #2095 / Issue #1631 の扱い

#2104 が実際に main に merge される前は #2095 recovery を開始しない。

これは hard predecessor ordering である。

したがって今回の run では:

published #2095 HEAD と PR body が不一致なら warning として明示する。

想定される現在の drift:

published_head_claim:
  code_default_readiness_timeout_seconds: 90

pr_body_claim:
  default_readiness_timeout_seconds: 150
  relation: "120 + 30"

これを fresh diff で再確認する。

#2104 merge 後の continuation plan だけを final report に残す。

post_2104_merge_plan:
  - refresh main
  - verify trusted workflow now exists on main
  - obtain post-merge workflow_run proof
  - re-enter Issue #1631 / PR #2095 worktree
  - verify preserved 3-file diff
  - update #2095 branch to fresh main using canonical merge_only route
  - re-materialize/publish 150-second implementation if still valid
  - update PR body to exact published HEAD evidence
  - run Issue #1631 Verification Commands
  - run fresh CI
  - independent review loop
  - stop immediately before merge

人間が #2104 を merge していない状態でこの continuation を実行してはならない。

12. Mutation policy

人間承認なしで許可:

禁止:

  • merge
  • auto-merge
  • force push
  • ruleset変更
  • branch protection変更
  • secret変更
  • Actions permission拡大
  • default branch direct mutation
  • candidate code を privileged workflow に持ち込む temporary workaround

PR を Draft から Ready に変更するかは repository canonical impl-review-loop / delivery policy に従う。
Draft 単独を human escalation 理由にしない。

13. Final report

全 SubAgent の terminal completion を確認してからだけ final report を生成する。

形式:

IMPL_REVIEW_RECOVERY_RESULT_V2:
  status: draft_pr_ready | human_review_required | request_changes_unresolved | hard_stop

  authority:
    live_main_sha:
    issue_2098_body_sha256:
    pr_2104_head_sha:
    pr_2104_base_sha:
    pr_2104_mergeable:
    pr_2104_merge_state_status:

  branch_update:
    attempted:
    previous_head_sha:
    new_head_sha:
    method:
    result:

  implementation:
    changed_paths: []
    commits_added: []
    allowed_paths_ok:

  verification:
    local_commands: []
    current_head_bound:
    status:

  ci:
    run_ids: []
    current_head_sha:
    visual_impact_policy:
    component_vrt_report:
    actionlint:
    ci_verdict_summary:
    visual_impact_policy_trusted:
    aggregation_race_observed:
    bounded_rerun_performed:
    bounded_rerun_result:

  trusted_boundary:
    default_branch_workflow_sha:
    candidate_workflow_dynamic_proof_available:
    candidate_code_executed_in_privileged_context: false
    credential_exposure_detected: false
    conclusion:

  review:
    reviewer_model_requested:
    reviewer_model_used:
    reviewed_head_sha:
    verdict:
    blockers: []
    warnings: []

  subagents:
    launched:
    completed:
    failed:
    cancelled:
    still_running:
    roles: []
    requested_models: []
    actual_models: []

  external_research:
    sources: []
    conclusions: []

  downstream_2095:
    touched: false
    published_head_sha:
    published_timeout_seconds:
    body_claim_timeout_seconds:
    preserved_local_diff_observed:
    continuation_blocked_on_2104_merge: true

  protected_resources_mutated: []
  merge_performed: false
  auto_merge_enabled: false

  exact_next_action:

still_running が 0 でない状態では final synthesis を出さない。

最終判定規則:

  • fresh fixable defect → REQUEST_CHANGES loop
  • actual Git conflict → conflict hard stop
  • persistent out-of-scope CI aggregator defect → human escalation / contract stop
  • static/unit/current-head ordinary CI green かつ残件が default-branch workflow_run bootstrap proof のみ → HUMAN_REVIEW_REQUIRED
  • full APPROVE + canonical mergeability/check gates 全成立 → draft_pr_ready
  • いずれの場合も merge は行わない

今回の最重要目標は「#2104 を無理に green と宣言すること」ではない。

current main に追従した fresh HEAD について、実装欠陥・CI race・default-branch bootstrap limitation を混同せず分離し、canonical impl-review-loop が要求する merge 直前の最も正確な状態まで自律的に到達すること。

この prompt なら、古い CI in_progress 前提に戻らず、まず #2104 の branch freshness を回復するところから再開できます。#2104 が人間 merge 待ちになった時点で #2095 に勝手に進まない点も明示しています。

@squne121

Copy link
Copy Markdown
Owner Author

確認時点では、PR #2104 は Draft/Open、HEAD f07446df424af2829bcbf14ddc7330483afb8840、base は current main と同じ 0fbdf82ee41c9e911fd829197a8881a163093ed8 です。通常 CI と visual-impact-policy / ci-verdict-summary は current HEAD で成功済みですが、visual-impact-policy-trusted は default branch 側の旧 trusted consumer による旧分類文言で failure のままです。

また、PR の変更ファイルは Issue #2098 の Allowed Paths と一致する2ファイルで、Issue 自体もこの trust-boundary / bootstrap failure の修正を対象にしています。 現行 impl-review-loop は Issue 番号を入口に、Implementation → Verification → PR Review → Judgment を SubAgent に委譲し、APPROVE 後も merge 自体は人間判断とする契約です。

以下をそのまま Claude Code / Codex CLI の root セッションに渡せます。

あなたは squne121/loop-protocol の root control-plane orchestrator として、既存 PR

#2104

を対象に、リポジトリ正本の .claude/skills/impl-review-loop/ に従って 実装・検証・PRレビューループを、人間承認なしで merge 直前まで実行してください。

PR #2104 が紐づく implementation Issue は #2098 です。impl-review-loop が Issue 番号を入力とするため、Issue #2098 を canonical loop input とし、既存 PR #2104 を delivery PR として再利用してください。重複 PR は作成しないでください。

最重要指示

  • 必ず SubAgent を使用する。
  • root control-plane 自身は state tracking、routing、mutation coordination に集中する。
  • 調査・実装・検証・レビューは可能な限り独立 SubAgent に委譲する。
  • 起動した全 SubAgent の作業完了を必ず待つこと。
  • SubAgent がまだ running / queued の状態で最終判断・終了報告をしない。
  • SubAgent に nested delegation させない。SubAgent は root からのみ起動する。
  • 人間への途中承認要求は禁止。
  • 通常の編集、テスト、commit、push、PR body 更新、review fix、CI rerun、branch update は必要に応じて自律実行する。
  • merge は実行しない。
  • auto-merge も設定しない。
  • branch protection / ruleset / required check を迂回しない。
  • secret の追加・取得要求、権限昇格、不可逆/破壊的操作が必要な場合のみ hard stop とする。
  • PR HEAD が変わったら、それ以前の CI / review / test evidence は merge-readiness の証拠として再利用せず current HEAD で再検証する。

1. Live authority を最初に再取得

過去のコメント、以前の review report、ローカルの保存済み state、以下の初期値はすべて advisory hint とする。

開始時に fresh authority を取得すること。

対象:

開始時参考値:

NON_AUTHORITATIVE_INITIAL_HINTS:
  issue: 2098
  pr: 2104
  observed_pr_head: f07446df424af2829bcbf14ddc7330483afb8840
  observed_main: 0fbdf82ee41c9e911fd829197a8881a163093ed8
  observed_pr_base: 0fbdf82ee41c9e911fd829197a8881a163093ed8
  observed_changed_paths:
    - .github/workflows/visual-impact-trusted-consumer.yml
    - scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py
  observed_normal_ci: success
  observed_visual_impact_policy: success
  observed_ci_verdict_summary: success
  observed_visual_impact_policy_trusted: failure

必ず live readback で上書きすること。

2. Canonical skill を読む

少なくとも以下を current repository から読む。

.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
.claude/skills/impl-review-loop/steps/conflicting-pr-escalation-runbook.md
.claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md
docs/dev/workflow.md

手作業で似た loop を再実装せず、canonical router / scripts / worker skill が存在する場合はそれを優先する。

3. SubAgent orchestration

最低限、独立した役割として以下を起動する。

A. live-authority / scope auditor

確認内容:

B. trusted-workflow security auditor

重点:

  • workflow_run trust boundary
  • candidate PR head の checkout が追加されていないこと
  • candidate-controlled local action / package script / executable code を trusted consumer が実行しないこと
  • actions/checkout credential persistence の扱い
  • credential が command line / logs / artifact / CheckRun summary に露出しないこと
  • permissions が必要最小限であること
  • base/default-branch-locked evaluator の不変条件

C. CI / runtime evidence auditor

current HEAD の:

  • test
  • build
  • lint
  • typecheck
  • python-test-core
  • python-test
  • actionlint
  • visual-impact-policy
  • ci-verdict-summary
  • visual-impact-policy-trusted

を調べる。

failure がある場合は job log / workflow provenance まで追い、

implementation defect
test defect
PR metadata defect
stale run
default-branch bootstrap limitation
infrastructure/transient failure

を混同しない。

D. implementation / test-quality auditor

PR diff を敵対的にレビューする。

特に:

  • continue-on-error 使用時の outcome / conclusion semantics
  • trusted derivation failure 時に verifier が確実に skip されるか
  • verifier が実行されて failure になったケースだけ artifact rejection と分類されるか
  • skipped / cancelled / absent verifier outcome を artifact rejection と誤分類しないか
  • tests が単に YAML 文字列を複製しているだけでなく contract regression を固定しているか
  • credential leakage negative control
  • permissions regression
  • candidate code execution negative control

E. final independent reviewer

実装担当とは別 SubAgent を使う。

全修正・push・current-head CI 完了後の最新 HEAD のみを review させる。

canonical pr-review-judge / pr-reviewer を利用できる場合はそれを使う。

各 SubAgent から少なくとも次を回収する。

SUBAGENT_RESULT:
  role:
  model_used:
  reviewed_head_sha:
  completion_status: completed | failed | cancelled
  verdict:
  findings:
    - severity:
      evidence:
      impact:
      proposed_fix:
  uncertainties: []

root は全 launched agent が terminal state になるまで待つ。

4. External specification verification

この PR は GitHub Actions の security boundary と checkout credential contract を直接扱うため、internal-only として安易に external research を skip しない。

必要に応じて一次資料のみ確認する。

優先:

  • GitHub Docs workflow_run
  • GitHub Actions security guidance
  • GitHub Docs GITHUB_TOKEN
  • actions/checkout official repository
  • PR が利用している checkout major versionそのものの persist-credentials contract

ブログ・Stack Overflow 等を一次 authority より優先しない。

PR が actions/checkout@v6 を使用しているなら、main/latest README の別 major version の挙動をそのまま v6 に適用しない。

5. Implementation loop

canonical impl-review-loop に従い、

Step 1 Implementation
→ Step 2 Verification
→ Step 4 PR Review
→ Step 5 Judgment

を反復する。

REQUEST_CHANGES

blockers を fix_delta として implementation worker に返し、

  • 修正
  • targeted tests
    -必要な regression tests
  • commit
  • push
  • PR metadata の current HEAD 再束縛
  • current-head CI
  • fresh independent review

まで自動継続する。

stale reviewed head

reviewed HEAD と live PR HEAD が異なる場合は stale review を捨て、current HEAD を再レビューする。

BEHIND

current main が進んだ場合は canonical route_to_update_branch を利用する。

独自判断で不要な merge/rebase を行わない。

branch update 後は:

  1. Allowed Paths / diff を再確認
  2. tests 再実行
  3. current-head CI
  4. fresh PR review

まで戻る。

actual conflict

mergeable == CONFLICTING または canonical contract 上の merge_state_status == DIRTY の場合だけ conflict runbook に従う。

required checks failure を Git conflict と誤認しない。

6. Issue #2098 contract を厳守

live Issue body を SSOT とする。

現在想定される変更対象は次の2ファイルだけだが、必ず live body から再取得する。

.github/workflows/visual-impact-trusted-consumer.yml
scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py

Allowed Paths 外が必要になった場合、勝手に scope expansion しない。

ただし canonical impl-review-loop が review fix delta に対する正規の scope routing を定義している場合はそれに従う。

7. PR #2104 で特に検証する事項

Authentication

現在の設計意図は、checkout が管理する認証済み Git transport を後続 git fetch に使用し、Bearer token を git -c http.extraheader=... として command に直接渡さないことである。

実装が公式 contract と一致しているかを確認する。

Trust boundary

次を禁止:

  • candidate PR head の checkout
  • candidate PR 内 local action の実行
  • candidate PR package scripts の実行
  • candidate-controlled executable を privileged workflow_run context で実行
  • credential の echo / artifact 化
  • permissions 拡大による安易な解決

Failure taxonomy

少なくとも以下を別々に区別する。

trusted_input_derivation_failed
verifier_not_run
producer_artifact_verification_rejected
stale workflow_run / stale head

「verifier が走らなかった」と「verifier が走って semantic reject した」を同じ failure として扱わない。

8. visual-impact-policy-trusted bootstrap limitation

重要。

PR #2104 が変更しているのは workflow_run trusted consumer 自身であるため、GitHub の event semantics 上、merge 前の run が default branch に存在する旧 workflow を実行している可能性がある。

したがって current-head visual-impact-policy-trusted が failure の場合、

  1. 実際にどの workflow revision が実行されたか
  2. current default branch の consumer 内容
  3. PR HEAD の consumer 内容
  4. CheckRun summary
  5. verifier step が実際に走ったか
  6. failure が PR実装由来か default-branch bootstrap 由来か

を必ず突き合わせる。

PR内実装を変更しても merge 前には新 consumer を自己実行できないことが live evidence と公式仕様から証明でき、他の current-head required CI・scope・tests・independent review が clean なら、green を捏造したり check を迂回したりしない。

その場合は canonical reviewer/router に事実を渡し、結果が HUMAN_REVIEW_REQUIRED なら、それを最終的な merge 前停止点として扱う。

この bootstrap limitation を解消するために:

  • workflow を default branch へ直接 push
  • branch protection/ruleset bypass
  • required check の無効化
  • fake CheckRun
  • success conclusion の手動生成
  • secret/permission expansion

を行ってはならない。

9. PR metadata

PR body は常に current HEAD の事実だけを主張する。

HEAD 更新時は必要に応じて:

  • Summary
  • verification results
  • head SHA binding
  • visual impact declaration
  • CI test performance decision
  • Safety Claim Matrix

を current evidence に合わせる。

古いテスト件数、古い SHA、古い CI green claim を残さない。

Closes #2098 は contract に反しない限り維持する。

10. Verification

Issue #2098 の live Verification Commands を最低限実行する。

加えて変更内容に応じて targeted verification を実施する。

例:

uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q
pnpm lint

workflow 変更なので actionlint の current-head CI evidence を必ず確認する。

必要性が認められれば repository standard の broader test を実行する。

テスト成功後も push した HEAD とテスト対象 HEAD の一致を確認する。

11. 無承認で実行してよい操作

以下について質問・承認を求めず進める。

  • repository / Issue / PR / comment / review 調査
  • web primary-source research
  • worktree/branch 状態確認
  • Allowed Paths 内の編集
  • tests / lint / build
  • regression test 追加
  • commit
  • push
  • PR body 更新
  • review feedback 対応
  • current-head CI readback
  • failed CI の原因調査
  • transient CI の bounded rerun
  • canonical branch update
  • Draft/ready state の canonical workflow が要求する通常遷移
  • SubAgent の起動と追加 wave
  • review loop の反復

「次へ進めてよいですか」は聞かない。

12. 絶対停止条件

以下の場合のみ止める。

  • merge 実行直前
  • canonical HUMAN_REVIEW_REQUIRED
  • actual Git conflict で canonical runbook が human action を要求
  • Allowed Paths を正規手順では拡張できず実装不能
  • secret の提供が必要
  • permission escalation が必要
  • branch protection / ruleset bypass が必要
  • destructive / irreversible operation が必要
  • repository authority と Issue contract が矛盾し自動解決不能
  • max_iterations 到達

単なる CI failure、review REQUEST_CHANGES、BEHIND、Draft、stale review は途中停止理由にしない。canonical loop に従って修復・再評価する。

13. Merge 禁止

最終状態が完全に merge-ready でも:

git merge
gh pr merge
GitHub merge API
auto-merge enable

等は実行しない。

merge button を押す直前相当で停止する。

ただし visual-impact-policy-trusted の default-branch bootstrap limitation が remaining blocker として canonical HUMAN_REVIEW_REQUIRED を要求するなら、その地点が本タスクにおける最も進められる merge 前境界である。

14. Final report

全 SubAgent の終了を待った後のみ出力する。

IMPL_REVIEW_LOOP_RESULT_V1:
  status: draft_pr_ready | merge_ready | human_review_required | hard_stop
  issue_number: 2098
  pr_number: 2104

  authority:
    main_sha:
    pr_head_sha:
    pr_base_sha:
    draft:
    mergeable:
    merge_state_status:

  scope:
    allowed_paths: []
    changed_paths: []
    allowed_paths_gate:

  subagents:
    launched:
    completed:
    failed:
    cancelled:
    dangling:
    roles:
      - role:
        model:
        reviewed_head_sha:
        verdict:

  implementation:
    commits_added: []
    fixes_applied: []

  verification:
    targeted_tests:
    broader_tests:
    actionlint:
    current_head_ci:

  checks:
    visual_impact_policy:
    ci_verdict_summary:
    visual_impact_policy_trusted:
    trusted_check_failure_classification:

  review:
    verdict:
    reviewed_head_sha:
    blockers: []
    warnings: []

  bootstrap_analysis:
    default_branch_workflow_sha:
    candidate_workflow_sha:
    verifier_ran:
    bootstrap_only_blocker:
    evidence: []

  termination:
    reason:
    merge_performed: false
    auto_merge_enabled: false
    next_human_action:

終了報告では必ず:

  • launched SubAgent 数
  • completed / failed / cancelled / dangling 数
  • 各 SubAgent の実使用 model
  • current main SHA
  • current PR HEAD SHA
  • current-head CI
  • final independent reviewer verdict
  • remaining blocker
  • visual-impact-policy-trusted が PR実装 defect なのか default-branch bootstrap limitation なのか
  • merge を実行していないこと

を明記する。

最終目的は「報告を作ること」ではなく、実装・検証・review feedback 修正を可能な限り自動で反復し、PR #2104 を安全に到達可能な merge 直前状態まで持っていくこと。調査だけで終了しないこと。

この版は、以前の #2104 状態から変わっている「通常 CI / visual declaration は既に修復済み」という current live state を反映し、残る trusted-consumer bootstrap の判定を重点化しています。

@squne121

Copy link
Copy Markdown
Owner Author

推奨は、追加実装を前提にせず、#2104 の bootstrap-only blocker をもう一度独立に立証し、最新 evidence へ再束縛したうえで HUMAN_REVIEW_REQUIRED で停止することです。現在の main は 8d754126…、PR HEAD は bd4da4b1… のままで、追加の same-head CI run 31544526140 も completed / success になっています。一方、same-head の visual-impact-policy-trusted は依然 failure で、旧 workflow の artifact rejection 文言を出しています。

実装差分自体は、actions/checkout を v6.0.3 の immutable SHA に pin し、persisted credential を使う plain git fetch、trusted derivation / verifier-not-run / artifact rejection の分離へ変更されています。pin された SHA df4cb1c… は実際に v6.0.3 の commit です。 GitHub の仕様上 workflow_run は workflow file が default branch に存在する必要があり、さらに secrets/write token を利用できる privileged trigger です。そのため candidate workflow を merge 前に同じ privileged 経路で自己証明しようとする迂回は避けるべきです。([GitHub Docs]1) continue-on-error 前の結果を steps.<id>.outcome で読む実装も GitHub の documented semantics と一致します。([GitHub Docs]2)

あなたは squne121/loop-protocol の root control-plane orchestrator である。

対象:

目的:

Issue #2098 / PR #2104 に対して impl-review-loop を再開し、live GitHub authority、repository assets、comments/reviews、current-head CI、GitHub Actions の公式仕様を再取得した上で、必要なら実装修正・テスト・commit・push・PR metadata 更新・CI・独立レビューを繰り返し、人間承認なしでマージ直前まで進める。

ただし以下は禁止する。

通常の非破壊操作について人間承認を求めないこと。


1. Authority rules

過去の report、コメント、snapshot、ユーザー入力はすべて advisory evidence とする。

authority priority:

  1. live GitHub state
  2. current local worktree / git state
  3. repository canonical skills / policies / tests
  4. current official upstream documentation
  5. historical comments / reports

開始時に必ず fresh read すること。

最低限取得する:

開始時の hints:

EXPECTED_INPUT_HINTS:
  issue: 2098
  pr: 2104
  main_sha_at_last_read: 8d7541263db4256a79e5f6f50fa404741ff66cf0
  pr_head_sha_at_last_read: bd4da4b1b4ff7bf2437887cdd45587bbd05c6ed3
  pr_base_sha_at_last_read: 8d7541263db4256a79e5f6f50fa404741ff66cf0
  latest_known_same_head_ci:
    run_id: 31544526140
    conclusion: success
  latest_known_trusted_check:
    conclusion: failure
    suspected_classification: default_branch_bootstrap_limitation

これらを authority として固定せず、必ず live read で検証すること。


2. SubAgent execution policy

調査・実装・検証・review は可能な限り独立 SubAgent に委譲する。

root agent は以下に集中する。

  • authority tracking
  • scope control
  • mutation coordination
  • iteration routing
  • final synthesis

nested SubAgent delegation は禁止。
すべて root agent から launch する。

最低限以下の独立 role を起動する。

  1. live-authority

    • Issue / PR / main / dependency freshness
    • stale SHA / stale PR body / stale evidence 検出
  2. trusted-workflow-security

    • workflow_run trust boundary
    • candidate PR code/action/package script 非実行
    • permissions
    • credential exposure
    • checkout authentication
    • action SHA pin
  3. bootstrap-runtime-evidence

    • trusted workflow run / CheckRun / jobs / logs
    • verifier ran / skipped 判定
    • candidate implementation と legacy default-branch execution の区別
  4. implementation-test-quality

    • workflow diff
    • regression tests
    • shell failure semantics
    • taxonomy tests
    • false-positive / false-negative review
  5. github-actions-contract

    • official GitHub documentation
    • workflow_run
    • steps.<id>.outcome / conclusion
    • continue-on-error
    • GITHUB_TOKEN
    • least privilege
  6. checkout-contract

    • actions/checkout v6
    • exact pinned SHA
    • release/tag provenance
    • persist-credentials
    • credential storage/cleanup behavior
  7. scope-drift

    • Allowed Paths
    • related Issue/PR path overlap
    • accidental downstream scope mixing
  8. final-independent-review

    • implementation担当とは別 SubAgent
    • fresh final HEAD のみを adversarial review

必要に応じて追加 SubAgent を起動してよい。

モデルを指定できる場合は role に適した最良の利用可能モデルを使う。
要求モデルが利用不能なら fallback してよいが、

  • requested model
  • actual model
  • failure/fallback reason

を記録する。

利用していないモデルを利用したと記録してはならない。

runtime concurrency 上限がある場合は wave に分割する。

launch した全 SubAgent が completed / failed / cancelled の terminal state に到達するまで final synthesis を開始してはならない。

各 SubAgent は以下を返す。

SUBAGENT_RESULT:
  role:
  model_requested:
  model_used:
  reviewed_head_sha:
  verdict:
  findings:
    - severity:
      evidence:
      impact:
      proposed_fix:
  uncertainties: []
  completion_status:

3. Immutable scope

Issue #2098 の code change Allowed Paths:

.github/workflows/visual-impact-trusted-consumer.yml
scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py

git diff --name-only <current-main>...<current-pr-head> を取得し、完全一致または subset であることを確認する。

Allowed Paths 外の tracked file change を発見した場合:

  1. 本 Issue に属さない既存差分か確認
  2. 自分が追加したものなら revert
  3. Issue 解決に本当に Allowed Paths 外変更が必要なら HARD_STOP_SCOPE_EXPANSION

勝手に別 Issue の変更を混ぜない。

PR body / comments 等の GitHub metadata 更新は code Allowed Paths とは別扱いで実施してよい。


4. External primary-source verification

WEB検索を行い、一次資料を優先する。

最低限 current version を確認する:

  • GitHub Docs: workflow_run
  • GitHub Docs: Actions contexts / steps.<id>.outcome
  • GitHub Docs: continue-on-error
  • GitHub Docs: GITHUB_TOKEN permissions / least privilege
  • GitHub Actions secure-use guidance
  • actions/checkout official repository
  • actions/checkout v6 credential persistence
  • PR が使用する exact checkout commit SHA の provenance

重要:

  • moving tag と immutable SHA を区別する。
  • checkout の current latest major が変化していても、この PR が採用している v6 contract を検証する。
  • blog、Stack Overflow、第三者記事を公式仕様の代替 authority にしない。

5. Current implementation adversarial review

PR HEAD の workflow と tests を fresh にレビューする。

特に確認する:

Authentication

  • privileged checkout が immutable SHA pin か
  • pin が意図した actions/checkout v6 release に属するか
  • persist-credentials の使用が official contract と一致するか
  • trusted-side git fetch が token を command line に直接埋め込んでいないか
  • token が logs / artifact / CheckRun summary に出ないか
    -不要な GH_TOKEN env が Git transport 用に残っていないか

Trust boundary

candidate PR head を:

  • checkout しない
  • execute しない
  • local action としてロードしない
  • package script として実行しない

candidate head の commit objects を data として fetch / diff すること と candidate-controlled code を execute すること を明確に区別する。

Permissions

Issue contract を超える permissions がないこと。

特に:

contents: read
actions: read
checks: write

を超える write permission が追加されていないこと。

Failure taxonomy

最低限以下を別状態として扱えること。

  1. trusted input derivation failed
  2. verifier not run
  3. verifier ran and rejected producer artifact
  4. verifier succeeded
  5. stale workflow_run
  6. missing PR / malformed precondition

continue-on-error 使用時は steps.<id>.outcome と conclusion の official semantics を確認する。

semantic verifier rejection と infrastructure/bootstrap failure を混同しない。


6. Bootstrap limitation determination

ここが今回の主判定である。

以下をすべて fresh evidence で確認する。

  1. current-head 通常 CI が green
  2. visual-impact-policy が green
  3. ci-verdict-summary が green
  4. targeted pytest が pass
  5. actionlint が pass
  6. changed-path gate が pass
  7. trusted CheckRun の failure が存在する
  8. trusted CheckRun の元となる workflow_run が default branch 側 workflow を実行している
  9. その workflow SHA が candidate PR HEAD ではない
  10. verifier が actually run していない、または candidate implementation が実行されていない
  11. failure summary が legacy implementation に由来することを説明できる
  12. PR HEAD の candidate workflow には当該 defect の修正が存在する
  13. candidate implementation を merge 前に同一 privileged workflow_run 経路で実行する supported/safe な方法がない

13 の判断では「単に難しい」を blocker としてはならない。

逆に以下のような迂回を行ってはならない。

  • default branch を一時的に candidate branch へ変更
  • ruleset bypass
  • privileged workflow に candidate branch checkout を追加
  • workflow_dispatch 等を追加して、異なる security semantics の実行結果を workflow_run proof と偽装
  • temporary secret / PAT 導入
  • candidate-controlled local action execution
  • failure check の削除

これらは runtime proof ではなく security model の変更である。

bootstrap-only limitation と判断するには、他の実装修正可能 blocker がゼロであることを独立 SubAgent review で確認する。


7. Implementation loop

fresh review で Issue #2098 Allowed Paths 内に解消可能な defect が見つかった場合は、人間承認なしで修正する。

iteration:

  1. fresh authority snapshot
  2. independent findings
  3. severity triage
  4. implement Allowed Paths 内の修正
  5. targeted tests
  6. broader required checks
  7. commit
  8. push
  9. PR body evidence rebind
  10. current-head CI 完了待ち
  11. current-head CheckRun readback
  12. independent final review

を繰り返す。

各 commit 後に old HEAD の evidence を current HEAD の証拠として再利用しない。


8. Verification

最低限実行する:

uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q
pnpm lint

さらに repository canonical CI / Issue contract が要求する verification を実行する。

CI については current PR HEAD に紐づく run のみを合格証拠にする。

同一 HEAD で複数 successful run がある場合、原則として freshest completed successful run を PR body の evidence に使用する。

現在の PR body が古い same-head CI run を参照しているだけなら correctness blocker とはしないが、merge 前 evidence として freshest completed run に再束縛することを優先する。


9. PR metadata

PR body を live state と照合する。

必要に応じて以下を更新する:

  • current HEAD SHA
  • current base SHA
  • freshest completed same-head CI run
  • targeted test results
  • actionlint
  • visual-impact-policy
  • ci-verdict-summary
  • trusted check failure
  • bootstrap limitation
  • verifier ran/skipped
  • Safety Claim Matrix
  • Acceptance Criteria evidence
  • post-merge verification requirement

以下を偽ってはならない。

  • visual-impact-policy-trusted: success
  • candidate trusted workflow runtime proof acquired
  • verifier executed
  • AC1 dynamic runtime proof acquired

取得していない証拠を取得済みと表現しない。

Closes #2098 は PR に保持してよいが、merge 前に Issue を手動 close しない。


10. Branch freshness

開始時および最終 review 前に current main と PR base/head を確認する。

main が進んでおり canonical impl-review-loop が update-branch を要求する場合:

  • repository canonical procedure で update branch
  • conflict を自動解決可能なら Allowed Paths / semantic intent を保持して解決
  • 新 HEAD に対して verification をすべてやり直す
  • PR body evidence を新 HEAD へ再束縛
  • independent review をやり直す

merge conflict が Allowed Paths 外の judgment を必要とするなら停止する。


11. Final review verdict

final independent reviewer は fresh HEAD のみを対象にする。

使用可能 verdict:

APPROVE
REQUEST_CHANGES
HUMAN_REVIEW_REQUIRED

APPROVE

実装上・policy 上の blocker がなく、merge 前に必要な evidence が取得済みの場合。

ただし merge は実行しない。

REQUEST_CHANGES

Allowed Paths 内で解消可能な defect がある場合。

root agent は自動で implementation loop に戻る。
人間承認を求めない。

HUMAN_REVIEW_REQUIRED

以下の条件をすべて満たす場合に限定する。

  • current HEAD 通常 CI green
  • scope gate pass
  • security review pass
  • no actionable implementation defect
  • current trusted failure の原因が candidate implementation ではなく default-branch bootstrap limitation
  • candidate privileged runtime proof が merge 前には取得不能
  • その制約を回避するには merge / branch protection bypass / trust-boundary weakening 等の禁止操作が必要

この場合は canonical human escalation として停止する。

同じ bootstrap-only failure を何度も rerun して loop を消費しない。


12. Draft / ready-for-review handling

PR #2104 の Draft 状態を無条件に変更しない。

.claude/skills/impl-review-loop、Issue delivery rule、repository policy を確認し、

  • HUMAN_REVIEW_REQUIRED 時に Draft 維持が canonical なら Draft のまま
  • merge judgment のため ready-for-review 化が canonical に明示されている場合のみ ready 化

とする。

判断根拠を final report に明記する。


13. Stop conditions

即停止するのは以下のみ。

通常のテスト失敗、CI失敗、review finding、stale PR body、branch update は停止理由ではない。
自動修正可能なら継続する。


14. Expected recommended termination

事前に verdict を固定してはならない。

ただし fresh evidence が以下の形なら:

normal_ci: success
scope: pass
security_review: pass
implementation_review: pass
trusted_check: failure
trusted_failure_source: default_branch_legacy_workflow
candidate_runtime_proof: unavailable_pre_merge
other_actionable_blockers: []

推奨 termination は:

status: human_review_required
reason: default_branch_workflow_run_bootstrap_limitation
merge_performed: false
auto_merge_enabled: false
recommended_human_action:
  - PR #2104 を merge するか人間が判断
  - merge 後、main 上の新 trusted consumer による workflow_run runtime proof を取得
  - trusted-side fetch 成功を確認
  - verifier が想定どおり実行されることを確認
  - CheckRun taxonomy が candidate 実装どおりであることを確認

別 Issue / PR の実装へそのまま進まない。


15. Final output

最後に必ず以下の machine-readable report を返す。

IMPL_REVIEW_LOOP_RECOVERY_RESULT_V1:
  status:
  issue_number: 2098
  pr_number: 2104

  authority:
    main_sha:
    pr_head_sha:
    pr_base_sha:
    draft:
    mergeable:
    merge_state_status:

  scope:
    allowed_paths:
      - .github/workflows/visual-impact-trusted-consumer.yml
      - scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py
    changed_paths:
    allowed_paths_gate:

  subagents:
    launched:
    completed:
    failed:
    cancelled:
    dangling:
    roles: []

  implementation:
    changed:
    commits_added: []
    fixes_applied: []

  verification:
    targeted_tests:
    broader_tests:
    actionlint:
    current_head_ci:
      run_id:
      conclusion:
      checks: []

  trusted_check:
    conclusion:
    check_run_id:
    summary:
    source_workflow_run_id:
    workflow_run_event:
    workflow_run_head_sha:
    verifier_ran:

  bootstrap_analysis:
    default_branch_workflow_sha:
    candidate_workflow_sha:
    bootstrap_only_blocker:
    evidence: []

  review:
    verdict:
    reviewed_head_sha:
    blockers: []
    warnings: []

  metadata:
    pr_body_rebound_to_current_head:
    pr_body_rebound_to_freshest_ci:
    draft_final_state:

  termination:
    reason:
    merge_performed: false
    auto_merge_enabled: false
    issue_closed_manually: false
    next_human_action:

加えて、人間向けに最大10行で以下を要約する。

  • 何を再確認したか
  • 追加修正があったか
  • current HEAD
  • current CI
  • trusted verifier が実行されたか
  • blocker が bootstrap-only か
  • review verdict
  • PR の Draft/Ready 状態
  • merge は実行していないこと
  • 推奨する次の人間操作

全 SubAgent の terminal completion を確認してから終了すること。

@squne121
squne121 marked this pull request as ready for review August 12, 2026 10:25
@squne121

Copy link
Copy Markdown
Owner Author

調査結果では、PR #2104 は HEAD 315357e2ccf562792ba863283fc7828c48116764、mergeable=true なのに mergeable_state=blocked です。base は main@fe4f242cb5a325d163d45f5eb822d40c49947488 で、現在の main も同じ SHA のため、BEHIND や競合が原因ではありません。

重要なのは branch rules の実態です。現在確認できる active ruleset は main-direct-push-protection 1件だけで、required checks は typecheck / lint / test / build / python-test の5件。approval 必須数は 0、CODEOWNERS review も不要です。visual-impact-policy-trusted はここには含まれていません。また、この ruleset に bypass actor はなく、現在ユーザーも bypass 不可です。

current HEAD に束縛された通常 CI run 31586602559 は conclusion=success です。current HEAD の visual-impact-policy、python-test、ci-verdict-summary も success で、残る赤は visual-impact-policy-trusted です。

したがって、visible ruleset だけでは BLOCKED を説明できません。最有力は、GitHub の classic branch protection など別の merge gate が重畳されていることです。GitHub は ruleset 同士だけでなく classic branch protection ともルールを重ね、より厳しい条件を適用します。([docs.github.com]1) このセッションの GitHub App では classic protection endpoint が 403 Resource not accessible by integration だったため、ここだけは CodexCLI 側のユーザー認証済み gh で確認する必要があります。

なお trusted failure 自体については、default branch にはまだ persist-credentials: false + 手動 Bearer header の旧 consumer があり、PR はその consumer 自身を修正しています。 GitHub 公式でも workflow_run は default branch を基準に動き、secrets/write token を利用できる privileged trigger です。したがって candidate workflow を privileged 経路で自己実行して無理に green にするのは不可です。([GitHub Docs]2) actions/checkout v6 の persisted credential を使って通常の git fetch を行う PR の方針自体は公式仕様に沿っています。([GitHub]3)

この環境には SubAgent の spawn/join API が公開されていないため、私自身がサブエージェントを実行・完了待ちしたとは扱えません。代わりに、以下の CodexCLI プロンプトでは SubAgent の起動と全員の join を必須化し、今回判明した「まず merge gate の provenance を特定する」という点に絞っています。

あなたは squne121/loop-protocol の root control-plane orchestrator として、PR #2104 / Issue #2098 を対象に MERGE_BLOCK_RECOVERY を実行する。

目的は PR #2104 が現在 mergeable=true なのに mergeStateStatus/BLOCKED となっている根本原因を live GitHub authority から特定し、repository policy と Issue #2098 の契約を維持したまま、必要な修正・CI・review対応を人間承認なしで実施して 通常の GitHub merge 操作が可能な状態まで持っていくことである。

PR 自体の merge、auto-merge、有効な branch protection / ruleset の bypass、偽 CheckRun 作成、required check の強制 success 化は行わない。

入力時点の情報は hint にすぎない。必ず fresh read で再検証する。

repo: squne121/loop-protocol
issue: 2098
pr: 2104

observed head:
315357e2ccf562792ba863283fc7828c48116764

observed base/main:
fe4f242cb5a325d163d45f5eb822d40c49947488

observed normal CI:
31586602559 = success

observed residual failed CheckRun:
visual-impact-policy-trusted
check_run_id: 94086762568

observed visible ruleset required checks:
- typecheck
- lint
- test
- build
- python-test

observed discrepancy:
mergeable=true
mergeStateStatus=BLOCKED
visible required checks are green
visual-impact-policy-trusted is not present in the visible ruleset

1. SubAgent policy

SubAgent capability を必ず使用する。

root agent は mutation coordination と final judgment のみに集中し、最低でも次の5 roleを独立 SubAgent に委譲する。

  1. merge-gate-authority-auditor

    • PR mergeStateStatus
    • rulesets
    • classic branch protection
    • required status checks
    • expected source App
    • review requirements
    • conversation-resolution requirement
    • merge method restrictions
    • base freshness
      を調査する。
  2. ci-check-provenance-auditor

    • current HEAD の全 CheckRun / commit status
    • required/non-required の区別
    • source App
    • current-head binding
    • merge test commit status
    • stale / duplicate context
      を調査する。
  3. trusted-workflow-security-auditor

  4. repository-policy-auditor

  5. final-independent-reviewer

    • mutation があった場合は mutation 担当とは別 agent
    • fresh final HEAD のみ review
    • merge gate が実際に解消したか独立判定する。

nested delegation 禁止。全 SubAgent は root から起動する。

runtime concurrency 制限がある場合は wave に分ける。

全 SubAgent が completed / failed / cancelled の terminal state に入るまで synthesis と final judgment を開始してはならない。dangling=0 を終了条件とする。

利用可能モデルを確認できる場合のみ明示的モデル指定を行う。存在しないモデルを使用したと記録してはならない。

各 SubAgent は以下を返す。

SUBAGENT_RESULT:
  role:
  model_used:
  authority_sha:
  verdict:
  findings: []
  blocker_candidates: []
  proposed_actions: []
  uncertainties: []
  completion_status:

2. Authority

authority priority は以下。

1. live GitHub API / GraphQL state
2. current local worktree / branch / HEAD
3. repository canonical skills / policies / tests
4. current Issue #2098 contract
5. historical comments / user supplied report

最初に認証状態を確認する。

gh auth status

認証できない場合だけ停止する。

その後、最低限以下を取得する。

REPO=squne121/loop-protocol
PR=2104

gh pr view "$PR" --repo "$REPO" \
  --json number,url,state,isDraft,mergeable,mergeStateStatus,reviewDecision,headRefOid,baseRefOid,headRefName,baseRefName,statusCheckRollup

HEAD="$(gh pr view "$PR" --repo "$REPO" --json headRefOid --jq .headRefOid)"
BASE="$(gh pr view "$PR" --repo "$REPO" --json baseRefOid --jq .baseRefOid)"
MAIN="$(gh api "repos/$REPO/branches/main" --jq .commit.sha)"

printf 'HEAD=%s\nBASE=%s\nMAIN=%s\n' "$HEAD" "$BASE" "$MAIN"

gh pr checks "$PR" --repo "$REPO" --required
gh pr checks "$PR" --repo "$REPO"

gh api "repos/$REPO/rules/branches/main"
gh api "repos/$REPO/rulesets?includes_parents=true&per_page=100"

# ここが今回最重要。
# ruleset とは別に classic branch protection を必ず読む。
gh api "repos/$REPO/branches/main/protection"

gh api "repos/$REPO/pulls/$PR"
gh api "repos/$REPO/commits/$HEAD/check-runs?per_page=100" --paginate
gh api "repos/$REPO/commits/$HEAD/status"

MERGE_SHA="$(gh api "repos/$REPO/pulls/$PR" --jq .merge_commit_sha)"
if [ -n "$MERGE_SHA" ] && [ "$MERGE_SHA" != "null" ]; then
  gh api "repos/$REPO/commits/$MERGE_SHA/check-runs?per_page=100"
  gh api "repos/$REPO/commits/$MERGE_SHA/status"
fi

GraphQL も必要なら使用し、mergeStateStatus、reviewDecision、review threads、status check rollup を取得する。

mergeStateStatus=BLOCKED の理由を推測だけで終了してはならない。どの rule / protection / check / review が blocking authority なのか、具体的な provenance を特定する。

3. Merge-gate provenance matrix

取得した情報から次を作る。

MERGE_GATE_PROVENANCE_V1:
  head_sha:
  base_sha:
  main_sha:
  behind: false
  conflicted: false

  rulesets:
    - id:
      name:
      enforcement:
      requirements: []

  classic_branch_protection:
    available:
    required_status_checks: []
    strict:
    required_reviews:
    conversation_resolution:
    restrictions: []

  status_checks:
    - context:
      required_by:
      expected_source:
      actual_source:
      sha:
      conclusion:
      blocking:

  reviews:
    required:
    satisfied:
    unresolved_threads:

  merge_methods:
    allowed_repository_methods: []
    allowed_rule_methods: []

  exact_blockers: []

特に以下を判別する。

  • classic branch protection に visual-impact-policy-trusted が required として残っていないか
  • ruleset と classic protection の required checks に差がないか
  • required check に expected GitHub App/source が指定され、同名の別 source が success しているだけではないか
  • current HEAD ではなく stale SHA にしか success が存在しない check がないか
  • duplicate check name の片方が required source と一致していないか
  • review / conversation resolution が classic protection 側で追加要求されていないか
  • strict check policy に対して base が本当に current main と一致しているか
  • repository の merge-method 設定と required linear history が矛盾していないか
  • merge test commit に別 required check が存在しないか

4. visual-impact-policy-trusted の扱い

この check が赤いという事実だけを根拠に PR code を変更してはならない。

まず current main の

.github/workflows/visual-impact-trusted-consumer.yml

と PR #2104 の同ファイルを比較する。

Issue #2098 の current Allowed Paths を live body から読み直す。

現時点の期待 Allowed Paths は:

.github/workflows/visual-impact-trusted-consumer.yml
scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py

current main の trusted consumer が旧 implementation で、PR がその consumer 自身を修正している場合、workflow_run の current execution が default branch definition を使う bootstrap limitation を正しく分類する。

以下は禁止。

- PR head の trusted workflow を privileged workflow_run として手動実行する
- candidate-controlled script/action/package を secrets/write token 付きで実行する
- check-runs API で synthetic success を作る
- failed trusted CheckRun を削除・上書きして merge を通す
- ruleset bypass
- branch protection bypass

GitHub 公式仕様を WEB 検索し、少なくとも以下の一次資料で確認する。

GitHub Docs: workflow_run
GitHub Docs: Secure use reference
GitHub Docs: rulesets / branch protection layering
GitHub Docs: required status checks
actions/checkout official README / changelog for the exact version used

candidate の auth/taxonomy implementation に genuine defect が発見され、Issue #2098 Allowed Paths 内で直せる場合だけ修正する。

5. Blocker別 action

A. required check の genuine failure / missing

正当な required workflow を current HEAD に対して再実行または修正する。

stale run の rerun では current-head evidence にならない場合、fresh run を正規 trigger で発生させる。

CheckRun を捏造しない。

コード変更が必要なら Issue #2098 Allowed Paths を守る。

変更後は最低限:

uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q
pnpm lint
git diff --check

を実行し、repository canonical CI も current HEAD で確認する。

commit/push 後は HEAD SHA を再取得し、古い CI/review evidence を捨てる。

B. stale / duplicate / expected-source mismatch

required status check の canonical producer を特定し、その producer に current HEAD の正規 CheckRun を生成させる。

同名 check を別 App や手動 API から生成して代替してはならない。

C. branch が BEHIND

MAIN != BASE かつ GitHub が BEHIND と判定した場合のみ、repository の canonical update procedure で main を取り込む。

force push 禁止。

conflict が発生した場合のみ hard stop。

D. required review / unresolved conversation

既存 review thread に actionable finding があるなら Allowed Paths 内で修正し、該当 thread へ evidence を返す。

単に reviewer approval が人間にしか付与できない場合は、それを exact blocker として停止する。

self-approval や review spoofing をしない。

E. classic branch protection が visual-impact-policy-trusted を required としている

これは今回最重要の circular-bootstrap case。

current main の consumer 自体の defect により trusted check が失敗し、PR #2104 がその consumer 自身を修正しているなら、candidate を merge 前に同じ privileged workflow_run 経路で green にすることは要求しない。

branch protection を勝手に変更・無効化しない。

以下として停止する。

classification: circular_default_branch_bootstrap_policy
code_fix_available_on_pr: false
requires_repository_policy_change_or_bootstrap_merge: true

その際、どの classic protection rule / context が circular dependency を作っているのか、現在値と必要な operator action を正確に報告する。

F. visible ruleset / classic protection とも全条件達成なのに BLOCKED

そこで終了せず、GitHub state の provenance をさらに調査する。

次を確認する。

- GraphQL mergeStateStatus
- reviewDecision
- merge queue / deployment / code scanning / code quality rules
- repository-level merge method
- commit signature / linear history
- merge test commit checks
- hidden classic protection requirements
- pending required status context

no-op commit を安易に作らない。

GitHub stale-state と結論するには、blocking authority が存在しないことを API evidence で示す。

6. Mutation policy

以下は人間確認なしで実施してよい。

- read-only GitHub/API investigation
- WEB一次資料検索
- Allowed Paths 内の code/test fix
- local verification
- normal commit
- normal push
- PR body の current-HEAD evidence rebinding
- CI retry
- review comment対応
- resolved thread の解決

以下は停止条件。

- merge
- auto-merge
- force push
- force reset
- secret value の取得・表示
- ruleset / branch protection の無効化・bypass
- required check spoofing
- candidate code の privileged execution
- Issue #2098 Allowed Paths 外のコード変更
- genuine Git conflict
- human approval そのものが必須

PR body に過去 SHA の CI を current evidence として残さない。

7. Fresh final review

mutation が発生したら全て current HEAD で再取得する。

gh pr view 2104 --repo "$REPO" \
  --json isDraft,mergeable,mergeStateStatus,reviewDecision,headRefOid,baseRefOid,statusCheckRollup

gh pr checks 2104 --repo "$REPO" --required
gh pr checks 2104 --repo "$REPO"

final-independent-reviewer は current HEAD と exact merge gates だけを対象に review する。

古い reviewed SHA の verdict は無効。

成功条件は、少なくとも以下。

- mergeable == MERGEABLE / true
- mergeStateStatus が BLOCKED ではない
- current HEAD が current main に対する required freshness 条件を満たす
- required checks 全て pass
- required reviews / threads 全て満たす
- genuine code blockers 0
- branch protection / ruleset bypass 0
- synthetic CheckRun 0

visual-impact-policy-trusted が non-required failure として残る場合は、その failure が active merge policy で blocking ではないことを API authority で証明した場合のみ merge-ready と判定してよい。

8. 終了

merge は実行しない。

最終出力:

PR_2104_MERGE_BLOCK_RECOVERY_V1:
  status: merge_ready | human_action_required | hard_stop | incomplete

  authority:
    head_sha:
    base_sha:
    main_sha:
    mergeable:
    merge_state_status:
    review_decision:

  blocker_root_cause:
    category:
    provenance:
    explanation:

  rules:
    applicable_rulesets: []
    classic_branch_protection_inspected:
    required_checks: []
    required_reviews:
    required_thread_resolution:
    merge_methods: []

  ci:
    current_head_run_ids: []
    required_checks_green:
    visual_impact_policy_trusted:
      conclusion:
      required:
      source_run:
      verifier_ran:
      classification:

  actions_taken:
    code_changes: []
    metadata_changes: []
    commits: []
    pushes: []
    reruns: []

  review:
    reviewed_head_sha:
    verdict:
    blockers: []
    warnings: []

  subagents:
    launched:
    completed:
    failed:
    cancelled:
    dangling:
    models_used: []

  safety:
    branch_protection_modified: false
    ruleset_modified: false
    synthetic_checkrun_created: false
    privileged_candidate_code_executed: false
    merge_performed: false
    auto_merge_enabled: false

  exact_next_action:

status: merge_ready として終了する場合でも、PR #2104 を実際には mergeしない。

もし human_action_required なら、「マージしてください」のような抽象表現ではなく、GitHub 上の何という rule/check/review がどう不足しているのか、operator が行うべき具体的な1操作を exact_next_action に書く。

このプロンプトのポイントは、「trusted を何とか green にする」ではなく、「なぜ非requiredに見える trusted failure がある状態で GitHub が BLOCKED と判定しているのか」を先に解決することです。classic branch protection 側に古い required context が残っていれば、今回の症状をかなり綺麗に説明できます。

@squne121

Copy link
Copy Markdown
Owner Author

調査した結果、画面の認識が正しいです。前回報告の「唯一の赤は非required visual-impact-policy-trusted」は、現在の CheckRun 群の説明としては不正確です。

PR #2104 は現在も HEAD 315357e2...、base/main fe4f242c...、Open・non-Draft・mergeable ですが、REST 上の mergeable_state は blocked です。

画面に見えている状態 | 調査結果 -- | -- visual-impact-policy-trusted failure | 実際の未解決 failure。default-branch workflow_run bootstrap 問題 python-test failure / Required | 実在する failure。ただし Python テストそのものではなく、依存 lane が cancelled だったため aggregate policy が fail visual-impact-policy failure | 実在する failure。ただし component-vrt-report cancellation に伴う cascade failure test / python-test-core / e2e / codex-execpolicy 等 cancelled | 同一 HEAD に対して起動された別 CI run が途中キャンセルされた結果 別の python-test success | 同一 HEAD に成功した別 CI run 31586602559 も存在する

特に重要なのは、同じ HEAD に同名 python-test CheckRun が複数存在している点です。現在確認できるだけで、python-test は success 1件と failure 3件が同じ 315357e2... に紐づいています。成功は run 31586602559、failure は 31587348169、31587375161、31587428458 由来です。 したがって、「同じ名前の成功 CheckRun がある → required checks は全部 green」と集約するのは危険です。今回の前回報告は、この重複 CheckRun の縮約方法を誤った可能性が高いです。

最新側の cancelled CI run 31587428458 では python-test job 自体が failure になっており、その失敗ステップは Evaluate python_test_bench_aggregate_policy です。 ログを追うと evaluator には core='cancelled'、codex='cancelled' が渡されて ok=False になっています。つまり pytest が落ちたのではなく、python-test-core / codex-execpolicy がキャンセルされたため fail-closed した二次障害です。

visual-impact-policy も同じ run 31587428458 で実際に failure しています。 その直前の component-vrt-report は cancelled で、通常の component VRT 自体は success まで進んだ後、negative-control 中にキャンセルされています。 visual-impact-policy のログでは、その cancelled CheckRun を参照したため canonical verify が成功していないと判定されています。これも #2104 の実装欠陥を直接示す failure ではなく、CI cancellation の連鎖です。

なぜ同じ HEAD の CI が何度もキャンセルされたのか

ここはかなり明確です。現在の .github/workflows/ci.yml は pull_request の edited まで trigger に含め、その一方で PR ref 単位の同一 concurrency group に cancel-in-progress: true を設定しています。 GitHub Actions の仕様上、同じ concurrency group で新しい run が入ると、cancel-in-progress: true は実行中 run をキャンセルします。(GitHub Docs)

今回、HEAD SHA を一度も変えずに PR-triggered CI が 4562 → 4563 → 4564 と連続して起動し、いずれも cancelled になっています。一方で CI workflow は edited を購読しています。このため、PR body 更新などの metadata edit が次の CI を起動し、前の CI をキャンセルした、というのが最も整合する説明です。GitHub の run API から元 webhook の action までは取得できなかったため、ここだけは高確度の推論です。GitHub は types で追加 activity を workflow trigger にできる仕様です。(GitHub Docs)

したがって、GitHub Support へ行く前に repository-side でやるべき回復手順があります。PR body や metadata の編集を止めた状態で、cancelled run 31587428458 を failed jobs だけではなく full rerun し、最後まで完走させることです。GitHub は workflow rerun で元と同じ GITHUB_SHA / GITHUB_REF を使用するため、HEAD を変えずに clean evidence を作れます。(GitHub Docs) GitHub CLI では gh run rerun 31587428458 が full rerun です。(GitHub CLI)

その clean rerun 後に required contexts と mergeable_state を再取得し、そこで初めて「required checks は全部 success、残る failure は nonrequired trusted check のみ、それでも BLOCKED」なら GitHub Support が妥当です。今の状態では Required の python-test failure を含む矛盾した CheckRun 群が実在するので、「Support しかない」と断定するのは早いです。

なお、active ruleset 16796903 から直接確認できた required contexts は typecheck / lint / test / build / python-test の5つです。 前回報告が6つ目として挙げた classic protection の validate-generated-artifact は、今回 GitHub App から classic branch protection endpoint が 403 になったため、私は live authority として再確認できていません。

長期的には .github/workflows/ci.yml で PR body の edited ごとにフル CI を走らせ、それが既存フル CI をキャンセルする設計を別 Issue で修正する価値があります。ただしこれは #2104 の Allowed Paths 2ファイル外なので、#2104 に混ぜるべきではありません。

このChatGPTセッションには SubAgent の launch/join API が公開されていないため、ここで「サブエージェントを起動して完了待ちした」とは記録できません。上の調査は GitHub live API・job logs・GitHub公式仕様を直接突合したものです。以下の CodexCLI プロンプトでは、SubAgent を実際に起動し、全員 terminal state になるまで待つことを必須条件にしています。

PR #2104 CI duplicate-run recovery / merge-block forensic

あなたは squne121/loop-protocol の root control-plane orchestrator として、PR #2104 の merge block を live authority から再調査し、repository-side で安全に解消可能な CI state を回復せよ。

対象:

目的:

  1. 「唯一の failure は nonrequired visual-impact-policy-trusted」という既存 report を鵜呑みにせず、同一 HEAD に重複している全 CheckRun / CheckSuite / WorkflowRun を再構成する。

  2. screenshot に見えている python-test failure、visual-impact-policy failure、複数 cancelled jobs の root cause を分類する。

  3. cancellation-induced cascade failure なら、コードや ruleset を変更せず、同じ HEAD に対する clean full CI rerun を1回完走させる。

  4. clean rerun 後に required checks / merge state / trusted check を fresh read し、repository-side recovery で merge-ready になるか、真に human/GitHub Support action が必要かを確定する。

  5. merge、auto-merge、branch protection/ruleset の変更・迂回、synthetic CheckRun 作成は絶対に行わない。

0. Known evidence is advisory only

以下は開始時点の hint であり、必ず live GitHub から再取得すること。

expected_authority:
  pr_number: 2104
  expected_head_sha: 315357e2ccf562792ba863283fc7828c48116764
  expected_base_sha: fe4f242cb5a325d163d45f5eb822d40c49947488
  expected_main_sha: fe4f242cb5a325d163d45f5eb822d40c49947488

known_ci:
successful_full_run:
run_id: 31586602559
later_same_head_runs:
- run_id: 31587348169
expected_conclusion: cancelled
- run_id: 31587375161
expected_conclusion: cancelled
- run_id: 31587428458
expected_conclusion: cancelled

latest_cancelled_run_evidence:
run_id: 31587428458
python_test_job_id: 94084780774
visual_impact_policy_job_id: 94084759743
component_vrt_report_job_id: 94084536933

trusted_check:
check_run_id: 94086762568
expected_name: visual-impact-policy-trusted
expected_conclusion: failure

known_ruleset:
id: 16796903
expected_required_contexts:
- typecheck
- lint
- test
- build
- python-test

過去 report の「required 6 checks」「唯一の赤」「GitHub Support が exact_next_action」という結論は authority としない。

1. SubAgent requirement

SubAgent capability が利用可能なら、必ず root から独立 SubAgent を起動する。

nested delegation 禁止。SubAgent から別 SubAgent を起動してはならない。

最低限以下を起動する。

A. check-run-authority-auditor

調査対象:

  • current PR HEAD/base/main

  • all CheckRuns on current HEAD

  • duplicate check names

  • CheckSuite → WorkflowRun mapping

  • run creation/start/completion ordering

  • required/nonrequired classification

  • mergeable_state / GraphQL mergeStateStatus

B. concurrency-event-forensics-auditor

調査対象:

  • .github/workflows/ci.yml

  • pull_request.types

  • concurrency.group

  • cancel-in-progress

  • 31587348169 / 31587375161 / 31587428458 が同一 HEAD で生成された理由

  • webhook/event action を取得可能なら exact action

  • exact action が取得不能なら inference と fact を明確に分離

C. ci-cascade-auditor

調査対象:

  • run 31587428458 の全 job logs

  • python-test

  • python-test-core

  • codex-execpolicy

  • component-vrt-report

  • visual-impact-policy

  • test

  • e2e

  • ci-verdict-summary

各 failure を:

  • primary implementation failure

  • cancellation-induced cascade failure

  • expected negative-control failure

  • stale/historical failure

のいずれかに分類する。

D. trusted-workflow-auditor

調査対象:

  • .github/workflows/visual-impact-trusted-consumer.yml

  • current main definition

  • PR candidate definition

  • workflow_run default-branch semantics

  • CheckRun 94086762568

  • source workflow run

  • verifier ran / skipped

  • trusted fetch authentication

  • permissions / trust boundary

PR head の privileged candidate code を実行しないこと。

E. independent-merge-gate-reviewer

上記4 agent の担当とは独立に、current HEAD の merge gate を fresh review する。

全 agent は以下を返す。

SUBAGENT_RESULT:
role:
model_requested:
model_used:
reviewed_head_sha:
findings:
- severity:
classification:
evidence:
impact:
proposed_action:
uncertainties: []
completion_status:

すべての予定 SubAgent が completed / failed / cancelled の terminal state になるまで root は synthesis・mutation・final verdict を開始してはならない。

SubAgent API が利用不能なら、利用したふりをせず:

status: SUBAGENT_CAPABILITY_UNAVAILABLE

で停止すること。

2. Fresh authority acquisition

最初に read-only で取得する。

git fetch origin
gh pr view 2104 -R squne121/loop-protocol
--json number,state,isDraft,headRefName,headRefOid,baseRefName,mergeable,mergeStateStatus,statusCheckRollup,body

gh api repos/squne121/loop-protocol/pulls/2104

gh api repos/squne121/loop-protocol/commits/HEAD/check-runs

HEAD は literal のまま使わず、live PR head SHA を変数に入れて使用すること。

さらに:

gh api repos/squne121/loop-protocol/actions/runs/31586602559
gh api repos/squne121/loop-protocol/actions/runs/31587348169
gh api repos/squne121/loop-protocol/actions/runs/31587375161
gh api repos/squne121/loop-protocol/actions/runs/31587428458

各 run の全 jobs / logs を取得する。

CheckRun は「name ごとに1件だけ選択」してはいけない。

最低限以下を保持する:

check_run_record:
id:
name:
conclusion:
status:
started_at:
completed_at:
check_suite_id:
app_id:
app_slug:
details_url:
workflow_run_id:
workflow_run_created_at:
workflow_run_attempt:
workflow_event:
head_sha:

同一 (head_sha, name, app) に複数レコードが存在する場合は全件を report する。

3. Verify the suspected cancellation chain

.github/workflows/ci.yml の live HEAD/base definition を確認する。

特に:

on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
- ready_for_review

concurrency:
...
cancel-in-progress: true

の実在を確認する。

同一 HEAD に 3つの追加 pull_request runs が存在する場合、

  • PR body edit

  • ready_for_review

  • その他 pull_request activity

のどれで起動したか、取得可能な event payload / audit evidence まで追う。

取得不能なら:

trigger_classification:
status: inferred
hypothesis: pull_request metadata edit caused same-ref concurrency cancellation

とし、fact と inference を混同しない。

4. Verify python-test failure causality

job 94084780774 のログを取得し、aggregate evaluator の入力を確認する。

既知 hint:

--core-result "cancelled"
--codex-result "cancelled"
python_test_bench_aggregate_policy_v1:
core='cancelled'
codex='cancelled'
ok=False

これが live log と一致するなら:

python_test_failure:
classification: cancellation_induced_cascade
underlying_pytest_failure: false

とする。

python-test aggregate policy を「cancelled を success 扱いする」修正は禁止。
fail-closed behavior は維持する。

5. Verify visual-impact-policy failure causality

job 94084759743 と component-vrt-report 94084536933 を追跡する。

以下を確認する:

  • normal component VRT が cancellation 前に success したか

  • component-vrt-report overall conclusion

  • evidence artifact が生成されたか

  • visual-impact-policy がどの CheckRun を canonical lane として選択したか

  • canonical_verify_lane_did_not_succeed_on_current_head の原因が cancellation か

cancellation が原因なら:

visual_impact_policy_failure:
classification: cancellation_induced_cascade
implementation_defect_proven: false

とする。

expected-negative-control の failure step を product regression と誤分類しない。

6. Required-check authority

active repository rulesets と classic branch protection を fresh read する。

gh api repos/squne121/loop-protocol/rulesets
gh api repos/squne121/loop-protocol/rulesets/16796903
gh api repos/squne121/loop-protocol/branches/main/protection

classic protection が permission error の場合、成功したふりをせず:

classic_branch_protection:
status: inaccessible
error:

を記録する。

過去 report の validate-generated-artifact required claim を未検証のまま live fact に昇格しない。

7. Recovery mutation gate

ここまでの全 SubAgent 完了後、root が以下を満たす場合のみ recovery mutation を許可する。

条件:

recovery_precondition:
pr_head_unchanged: true
main_not_ahead_of_base: true
no_new_primary_code_failure: true
cancelled_runs_explain_visible_required_failures: true
no_metadata_edit_in_progress: true

満たさない場合は rerun せず原因を報告する。

Freeze rule

recovery run 開始後は:

  • PR body edit

  • title edit

  • draft/ready toggle

  • label mutation

  • commit/push

  • branch update

を一切行わない。

8. Perform one clean FULL rerun

--failed ではなく full rerun を使う。

gh run rerun 31587428458 -R squne121/loop-protocol

その後、完了まで待つ。

gh run watch 31587428458 -R squne121/loop-protocol --exit-status

watch が非zeroでも直ちに修正を始めず、latest attempt の全 jobs/logs を取得する。

rerun 中に別 run が起動して再び cancellation した場合、

  • 新 run id

  • actor

  • event

  • timestamp

  • concurrency relationship

を取得し、external_superseding_run として report する。

9. Post-rerun fresh read

rerun 完了後に必ず authority を取り直す。

  • PR head/base/main

  • current CheckRuns 全件

  • latest run attempt

  • required contexts

  • reviews

  • unresolved threads

  • mergeable

  • mergeStateStatus

  • trusted CheckRun

  • workflow_run consumer result

過去 snapshot を再利用しない。

同じ名前の stale CheckRuns が残っていても削除・synthetic success 化しない。

10. Trusted workflow treatment

visual-impact-policy-trusted failure は normal CI failure と混ぜない。

GitHub workflow_run が default branch 側の workflow definition を使用するため candidate consumer を merge 前にその privileged path で自己証明できない、という bootstrap limitation を公式 GitHub documentation と current repository definition で再検証する。

rerun 後も trusted consumer が legacy main definition で失敗するなら:

trusted_check:
classification: default_branch_bootstrap_limitation

とする。

ただし nonrequired であることを ruleset / classic protection の live authority から確認できた場合のみ nonrequired と記録する。

11. Decision

Case A — clean rerun resolves required contexts

clean full rerun が成功し、全 live required contexts が success になった場合:

  • code change しない

  • PR metadata を変更しない

  • mergeしない

  • auto-mergeしない

その上で mergeStateStatus を再取得する。

MERGEABLE + CLEAN 相当なら:

status: merge_ready_human_merge_required

とする。

Case B — required checks greenだが BLOCKED のまま

以下が全て成立する場合のみ:

  • all verifiable required checks success

  • no reviews required

  • no unresolved thread

  • current base freshness satisfied

  • merge method permitted

  • remaining failed check is proven nonrequired

  • mergeStateStatus remains BLOCKED

GitHub Support escalation を妥当とする。

Support 用 evidence pack に:

  • PR number

  • head/base/main SHA

  • exact required contexts

  • each current required CheckRun id/conclusion/app

  • nonrequired failing CheckRun id

  • clean rerun id/attempt

  • ruleset id

  • reviews/threads

  • REST mergeable_state

  • GraphQL mergeStateStatus

を含める。

Case C — clean rerun still has genuine required failure

その failure の root cause を調査する。

#2104 の Allowed Paths を fresh Issue authority から確認する。

Allowed Paths 外、特に .github/workflows/ci.yml の変更が必要なら #2104 に scope creep しない。

status: separate_followup_required

とし、別 Issue 用の実装可能な draft を出す。

12. Long-term architecture review

今回の incident が:

  • pull_request: edited が full CI を再起動

  • same PR ref concurrency

  • cancel-in-progress: true

  • aggregate jobs が cancelled dependency を正しく fail-closed

  • metadata edit のたびに expensive/code-equivalent CI evidence が破壊される

という構造なら、別 Issue として改善案を出す。

候補:

  • edited を full code CI trigger から外す

  • PR-body-dependent validation を lightweight metadata workflow に分離する

  • metadata-only activity が running full CI を cancel しない concurrency policy にする

ただし本 recovery では .github/workflows/ci.yml を変更しない。

13. Safety hard stops

絶対に実行しない:

  • PR merge

  • auto-merge

  • branch protection変更

  • ruleset変更

  • required status check削除

  • synthetic CheckRun / Status 作成

  • successful status の偽造

  • force push

  • history rewrite

  • secret/token 表示

  • candidate-controlled code の privileged workflow_run execution

  • Allowed Paths の無断拡張

14. Required final output

最終出力は次の形式にする。

PR_2104_CI_RECOVERY_V2:
status:

authority:
head_sha:
base_sha:
main_sha:
mergeable:
merge_state_status:

duplicate_check_analysis:
same_head_duplicate_contexts: []
successful_runs: []
failed_runs: []
cancelled_runs: []

root_causes:
primary: []
cancellation_induced_cascade: []
stale_or_superseded: []

python_test:
current_authoritative_result:
underlying_pytest_failure:
evidence:

visual_impact_policy:
current_authoritative_result:
component_vrt_result:
evidence:

trusted_check:
check_run_id:
required:
classification:
verifier_ran:
evidence:

concurrency:
trigger:
exact_or_inferred:
cancel_in_progress:
evidence:

clean_rerun:
source_run_id:
attempt:
conclusion:
all_required_green:

rules:
ruleset_ids: []
required_contexts: []
classic_branch_protection_status:

subagents:
launched:
terminal:
failed:
cancelled:
dangling:
reports: []

mutations:
code_changes: []
metadata_changes: []
workflow_reruns: []

safety:
merged: false
auto_merge_enabled: false
protection_modified: false
synthetic_check_created: false

exact_next_action:

最終 verdict を出す前にもう一度 current PR HEAD を取得し、reviewed HEAD と一致することを確認せよ。

調査した結果、**画面の認識が正しいです**。前回報告の「唯一の赤は非required `visual-impact-policy-trusted`」は、現在の CheckRun 群の説明としては不正確です。

PR #2104 は現在も HEAD 315357e2...、base/main fe4f242c...、Open・non-Draft・mergeable ですが、REST 上の mergeable_state は blocked です。

画面に見えている状態 調査結果
visual-impact-policy-trusted failure 実際の未解決 failure。default-branch workflow_run bootstrap 問題
python-test failure / Required 実在する failure。ただし Python テストそのものではなく、依存 lane が cancelled だったため aggregate policy が fail
visual-impact-policy failure 実在する failure。ただし component-vrt-report cancellation に伴う cascade failure
test / python-test-core / e2e / codex-execpolicy 等 cancelled 同一 HEAD に対して起動された別 CI run が途中キャンセルされた結果
別の python-test success 同一 HEAD に成功した別 CI run 31586602559 も存在する

特に重要なのは、同じ HEAD に同名 python-test CheckRun が複数存在している点です。現在確認できるだけで、python-test は success 1件と failure 3件が同じ 315357e2... に紐づいています。成功は run 31586602559、failure は 31587348169、31587375161、31587428458 由来です。 したがって、「同じ名前の成功 CheckRun がある → required checks は全部 green」と集約するのは危険です。今回の前回報告は、この重複 CheckRun の縮約方法を誤った可能性が高いです。

最新側の cancelled CI run 31587428458 では python-test job 自体が failure になっており、その失敗ステップは Evaluate python_test_bench_aggregate_policy です。 ログを追うと evaluator には core='cancelled'、codex='cancelled' が渡されて ok=False になっています。つまり pytest が落ちたのではなく、python-test-core / codex-execpolicy がキャンセルされたため fail-closed した二次障害です。

visual-impact-policy も同じ run 31587428458 で実際に failure しています。 その直前の component-vrt-report は cancelled で、通常の component VRT 自体は success まで進んだ後、negative-control 中にキャンセルされています。 visual-impact-policy のログでは、その cancelled CheckRun を参照したため canonical verify が成功していないと判定されています。これも #2104 の実装欠陥を直接示す failure ではなく、CI cancellation の連鎖です。

なぜ同じ HEAD の CI が何度もキャンセルされたのか

ここはかなり明確です。現在の .github/workflows/ci.yml は pull_request の edited まで trigger に含め、その一方で PR ref 単位の同一 concurrency group に cancel-in-progress: true を設定しています。 GitHub Actions の仕様上、同じ concurrency group で新しい run が入ると、cancel-in-progress: true は実行中 run をキャンセルします。([GitHub Docs]1)

今回、HEAD SHA を一度も変えずに PR-triggered CI が 4562 → 4563 → 4564 と連続して起動し、いずれも cancelled になっています。一方で CI workflow は edited を購読しています。このため、PR body 更新などの metadata edit が次の CI を起動し、前の CI をキャンセルした、というのが最も整合する説明です。GitHub の run API から元 webhook の action までは取得できなかったため、ここだけは高確度の推論です。GitHub は types で追加 activity を workflow trigger にできる仕様です。([GitHub Docs]2)

したがって、GitHub Support へ行く前に repository-side でやるべき回復手順があります。PR body や metadata の編集を止めた状態で、cancelled run 31587428458 を failed jobs だけではなく full rerun し、最後まで完走させることです。GitHub は workflow rerun で元と同じ GITHUB_SHA / GITHUB_REF を使用するため、HEAD を変えずに clean evidence を作れます。([GitHub Docs]3) GitHub CLI では gh run rerun 31587428458 が full rerun です。([GitHub CLI]4)

その clean rerun 後に required contexts と mergeable_state を再取得し、そこで初めて「required checks は全部 success、残る failure は nonrequired trusted check のみ、それでも BLOCKED」なら GitHub Support が妥当です。今の状態では Required の python-test failure を含む矛盾した CheckRun 群が実在するので、「Support しかない」と断定するのは早いです。

なお、active ruleset 16796903 から直接確認できた required contexts は typecheck / lint / test / build / python-test の5つです。 前回報告が6つ目として挙げた classic protection の validate-generated-artifact は、今回 GitHub App から classic branch protection endpoint が 403 になったため、私は live authority として再確認できていません。

長期的には .github/workflows/ci.yml で PR body の edited ごとにフル CI を走らせ、それが既存フル CI をキャンセルする設計を別 Issue で修正する価値があります。ただしこれは #2104 の Allowed Paths 2ファイル外なので、#2104 に混ぜるべきではありません。

このChatGPTセッションには SubAgent の launch/join API が公開されていないため、ここで「サブエージェントを起動して完了待ちした」とは記録できません。上の調査は GitHub live API・job logs・GitHub公式仕様を直接突合したものです。以下の CodexCLI プロンプトでは、SubAgent を実際に起動し、全員 terminal state になるまで待つことを必須条件にしています。

PR #2104 CI duplicate-run recovery / merge-block forensic

あなたは squne121/loop-protocol の root control-plane orchestrator として、PR #2104 の merge block を live authority から再調査し、repository-side で安全に解消可能な CI state を回復せよ。

対象:

目的:

  1. 「唯一の failure は nonrequired visual-impact-policy-trusted」という既存 report を鵜呑みにせず、同一 HEAD に重複している全 CheckRun / CheckSuite / WorkflowRun を再構成する。
  2. screenshot に見えている python-test failure、visual-impact-policy failure、複数 cancelled jobs の root cause を分類する。
  3. cancellation-induced cascade failure なら、コードや ruleset を変更せず、同じ HEAD に対する clean full CI rerun を1回完走させる。
  4. clean rerun 後に required checks / merge state / trusted check を fresh read し、repository-side recovery で merge-ready になるか、真に human/GitHub Support action が必要かを確定する。
  5. merge、auto-merge、branch protection/ruleset の変更・迂回、synthetic CheckRun 作成は絶対に行わない。

0. Known evidence is advisory only

以下は開始時点の hint であり、必ず live GitHub から再取得すること。

expected_authority:
  pr_number: 2104
  expected_head_sha: 315357e2ccf562792ba863283fc7828c48116764
  expected_base_sha: fe4f242cb5a325d163d45f5eb822d40c49947488
  expected_main_sha: fe4f242cb5a325d163d45f5eb822d40c49947488

known_ci:
  successful_full_run:
    run_id: 31586602559
  later_same_head_runs:
    - run_id: 31587348169
      expected_conclusion: cancelled
    - run_id: 31587375161
      expected_conclusion: cancelled
    - run_id: 31587428458
      expected_conclusion: cancelled

  latest_cancelled_run_evidence:
    run_id: 31587428458
    python_test_job_id: 94084780774
    visual_impact_policy_job_id: 94084759743
    component_vrt_report_job_id: 94084536933

  trusted_check:
    check_run_id: 94086762568
    expected_name: visual-impact-policy-trusted
    expected_conclusion: failure

known_ruleset:
  id: 16796903
  expected_required_contexts:
    - typecheck
    - lint
    - test
    - build
    - python-test

過去 report の「required 6 checks」「唯一の赤」「GitHub Support が exact_next_action」という結論は authority としない。

1. SubAgent requirement

SubAgent capability が利用可能なら、必ず root から独立 SubAgent を起動する。

nested delegation 禁止。SubAgent から別 SubAgent を起動してはならない。

最低限以下を起動する。

A. check-run-authority-auditor

調査対象:

  • current PR HEAD/base/main
  • all CheckRuns on current HEAD
  • duplicate check names
  • CheckSuite → WorkflowRun mapping
  • run creation/start/completion ordering
  • required/nonrequired classification
  • mergeable_state / GraphQL mergeStateStatus

B. concurrency-event-forensics-auditor

調査対象:

  • .github/workflows/ci.yml
  • pull_request.types
  • concurrency.group
  • cancel-in-progress
  • 31587348169 / 31587375161 / 31587428458 が同一 HEAD で生成された理由
  • webhook/event action を取得可能なら exact action
  • exact action が取得不能なら inference と fact を明確に分離

C. ci-cascade-auditor

調査対象:

  • run 31587428458 の全 job logs
  • python-test
  • python-test-core
  • codex-execpolicy
  • component-vrt-report
  • visual-impact-policy
  • test
  • e2e
  • ci-verdict-summary

各 failure を:

  • primary implementation failure
  • cancellation-induced cascade failure
  • expected negative-control failure
  • stale/historical failure

のいずれかに分類する。

D. trusted-workflow-auditor

調査対象:

  • .github/workflows/visual-impact-trusted-consumer.yml
  • current main definition
  • PR candidate definition
  • workflow_run default-branch semantics
  • CheckRun 94086762568
  • source workflow run
  • verifier ran / skipped
  • trusted fetch authentication
  • permissions / trust boundary

PR head の privileged candidate code を実行しないこと。

E. independent-merge-gate-reviewer

上記4 agent の担当とは独立に、current HEAD の merge gate を fresh review する。

全 agent は以下を返す。

SUBAGENT_RESULT:
  role:
  model_requested:
  model_used:
  reviewed_head_sha:
  findings:
    - severity:
      classification:
      evidence:
      impact:
      proposed_action:
  uncertainties: []
  completion_status:

すべての予定 SubAgent が completed / failed / cancelled の terminal state になるまで root は synthesis・mutation・final verdict を開始してはならない。

SubAgent API が利用不能なら、利用したふりをせず:

status: SUBAGENT_CAPABILITY_UNAVAILABLE

で停止すること。

2. Fresh authority acquisition

最初に read-only で取得する。

git fetch origin
gh pr view 2104 -R squne121/loop-protocol \
  --json number,state,isDraft,headRefName,headRefOid,baseRefName,mergeable,mergeStateStatus,statusCheckRollup,body

gh api repos/squne121/loop-protocol/pulls/2104

gh api repos/squne121/loop-protocol/commits/HEAD/check-runs

HEAD は literal のまま使わず、live PR head SHA を変数に入れて使用すること。

さらに:

gh api repos/squne121/loop-protocol/actions/runs/31586602559
gh api repos/squne121/loop-protocol/actions/runs/31587348169
gh api repos/squne121/loop-protocol/actions/runs/31587375161
gh api repos/squne121/loop-protocol/actions/runs/31587428458

各 run の全 jobs / logs を取得する。

CheckRun は「name ごとに1件だけ選択」してはいけない。

最低限以下を保持する:

check_run_record:
  id:
  name:
  conclusion:
  status:
  started_at:
  completed_at:
  check_suite_id:
  app_id:
  app_slug:
  details_url:
  workflow_run_id:
  workflow_run_created_at:
  workflow_run_attempt:
  workflow_event:
  head_sha:

同一 (head_sha, name, app) に複数レコードが存在する場合は全件を report する。

3. Verify the suspected cancellation chain

.github/workflows/ci.yml の live HEAD/base definition を確認する。

特に:

on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - edited
      - ready_for_review

concurrency:
  ...
  cancel-in-progress: true

の実在を確認する。

同一 HEAD に 3つの追加 pull_request runs が存在する場合、

  • PR body edit
  • ready_for_review
  • その他 pull_request activity

のどれで起動したか、取得可能な event payload / audit evidence まで追う。

取得不能なら:

trigger_classification:
  status: inferred
  hypothesis: pull_request metadata edit caused same-ref concurrency cancellation

とし、fact と inference を混同しない。

4. Verify python-test failure causality

job 94084780774 のログを取得し、aggregate evaluator の入力を確認する。

既知 hint:

--core-result "cancelled"
--codex-result "cancelled"
python_test_bench_aggregate_policy_v1:
  core='cancelled'
  codex='cancelled'
  ok=False

これが live log と一致するなら:

python_test_failure:
  classification: cancellation_induced_cascade
  underlying_pytest_failure: false

とする。

python-test aggregate policy を「cancelled を success 扱いする」修正は禁止。
fail-closed behavior は維持する。

5. Verify visual-impact-policy failure causality

job 94084759743 と component-vrt-report 94084536933 を追跡する。

以下を確認する:

  • normal component VRT が cancellation 前に success したか
  • component-vrt-report overall conclusion
  • evidence artifact が生成されたか
  • visual-impact-policy がどの CheckRun を canonical lane として選択したか
  • canonical_verify_lane_did_not_succeed_on_current_head の原因が cancellation か

cancellation が原因なら:

visual_impact_policy_failure:
  classification: cancellation_induced_cascade
  implementation_defect_proven: false

とする。

expected-negative-control の failure step を product regression と誤分類しない。

6. Required-check authority

active repository rulesets と classic branch protection を fresh read する。

gh api repos/squne121/loop-protocol/rulesets
gh api repos/squne121/loop-protocol/rulesets/16796903
gh api repos/squne121/loop-protocol/branches/main/protection

classic protection が permission error の場合、成功したふりをせず:

classic_branch_protection:
  status: inaccessible
  error:

を記録する。

過去 report の validate-generated-artifact required claim を未検証のまま live fact に昇格しない。

7. Recovery mutation gate

ここまでの全 SubAgent 完了後、root が以下を満たす場合のみ recovery mutation を許可する。

条件:

recovery_precondition:
  pr_head_unchanged: true
  main_not_ahead_of_base: true
  no_new_primary_code_failure: true
  cancelled_runs_explain_visible_required_failures: true
  no_metadata_edit_in_progress: true

満たさない場合は rerun せず原因を報告する。

Freeze rule

recovery run 開始後は:

  • PR body edit
  • title edit
  • draft/ready toggle
  • label mutation
  • commit/push
  • branch update

を一切行わない。

8. Perform one clean FULL rerun

--failed ではなく full rerun を使う。

gh run rerun 31587428458 -R squne121/loop-protocol

その後、完了まで待つ。

gh run watch 31587428458 -R squne121/loop-protocol --exit-status

watch が非zeroでも直ちに修正を始めず、latest attempt の全 jobs/logs を取得する。

rerun 中に別 run が起動して再び cancellation した場合、

  • 新 run id
  • actor
  • event
  • timestamp
  • concurrency relationship

を取得し、external_superseding_run として report する。

9. Post-rerun fresh read

rerun 完了後に必ず authority を取り直す。

  • PR head/base/main
  • current CheckRuns 全件
  • latest run attempt
  • required contexts
  • reviews
  • unresolved threads
  • mergeable
  • mergeStateStatus
  • trusted CheckRun
  • workflow_run consumer result

過去 snapshot を再利用しない。

同じ名前の stale CheckRuns が残っていても削除・synthetic success 化しない。

10. Trusted workflow treatment

visual-impact-policy-trusted failure は normal CI failure と混ぜない。

GitHub workflow_run が default branch 側の workflow definition を使用するため candidate consumer を merge 前にその privileged path で自己証明できない、という bootstrap limitation を公式 GitHub documentation と current repository definition で再検証する。

rerun 後も trusted consumer が legacy main definition で失敗するなら:

trusted_check:
  classification: default_branch_bootstrap_limitation

とする。

ただし nonrequired であることを ruleset / classic protection の live authority から確認できた場合のみ nonrequired と記録する。

11. Decision

Case A — clean rerun resolves required contexts

clean full rerun が成功し、全 live required contexts が success になった場合:

  • code change しない
  • PR metadata を変更しない
  • mergeしない
  • auto-mergeしない

その上で mergeStateStatus を再取得する。

MERGEABLE + CLEAN 相当なら:

status: merge_ready_human_merge_required

とする。

Case B — required checks greenだが BLOCKED のまま

以下が全て成立する場合のみ:

  • all verifiable required checks success
  • no reviews required
  • no unresolved thread
  • current base freshness satisfied
  • merge method permitted
  • remaining failed check is proven nonrequired
  • mergeStateStatus remains BLOCKED

GitHub Support escalation を妥当とする。

Support 用 evidence pack に:

  • PR number
  • head/base/main SHA
  • exact required contexts
  • each current required CheckRun id/conclusion/app
  • nonrequired failing CheckRun id
  • clean rerun id/attempt
  • ruleset id
  • reviews/threads
  • REST mergeable_state
  • GraphQL mergeStateStatus

を含める。

Case C — clean rerun still has genuine required failure

その failure の root cause を調査する。

#2104 の Allowed Paths を fresh Issue authority から確認する。

Allowed Paths 外、特に .github/workflows/ci.yml の変更が必要なら #2104 に scope creep しない。

status: separate_followup_required

とし、別 Issue 用の実装可能な draft を出す。

12. Long-term architecture review

今回の incident が:

  • pull_request: edited が full CI を再起動
  • same PR ref concurrency
  • cancel-in-progress: true
  • aggregate jobs が cancelled dependency を正しく fail-closed
  • metadata edit のたびに expensive/code-equivalent CI evidence が破壊される

という構造なら、別 Issue として改善案を出す。

候補:

  • edited を full code CI trigger から外す
  • PR-body-dependent validation を lightweight metadata workflow に分離する
  • metadata-only activity が running full CI を cancel しない concurrency policy にする

ただし本 recovery では .github/workflows/ci.yml を変更しない。

13. Safety hard stops

絶対に実行しない:

  • PR merge
  • auto-merge
  • branch protection変更
  • ruleset変更
  • required status check削除
  • synthetic CheckRun / Status 作成
  • successful status の偽造
  • force push
  • history rewrite
  • secret/token 表示
  • candidate-controlled code の privileged workflow_run execution
  • Allowed Paths の無断拡張

14. Required final output

最終出力は次の形式にする。

PR_2104_CI_RECOVERY_V2:
  status:

  authority:
    head_sha:
    base_sha:
    main_sha:
    mergeable:
    merge_state_status:

  duplicate_check_analysis:
    same_head_duplicate_contexts: []
    successful_runs: []
    failed_runs: []
    cancelled_runs: []

  root_causes:
    primary: []
    cancellation_induced_cascade: []
    stale_or_superseded: []

  python_test:
    current_authoritative_result:
    underlying_pytest_failure:
    evidence:

  visual_impact_policy:
    current_authoritative_result:
    component_vrt_result:
    evidence:

  trusted_check:
    check_run_id:
    required:
    classification:
    verifier_ran:
    evidence:

  concurrency:
    trigger:
    exact_or_inferred:
    cancel_in_progress:
    evidence:

  clean_rerun:
    source_run_id:
    attempt:
    conclusion:
    all_required_green:

  rules:
    ruleset_ids: []
    required_contexts: []
    classic_branch_protection_status:

  subagents:
    launched:
    terminal:
    failed:
    cancelled:
    dangling:
    reports: []

  mutations:
    code_changes: []
    metadata_changes: []
    workflow_reruns: []

  safety:
    merged: false
    auto_merge_enabled: false
    protection_modified: false
    synthetic_check_created: false

  exact_next_action:

最終 verdict を出す前にもう一度 current PR HEAD を取得し、reviewed HEAD と一致することを確認せよ。

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.

実装: trusted visual-impact consumer の Git 認証 bootstrap failure を分類・修正する

1 participant