Repository navigation
Open
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1493"
goal_ref: "overlap preflight の GraphQL cursor pagination を read-only runtime smoke で検証できる controlled VC を提供する"
change_kind: workflowParent Issue
Parent Goal Ref
- Goal: GraphQL cursor pagination で implementation Issue candidate を完全収集し、saturation による構造的停止を解消する。
- Desired Destination: 実装: open-pr の overlap preflight hard gate に --limit 伝播を追加し repo 規模拡大による全面停止を解消する #1493 が実リポジトリの複数ページ収集を runtime evidence として検証できる。
Current Validated Scope
- 実装: open-pr の overlap preflight hard gate に --limit 伝播を追加し repo 規模拡大による全面停止を解消する #1493 の AC5 は
uv run python3 ... --runtime-evidence-fileを指定するが、VC allowlist 外であり、現行 script に当該 option は存在しない。 - fixture pytest は pagination algorithm を検証できるが、GitHub CLI 認証と実 GraphQL pagination の runtime evidence を置換しない。
Remaining Parent Gaps
- 実装: open-pr の overlap preflight hard gate に --limit 伝播を追加し repo 規模拡大による全面停止を解消する #1493 の cursor pagination producer 実装と stored/fresh collection contract は本 Issue で変更しない。
Outcome
controlled runtime-smoke script と VC preflight policy が、read-only GraphQL pagination evidence を bounded に生成・検証でき、#1493 がその evidence を runtime AC の正規入力として使える状態。
In Scope
- read-only GraphQL cursor pagination smoke の exact argv、repository binding、timeout、output/artifact bound を定義する。
- VC preflight がその exact command だけを許可し、wrapper・extra flag・repository mismatch を拒否する。
- smoke が page count、fetched count、terminal page、complete/saturated、route、skip reason を bounded JSON artifact に記録する。
- pytest で allow/deny と artifact schema を検証する。
Out of Scope
- 実装: open-pr の overlap preflight hard gate に --limit 伝播を追加し repo 規模拡大による全面停止を解消する #1493 の pagination producer、open-pr collection contract、overlap route の実装。
- GitHub Issue/PR の作成・更新・削除、raw gh mutation、credential の表示。
- generic な
uv run python3の許可。
Acceptance Criteria
- AC1: canonical runtime-smoke argv だけが VC preflight で許可される。
- AC2: wrapper、extra flag、wrong repo、write-capable gh option、unbounded artifact path は fail-closed で拒否される。
- AC3: smoke artifact は repository、timestamp、fetched_count、page_count、has_next_page、complete、saturated、route、skip_reason を bounded schema で記録する。
- AC4: GitHub API が利用可能な環境では read-only runtime smoke を実行し、利用不能時は明示的 SKIP を成功扱いにしない。
Runtime Verification Applicability
runtime_verification_applicability:
decision: immediate
reason: "実 GraphQL pagination と gh authentication を含むため、fixture test だけでは AC4 を証明できない。"
applicable_acs: [AC4]
execution_environment: "gh 認証済み Linux/WSL repository checkout"
skip_conditions: "gh 未認証、network unavailable、rate limit"
fallback_policy: "SKIP は PASS に変換しない。"
artifact_requirements: "bounded runtime-smoke JSON artifact"Verification Commands
# AC1
$ uv run --locked pytest scripts/agent-guards/tests/test_runtime_smoke_command_policy.py -q
# AC2
$ uv run --locked pytest scripts/agent-guards/tests/test_runtime_smoke_command_policy.py -q
# AC3
$ uv run --locked pytest scripts/ci/tests/test_overlap_pagination_runtime_smoke.py -q
# AC4
$ uv run --isolated --locked --no-default-groups python3 scripts/ci/overlap_pagination_runtime_smoke.pyAllowed Paths
scripts/agent-guards/skill_runtime_command_policy.pyscripts/agent-guards/tests/test_runtime_smoke_command_policy.pyscripts/ci/overlap_pagination_runtime_smoke.pyscripts/ci/tests/test_overlap_pagination_runtime_smoke.py.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python
- pytest
- GitHub GraphQL API
Required Design References
docs/dev/runtime-verification-policy.md.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py.claude/skills/implement-issue/scripts/check_implementation_overlap.py
Delivery Rule
- 1 Issue = 1 PR、dedicated worktree、Draft PR を使用する。
- 実装: open-pr の overlap preflight hard gate に --limit 伝播を追加し repo 規模拡大による全面停止を解消する #1493 の pagination producer には触れない。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jul 18, 2026
判定
REQUEST_CHANGES。
方向性は妥当ですが、現状の #1610 は「controlled VC を追加した」という形式だけを満たし、#1493 の本番 pagination producer が正しく動くことを証明しない false green を作れる契約です。
#1610 自体には現時点でコメントはありません。
Blocker 1: runtime verification の構文契約に違反している
#1610 は
runtime_verification_applicability.decision: immediateとしていますが、AC4 に必須の次のタグがありません。<!-- runtime-verification: true -->リポジトリの SSOT は、
immediateなのにこのタグが一つもない場合を明示的に blocker としています。また、SKIP は exit 77、fallback は FAIL でなければなりません。修正要求
のように runtime 専用 AC を分離してください。unit test の AC と実環境 AC を同じ AC4 に混在させるべきではありません。
Blocker 2: smoke が production producer を検証していない
現在の本番コード
check_implementation_overlap.pyは依然として、で候補を取得しています。
一方、#1610 は新規の独立スクリプト、
を追加し、#1493 の pagination producer 自体には触れないと宣言しています。
この構造では次の状態が成立します。
complete=trueを返す。check_implementation_overlap.pyは引き続き100件で saturation 停止する。つまり、検証対象と実装対象が別物です。
修正要求
次のどちらかに変更してください。
独立した GraphQL 実装を smoke 側に複製する案は却下すべきです。pagination query、cursor invariant、safety cap が二重管理になります。
また、#1610 は #1493 の production API が確定しないと実装できません。Machine-Readable Contract に少なくとも次が必要です。
または stacked PR の固定 base SHA を指定してください。
Blocker 3: 親Issueの核心条件がACから消えている
親 #1493 の runtime AC は、実リポジトリで次を要求しています。
fetched_count > 100complete=truesaturated=falsehas_next_page=false実際の overlap route が安全であることは要求していません。
しかし #1610 の AC4 は「GitHub API が利用可能なら smoke を実行する」としか規定していません。これでは候補が0件、1ページ、100件以下でも PASS できます。
修正要求
runtime AC を少なくとも次まで固定してください。
GitHub GraphQL connection は
firstまたはlastに1〜100を指定し、pageInfo.hasNextPageとendCursorで次ページを取得するのが公式契約です。([GitHub Docs]1)Blocker 4: canonical argv と AC2 が矛盾している
記載されている canonical command は次です。
しかし AC2 は以下を拒否するとしています。
canonical command に
--repoも artifact path も存在しないため、wrong repo や unbounded path を入力する経路自体がありません。設計をどちらかに決める必要があります。
推奨: stdout artifact 方式
--repoと--issue-numberは exact value。artifacts/に保存する。任意の
--outputを許可するより安全かつ単純です。リポジトリの runtime verification policy も、artifact 保存責務を test-runner に置いています。Blocker 5: worktree artifact 書き込みが current-head 検証と衝突する
現行
baseline_vc_preflight.pyの current-head mode は、実行前後の、を確認し、実行後に untracked file が生成されると certification を失います。
そのため smoke script 自身が worktree 内へ JSON artifact を作ると、正常な runtime evidence 生成なのに
worktree_not_clean_after_executionで blocked になる可能性があります。修正要求
リポジトリ内の既存 controlled runner も、stdout/stderr をストリーミングしながら上限を監視し、timeoutまたは上限超過時に process group を終了しています。
Blocker 6: policyの責務境界が混線している
#1610 の Allowed Paths には、
の両方があります。
しかし、この二つは別の admission layer です。
baseline_vc_preflight.pyIssue本文の Verification Command を分類・実行する policy。
skill_runtime_command_policy.pypreflight.runなどの privileged exact command ID を認可する policy。現行
skill_runtime_command_policy.pyに存在する command ID はpreflight.run系のみであり、新しい pagination smoke profile はありません。新しい privileged profile を追加するつもりなら、少なくとも executor、registry、runner wiring まで必要です。現在の Allowed Paths では完結しません。
一方、単に Issue VC として runtime smoke を許可するだけなら、
skill_runtime_command_policy.pyは不要です。類似の exact uv smoke allowlist は既にbaseline_vc_preflight.pyに実装され、そのテストも issue-contract-review 配下にあります。推奨
skill_runtime_command_policy.pyとscripts/agent-guards/tests/test_runtime_smoke_command_policy.pyをスコープから除外し、次へ寄せてください。Blocker 7: exact argv の過去の失敗を再発させる可能性が高い
類似変更の #1195 / PR #1200 では、当初「exact runtime smoke」と称しながら、
Path(argv[0]).nameset比較を使用していました。結果として path-qualified executable、option reorder、duplicate option を許す余地が残り、#1210 で exact list comparison に修正されています。
#1610 の AC1に「canonical argvだけ」と書くだけでは不十分です。
最低限、以下を negative test として列挙してください。
raw argv の完全な tuple/list comparison を使用し、basename 比較、option集合比較、正規化後の同値判定で許可してはいけません。
Blocker 8: 「read-only」の定義が弱い
gh api graphqlは、read query も mutation も同じ GraphQL endpoint に送信します。HTTP methodだけで read-only を判定できません。GraphQL では operation がqueryかmutationかが意味を決めます。([GitHub Docs]2)したがって、AC2 の「write-capable gh optionを拒否」だけでは不十分です。
必要な固定条件
query一つのみ。mutationtokenを含む任意 query inputを受け付けない。repository.issuesconnection を使用する。states: OPENとlabels: ["phase/implementation"]を固定する。shell=False。gh alias、extension、wrapperを使用しない。Repository.issuesはafter、first、labels、states、orderByを正式にサポートしています。([GitHub Docs]3)さらに
GH_HOSTは接続先を、GH_REPOはrepository contextを変更できます。caller環境をそのまま継承したまま「repo binding済み」と主張できません。([GitHub CLI]4)既存の
run_scope_rollup_preflight.pyではGH_HOST、GH_REPO、GH_CONFIG_DIR、GH_PATH、pager/debug系環境変数を除去しています。同等の環境 sanitation を再利用するか、共有helperへ抽出すべきです。
Major 1: pagination invariant が定義されていない
次の不正応答を fail-closed にする契約が必要です。
hasNextPage=trueなのにendCursorが null または空。endCursor。nodesが list ではない。data.repositoryが null。errorsがある。既存の repository asset は
hasNextPage=trueなのに cursor が取れない場合や、最大ページ数到達時に incomplete として停止します。gh api --paginateを利用する場合、GraphQL query が$endCursorを受け取り、pageInfoを返す必要があります。また各ページは別々のJSONとして出力され、--slurpを付けると配列化されます。([GitHub CLI]5)この smoke では挙動を細かく検証する必要があるため、
--paginateに全て任せるより、Python側の明示ループの方が監査しやすい設計です。Major 2: bounded の具体値がない
「bounded」とだけ書かれており、次が未定義です。
推奨初期値は例えば次です。
値そのものより、定数・artifact・test expectation が一つのSSOTから導かれることが重要です。
Major 3: artifact schema が形式だけで、意味論がない
最低限、schema名と cross-field invariant が必要です。
{ "schema": "OVERLAP_PAGINATION_RUNTIME_SMOKE_V1", "repository": "squne121/loop-protocol", "timestamp": "2026-07-18T00:00:00Z", "fetched_count": 157, "page_count": 2, "has_next_page": false, "complete": true, "saturated": false, "route": "human_review_required", "skip_reason": null }PASS時の不変条件:
SKIP時:
FAIL時:
boolが Python上でintの subclassである点にも注意し、page_count=trueを整数として受理しない schema test が必要です。Major 4: rate limit を return codeだけで分類できない
GitHub GraphQL は rate-limit関連を GraphQL response の
errorsとして返す場合があり、HTTPまたはCLIの終了状態だけで完全に分類できません。またserver timeoutでは 502/504 になり得ます。([GitHub Docs]6)分類を明示してください。
gh未導入、未認証、network unavailable、rate limit exhausted→ SKIP 77
→ FAIL 1
→ 原則 FAIL 1
→ FAIL 1
実行を開始できない環境と、開始後に検証が壊れた状態を同じ SKIP にしてはいけません。
推奨する再構成
Machine-Readable Contract
設計
baseline_vc_preflight.pyは exact raw argv の一形式だけを許可する。推奨 canonical command
推奨 Allowed Paths
production pagination APIとの接続に追加パスが必要なら、#1493完了後の実パスを明示的に加えてください。
最終評価
#1610 は必要な follow-up ですが、現状は以下の理由で implementation-ready ではありません。
>100件・複数ページの本質的条件が消失。Issue本文を修正してから実装へ進めるべきです。GitHubへのコメント投稿・Issue更新は行っていません。