Skip to content

実装: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する #2076

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "visual-impact-policy-trusted CheckRun が実際に producer artifact を取得・検証できる状態にする"
change_kind: workflow

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: .github/workflows/visual-impact-trusted-consumer.yml の producer artifact download が常時失敗している既存インフラバグを解消し、visual-impact-policy-trusted check が実際の検証結果を報告できるようにする
  • Desired Destination: N/A(単独改善のため parent なし)

Current Validated Scope

  • .github/workflows/visual-impact-trusted-consumer.yml の Download producer artifacts (untrusted input) ステップにある gh api ... --output decision.zip / gh api ... --output evidence.zip 呼び出しの修正

Remaining Parent Gaps

なし

Runtime Verification Applicability

  • decision: deferred
  • reason: workflow_run consumer は default branch の workflow 定義で実行されるため、
    本 bootstrap PR 自身では修正版 consumer の genuine runtime verification が成立しない
  • deferred_destination:
    • destination_type: phase
    • destination_ref: post-merge bootstrap verification
  • deferred_verification_condition: >-
    実装: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する #2076 の修正が main に landing 後、fix(contract-review): RVA 欠落を fail-closed に統一 #2070 を最新 main に更新して新規 ci run を発生させ、
    visual-impact-policy-trusted の Download producer artifacts が success、
    Independently re-verify producer artifacts が skipped されず実行され、
    current PR head に対する trusted CheckRun が実検証結果を報告すること

Outcome

.github/workflows/visual-impact-trusted-consumer.yml の gh api 呼び出しが --output フラグではなく正しい方法(stdout リダイレクトなど)で artifact zip を取得するように修正され、visual-impact-policy-trusted CheckRun が producer artifact の download に成功し、実際の独立再検証結果(success/failure)を報告できる状態になっている。

Background

PR #2057(Issue #2048)の impl-review-loop 中、pr-reviewer が visual-impact-policy-trusted CI check が継続的に失敗していることを発見し調査した。原因は .github/workflows/visual-impact-trusted-consumer.yml の producer artifact download ステップで gh api ... --output decision.zip を実行しているが、gh api コマンドは --output フラグをサポートしておらず unknown flag: --output で exit 1 しているという、ワークフローファイル自体のバグである。

このワークフローは workflow_run トリガーのため常に base/default branch(main)のファイルが使われ、PR head 由来ではない。直近複数回の run が全て同一の base head_sha で同じ理由で失敗していることを確認済みで、全 PR に影響する既存インフラバグである(Issue #2019 で導入された check で、branch protection の required_status_checks には含まれていない)。

In Scope

  • .github/workflows/visual-impact-trusted-consumer.yml の Download producer artifacts (untrusted input) ステップにある gh api 呼び出し(decision.zip / evidence.zip の 2 箇所)を、gh api がサポートする方法(例: gh api ... > decision.zip のような stdout リダイレクト、または同等の正しいオプション)に修正する

Out of Scope

Acceptance Criteria

  • AC1: .github/workflows/visual-impact-trusted-consumer.yml の Download producer artifacts (untrusted input) ステップに gh api と --output フラグの組み合わせが存在しない
  • AC2: 同ステップで decision.zip / evidence.zip の取得が gh api がサポートする方法(stdout リダイレクト等)で行われている
  • AC3: 修正後の workflow run で visual-impact-policy-trusted check の Download producer artifacts (untrusted input) ステップが success し、Independently re-verify producer artifacts (base-locked evaluator) ステップが skip されずに実行され、unknown flag: --output エラーが発生しない。CheckRun は対象 PR の current head SHA に bind される(docs/dev/runtime-verification-policy.md の deferred 条件で post-merge に検証、静的には actionlint で構文エラーがないことのみ確認する)。

Verification Commands

AC2 の VC は shell redirect operator(>)自体を VC 行内に literal 記載できない制約のため、
PCRE の \x3e エスケープで > を表現して同一の意図(stdout redirect 修正の検査)を検証する。
AC3 は curl | bash の compound pipe を避け、download → chmod 実行を分離した 3 ステップにする。
AC3 の VC は curl(ネットワーク)・bash(シェル実行)・actionlint(allowlist 外コマンド)を要するため
baseline preflight(sandboxed, allowlist-only)では実行不可能。# baseline-expect: deferred
アノテーションにより baseline preflight ではこの VC を skip し(decision: go,
scope_class: pr_review_only)、実際の actionlint 実行検証は pr-review-judge(実装 PR レビュー時)
の責務とする。

# AC1
$ ! rg -n -- '--output' .github/workflows/visual-impact-trusted-consumer.yml

# AC2
$ rg -Pn 'gh api "repos/\$\{REPO\}/actions/artifacts/\$\{DECISION_ARTIFACT_ID\}/zip"\s*\x3e\s*decision\.zip' .github/workflows/visual-impact-trusted-consumer.yml
$ rg -Pn 'gh api "repos/\$\{REPO\}/actions/artifacts/\$\{EVIDENCE_ARTIFACT_ID\}/zip"\s*\x3e\s*evidence\.zip' .github/workflows/visual-impact-trusted-consumer.yml

# AC3
# baseline-expect: deferred
$ curl -fsSL -o download-actionlint.bash https://raw.githubusercontent.com/rhysd/actionlint/914e7df21a07ef503a81201c76d2b11c789d3fca/scripts/download-actionlint.bash
# baseline-expect: deferred
$ bash download-actionlint.bash 1.7.12
# baseline-expect: deferred
$ ./actionlint .github/workflows/visual-impact-trusted-consumer.yml

(uvx actionlint は使わない。repo の CI は .github/workflows/ci.yml の actionlint job と同じ pinned downloader 経路を使う。)

Allowed Paths

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

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Required Design References

  • .github/workflows/visual-impact-trusted-consumer.yml
  • docs/dev/runtime-verification-policy.md

Scope Delta(該当時のみ記載)

N/A

Delivery Rule

1 Issue = 1 PR。Draft PR を既定とする。

Notes for Reviewer

このワークフローは workflow_run トリガーのため、修正が反映されるのは本 PR マージ後の次回 ci workflow 完了時点であり、本 PR 自体の CI 上ではこの check の green 化を直接確認できない場合がある(actionlint 等の静的検証と目視確認で代替する)。

Scope Collision (C1): related_issue=#2040, #2019, #239, #213, #205; overlapping_paths=.github/workflows/visual-impact-trusted-consumer.yml。non_conflict_reason: いずれも .github/workflows/ や大規模な複数ファイル group の一部として Allowed Paths に本ファイルを含んでいるだけで、本 Issue が対象とする gh api --output バグ修正そのものを扱っていない(#2019 は本ワークフローの新規導入元、#2040/#239/#213/#205 は無関係な広域 Allowed Paths)。edit_intent: 本 Issue は単一ファイルの pinpoint バグ修正のみを行い、他 Issue のスコープとは独立。

Dependency Disposition — PR #2070: PR #2070(Issue #2040 実装、OPEN/Draft、base=main)は既に .github/workflows/visual-impact-trusted-consumer.yml に対して本 Issue と exact-path / exact-intent で重複する2行修正(gh api ... > decision.zip / > evidence.zip)を含む。#2076 を本ファイルの minimal bootstrap landing の authoritative owner とする。#2076 が先に merge された場合、PR #2070 は最新 main へ rebase して同等 hunk を消化する(no-op化)。PR #2070 が先に同修正を main へ landing した場合、#2076 は no-change / superseded として扱う。

Source

dedupe_key: follow-up:squne121/loop-protocol:infra:visual-impact-trusted-consumer-bug
source: post-merge-cleanup (PR #2057 / Issue #2048)

Activity

  1. added
    bug
    workflow
    triage-required
    phase/implementation
    on Aug 11, 2026
  2. squne121 commented on Aug 11, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES / implementation_go = false です。

    gh api --output を stdout redirect に直す実装方向そのものは妥当です。GitHub CLI の現行 gh api に --output は存在せず、レスポンスは stdout に出力されます。artifact download REST API は ZIP download endpoint を提供します。 ([GitHub CLI]1)

    ただし #2076 は、実装コードより Issue contract 側に merge-blocking な欠陥があります。特に Verification Commands は現状のままだと「正しい修正を FAIL させ、壊れた修正を PASS させ得る」状態です。

    P0 — Runtime Verification Applicability 欠落で canonical executor が着手不能

    #2076 は issue_kind: implementation ですが、本文に canonical ## Runtime Verification Applicability がありません。

    これは単なる文書不足ではありません。current implement-issue はこのセクションが無ければ 実装開始せず human escalation すると明記しています。さらに SSOT は全 Issue に not_applicable | immediate | deferred の明示を要求しています。

    この Issue は runtime verification 自体が不要なのではなく、workflow_run が default branch 上の workflow 定義を使うため 修正版を merge するまで genuine runtime verification が成立しないケースです。GitHub 公式仕様でも workflow_run の GITHUB_SHA / GITHUB_REF は default branch、workflow file も default branch に存在する必要があります。 ([GitHub Docs]2)

    したがって not_applicable ではなく、例えば以下の deferred が整合します。

    ## Runtime Verification Applicability
    
    - decision: deferred
    - reason: workflow_run consumer は default branch の workflow 定義で実行されるため、
      本 bootstrap PR 自身では修正版 consumer の genuine runtime verification が成立しない
    - deferred_destination:
        - destination_type: phase
        - destination_ref: post-merge bootstrap verification
    - deferred_verification_condition: >-
        #2076 の修正が main に landing 後、#2070 を最新 main に更新して新規 ci run を発生させ、
        visual-impact-policy-trusted の Download producer artifacts が success、
        Independently re-verify producer artifacts が skipped されず実行され、
        current PR head に対する trusted CheckRun が実検証結果を報告すること

    P0 — AC1〜AC3 の Verification Commands が検証器として成立していない

    現行 VC は3本とも問題があります。

    AC1 は exit semantics が逆です。

    rg -c -- '--output' ...

    修正後は「0 matches」が期待値ですが、ripgrep は no-match を exit 1 とします。通常の fail-fast VC runner では、正しい修正ほど FAIL します。 ([GitHub]3)

    AC2 は broken/fixed を区別できません。

    rg -n 'gh api.*artifacts.*zip' ...

    これは現在の壊れた gh api ... --output ... でも一致するので、AC2 の「supported method で取得」という主張を検証していません。

    AC3 の actionlint は runtime 成功の代替証拠になりません。 actionlint は workflow syntax、expression、action inputs、ShellCheck 等の静的 checker であり、外部 CLI の任意フラグ互換性を実行検証するものではありません。 ([GitHub]4)

    しかもリポジトリ自身の履歴が反例になっています。trusted consumer を導入した PR #2045 は actionlint ... zero findings を記録して merge されましたが、その結果 main に残った workflow が今回の gh api --output failure を起こしています。

    最低でも静的 VC は次程度まで強くすべきです。

    # AC1: unsupported flag が存在しない
    ! rg -n -- '--output' .github/workflows/visual-impact-trusted-consumer.yml
    
    # AC2: intended minimal fix を直接検査
    rg -F 'gh api "repos/${REPO}/actions/artifacts/${DECISION_ARTIFACT_ID}/zip" > decision.zip' \
      .github/workflows/visual-impact-trusted-consumer.yml
    
    rg -F 'gh api "repos/${REPO}/actions/artifacts/${EVIDENCE_ARTIFACT_ID}/zip" > evidence.zip' \
      .github/workflows/visual-impact-trusted-consumer.yml

    actionlint は追加の syntax gate として残して構いませんが、AC3 runtime evidence の代用にはしない方がよいです。

    P1 — uvx actionlint は repository-standard の actionlint 実行方法ではない

    #2076 は、

    uvx actionlint ...

    を指定しています。

    uvx は原則としてコマンド名と同名の Python package を解決する仕組みです。一方、公式 actionlint は Go binary として配布され、公式 installation は binary/Homebrew/go install 等です。Python wrapper は別名 actionlint-py です。 ([Astral Docs]5)

    そしてこの repository の current CI は、actionlint の公式 downloader を commit pin し、1.7.12 をインストールして actionlint を直接実行しています。

    Issue VC も repository-standard と揃えるべきです。少なくとも uvx actionlint という新しい取得経路を canonical VC に持ち込む理由はありません。

    P1 — Scope Collision 記述が current repository state と矛盾

    #2076 は、

    #2040 は Allowed Paths が重なるだけで gh api --output bug 自体は扱っていない

    としています。

    しかし現在 open / Draft の PR #2070(#2040 実装) は、この trusted workflow failure を明示的に扱っています。PR 自身も gh api --output failure に対する minimal workflow fix を含むと記録しています。

    さらに OWNER コメントでは既に、

    という方針が明示されています。

    つまり #2076 は「独立した新規修正」ではなく、事実上 #2070 から切り離す bootstrap authority と定義するのが正確です。

    Dependency Dispositions には最低でも次を固定した方がよいです。

    - PR #2070:
      exact-path / exact-intent overlap。
      #2076 を minimal bootstrap landing の authoritative owner とする。
      #2076 が先に merge された場合、#2070 は latest main へ更新して equivalent hunk を消化する。
      #2070 が先に同修正を main へ landing した場合、#2076 は no-change / superseded とする。
    

    これがないと、二つの implementation Issue/PR が同一2行を別々に所有することになります。

    P1 — AC3 は「CheckRun が存在する」ではなく step-level 到達性を要求すべき

    trusted consumer は artifact download failure 後でも failure CheckRun を発行できます。そのため、

    visual-impact-policy-trusted が failure を返した

    だけでは、独立 evaluator に到達した証拠になりません。

    AC3 の post-merge condition は少なくとも、

    1. Download producer artifacts (untrusted input) = success
    2. Independently re-verify producer artifacts (base-locked evaluator) が skipped ではない
    3. unknown flag: --output がない
    4. CheckRun が対象 PR の current head SHA に bind
    5. valid producer fixture/run なら success

    まで固定すべきです。

    これは Issue の Outcome「download に成功し、実際の独立再検証結果を報告する」を機械的に検証可能な形へ落としたものです。

    P2 — untrusted artifact の workspace 展開は別 hardening Issue 候補

    今回の pinpoint bootstrap では stdout redirect の2行修正に留める方が blast radius は小さいです。

    ただし長期的には、GitHub 公式の workflow_run artifact 使用例は、untrusted artifact を workspace に展開せず ${{ runner.temp }}/artifacts に置くよう明示しています。さらに gh run download <run-id> -n <artifact> -D <dir> という artifact 専用 CLI も存在します。 ([GitHub Docs]2)

    したがって後続 hardening としては、

    manual REST + ZIP + unzip
            ↓
    gh run download または actions/download-artifact
            ↓
    $RUNNER_TEMP 配下
    

    を検討する価値があります。ただし、これは #2076 の bootstrap scope に混ぜるべきではありません。#2019 が作った trust boundary を直している最中なので、今回は変更面積を増やさない方が安全です。

    推奨する修正後の Issue 方針

    実装差分は #2070 に既に存在する2行相当をそのまま最小 bootstrap として採用し、Issue contract だけ以下を直すのが最短です。

    1. Runtime Verification Applicability: deferred を追加。
    2. AC3 から「actionlint で runtime verification の代替可」を削除。
    3. AC1 の rg exit semantics を修正。
    4. AC2 を exact supported download form の assertion に変更。
    5. actionlint VC を repository-standard の pinned lane に合わせる。
    6. fix(contract-review): RVA 欠落を fail-closed に統一 #2070 を explicit overlap / bootstrap source として Dependency Disposition に追加。
    7. post-merge の destination を「fix(contract-review): RVA 欠落を fail-closed に統一 #2070 rebase後の fresh CI → trusted consumer」まで固定。
    8. artifact extraction の $RUNNER_TEMP 化は別 hardening とする。

    この状態なら Issue refinement 後は GO です。実装自体について新しい設計を発明する必要はありません。現在の主要リスクは2行のコードではなく、bootstrap の ownership と verification authority が Issue contract に正しく表現されていないことです。

    なお branch protection の live 設定は GitHub App から 403 になり、visual-impact-policy-trusted が現在も non-required かは今回独立検証できませんでした。その点だけは #2076 本文の記載を source of record として扱っています。

  3. squne121 commented on Aug 11, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    結果: approved(3 iteration、review-issue VERDICT: approve、validator: valid)

    実施内容

    1. anchor comment(OWNER, https://github.com/squne121/loop-protocol/issues/2076#issuecomment-5248646011)を対象に preflight を実行。investigation_policy.required: true / web_research_policy.required: true を検出。
    2. web-researcher(AGY grounded_research)は quota 枯渇で外部仕様の直接検証に失敗。codebase-investigator(AGY local_asset_research)も prompt-only mode 制約で gh pr view / gh issue view 等の実行が禁止され、fact-check が NOT_CHECKABLE となった。このため control-plane が直接 repo 事実確認を実施し、OWNER の指摘(gh api --output バグの実在、PR fix(contract-review): RVA 欠落を fail-closed に統一 #2070 の overlap、actionlint pinned binary 運用、関連 Issue の状態)を全て repo 上の証跡で確認した。
    3. issue-reviewer による初回レビュー(VERDICT: needs-fix、5 blockers): Runtime Verification Applicability セクション欠落、Required Design References 空、AC1〜AC3 の Verification Commands 不備、Scope Collision 記述の PR fix(contract-review): RVA 欠落を fail-closed に統一 #2070 未反映。
    4. iteration 1: issue-editor が anchor comment の指摘に沿って本文を全面修正(RVA セクション追加・Required Design References 追加・AC1〜AC3 VC 書き換え・PR fix(contract-review): RVA 欠落を fail-closed に統一 #2070 の Dependency Disposition 追記)。
    5. iteration 2: 再レビューで AC3 の curl/bash/actionlint が VC preflight allowlist 外と判定(3 blockers)。# baseline-expect: deferred annotation を追加。
    6. iteration 3: annotation のスコープが最初の $ コマンド行にしか適用されていなかったため、3つの $ コマンド行それぞれに annotation を個別配置し修正(2 blockers → 0 blockers)。
    7. 最終レビュー: check_issue_contract.py / contract_readiness_check.py 全 pass、VERDICT: approve、validate_review_compact_output.py で valid 判定済み。

    最終状態

    • body sha256: sha256:d57bce21e1e8c1592fc50dbf4f9c00fc14e75638bbe9c0bc3df790f5d4432f0d
    • GitHub 上の実本文と独立 readback で一致確認済み
    • follow-up materialization candidates: なし(parent_issue: none、単独 implementation issue)
    • scope_delta_decision.status: fail_closed(anchor comment は scope reframe ではなく通常の review feedback)
    • scope_signal_guard.triggered: false
    schema_version: loop_handoff_result/v1
    issue_number: 2076
    loop_outcome: approved
    reviewed_body_sha256: sha256:d57bce21e1e8c1592fc50dbf4f9c00fc14e75638bbe9c0bc3df790f5d4432f0d
    issue_kind: implementation
    next_step: impl-review-loop
    implementation_allowed: true
    iterations: 3
  4. added
    agent/implementer
    and removed
    triage-required
    on Aug 11, 2026
  5. squne121 commented on Aug 11, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-11T05:30:24Z)

  6. squne121 commented on Aug 11, 2026

    @squne121
    OwnerAuthor

    impl-review-loop 完了報告

    PR #2085(Draft, head 9865e529fc6b155ca519ec10febf243be076dc3c)が pr-reviewer APPROVE を取得し、必須 CI(typecheck / lint / test / build / python-test / validate-generated-artifact)が全て green です。

    判定サマリー

    • reviewer_verdict: APPROVE(blockers: なし)
    • live mergeability: mergeable: MERGEABLE, merge_state_status: BLOCKED(Draft PR のため。実 Git conflict ではない)
    • route_loop_verdict_v2() route: fail_closed(reason: merge_state_status_blocked_not_conflict_defer_to_ci_evaluator。human escalation ではなく、Draft 状態は current-head required-CI evaluator の判定に委ねる)
    • visual-impact-policy-trusted のみ failure ですが、branch protection の required_status_checks 対象外であり、Issue/PR 本文双方に deferred と明記済みの既知挙動です(workflow_run トリガーのため本 PR 自体では修正版 consumer の genuine runtime verification が成立しない)。

    対応した副次課題

    • PR本文の日本語比率不足(4 prose block)を修正
    • .github/workflows/* の変更に伴う visual-surface dependency registry の required visual-impact policy check(VISUAL_IMPACT_DECLARATION_V1 宣言ブロック欠落)を、baseline diff なしの verified_unchanged disposition で解消

    次のアクション(人間判断待ち)

    PR #2085 を Ready for review に変更し、マージしてください。マージ後は Issue 本文の deferred_verification_condition(#2070 を最新 main に更新して新規 CI run を発生させ、visual-impact-policy-trusted の実検証結果を確認)に従い post-merge の runtime 検証を行ってください。

    IMPL_REVIEW_LOOP_RESULT_V1:
    status: draft_pr_ready
    pr_url: #2085
    reviewed_head_sha: 9865e52
    iterations: 1

  7. squne121 commented on Aug 11, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-08-11T08:29:51Z)

    • status: ok
    • 次アクション: なし(parent issue なし、superseded PR なし、follow-up issue は起票済み)
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:pr/2085:visual-impact-trusted-verifier-bypass-p0"
          status: reused_open
          issue:
            number: 2090
            url: "https://github.com/squne121/loop-protocol/issues/2090"
          reason: "PR #2085 レビューコメント時点で既に issue-creator 経由で起票済み。重複起票なし。"
    
      note_only_observations: []

    worktree/branch(worktree-issue-2076-visual-impact-trusted-consumer-yml-gh-ap)はクリーンアップ済みです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerbugphase/implementationworkflow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions