Skip to content

実装: root GitHub auth probe を対象host限定(--active --hostname github.com)に変更する #2404

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "root GitHub auth probe が github.com の active account の認証状態だけを検査し、無関係な host または inactive account の認証不整合で workflow を誤って block しないようにする。対象 repository の read capability 判定を担当する既存の _github_repo_read_probe も同一の github.com host に固定し、composite capability 全体で無関係な host(例: GH_HOST 環境変数由来)が再侵入しないようにする。"
change_kind: code

Parent Issue

なし

Parent Goal Ref

  • Goal: N/A(単独改善のため親 Issue なし)
  • Desired Destination: N/A

Current Validated Scope

  • scripts/claude-gpt/workflow_capability_preflight.py の _github_auth_probe が実行する gh auth status 呼び出しコマンドを gh auth status --active --hostname github.com に変更する

Remaining Parent Gaps

なし

Outcome

scripts/claude-gpt/workflow_capability_preflight.py の _github_auth_probe(281行目付近)が実行する GitHub auth probe コマンドが ["gh", "auth", "status", "--active", "--hostname", "github.com"] に変更され、github.com の active account 認証状態のみを検査するようになった状態。同ファイルの _github_repo_read_probe(290行目付近)が実行する gh repo view コマンドの対象引数が repo(例: squne121/loop-protocol)から f"github.com/{repo}" へ変更され、ambient default host(GH_HOST 環境変数の影響を含む)ではなく github.com に明示的に固定されるようになった状態。これにより auth probe と repo-read probe の両方が同一の github.com host のみを検査する composite capability となる。current main(PR #2410 マージ後)に存在する scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py::test_root_to_producer_transports_deadline_with_fake_external_clis の exact fake-gh invocation trace assertion が、変更後の argv [["auth", "status", "--active", "--hostname", "github.com"], ["repo", "view", "github.com/squne121/loop-protocol", "--json", "name"], ["api", "--hostname", "github.com", "repos/squne121/loop-protocol", "--jq", "{name}"]] で PASS すること、および既存の scripts/claude-gpt/tests/test_workflow_capability_preflight.py / scripts/claude-gpt/tests/test_actor_scoped_capability_probe.py が変更後も PASS していることで完了を判定する。

Runtime Verification Applicability

decision: immediate
reason: >
  root capability preflight が外部 gh subprocess へ渡す argv を変更するため。
  current main に存在する hermetic root-to-producer boundary test で
  exact fake-gh invocation trace を検証できる。
applicable_acs:
  - AC1
  - AC2
  - AC5
execution_environment: >
  Deterministic pytest with the existing fake gh leaf CLI.
  No live GitHub network, credentials, or user account state required.
skip_conditions: >
  なし。本変更は常に hermetic pytest(fake gh leaf CLI)で検証可能であり、
  live GitHub 環境・credential が必要になるケースは存在しない。
fallback_policy: >
  runtime verification(AC1/AC2/AC5 の pytest 実行)が失敗した場合は fallback を設けず、
  Stop Conditions に従い実装を完了扱いにしない。
artifact_requirements: >
  AC1/AC2/AC3/AC5 の pytest 実行結果(exit code・出力)と、AC4 の `gh --version` 出力を
  PR evidence として記録する。

In Scope

  • _github_auth_probe 内の gh auth status subprocess 呼び出し引数を ["gh", "auth", "status", "--active", "--hostname", "github.com"] に変更する
  • 変更に伴い必要な場合、同ファイル内のこのprobeに関するdocstring/コメント(17行目・29行目・327行目付近の gh auth status 記述)を更新する
  • scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py 内の test_root_to_producer_transports_deadline_with_fake_external_clis の exact fake-gh trace 期待値の先頭要素を ["auth", "status"] から ["auth", "status", "--active", "--hostname", "github.com"] へ更新する(fixture 自体は args[:2] == ["auth", "status"] で受理するため変更不要)
  • _github_repo_read_probe 内の gh repo view subprocess 呼び出し引数を ["gh", "repo", "view", repo, "--json", "name"] から ["gh", "repo", "view", f"github.com/{repo}", "--json", "name"] に変更する(GitHub CLI は HOST/OWNER/REPO 形式を正式にサポートする)
  • 上記に伴い、同じ exact fake-gh trace 期待値の2番目の要素を ["repo", "view", "squne121/loop-protocol", "--json", "name"] から ["repo", "view", "github.com/squne121/loop-protocol", "--json", "name"] へ更新する(新しい fixture・env sanitizer・host abstraction は追加しない)

Out of Scope

Acceptance Criteria

  • AC1: _github_auth_probe が subprocess へ渡すコマンド配列が ["gh", "auth", "status", "--active", "--hostname", "github.com"] である
  • AC2: scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py::test_root_to_producer_transports_deadline_with_fake_external_clis の fake-gh exact trace が次の順序で PASS する: [["auth", "status", "--active", "--hostname", "github.com"], ["repo", "view", "github.com/squne121/loop-protocol", "--json", "name"], ["api", "--hostname", "github.com", "repos/squne121/loop-protocol", "--jq", "{name}"]]
  • AC5: _github_repo_read_probe が subprocess へ渡すコマンド配列が ["gh", "repo", "view", "github.com/squne121/loop-protocol", "--json", "name"] である(AC2 の exact trace 2番目の要素と同一証跡)
  • AC3: 既存テストスイート scripts/claude-gpt/tests/test_workflow_capability_preflight.py および scripts/claude-gpt/tests/test_actor_scoped_capability_probe.py が全件 PASS する
  • AC4: 実利用環境の GitHub CLI が --active フラグの最低要求バージョンである 2.57.0 以上であることを gh --version で確認し、PR evidence に記録する(コード上の互換 fallback は追加しない)

Verification Commands

# AC4
# preflight-scope: pr_review_only
$ gh --version

# AC1
$ uv run --locked pytest scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py::test_root_to_producer_transports_deadline_with_fake_external_clis -q

# AC2
$ uv run --locked pytest scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py::test_root_to_producer_transports_deadline_with_fake_external_clis -q

# AC3
$ uv run --locked pytest scripts/claude-gpt/tests/test_workflow_capability_preflight.py scripts/claude-gpt/tests/test_actor_scoped_capability_probe.py scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py -q

# AC5
$ uv run --locked pytest scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py::test_root_to_producer_transports_deadline_with_fake_external_clis -q

補助確認(Acceptance Criteria の証拠にはしない):

$ grep -n "auth.*status.*--active.*--hostname.*github.com" scripts/claude-gpt/workflow_capability_preflight.py

Allowed Paths

  • scripts/claude-gpt/workflow_capability_preflight.py
  • scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 実行環境の GitHub CLI が 2.57.0 未満であることが判明した場合(production への互換コード追加ではなく、環境更新または Issue 再検討で対応する)

Required Skills

なし

Required Design References

Scope Delta(任意)

Scope Delta (OWNER trusted anchor, PR #2413 敵対的レビュー): PR #2413 の head c18818c に対する OWNER REQUEST_CHANGES(https://github.com/squne121/loop-protocol/pull/2413#issuecomment-5465790972)を受け、Out of Scope から _github_repo_read_probe の変更除外を撤回し、host 引数を f"github.com/{repo}" に固定する変更のみを In Scope へ追加した(AC5 / Allowed Paths は既存の workflow_capability_preflight.py に含まれるため変更なし)。理由: auth probe のみを github.com に固定しても、同一 composite capability の repo-read probe が ambient default host(GH_HOST 環境変数の影響を含む)のままでは、無関係な host の認証不整合による誤 block を防ぐという本 Issue の目的が未達成のため。

Scope Collision Note

Scope Collision (C1): related_issue=#2401 (merged via PR #2410), #420, #205; overlapping_paths=scripts/claude-gpt/workflow_capability_preflight.py.

Notes for Reviewer

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Aug 29, 2026
  2. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    敵対的レビュー結果

    verdict: REQUEST_CHANGES
    reviewed_main_sha: df7edd65c37f9ce4a4491599ad624b1ce7b10328
    production_direction: broadly_sound
    issue_contract: not_implementation_ready
    blocking_findings:
      P0: 1
      P1: 1
    conditional_findings:
      P1: 1
    non_blocking_findings:
      P2: 2

    実装しようとしているコマンド変更自体は正しいです。
    ただし、Issue #2404 は作成後に main が更新された結果、現在は Allowed Paths・Acceptance Criteria・Verification Commands が current main と矛盾しています。現状の契約のまま実装を開始すると、「既存の恒久回帰テストを壊す」か「Allowed Paths 違反で停止する」かの二択になります。

    Issue #2404 は現在も open、コメントなしで、作成直後から本文が更新されていません。一方、その後に Issue #2401 が完了し、PR #2410 が main にマージされています。Issue #2404 の Scope Collision Note に残っている #2401 (OPEN) と「どちらを先にマージしても影響しない」という記述は、現在の状態では成立していません。

    Findings

    ID | 重要度 | 指摘 | 判定 -- | -- | -- | -- P0-1 | P0 | PR #2410 が追加した exact-argv テストの更新が必要なのに、そのテストファイルが Allowed Paths 外 | 実装着手前に Issue 修正必須 P1-1 | P1 | 現在の Verification Commands は変更対象の実 subprocess argv を証明せず、false-green になり得る | close evidence として不十分 P1-2 | 条件付き P1 | --active の最低 GitHub CLI バージョンが契約されていない | 実環境の gh が 2.57.0 以上なら解消 P2-1 | P2 | Goal が「対象リポジトリの認証状態だけ」と過剰表現している | host/account scope に修正 P2-2 | P2 | Scope Collision Note が #2401 の完了・PR #2410 の影響を反映していない | 記録更新のみ。新しいロックや直列化は不要

    P0-1: current main では Allowed Paths と既存テストが正面衝突する

    現在の production 実装は次の argv を発行しています。

    ["gh", "auth", "status"]

    Issue #2404 はこれを次へ変える契約です。

    ["gh", "auth", "status", "--active", "--hostname", "github.com"]

    ここまでは明確です。

    しかし、Issue #2404 の作成後にマージされた PR #2410 は、real root consumer から real producer subprocess を通し、fake gh wrapper が観測した三つの CLI 呼び出しを exact argv / exact order で照合する恒久回帰テストを追加しています。現在の期待値は次です。

    assert gh_calls == [
        ["auth", "status"],
        ["repo", "view", _REPO, "--json", "name"],
        ["api", "--hostname", "github.com", f"repos/{_REPO}", "--jq", "{name}"],
    ]

    したがって production の一行だけを Issue #2404 の指定どおり変えると、このテストは決定的に失敗します。これは一般的な「念のためテストを追加した方がよい」という話ではなく、現在の exact-list assertion と変更後の literal argv が一致しないという直接的な衝突です。

    ところが Issue #2404 の Allowed Paths は次の一ファイルだけです。

    scripts/claude-gpt/workflow_capability_preflight.py

    さらに Stop Conditions は Allowed Paths 外の変更が必要なら停止するよう要求しています。つまり実装者は、正しく current main を確認した時点で停止するしかありません。

    必須修正

    Allowed Paths に次を追加してください。

    scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py

    そして exact trace の先頭だけを変更します。

    assert gh_calls == [
        ["auth", "status", "--active", "--hostname", "github.com"],
        ["repo", "view", _REPO, "--json", "name"],
        ["api", "--hostname", "github.com", f"repos/{_REPO}", "--jq", "{name}"],
    ]

    共有 fake gh fixture は args[:2] == ["auth", "status"] で受理しているため、追加フラグを許容します。fixture の変更も、新しい fake CLI も、新しい共通ハーネスも不要です。

    この exact trace は偶然追加されたものではありません。PR #2410 では OWNER review が一度 false-green を検出し、root→producer の deadline transport と fake CLI の exact argv/order を実際に観測するよう REQUEST_CHANGES を出した結果として追加されています。今回それを Verification から落とすのは、直前のレビュー修正を逆行させます。


    P1-1: 現行 Verification は変更対象を証明していない

    Issue #2404 の AC1 は、次の grep です。

    grep -n "auth.*status.*--active.*--hostname.*github.com" \
      scripts/claude-gpt/workflow_capability_preflight.py

    これは production の subprocess argv を検証していません。Issue 自身が同じファイル内の docstring/comment 更新を許可しているため、例えばコメントに対象文字列を書き、実 argv を従来のまま残しても AC1 が PASS します。

    AC2 の test_workflow_capability_preflight.py も exact argv の証明にはなりません。同ファイルの real-subprocess test は @pytest.mark.github_live で、通常の pytest 設定では deselect されます。それ以外のテストは、root probe を monkeypatch するか、結果の schema・decision を確認するだけで、_github_auth_probe の argv を固定していません。

    AC3 の test_actor_scoped_capability_probe.py はさらに明確で、共通 _assess() helper が _github_auth_probe と _github_repo_read_probe を monkeypatch しています。そこで捕捉している subprocess は controlled_github_read の gh api 呼び出しであり、今回変える root auth argv ではありません。

    その結果、次の状態が起こり得ます。

    AC1 grep                           PASS
    test_workflow_capability_preflight PASS
    test_actor_scoped_capability_probe PASS
    current-main exact argv test       FAIL

    Runtime Verification Applicability の修正

    現在の not_applicable は不適切です。これは外部 CLI subprocess の argv と、その exit status が workflow block に変換される経路を変更します。直前の Issue #2401 でも、同じ producer 境界について decision: immediate、かつ「fake external leaf CLI を使う hermetic pytest、live GitHub・credential 不要」と定義していました。

    次のようにするのが妥当です。

    decision: immediate
    reason: >
      root capability preflight が外部 gh subprocess へ渡す argv を変更するため。
      current main に存在する hermetic root-to-producer boundary test で
      exact fake-gh invocation trace を検証できる。
    execution_environment: >
      Deterministic pytest with the existing fake gh leaf CLI.
      No live GitHub network, credentials, or user account state required.

    これはハーネス強化ではありません。既にある、今回の変更をちょうど観測できる一件のテストを更新して使うだけです。


    P1-2: --active は GitHub CLI 2.57.0 以降という前提が抜けている

    GitHub CLI の公式マニュアルによれば、裸の gh auth status は既知の host/account を検査し、いずれかに問題があると非ゼロ終了します。--hostname は host を、--active は active account のみに検査対象を絞ります。公式実装でも opts.Active の場合は active entry の検査後に continue し、inactive users のループへ入りません。したがって Issue #2404 の技術的な方向性は正しいです。(GitHub CLI)

    ただし --active は GitHub CLI 2.57.0 で追加されたフラグです。

    2.57.0 未満の gh ではこのフラグが存在しないため、該当環境では非ゼロ終了になります。現在の producer は subprocess の非ゼロをすべて PROBE_NONZERO_EXIT とし、最終的に github:auth_unavailable として workflow を block します。つまり「無関係な account による誤 block を減らす」変更が、古い CLI では「すべての workflow を block する」変更になります。

    個人趣味開発であることを考えると、ここで production に version parser、fallback argv、二段 probe、互換レイヤーを追加する必要はありません。必要なのは次だけです。

    gh --version
    • 現在の実利用環境が 2.57.0 以上なら、その結果を PR evidence に残してこの finding は解消。

    • 2.57.0 未満なら GitHub CLI を更新。

    • コード上の fallback は追加しない。

    Issue の Notes または Preconditions に次を一行入れる程度で十分です。

    runtime_precondition: "GitHub CLI >= 2.57.0 (`gh auth status --active` support)"

    P2-1: 「対象リポジトリの認証状態だけ」は正確ではない

    現在の Goal は次の趣旨です。

    root GitHub auth probe が対象リポジトリの認証状態だけを検査する

    しかし gh auth status --active --hostname github.com が検査するのは、github.com の active account/token の認証状態です。リポジトリへの read capability は、その後の別 probe である次の呼び出しが確認します。

    ["gh", "repo", "view", repo, "--json", "name"]

    したがって、Goal は次のようにした方が producer/consumer 境界を正確に表します。(GitHub CLI)

    goal_ref: >
      root GitHub auth probe が github.com の active account の認証状態だけを検査し、
      無関係な host または inactive account の認証不整合で workflow を誤って
      block しないようにする。対象 repository の read capability 判定は
      既存の _github_repo_read_probe が引き続き担当する。

    これは実装変更ではなく、将来「この auth probe 単独で repository access まで証明している」と誤解されないための契約修正です。


    P2-2: Scope Collision Note を current main に合わせる

    現在の記述には、少なくとも次の二点で drift があります。

    related_issue=#2401 (OPEN)
    dependency ordering: 依存関係なし
    どちらを先にマージしても他方に影響しない

    #2401 は既に completed で、PR #2410 が main に exact-argv test を追加したため、実際には #2404 の Allowed Paths と Verification に影響しています。

    推奨する置き換えは次です。

    - #2401 / PR #2410 は merge 済み。
    - PR #2410 が追加した
      scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py
      に root auth probe の exact argv assertion があるため、本 Issue で期待値更新が必要。
    - #420 / #205 は scripts/** という broad path overlap のみで、
      _github_auth_probe の同一処理に対する競合は確認されていない。
    - 実装開始時に current main へ rebase し、同一 hunk の実競合だけを確認する。

    #420 / #205 を理由に作業を直列化したり、ファイル単位の排他ロックや新しい overlap harness を追加したりする必要はありません。


    推奨する Issue 契約の最小修正版

    Allowed Paths

    scripts/claude-gpt/workflow_capability_preflight.py
    scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py

    fixture ファイルは追加しません。

    Acceptance Criteria

    AC1:
      _github_auth_probe が subprocess へ
      ["gh", "auth", "status", "--active", "--hostname", "github.com"]
      を渡す。
    

    AC2:
    test_root_to_producer_transports_deadline_with_fake_external_clis の
    fake-gh exact trace が次の順序である。

    [
    ["auth", "status", "--active", "--hostname", "github.com"],
    ["repo", "view", "squne121/loop-protocol", "--json", "name"],
    ["api", "--hostname", "github.com",
    "repos/squne121/loop-protocol", "--jq", "{name}"]
    ]

    AC3:
    既存の capability-preflight focused suites が PASS する。

    AC4:
    実利用環境の GitHub CLI が 2.57.0 以上であることを
    gh --version で確認し、PR evidence に記録する。

    Verification Commands

    gh --version

    uv run --locked pytest
    scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py::test_root_to_producer_transports_deadline_with_fake_external_clis
    -q

    uv run --locked pytest
    scripts/claude-gpt/tests/test_workflow_capability_preflight.py
    scripts/claude-gpt/tests/test_actor_scoped_capability_probe.py
    scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py
    -q

    grep は補助確認として残しても構いませんが、Acceptance Criteria の証拠にはしない方がよいです。


    採用してよい設計判断

    • --active --hostname github.com の採用は正しい。

    • current project が github.com/squne121/loop-protocol 固定である限り、host の環境変数化は不要。

    • root auth と repository read を別 probe のまま保つのは正しい。

    • actor-scoped / controlled probe へ変更を波及させないのも正しい。

    • 非ゼロ終了を fail-closed とする既存方針は維持してよい。

    • --json へ変更してはいけません。公式マニュアル上、JSON mode は認証不整合があっても原則 exit zero になるため、現在の exit-status probe の目的を損ないます。(GitHub CLI)

    • 新しい security sandbox、credential abstraction、version framework、live-account test、共通 CLI harness は不要。

    • 既存の exact root→producer test 一件を更新するのが最も小さく、最も強い修正です。

    最終判定

    Issue #2404 の意図と production 変更案は approve です。
    一方、現行 Issue 契約は current main に追随していないため、現状のままでは Implementation Ready ではありません。

    マージ可能条件は次の三点です。

    1. test_capability_preflight_review_fixes.py を Allowed Paths に追加する。

    2. grep 中心の Verification を、既存 exact root→producer test 中心へ置き換える。

    3. 実環境の gh >= 2.57.0 を確認し、コード上の追加互換ハーネスは作らない。

    なお、今回のテスト失敗判定はローカル pytest の実行結果ではなく、current-main にある exact expected list と変更後 argv の静的比較に基づきます。ただし比較対象が完全一致 assertion なので、該当テストが変更前のまま実行された場合に失敗する点は決定的です。

    # 敵対的レビュー結果
    verdict: REQUEST_CHANGES
    reviewed_main_sha: df7edd65c37f9ce4a4491599ad624b1ce7b10328
    production_direction: broadly_sound
    issue_contract: not_implementation_ready
    blocking_findings:
      P0: 1
      P1: 1
    conditional_findings:
      P1: 1
    non_blocking_findings:
      P2: 2

    実装しようとしているコマンド変更自体は正しいです。
    ただし、Issue #2404 は作成後に main が更新された結果、現在は Allowed Paths・Acceptance Criteria・Verification Commands が current main と矛盾しています。現状の契約のまま実装を開始すると、「既存の恒久回帰テストを壊す」か「Allowed Paths 違反で停止する」かの二択になります。

    Issue #2404 は現在も open、コメントなしで、作成直後から本文が更新されていません。一方、その後に Issue #2401 が完了し、PR #2410 が main にマージされています。Issue #2404 の Scope Collision Note に残っている #2401 (OPEN) と「どちらを先にマージしても影響しない」という記述は、現在の状態では成立していません。

    Findings

    ID 重要度 指摘 判定
    P0-1 P0 PR #2410 が追加した exact-argv テストの更新が必要なのに、そのテストファイルが Allowed Paths 外 実装着手前に Issue 修正必須
    P1-1 P1 現在の Verification Commands は変更対象の実 subprocess argv を証明せず、false-green になり得る close evidence として不十分
    P1-2 条件付き P1 --active の最低 GitHub CLI バージョンが契約されていない 実環境の gh が 2.57.0 以上なら解消
    P2-1 P2 Goal が「対象リポジトリの認証状態だけ」と過剰表現している host/account scope に修正
    P2-2 P2 Scope Collision Note が #2401 の完了・PR #2410 の影響を反映していない 記録更新のみ。新しいロックや直列化は不要

    P0-1: current main では Allowed Paths と既存テストが正面衝突する

    現在の production 実装は次の argv を発行しています。

    ["gh", "auth", "status"]

    Issue #2404 はこれを次へ変える契約です。

    ["gh", "auth", "status", "--active", "--hostname", "github.com"]

    ここまでは明確です。

    しかし、Issue #2404 の作成後にマージされた PR #2410 は、real root consumer から real producer subprocess を通し、fake gh wrapper が観測した三つの CLI 呼び出しを exact argv / exact order で照合する恒久回帰テストを追加しています。現在の期待値は次です。

    assert gh_calls == [
        ["auth", "status"],
        ["repo", "view", _REPO, "--json", "name"],
        ["api", "--hostname", "github.com", f"repos/{_REPO}", "--jq", "{name}"],
    ]

    したがって production の一行だけを Issue #2404 の指定どおり変えると、このテストは決定的に失敗します。これは一般的な「念のためテストを追加した方がよい」という話ではなく、現在の exact-list assertion と変更後の literal argv が一致しないという直接的な衝突です。

    ところが Issue #2404 の Allowed Paths は次の一ファイルだけです。

    scripts/claude-gpt/workflow_capability_preflight.py
    

    さらに Stop Conditions は Allowed Paths 外の変更が必要なら停止するよう要求しています。つまり実装者は、正しく current main を確認した時点で停止するしかありません。

    必須修正

    Allowed Paths に次を追加してください。

    scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py
    

    そして exact trace の先頭だけを変更します。

    assert gh_calls == [
        ["auth", "status", "--active", "--hostname", "github.com"],
        ["repo", "view", _REPO, "--json", "name"],
        ["api", "--hostname", "github.com", f"repos/{_REPO}", "--jq", "{name}"],
    ]

    共有 fake gh fixture は args[:2] == ["auth", "status"] で受理しているため、追加フラグを許容します。fixture の変更も、新しい fake CLI も、新しい共通ハーネスも不要です。

    この exact trace は偶然追加されたものではありません。PR #2410 では OWNER review が一度 false-green を検出し、root→producer の deadline transport と fake CLI の exact argv/order を実際に観測するよう REQUEST_CHANGES を出した結果として追加されています。今回それを Verification から落とすのは、直前のレビュー修正を逆行させます。


    P1-1: 現行 Verification は変更対象を証明していない

    Issue #2404 の AC1 は、次の grep です。

    grep -n "auth.*status.*--active.*--hostname.*github.com" \
      scripts/claude-gpt/workflow_capability_preflight.py

    これは production の subprocess argv を検証していません。Issue 自身が同じファイル内の docstring/comment 更新を許可しているため、例えばコメントに対象文字列を書き、実 argv を従来のまま残しても AC1 が PASS します。

    AC2 の test_workflow_capability_preflight.py も exact argv の証明にはなりません。同ファイルの real-subprocess test は @pytest.mark.github_live で、通常の pytest 設定では deselect されます。それ以外のテストは、root probe を monkeypatch するか、結果の schema・decision を確認するだけで、_github_auth_probe の argv を固定していません。

    AC3 の test_actor_scoped_capability_probe.py はさらに明確で、共通 _assess() helper が _github_auth_probe と _github_repo_read_probe を monkeypatch しています。そこで捕捉している subprocess は controlled_github_read の gh api 呼び出しであり、今回変える root auth argv ではありません。

    その結果、次の状態が起こり得ます。

    AC1 grep                           PASS
    test_workflow_capability_preflight PASS
    test_actor_scoped_capability_probe PASS
    current-main exact argv test       FAIL
    

    Runtime Verification Applicability の修正

    現在の not_applicable は不適切です。これは外部 CLI subprocess の argv と、その exit status が workflow block に変換される経路を変更します。直前の Issue #2401 でも、同じ producer 境界について decision: immediate、かつ「fake external leaf CLI を使う hermetic pytest、live GitHub・credential 不要」と定義していました。

    次のようにするのが妥当です。

    decision: immediate
    reason: >
      root capability preflight が外部 gh subprocess へ渡す argv を変更するため。
      current main に存在する hermetic root-to-producer boundary test で
      exact fake-gh invocation trace を検証できる。
    execution_environment: >
      Deterministic pytest with the existing fake gh leaf CLI.
      No live GitHub network, credentials, or user account state required.

    これはハーネス強化ではありません。既にある、今回の変更をちょうど観測できる一件のテストを更新して使うだけです。


    P1-2: --active は GitHub CLI 2.57.0 以降という前提が抜けている

    GitHub CLI の公式マニュアルによれば、裸の gh auth status は既知の host/account を検査し、いずれかに問題があると非ゼロ終了します。--hostname は host を、--active は active account のみに検査対象を絞ります。公式実装でも opts.Active の場合は active entry の検査後に continue し、inactive users のループへ入りません。したがって Issue #2404 の技術的な方向性は正しいです。(GitHub CLI)

    ただし --active は GitHub CLI 2.57.0 で追加されたフラグです。

    2.57.0 未満の gh ではこのフラグが存在しないため、該当環境では非ゼロ終了になります。現在の producer は subprocess の非ゼロをすべて PROBE_NONZERO_EXIT とし、最終的に github:auth_unavailable として workflow を block します。つまり「無関係な account による誤 block を減らす」変更が、古い CLI では「すべての workflow を block する」変更になります。

    個人趣味開発であることを考えると、ここで production に version parser、fallback argv、二段 probe、互換レイヤーを追加する必要はありません。必要なのは次だけです。

    gh --version
    • 現在の実利用環境が 2.57.0 以上なら、その結果を PR evidence に残してこの finding は解消。
    • 2.57.0 未満なら GitHub CLI を更新。
    • コード上の fallback は追加しない。

    Issue の Notes または Preconditions に次を一行入れる程度で十分です。

    runtime_precondition: "GitHub CLI >= 2.57.0 (`gh auth status --active` support)"

    P2-1: 「対象リポジトリの認証状態だけ」は正確ではない

    現在の Goal は次の趣旨です。

    root GitHub auth probe が対象リポジトリの認証状態だけを検査する

    しかし gh auth status --active --hostname github.com が検査するのは、github.com の active account/token の認証状態です。リポジトリへの read capability は、その後の別 probe である次の呼び出しが確認します。

    ["gh", "repo", "view", repo, "--json", "name"]

    したがって、Goal は次のようにした方が producer/consumer 境界を正確に表します。([GitHub CLI]1)

    goal_ref: >
      root GitHub auth probe が github.com の active account の認証状態だけを検査し、
      無関係な host または inactive account の認証不整合で workflow を誤って
      block しないようにする。対象 repository の read capability 判定は
      既存の _github_repo_read_probe が引き続き担当する。

    これは実装変更ではなく、将来「この auth probe 単独で repository access まで証明している」と誤解されないための契約修正です。


    P2-2: Scope Collision Note を current main に合わせる

    現在の記述には、少なくとも次の二点で drift があります。

    related_issue=#2401 (OPEN)
    dependency ordering: 依存関係なし
    どちらを先にマージしても他方に影響しない
    

    #2401 は既に completed で、PR #2410 が main に exact-argv test を追加したため、実際には #2404 の Allowed Paths と Verification に影響しています。

    推奨する置き換えは次です。

    - #2401 / PR #2410 は merge 済み。
    - PR #2410 が追加した
      scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py
      に root auth probe の exact argv assertion があるため、本 Issue で期待値更新が必要。
    - #420 / #205 は scripts/** という broad path overlap のみで、
      _github_auth_probe の同一処理に対する競合は確認されていない。
    - 実装開始時に current main へ rebase し、同一 hunk の実競合だけを確認する。
    

    #420 / #205 を理由に作業を直列化したり、ファイル単位の排他ロックや新しい overlap harness を追加したりする必要はありません。


    推奨する Issue 契約の最小修正版

    Allowed Paths

    scripts/claude-gpt/workflow_capability_preflight.py
    scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py
    

    fixture ファイルは追加しません。

    Acceptance Criteria

    AC1:
      _github_auth_probe が subprocess へ
      ["gh", "auth", "status", "--active", "--hostname", "github.com"]
      を渡す。
    
    AC2:
      test_root_to_producer_transports_deadline_with_fake_external_clis の
      fake-gh exact trace が次の順序である。
    
      [
        ["auth", "status", "--active", "--hostname", "github.com"],
        ["repo", "view", "squne121/loop-protocol", "--json", "name"],
        ["api", "--hostname", "github.com",
         "repos/squne121/loop-protocol", "--jq", "{name}"]
      ]
    
    AC3:
      既存の capability-preflight focused suites が PASS する。
    
    AC4:
      実利用環境の GitHub CLI が 2.57.0 以上であることを
      `gh --version` で確認し、PR evidence に記録する。
    

    Verification Commands

    gh --version
    
    uv run --locked pytest \
      scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py::test_root_to_producer_transports_deadline_with_fake_external_clis \
      -q
    
    uv run --locked pytest \
      scripts/claude-gpt/tests/test_workflow_capability_preflight.py \
      scripts/claude-gpt/tests/test_actor_scoped_capability_probe.py \
      scripts/claude-gpt/tests/test_capability_preflight_review_fixes.py \
      -q

    grep は補助確認として残しても構いませんが、Acceptance Criteria の証拠にはしない方がよいです。


    採用してよい設計判断

    • --active --hostname github.com の採用は正しい。
    • current project が github.com/squne121/loop-protocol 固定である限り、host の環境変数化は不要。
    • root auth と repository read を別 probe のまま保つのは正しい。
    • actor-scoped / controlled probe へ変更を波及させないのも正しい。
    • 非ゼロ終了を fail-closed とする既存方針は維持してよい。
    • --json へ変更してはいけません。公式マニュアル上、JSON mode は認証不整合があっても原則 exit zero になるため、現在の exit-status probe の目的を損ないます。([GitHub CLI]1)
    • 新しい security sandbox、credential abstraction、version framework、live-account test、共通 CLI harness は不要。
    • 既存の exact root→producer test 一件を更新するのが最も小さく、最も強い修正です。

    最終判定

    Issue #2404 の意図と production 変更案は approve です。
    一方、現行 Issue 契約は current main に追随していないため、現状のままでは Implementation Ready ではありません。

    マージ可能条件は次の三点です。

    1. test_capability_preflight_review_fixes.py を Allowed Paths に追加する。
    2. grep 中心の Verification を、既存 exact root→producer test 中心へ置き換える。
    3. 実環境の gh >= 2.57.0 を確認し、コード上の追加互換ハーネスは作らない。

    なお、今回のテスト失敗判定はローカル pytest の実行結果ではなく、current-main にある exact expected list と変更後 argv の静的比較に基づきます。ただし比較対象が完全一致 assertion なので、該当テストが変更前のまま実行された場合に失敗する点は決定的です。

  3. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(approved)

    OWNER の敵対的レビュー(issuecomment-5465608024)を Issue 契約へ反映しました。

    反映内容

    レビュー経緯(2 iteration)

    1. iteration 1: Step 2 canonical review で needs-fix(Allowed Paths / RVA 不整合、Required Design References 不足を検出)→ 修正
    2. iteration 2: Step 2 review で新規 2 blocker(decision: immediate に runtime-verification タグ欠如、gh --version が VC gh allowlist 外)を検出 → AC1/AC2 へ <!-- runtime-verification: true --> タグ付与、gh --version に # preflight-scope: pr_review_only annotation 付与で解消
    3. Step 2 review: VERDICT: approve(blocker 0)
    4. Step 2.5 semantic review applicability: false(checker findings 0 件、cross-contract change なし)→ スキップ
    5. run_contract_review_once.py --mode static: status: go(AC1-AC3 の pytest 実行含め全 VC PASS、AC4 は pr_review_only として pr-review-judge へ deferred)

    Final Gate: passed(## Verification Commands を実際に検証して status: go を取得)

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: null
        generated_at: "2026-08-30T00:06:27.350803Z"
        body_sha256: "sha256:a73b27e09722d90e3915dd7a08da96d8d3400ffb5f025f6eef9db13e98c419a1"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label mutation performed"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-08-30T00:06:27.350803Z"
      checked_body_sha256: "sha256:a73b27e09722d90e3915dd7a08da96d8d3400ffb5f025f6eef9db13e98c419a1"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  4. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  5. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-30T00:15:10Z)

    • PR: fix: root github auth probe を --active --hostname github.com に限定する #2413
    • Worktree: .claude/worktrees/issue-2404-gh-auth-active-hostname
    • Branch: worktree-issue-2404-gh-auth-active-hostname
    • Verification: 4/4 PASS(typecheck/lint/test/build)+ Issue VC AC1/AC2/AC3 PASS + AC4 gh --version 2.98.0(要件 >= 2.57.0 満たす)
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  6. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-30T00:26:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2413"
      head_sha: "c18818c0f89059d5cb814436db98f308b8990850"
      issue_number: 2404
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  7. self-assigned this
    on Aug 30, 2026
  8. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-30T01:05:00Z)

    経緯: PR #2413 への OWNER REQUEST_CHANGES(_github_repo_read_probe host-scope 漏れ)を受け、Issue #2404 を trusted anchor scope reframe(AC5 追加)→ fix_delta 実装(head ebe972a)→ PR 本文の Safety Claim Matrix 修正 → CI race(旧 workflow run の cancelled job 起因の stale failure)解消確認、を経て APPROVE。

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2413"
      head_sha: "ebe972a525f89da55dc693e64e2878f66f395821"
      issue_number: 2404
      termination_reason: approved
      merge_ready: true
      iteration: 2
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  9. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-08-30T01:20:00Z)

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues: []
      note_only_observations: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent/implementerenhancementphase/implementationtriage-required

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions