Skip to content

調査: credentialless GitHub read の live AC を shared-runner API rate limit から分離して deterministic にする #2313

Closed
1 of 1 issue completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "CI required job python-test-core の credentialless GitHub read live AC を、shared-runner の unauthenticated rate limit に依存しない deterministic な検証方式にする"
change_kind: research-only

Parent Issue

none(単独 follow-up)

Background

PR #2307(Closes #2273)のマージ直前に、required CI python-test-core が
scripts/agent-guards/tests/test_credentialless_github_read.py::test_credentialless_public_issue_read_succeeds[1]
の失敗で赤くなった。3 独立 SubAgent による forensics + same-head 比較 + contract/review history の
join barrier 評価を経て、以下を full confidence で確認済み。

Source

dedupe_key: "follow-up:squne121/loop-protocol:ci/credentialless-rate-limit-flake"
source: "post-merge-cleanup (PR #2307, Closes #2273)"

Evidence

Investigation Findings

codebase-investigator による独立検証(main HEAD 3928a46b6019ca70194ff7991be5855a31a299fc)で、
OWNER review comment の事実主張はすべて TRUE と確認された。

# 主張 判定 根拠
1 pyproject.toml は unauthenticated live GitHub REST/API read を github_live marker として定義し、default pytest では除外する契約になっている(PR #2319 で導入・マージ済み) TRUE pyproject.toml:24-28
2 test_credentialless_public_issue_read_succeeds(scripts/agent-guards/tests/test_credentialless_github_read.py)には現在も @pytest.mark.github_live が付与されていない TRUE scripts/agent-guards/tests/test_credentialless_github_read.py:165-166
3 テストは urllib.error.URLError を catch して DNS/egress failure を skip する設計だが、production transport(scripts/agent-guards/github_credentialless_read.py)は現在 URLError を TransportConnectivityFailure に変換して再送出しており、当該 except 節は実際の transport failure を捕捉できない TRUE Test: 同ファイル 180-189 行 / Prod: github_credentialless_read.py:312-319
4 5xx は skip、rate limit(403)は fail という扱いの差があり、どちらも upstream/environment 由来にも関わらず CI verdict が異なる TRUE scripts/agent-guards/tests/test_credentialless_github_read.py:175-179, 323
5 既存の marker collection regression test(.claude/skills/impl-review-loop/tests/test_github_live_marker_collection.py)は別ファイル(test_ensure_contract_snapshot_fingerprint_patch.py)をハードコード対象にしており、今回の unmarked live test はカバーしていない TRUE .claude/skills/impl-review-loop/tests/test_github_live_marker_collection.py:28-32
6 github_credentialless_read.py 系の transport には repository-bound / GET-only / redirect reject / structured error classification(401/403/404/429/5xx taxonomy)の hermetic behavioral test が既に十分揃っている TRUE scripts/agent-guards/tests/test_credentialless_github_read.py(28 test functions)

結論: 「credentialless read を deterministic にする」ための新規アーキテクチャは不要であり、
既存 github_live marker policy への適合漏れ(marker 未付与)と、live test 側の stale な
error-handling 記述(URLError 前提)が根本原因である。

Recommendation

採用: 案1(Hermetic required CI + live verification 分離)を、既存 github_live marker policy を
使ってそのまま最小実装する。新規 CI lane・新規 runner・新規 policy engine は不要。

推奨理由:

棄却:

  • 案2(dedicated egress / quota isolation): 固定 egress IP は unauthenticated quota(60 req/hr/IP)
    自体を増やすわけではなく、quota を他送信元と混ぜにくくするだけ。GitHub-hosted larger runner での
    static IP 利用には GitHub Enterprise Cloud が必要であり、self-hosted runner は 1 件の public GET
    のために運用負荷を背負うことになり費用対効果が悪い。この案はテストの実行契約や error taxonomy を
    一切変更しないため、Issue 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 AC3 の fail-closed 契約(skip vs fail の設計意図)には影響しない
  • 案3(GET-only repository-bound authenticated broker の新規実装): GITHUB_TOKEN を使えば
    1 repository あたり 1,000 req/hr まで上がるが、これは「CI flake 修正」ではなく Issue 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 の
    auth_required: false / credentialless isolated session という production contract 自体の変更に
    あたる。fail-closed が「何を fail させるか」(rate limit/HTTP error を skip せず fail させる設計
    意図)自体は変わらないが、fail-closed が守る対象(credentialless という前提)を変えてしまうため、
    Issue 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 AC3 の契約範囲を拡張する scope reframe が必要になる。production requirement が
    変わらない限り、この推奨実装 Issue の対象にはしない
  • scheduled lane(優先度低い代替案): GitHub は高負荷時に scheduled workflow が遅延し、queued job が
    drop され得ると明記している。canary / telemetry としては有用だが、deterministic proof や
    required merge gate としては扱うべきではない。この案も required CI 側のテスト実行契約自体は
    変更しないため、fail-closed semantics(skip vs fail の判定ロジック)には影響しない。ただし
    required merge gate として使わない以上、AC3 が要求する「shared-runner quota に依存しない
    deterministic な検証」を satisfy しない点が主な棄却理由である

Outcome

test_credentialless_public_issue_read_succeeds が required PR CI 上で shared-runner の
unauthenticated GitHub API rate limit に依存して非決定的に失敗する問題について、上記
Investigation Findings / Recommendation に基づき採用案(既存 github_live marker policy への
適合、stale な例外処理・severity 不整合の是正、regression test coverage 拡張)を実装する
implementation Issue(#2361)が起票され、本 Issue がそれを link している状態。

In Scope

Out of Scope

Acceptance Criteria

Verification Commands

gh issue view は本 Issue 自身の本文/comment 取得であり fetch のみで内容判定は行わない(VC 単一コマンド制約により複数コマンドの組み合わせが不可のため)。各 AC が要求する内容(Investigation Findings / Recommendation セクションの記載、implementation Issue へのリンク、close 可否)の意味的判定は、pr-review-judge / issue-contract-review の human_judgment_required 経路に委ねる。

# AC1
# baseline-expect: pass
$ gh issue view 2313 --repo squne121/loop-protocol --json body -q .body
# AC2
# baseline-expect: pass
$ gh issue view 2313 --repo squne121/loop-protocol --json body -q .body
# AC3
# baseline-expect: pass
$ gh issue view 2313 --repo squne121/loop-protocol --json body,comments -q .body
# AC4
# baseline-expect: pass
$ gh issue view 2313 --repo squne121/loop-protocol --json state -q .state

Allowed Paths

  • 読み取り専用。リポジトリ変更なし(既定)

Stop Conditions

  • Outcome / Scope / AC が検索可能な形で記載されていない場合は即停止
  • Allowed Paths 外への書き込みを試みた場合は即停止
  • 権限不足(permission denied)により操作が完了できない場合は即停止
  • 成果物の書き込みに失敗した場合(I/O エラー等)は即停止

Handoff Contract

Notes for Reviewer

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    phase/research
    agent/research
    follow-up
    testing
    on Aug 23, 2026
  2. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES — #2313 は reframe-in-place を推奨します。

    問題認識自体は正しいです。実際、PR #2307 では同一 head SHA で success → success → failure と反転し、python-test-core の唯一の失敗が test_credentialless_public_issue_read_succeeds[1] の 403 primary_ratelimit_exhausted でした。コード regression ではなく、外部 quota による required-CI flake だったことは十分立証されています。

    ただし、「live credentialless read を deterministic にする」という問題設定が一段ずれています。 外部 GitHub API を無認証で実際に叩く以上、それ自体を deterministic にはできません。deterministic にすべきなのは required PR CI です。GitHub 公式仕様でも unauthenticated REST は送信元 IP 単位で 60 requests/hour です。(GitHub Docs)

    #2313 は現在 open のままで、コメントもありません。後述する後続変更を取り込んだ refinement が行われていません。

    敵対的レビューでの主な指摘

    1. P1 — 「fail-closed production semantics」と「upstream outage で PR を赤くすること」を混同しています。 Production で GitHub read が失敗したとき、成功へ偽装せず rate_limited / transport_connectivity_failure / upstream_environment_failure として停止するのが fail-closed です。一方、その処理が正しいことは fault injection で deterministic に検証できます。実 GitHub がその瞬間に quota を残していることまで、コード変更の merge eligibility にする必要はありません。むしろ 実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 は既に transport failure を semantic failure と分離して environment_failure として扱う方向に進んでいます。

    2. P1 — 調査: credentialless GitHub read の live AC を shared-runner API rate limit から分離して deterministic にする #2313 は現在のリポジトリ test-lane policy に追いついていません。 現在の pyproject.toml は、unauthenticated live GitHub REST/API read を明示的に github_live と定義し、default pytest では除外する契約になっています。 この変更は PR fix: test_isolated_anchor_single_authority のtransient判定を構造化reason_codeベースに改修する #2319 で既に導入・merge 済みです。 ところが問題の test_credentialless_public_issue_read_succeeds には現在も @pytest.mark.github_live が付いていません。したがって 新しいアーキテクチャを発明する前に、既存ポリシーへこの1テストを合わせればよい 状態です。

    3. P1 — 現在の live test 自体も error semantics が drift しています。 テストは「DNS/egress failure は SKIP」と説明し URLError を catch していますが、production transport は現在 URLError を TransportConnectivityFailure に変換して再送出します。そのため当該 except urllib.error.URLError は通常の transport failure を捕まえません。 また、5xx は skip なのに rate limit は fail です。どちらも upstream/environment state なのに CI verdict が異なっています。「AC3 fail-closed」を根拠に現在の挙動を固定するのは危険です。

    4. P1 — 案2の dedicated egress / quota isolation は個人開発には過剰です。 固定 egress IP は unauthenticated quota を 60→増加させるわけではなく、quota を他の送信元と混ぜにくくするだけです。GitHub-hosted larger runner で static IP を使うには GitHub Enterprise Cloud が必要です。(GitHub Docs) Self-hosted runner ならできますが、1件の public GET のために runner 運用を背負うのは費用対効果が悪いです。

    5. P1 — 案3の authenticated broker は「CI flake 修正」ではなく production contract の変更です。 Actions の GITHUB_TOKEN なら 1 repository あたり 1,000 requests/hour に上がります。(GitHub Docs) しかしそれでは auth_required: false / 「credentialless isolated session」という 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 の性質を検証していません。これを採るなら「rate-limit対策」ではなく、production architecture 自体を authenticated broker に変更する別の Owner Decision が必要です。現時点では推奨しません。

    6. P2 — scheduled lane も deterministic ではありません。 GitHub 自身が scheduled workflow は高負荷時に遅延し、場合によっては queued job が drop され得ると明記しています。(GitHub Docs) したがって schedule は canary / telemetry としては有用ですが、deterministic proof や required merge gate として扱うべきではありません。

    4案の評価

    案 | 評価 | 理由 -- | -- | -- Hermetic required CI + live verification 分離 | 採用。ただしさらに簡素化 | 既存 github_live policy をそのまま使用すればよい。新規 CI lane は必須ではない Dedicated egress / quota isolation | 棄却 | コスト・運用負荷に対して得られるのは quota isolation だけ Authenticated GET broker | 現時点では棄却 | AC3 の credentialless semantics を変える。production requirement が変わった場合のみ再検討 その他 | github_live opt-in canary が最適 | required CI は hermetic、必要時だけ真の unauthenticated GET を実行

    特に、現行テスト群には既に「Authorization header が付かない」「exact GET」「comments pagination」「redirect reject」「403/429/401/404/5xx taxonomy」などの hermetic behavioral test がかなり揃っています。 Transport 本体も repository-bound / GET-only / redirect reject / structured error classification まで実装されています。 足りないのは transport の品質ではなく、live test の lane classification です。

    推奨する #2313 のリフレーム

    Outcome は、概ね次の状態を目指すのがよいです。

    python-test-core は credentialless GitHub read の correctness を hermetic test だけで検証し、外部 GitHub API quota・DNS・5xx に merge eligibility を依存させない。実 GitHub に対する unauthenticated positive control は github_live runtime verification として明示的に opt-in 実行でき、rate limit/auth dependency 等を成功へ偽装しない。

    これは #2241 の credentialless semantics を弱めません。**「実ネットワーク failure を PASS にする」のではなく、「実ネットワーク availability を required CI のコード判定から外す」**という分離です。

    実装 Issue もかなり小さくできます。中心変更はこれで足ります。

    @pytest.mark.github_live
    @pytest.mark.parametrize("issue_number", [1])
    def test_credentialless_public_issue_read_succeeds(issue_number):
        ...

    現在の pytest 設定が -m 'not github_live and not claude_live' なので、これだけで default CI から live GET は外れます。

    品質を一段上げるなら、既存の test_github_live_marker_collection.py を少し拡張し、この nodeid が「default では deselect / -m github_live なら collect」されることを regression test に加える程度で十分です。現行 guard は特定の別ファイルだけをハードコードして確認しているため、今回の unmarked live test を検出できませんでした。 新しい generic policy engine やネットワーク harness は不要です。

    最終評価

    #2313 の方向性は正しいが、現在の4択は過剰設計寄りです。 2026年8月27日時点のリポジトリには既に答えの大半があります。

    推奨 disposition は reframe-in-place → 案1を既存 github_live policy で最小実装 → implementation Issue 起票 → #2313 close。

    実装 Issue の規模感としては、test_credentialless_github_read.py の marker 追加、live test の stale な例外説明/分類の整理、既存 marker collection regression の追加まで。CI workflow、新 runner、authenticated broker、credential forwarding は触らないのが、このリポジトリの実用性と個人開発の運用負荷のバランスでは最も良いです。

    ## 判定

    REQUEST_CHANGES — #2313 は reframe-in-place を推奨します。

    問題認識自体は正しいです。実際、PR #2307 では同一 head SHA で success → success → failure と反転し、python-test-core の唯一の失敗が test_credentialless_public_issue_read_succeeds[1] の 403 primary_ratelimit_exhausted でした。コード regression ではなく、外部 quota による required-CI flake だったことは十分立証されています。

    ただし、「live credentialless read を deterministic にする」という問題設定が一段ずれています。 外部 GitHub API を無認証で実際に叩く以上、それ自体を deterministic にはできません。deterministic にすべきなのは required PR CI です。GitHub 公式仕様でも unauthenticated REST は送信元 IP 単位で 60 requests/hour です。([GitHub Docs]1)

    #2313 は現在 open のままで、コメントもありません。後述する後続変更を取り込んだ refinement が行われていません。

    敵対的レビューでの主な指摘

    1. P1 — 「fail-closed production semantics」と「upstream outage で PR を赤くすること」を混同しています。 Production で GitHub read が失敗したとき、成功へ偽装せず rate_limited / transport_connectivity_failure / upstream_environment_failure として停止するのが fail-closed です。一方、その処理が正しいことは fault injection で deterministic に検証できます。実 GitHub がその瞬間に quota を残していることまで、コード変更の merge eligibility にする必要はありません。むしろ 実装: Claude-GPT issue-refinement preflight の anchor comment 取得を credentialless transport へ統一する #2257 は既に transport failure を semantic failure と分離して environment_failure として扱う方向に進んでいます。

    2. P1 — 調査: credentialless GitHub read の live AC を shared-runner API rate limit から分離して deterministic にする #2313 は現在のリポジトリ test-lane policy に追いついていません。 現在の pyproject.toml は、unauthenticated live GitHub REST/API read を明示的に github_live と定義し、default pytest では除外する契約になっています。 この変更は PR fix: test_isolated_anchor_single_authority のtransient判定を構造化reason_codeベースに改修する #2319 で既に導入・merge 済みです。 ところが問題の test_credentialless_public_issue_read_succeeds には現在も @pytest.mark.github_live が付いていません。したがって 新しいアーキテクチャを発明する前に、既存ポリシーへこの1テストを合わせればよい 状態です。

    3. P1 — 現在の live test 自体も error semantics が drift しています。 テストは「DNS/egress failure は SKIP」と説明し URLError を catch していますが、production transport は現在 URLError を TransportConnectivityFailure に変換して再送出します。そのため当該 except urllib.error.URLError は通常の transport failure を捕まえません。 また、5xx は skip なのに rate limit は fail です。どちらも upstream/environment state なのに CI verdict が異なっています。「AC3 fail-closed」を根拠に現在の挙動を固定するのは危険です。

    4. P1 — 案2の dedicated egress / quota isolation は個人開発には過剰です。 固定 egress IP は unauthenticated quota を 60→増加させるわけではなく、quota を他の送信元と混ぜにくくするだけです。GitHub-hosted larger runner で static IP を使うには GitHub Enterprise Cloud が必要です。([GitHub Docs]2) Self-hosted runner ならできますが、1件の public GET のために runner 運用を背負うのは費用対効果が悪いです。

    5. P1 — 案3の authenticated broker は「CI flake 修正」ではなく production contract の変更です。 Actions の GITHUB_TOKEN なら 1 repository あたり 1,000 requests/hour に上がります。([GitHub Docs]3) しかしそれでは auth_required: false / 「credentialless isolated session」という 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 の性質を検証していません。これを採るなら「rate-limit対策」ではなく、production architecture 自体を authenticated broker に変更する別の Owner Decision が必要です。現時点では推奨しません。

    6. P2 — scheduled lane も deterministic ではありません。 GitHub 自身が scheduled workflow は高負荷時に遅延し、場合によっては queued job が drop され得ると明記しています。([GitHub Docs]4) したがって schedule は canary / telemetry としては有用ですが、deterministic proof や required merge gate として扱うべきではありません。

    4案の評価

    案 評価 理由
    Hermetic required CI + live verification 分離 採用。ただしさらに簡素化 既存 github_live policy をそのまま使用すればよい。新規 CI lane は必須ではない
    Dedicated egress / quota isolation 棄却 コスト・運用負荷に対して得られるのは quota isolation だけ
    Authenticated GET broker 現時点では棄却 AC3 の credentialless semantics を変える。production requirement が変わった場合のみ再検討
    その他 github_live opt-in canary が最適 required CI は hermetic、必要時だけ真の unauthenticated GET を実行

    特に、現行テスト群には既に「Authorization header が付かない」「exact GET」「comments pagination」「redirect reject」「403/429/401/404/5xx taxonomy」などの hermetic behavioral test がかなり揃っています。 Transport 本体も repository-bound / GET-only / redirect reject / structured error classification まで実装されています。 足りないのは transport の品質ではなく、live test の lane classification です。

    推奨する #2313 のリフレーム

    Outcome は、概ね次の状態を目指すのがよいです。

    python-test-core は credentialless GitHub read の correctness を hermetic test だけで検証し、外部 GitHub API quota・DNS・5xx に merge eligibility を依存させない。実 GitHub に対する unauthenticated positive control は github_live runtime verification として明示的に opt-in 実行でき、rate limit/auth dependency 等を成功へ偽装しない。

    これは #2241 の credentialless semantics を弱めません。**「実ネットワーク failure を PASS にする」のではなく、「実ネットワーク availability を required CI のコード判定から外す」**という分離です。

    実装 Issue もかなり小さくできます。中心変更はこれで足ります。

    @pytest.mark.github_live
    @pytest.mark.parametrize("issue_number", [1])
    def test_credentialless_public_issue_read_succeeds(issue_number):
        ...

    現在の pytest 設定が -m 'not github_live and not claude_live' なので、これだけで default CI から live GET は外れます。

    品質を一段上げるなら、既存の test_github_live_marker_collection.py を少し拡張し、この nodeid が「default では deselect / -m github_live なら collect」されることを regression test に加える程度で十分です。現行 guard は特定の別ファイルだけをハードコードして確認しているため、今回の unmarked live test を検出できませんでした。 新しい generic policy engine やネットワーク harness は不要です。

    最終評価

    #2313 の方向性は正しいが、現在の4択は過剰設計寄りです。 2026年8月27日時点のリポジトリには既に答えの大半があります。

    推奨 disposition は reframe-in-place → 案1を既存 github_live policy で最小実装 → implementation Issue 起票 → #2313 close。

    実装 Issue の規模感としては、test_credentialless_github_read.py の marker 追加、live test の stale な例外説明/分類の整理、既存 marker collection regression の追加まで。CI workflow、新 runner、authenticated broker、credential forwarding は触らないのが、このリポジトリの実用性と個人開発の運用負荷のバランスでは最も良いです。

  3. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    本 Issue の refinement を完了しました。

    OWNER review comment(https://github.com/squne121/loop-protocol/issues/2313#issuecomment-5437857594)の reframe-in-place 推奨に従い、codebase-investigator による独立検証(全 6 主張 TRUE 確認)を経て、4 設計候補のうち案1(既存 github_live marker policy での最小実装)を採用しました。推奨理由・棄却理由(fail-closed 契約への影響評価を含む)は本文の Investigation Findings / Recommendation セクションに記載済みです。

    採用案を実装する implementation Issue #2361 を起票し、本 Issue にリンクしました。全 Acceptance Criteria(AC1-AC4)を満たしたため、本 Issue を close します。実装の進捗は #2361 で追跡してください。

  4. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    • STATUS: approved
    • TERMINATION_CAUSE: approved(deterministic checker VERDICT: approve、semantic review effective_verdict: approve)
    • iteration: 1(needs-fix → rewrite → re-review → approve)

    実施内容

    1. anchor comment(OWNER review, issuecomment-5437857594)の reframe-in-place 推奨を、codebase-investigator による独立検証(6 主張すべて TRUE)で裏付けた
    2. Issue 本文へ ## Investigation Findings / ## Recommendation セクションを追加し、AC1(4 設計候補の比較結果)・AC2(推奨案とその理由)を充足
    3. Verification Commands(AC1-AC4)のパイプ compound command を、既存 CLOSED research Issue(調査: graphify prs 系 PR tools の advisory-only pilot 可否を調査する #2018)と同じ # baseline-expect: pass + 単一コマンド fetch パターンへ修正(VC_SINGLE_COMMAND_GUARDRAIL fail-closed を解消)
    4. Step 2.5 semantic design review(issue-design-reviewer)で medium finding 1 件(棄却案の fail-closed 契約への影響評価不足)を検出 → Recommendation の棄却理由に fail-closed 契約への影響を追記して反映
    5. AC3 充足のため、推奨案を実装する follow-up implementation Issue 実装: credentialless GitHub read live test の github_live marker適合と例外処理是正 #2361 を起票し、調査: credentialless GitHub read の live AC を shared-runner API rate limit から分離して deterministic にする #2313 にリンク(sub-issue 登録済み)
    6. 全 AC(AC1-AC4)充足を確認し、Issue 調査: credentialless GitHub read の live AC を shared-runner API rate limit から分離して deterministic にする #2313 を close

    FOLLOW_UP_MATERIALIZATION_RESULT_V1

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:issue-2313:recommended-implementation"
          status: created
          issue:
            number: 2361
            url: "https://github.com/squne121/loop-protocol/issues/2361"
          reason: null
      note_only_observations: []

    最終状態

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/researchfollow-upphase/researchtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions