Skip to content

fix(guard): gh issue/pr GitHub ops を allowlist-closed から除外し post-merge-cleanup 操作を復元する #1108

Closed

Description

@squne121

背景

PR #1100 で gh issue/pr mutation を allowlist-closed 方式に変更した結果、gh issue close / gh issue create / gh issue edit が guard
にブロックされるようになった。これは user_github_ops_policy(GitHub Issue/PR 操作は
allow)と衝突する regression。

問題

guard の本来の意図は「ローカル git state を変更するコマンド」をブロックすること。gh issue close は git state と無関係なのにブロックされている。

修正方針

DISPLAY_READONLY_PATTERNS に加え GH_OPS_ALLOW_PATTERNS を追加:

GH_OPS_ALLOW_PATTERNS = [
    r"^gh\s+issue\s+(close|create|edit|comment|reopen)(\s|$)",
    r"^gh\s+pr\s+(create|comment|edit)(\s|$)",
]

is_gh_mutation_command() でこのリストを allowlist に追加。

Parent Issue

none(PR #1100 の follow-up として独立 Issue)

Parent Goal Ref

  • Goal: guard の allowlist-closed 方式が GitHub Issue/PR 操作(gh issue close/create/edit 等)を誤ってブロックしない
  • Desired Destination: is_gh_mutation_command() が GH_OPS_ALLOW_PATTERNS を持ち、GitHub ops を通過させる

Outcome

scripts/agent-guards/local_main_branch_guard.py の is_gh_mutation_command() が gh issue close/create/edit/comment/reopen および gh pr create/comment/edit を block せず通過させる。gh pr merge / gh pr checkout は引き続き block される。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: guard ロジックの変更は pytest ユニットテストで静的に検証可能。ランタイム起動は不要

In Scope

  • scripts/agent-guards/local_main_branch_guard.py に GH_OPS_ALLOW_PATTERNS を追加
  • is_gh_mutation_command() を GH_OPS_ALLOW_PATTERNS で拡張
  • 対応するテスト追加(AC1〜AC4 のカバレッジ)

Out of Scope

  • guard の他のブロックロジックの変更
  • gh pr merge / gh pr checkout の動作変更
  • allowlist-closed 方式そのものの廃止

Current Validated Scope

  • scripts/agent-guards/local_main_branch_guard.py の is_gh_mutation_command() のみを変更する
  • テストは tests/codex/test_local_main_branch_guard.py および .claude/hooks/tests/test_local_main_branch_guard.py に追加する

Remaining Parent Gaps

  • なし(本 Issue で完結)

Acceptance Criteria

  • AC1: gh issue close 1089 が allow される
  • AC2: gh issue create が allow される
  • AC3: gh pr merge は引き続き block される
  • AC4: gh pr checkout は引き続き block される

Allowed Paths

  • scripts/agent-guards/local_main_branch_guard.py
  • tests/codex/test_local_main_branch_guard.py
  • .claude/hooks/tests/test_local_main_branch_guard.py

Verification Commands

# AC1
# baseline-expect: fail
$ uv run pytest tests/codex/test_local_main_branch_guard.py -v -k "gh_issue_close_is_denied"
# AC2
# baseline-expect: fail
$ uv run pytest tests/codex/test_local_main_branch_guard.py -v -k "unlisted_gh_mutations_are_blocked"
# AC3
# baseline-expect: pass
$ uv run pytest tests/codex/test_local_main_branch_guard.py -v -k "gh_pr_merge_is_denied"
# AC4
# baseline-expect: pass
$ uv run pytest tests/codex/test_local_main_branch_guard.py -v -k "gh_pr_checkout_is_denied"

Stop Conditions

実装中にこれらの状況が発生したら直ちに作業を停止し、Issue comment に状況を記録して人間の判断を待つ:

  • Allowed Paths 外のファイルへの変更が必要になった
  • guard の他のブロックロジックに副作用が発生した
  • AC1〜AC4 以外の既存テストが新たに失敗した
  • スコープ外の機能追加が必要と判明した
  • 設計上の不整合が発見された
  • セキュリティ上の懸念が発生した

Required Skills

  • Python(scripts/agent-guards/ の guard ロジック)
  • pytest(テスト追加・実行)

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
issue_number: 1108
type: implementation
status: ready
outcome: "is_gh_mutation_command() で gh issue/pr GitHub ops を GH_OPS_ALLOW_PATTERNS allowlist に追加し user_github_ops_policy regression を修正する"
allowed_paths:
  - scripts/agent-guards/local_main_branch_guard.py
  - tests/codex/test_local_main_branch_guard.py
  - .claude/hooks/tests/test_local_main_branch_guard.py
verification_commands:
  - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_issue_close_is_denied'"
  - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'unlisted_gh_mutations_are_blocked'"
  - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_pr_merge_is_denied'"
  - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_pr_checkout_is_denied'"

Source

follow-up:squne121/loop-protocol:pr/1100:gh-ops-regression-fix

Activity

  1. added
    bug
    triage-required
    on Jun 21, 2026
  2. squne121 commented on Jun 21, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    #1108 の問題提起自体は妥当です。local_main_branch_guard の本来目的が「local root の Git checkout / branch state を壊す操作の遮断」なら、gh issue close のような GitHub Issue 操作まで一律 block するのは過剰です。#1108 は PR #1100 後に gh issue close/create/edit が block され、user_github_ops_policy と衝突した regression と説明しています。#1108 自体に追加コメントはありません。

    ただし、現在の #1108 の修正案をそのまま実装するのは危険です。GH_OPS_ALLOW_PATTERNS を足して gh issue/pr mutation を「block 対象外」にするだけだと、read-only / local-git-safe / remote-GitHub-mutation / interactive / branch-dependent の区別が崩れます。#1089 は明示的に gh issue view/list と gh pr view/list/status だけを display read-only とし、gh issue edit/comment/close や gh pr checkout/merge/update-branch を fail-closed にする contract でした。

    主要な衝突点

    PR #1100 は #1089 の contract に沿って、gh readonly 許可 / gh mutation fail-closed を実装した PR です。PR 本文でも AC11 として DISPLAY_READONLY_PATTERNS 拡張と mutation deny を掲げています。

    現在の実装では、DISPLAY_READONLY_PATTERNS に gh issue view/list と gh pr view/list/status だけが入り、is_gh_mutation_command() はそれ以外の gh issue/pr を block する設計です。

    さらにテストも、gh issue edit、gh issue close、gh pr merge、gh pr update-branch を block する前提で書かれています。別の completeness fixture では gh issue create や gh pr create も block 対象です。#1108 を通すなら、これは単なる regression fix ではなく、#1089 の security/ops policy reversal として扱うべきです。

    重大ブロッカー

    1. gh pr create は「Issue/PR metadata 操作」では済まない

    #1108 は gh pr create を allow 予定に含めていますが、これはかなり危険です。GitHub CLI の公式マニュアルでは、現在の branch が fully pushed でない場合、gh pr create はどこへ push するかを尋ね、fork や push を発生させ得ます。--head を使うと fork/push の挙動を回避できますが、bare な gh pr create は local branch state と remote write の両方に絡みます。(GitHub CLI)

    したがって、#1108 の初回修正で gh pr create を allow するのはやめるべきです。必要なら別 Issue に分離し、少なくとも --head OWNER:branch --base main --title ... --body ... --repo squne121/loop-protocol のような非対話・明示 branch 指定だけを検討対象にしてください。

    2. gh pr edit は current branch 推定に依存し得る

    gh pr edit は引数なしだと current branch の PR を選択します。つまり local checkout state に依存します。さらに base branch、reviewer、project、label など複数の PR metadata を変更できます。(GitHub CLI)

    gh pr edit を allow するなら、bare gh pr edit は block し、PR number / URL を必須にするべきです。#1108 の r"^gh\s+pr\s+(create|comment|edit)" は広すぎます。

    3. comment / edit / create には対話・削除・ファイル読込オプションがある

    gh issue comment と gh pr comment には --delete-last、--edit-last、--editor、--web、--body-file などがあります。単純に comment を allow すると、コメント追加だけでなく削除・編集・外部エディタ起動・ファイル読込をまとめて許可します。(GitHub CLI)

    gh issue create も bare 実行では対話入力に入り得ますし、--body-file、--editor、--web、project 追加などがあります。project 操作には追加 scope も必要です。(GitHub CLI)

    したがって、GH_OPS_ALLOW_PATTERNS は「subcommand 名」だけで許可してはいけません。flag matrix まで固定してください。

    4. gh pr merge と gh pr checkout を block 維持する根拠は強い

    #1108 の AC3/AC4 は正しいです。gh pr checkout は PR branch を checkout するコマンドであり、公式例でも branch switch を伴います。(GitHub CLI)

    gh pr merge は GitHub 上で merge するだけでなく、--delete-branch により local / remote branch の削除も含み得ます。これは local root guard の対象外にしてよい操作ではありません。(GitHub CLI)

    5. docs と hook-boundaries の更新が必須

    docs/dev/hook-boundaries.md は #1089 後の正本として、gh issue view/list と gh pr view/list/status だけを readonly とし、gh mutation コマンド(edit/close/merge 等) を fail-closed と明記しています。#1108 はこの正本と衝突します。

    したがって実装だけ直すと、scripts/check_hook_boundaries.py の設計思想とドキュメント正本が乖離します。#1108 の Allowed Paths には docs/dev/hook-boundaries.md と必要なら scripts/check_hook_boundaries.py を入れるべきです。

    6. Codex parity テストが不足する

    Claude 側テストには gh issue close/create/edit の deny fixture がありますが、Codex 側は gh pr checkout deny と read-only pipeline 中心で、新しい GitHub remote ops allow matrix はありません。

    #1089 の主眼は Claude/Codex parity でした。#1108 で shared core だけを直して Claude 側だけテストするのは、同じ種類の regression を再発させます。

    推奨する設計

    DISPLAY_READONLY_PATTERNS に足してはいけません。gh issue close/create/edit/comment/reopen は read-only ではなく、remote GitHub mutation です。新しい分類を作るべきです。

    REASON_GITHUB_REMOTE_OPS = "github_remote_ops_command"
    

    評価順は概ね次が安全です。

    1. readonly pipeline classifier

    2. compound / wrapper / redirection fail-closed

    3. shlex tokenization

    4. git global option fail-closed

    5. display readonly allow

    6. branch-safe maintenance allow

    7. /tmp / python -c fail-closed

    8. safe GitHub remote ops allow

    9. all other gh issue/pr mutation fail-closed

    10. branch mutation detection

    11. drifted/detached strict allowlist

    12. default allow

    safe GitHub remote ops は raw regex ではなく token ベースで判定してください。最低限、次をチェックするべきです。

    - tokens[0] == "gh"
    - tokens[1] in {"issue", "pr"}
    - tokens[2] が許可 subcommand
    - pipeline / redirection / compound / shell wrapper を含まない
    - bare interactive form を許可しない
    - `--web`, `--editor`, `--delete-last`, `--edit-last`, `--body-file` などを明示判断
    - `gh pr create` と bare `gh pr edit` は初回修正から除外
    - 可能なら `--repo squne121/loop-protocol` を必須、少なくとも他 repo を block
    

    #1108 の AC 書き換え案

    現行 AC は粗すぎます。以下に置き換えるのが安全です。

    区分 | コマンド | 判定 -- | -- | -- allow | gh issue close 1089 --repo squne121/loop-protocol --reason completed | github_remote_ops_command allow | gh issue comment 1089 --repo squne121/loop-protocol --body "..." | github_remote_ops_command allow | gh issue reopen 1089 --repo squne121/loop-protocol --comment "..." | github_remote_ops_command allow 条件付き | gh issue create --repo squne121/loop-protocol --title "..." --body "..." | 非対話形式のみ block | bare gh issue create | 対話入力のため block block | gh issue comment 1089 --delete-last | destructive comment mutation block | gh issue comment 1089 --editor / --web | interactive / external UI block | gh issue edit 1089 --body-file secret.txt | file-read 経由の mutation block | gh pr create | push/fork/current branch 依存のため初回除外 block | bare gh pr edit | current branch 依存 block | gh pr checkout 123 | local checkout mutation block | gh pr merge 123 | merge / branch delete risk block | gh issue develop 123 --checkout | local checkout mutation block | gh api ... | endpoint/method/body 混在のため別 Issue

    追加すべきテスト

    最低限、以下を追加してください。

    uv run pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py -q
    uv run python3 scripts/check_hook_boundaries.py
    pnpm typecheck
    pnpm lint
    pnpm test
    pnpm build
    

    テスト内容は次の matrix が必要です。

    Claude:
    - allowed GitHub remote ops は status=allow, reason_code=github_remote_ops_command
    - `readonly_command` ではないこと
    - `gh issue close | head` は block
    - `gh issue close && git switch issue-123` は block
    - `gh issue comment --delete-last` は block
    - `gh pr create` は block または厳格条件付き allow
    - `gh pr checkout` / `gh pr merge` は block 維持
    

    Codex:

    • 同じ allow/block/reason_code matrix
    • PreToolUse / PermissionRequest の両イベントで parity

    最終結論

    #1108 は「PR #1100 の副作用を直す Issue」としては必要です。ただし、現在の修正案は GitHub remote ops を read-only / non-mutation に誤分類する危険な巻き戻し です。

    実装方針は次に限定してください。

    1. gh issue close/comment/reopen など、post-merge-cleanup に実際必要な操作だけを github_remote_ops_command として許可する。

    2. DISPLAY_READONLY_PATTERNS には入れない。

    3. gh pr create / gh pr edit は初回修正から外すか、非対話・明示 repo・明示 branch の厳格条件を別 Issue で扱う。

    4. 実装: local_main_branch_guard の Claude/Codex read-only parity と script allowlist を整備する #1089 で追加された deny fixture / hook-boundaries docs / Codex parity test を同時更新する。

    この条件を満たさない PR は、false block の修正ではなく false allow の導入になります。

    ## 判定: REQUEST_CHANGES

    #1108 の問題提起自体は妥当です。local_main_branch_guard の本来目的が「local root の Git checkout / branch state を壊す操作の遮断」なら、gh issue close のような GitHub Issue 操作まで一律 block するのは過剰です。#1108 は PR #1100 後に gh issue close/create/edit が block され、user_github_ops_policy と衝突した regression と説明しています。#1108 自体に追加コメントはありません。

    ただし、現在の #1108 の修正案をそのまま実装するのは危険です。GH_OPS_ALLOW_PATTERNS を足して gh issue/pr mutation を「block 対象外」にするだけだと、read-only / local-git-safe / remote-GitHub-mutation / interactive / branch-dependent の区別が崩れます。#1089 は明示的に gh issue view/list と gh pr view/list/status だけを display read-only とし、gh issue edit/comment/close や gh pr checkout/merge/update-branch を fail-closed にする contract でした。

    主要な衝突点

    PR #1100 は #1089 の contract に沿って、gh readonly 許可 / gh mutation fail-closed を実装した PR です。PR 本文でも AC11 として DISPLAY_READONLY_PATTERNS 拡張と mutation deny を掲げています。

    現在の実装では、DISPLAY_READONLY_PATTERNS に gh issue view/list と gh pr view/list/status だけが入り、is_gh_mutation_command() はそれ以外の gh issue/pr を block する設計です。

    さらにテストも、gh issue edit、gh issue close、gh pr merge、gh pr update-branch を block する前提で書かれています。別の completeness fixture では gh issue create や gh pr create も block 対象です。#1108 を通すなら、これは単なる regression fix ではなく、#1089 の security/ops policy reversal として扱うべきです。

    重大ブロッカー

    1. gh pr create は「Issue/PR metadata 操作」では済まない

    #1108 は gh pr create を allow 予定に含めていますが、これはかなり危険です。GitHub CLI の公式マニュアルでは、現在の branch が fully pushed でない場合、gh pr create はどこへ push するかを尋ね、fork や push を発生させ得ます。--head を使うと fork/push の挙動を回避できますが、bare な gh pr create は local branch state と remote write の両方に絡みます。([GitHub CLI]1)

    したがって、#1108 の初回修正で gh pr create を allow するのはやめるべきです。必要なら別 Issue に分離し、少なくとも --head OWNER:branch --base main --title ... --body ... --repo squne121/loop-protocol のような非対話・明示 branch 指定だけを検討対象にしてください。

    2. gh pr edit は current branch 推定に依存し得る

    gh pr edit は引数なしだと current branch の PR を選択します。つまり local checkout state に依存します。さらに base branch、reviewer、project、label など複数の PR metadata を変更できます。([GitHub CLI]2)

    gh pr edit を allow するなら、bare gh pr edit は block し、PR number / URL を必須にするべきです。#1108 の r"^gh\s+pr\s+(create|comment|edit)" は広すぎます。

    3. comment / edit / create には対話・削除・ファイル読込オプションがある

    gh issue comment と gh pr comment には --delete-last、--edit-last、--editor、--web、--body-file などがあります。単純に comment を allow すると、コメント追加だけでなく削除・編集・外部エディタ起動・ファイル読込をまとめて許可します。([GitHub CLI]3)

    gh issue create も bare 実行では対話入力に入り得ますし、--body-file、--editor、--web、project 追加などがあります。project 操作には追加 scope も必要です。([GitHub CLI]4)

    したがって、GH_OPS_ALLOW_PATTERNS は「subcommand 名」だけで許可してはいけません。flag matrix まで固定してください。

    4. gh pr merge と gh pr checkout を block 維持する根拠は強い

    #1108 の AC3/AC4 は正しいです。gh pr checkout は PR branch を checkout するコマンドであり、公式例でも branch switch を伴います。([GitHub CLI]5)

    gh pr merge は GitHub 上で merge するだけでなく、--delete-branch により local / remote branch の削除も含み得ます。これは local root guard の対象外にしてよい操作ではありません。([GitHub CLI]6)

    5. docs と hook-boundaries の更新が必須

    docs/dev/hook-boundaries.md は #1089 後の正本として、gh issue view/list と gh pr view/list/status だけを readonly とし、gh mutation コマンド(edit/close/merge 等) を fail-closed と明記しています。#1108 はこの正本と衝突します。

    したがって実装だけ直すと、scripts/check_hook_boundaries.py の設計思想とドキュメント正本が乖離します。#1108 の Allowed Paths には docs/dev/hook-boundaries.md と必要なら scripts/check_hook_boundaries.py を入れるべきです。

    6. Codex parity テストが不足する

    Claude 側テストには gh issue close/create/edit の deny fixture がありますが、Codex 側は gh pr checkout deny と read-only pipeline 中心で、新しい GitHub remote ops allow matrix はありません。

    #1089 の主眼は Claude/Codex parity でした。#1108 で shared core だけを直して Claude 側だけテストするのは、同じ種類の regression を再発させます。

    推奨する設計

    DISPLAY_READONLY_PATTERNS に足してはいけません。gh issue close/create/edit/comment/reopen は read-only ではなく、remote GitHub mutation です。新しい分類を作るべきです。

    REASON_GITHUB_REMOTE_OPS = "github_remote_ops_command"

    評価順は概ね次が安全です。

    1. readonly pipeline classifier
    2. compound / wrapper / redirection fail-closed
    3. shlex tokenization
    4. git global option fail-closed
    5. display readonly allow
    6. branch-safe maintenance allow
    7. /tmp / python -c fail-closed
    8. safe GitHub remote ops allow
    9. all other gh issue/pr mutation fail-closed
    10. branch mutation detection
    11. drifted/detached strict allowlist
    12. default allow

    safe GitHub remote ops は raw regex ではなく token ベースで判定してください。最低限、次をチェックするべきです。

    - tokens[0] == "gh"
    - tokens[1] in {"issue", "pr"}
    - tokens[2] が許可 subcommand
    - pipeline / redirection / compound / shell wrapper を含まない
    - bare interactive form を許可しない
    - `--web`, `--editor`, `--delete-last`, `--edit-last`, `--body-file` などを明示判断
    - `gh pr create` と bare `gh pr edit` は初回修正から除外
    - 可能なら `--repo squne121/loop-protocol` を必須、少なくとも他 repo を block
    

    #1108 の AC 書き換え案

    現行 AC は粗すぎます。以下に置き換えるのが安全です。

    区分 コマンド 判定
    allow gh issue close 1089 --repo squne121/loop-protocol --reason completed github_remote_ops_command
    allow gh issue comment 1089 --repo squne121/loop-protocol --body "..." github_remote_ops_command
    allow gh issue reopen 1089 --repo squne121/loop-protocol --comment "..." github_remote_ops_command
    allow 条件付き gh issue create --repo squne121/loop-protocol --title "..." --body "..." 非対話形式のみ
    block bare gh issue create 対話入力のため block
    block gh issue comment 1089 --delete-last destructive comment mutation
    block gh issue comment 1089 --editor / --web interactive / external UI
    block gh issue edit 1089 --body-file secret.txt file-read 経由の mutation
    block gh pr create push/fork/current branch 依存のため初回除外
    block bare gh pr edit current branch 依存
    block gh pr checkout 123 local checkout mutation
    block gh pr merge 123 merge / branch delete risk
    block gh issue develop 123 --checkout local checkout mutation
    block gh api ... endpoint/method/body 混在のため別 Issue

    追加すべきテスト

    最低限、以下を追加してください。

    uv run pytest .claude/hooks/tests/test_local_main_branch_guard.py tests/codex/test_local_main_branch_guard.py -q
    uv run python3 scripts/check_hook_boundaries.py
    pnpm typecheck
    pnpm lint
    pnpm test
    pnpm build

    テスト内容は次の matrix が必要です。

    Claude:
    - allowed GitHub remote ops は status=allow, reason_code=github_remote_ops_command
    - `readonly_command` ではないこと
    - `gh issue close | head` は block
    - `gh issue close && git switch issue-123` は block
    - `gh issue comment --delete-last` は block
    - `gh pr create` は block または厳格条件付き allow
    - `gh pr checkout` / `gh pr merge` は block 維持
    
    Codex:
    - 同じ allow/block/reason_code matrix
    - PreToolUse / PermissionRequest の両イベントで parity
    

    最終結論

    #1108 は「PR #1100 の副作用を直す Issue」としては必要です。ただし、現在の修正案は GitHub remote ops を read-only / non-mutation に誤分類する危険な巻き戻し です。

    実装方針は次に限定してください。

    1. gh issue close/comment/reopen など、post-merge-cleanup に実際必要な操作だけを github_remote_ops_command として許可する。
    2. DISPLAY_READONLY_PATTERNS には入れない。
    3. gh pr create / gh pr edit は初回修正から外すか、非対話・明示 repo・明示 branch の厳格条件を別 Issue で扱う。
    4. 実装: local_main_branch_guard の Claude/Codex read-only parity と script allowlist を整備する #1089 で追加された deny fixture / hook-boundaries docs / Codex parity test を同時更新する。

    この条件を満たさない PR は、false block の修正ではなく false allow の導入になります。

  3. squne121 commented on Jun 21, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  4. squne121 commented on Jun 21, 2026

    @squne121
    OwnerAuthor

    CONTRACT_REVIEW_RESULT_V1

    schema: CONTRACT_REVIEW_RESULT_V1
    issue_number: 1108
    repo: squne121/loop-protocol
    status: go
    reviewed_at: "2026-06-21"
    body_sha256: 96f85e0b7e2c67ac6bc453b589637b1454449edcf6c95095d52adde501c2699a
    
    checks:
      template_compliance: pass
      state_label: pass   # state/needs-human なし
      allowed_paths_present: pass
      vc_present: pass
      stop_conditions_complete: pass
      vc_preflight: pass
      ac_verifiability: pass
      product_spec_check: pass
      worktree_branch_collision: pass
      next_action: implement-issue
      blocked_reasons: []
    
    contract_snapshot:
      outcome: >
        scripts/agent-guards/local_main_branch_guard.py の is_gh_mutation_command() が
        gh issue close/create/edit/comment/reopen および gh pr create/comment/edit を
        block せず通過させる。gh pr merge / gh pr checkout は引き続き block される。
      acceptance_criteria:
        - "AC1: gh issue close 1089 が allow される"
        - "AC2: gh issue create が allow される"
        - "AC3: gh pr merge は引き続き block される"
        - "AC4: gh pr checkout は引き続き block される"
      verification_commands:
        - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_issue_close_is_denied'"
        - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'unlisted_gh_mutations_are_blocked'"
        - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_pr_merge_is_denied'"
        - "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_pr_checkout_is_denied'"
      allowed_paths:
        - scripts/agent-guards/local_main_branch_guard.py
        - tests/codex/test_local_main_branch_guard.py
        - .claude/hooks/tests/test_local_main_branch_guard.py
      worktree_branch: issue-1108-gh-ops-allowlist (未使用・衝突なし)
    
    vc_preflight:
      summary: all pass (4/4 go)
      ac1:
        raw_command: "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_issue_close_is_denied'"
        baseline_expect: fail
        actual_exit_code: 0
        classification: expected_pass
        category: regression_gate
        scope_class: regression_gate
        decision: go
        note: >
          現在テストは test_gh_issue_close_is_denied が "block" を assert し PASS する。
          baseline-expect: fail は「実装前にこのテスト(新 allow assertion)が fail すること」を示すが、
          テスト自体が実装後に書き換えられる前提のため go。
      ac2:
        raw_command: "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'unlisted_gh_mutations_are_blocked'"
        baseline_expect: fail
        actual_exit_code: 0
        classification: expected_pass
        category: regression_gate
        scope_class: regression_gate
        decision: go
        note: >
          test_unlisted_gh_mutations_are_blocked は gh issue create / gh pr create を
          blocked として assert し現在 PASS。実装後は GH_OPS_ALLOW_PATTERNS でこれら
          ops が許可され、テスト assertion を更新または新テスト追加が必要。go。
      ac3:
        raw_command: "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_pr_merge_is_denied'"
        baseline_expect: pass
        actual_exit_code: 0
        classification: expected_pass
        category: baseline_expect_pass
        scope_class: regression_gate
        decision: go
      ac4:
        raw_command: "uv run pytest tests/codex/test_local_main_branch_guard.py -v -k 'gh_pr_checkout_is_denied'"
        baseline_expect: pass
        actual_exit_code: 0
        classification: expected_pass
        category: baseline_expect_pass
        scope_class: regression_gate
        decision: go
    
    blockers: none
    runtime_verification: not_applicable
    
    implementer_notes:
      - "AC1/AC2 の VC テスト名は現在の(壊れた)挙動を assert している。実装後は test assertion を逆転させるか新テストを追加すること"
      - "test_unlisted_gh_mutations_are_blocked の parametrize リストから gh issue create / gh pr create を除外するか別テストクラスに移すこと"
      - "worktree: .claude/worktrees/issue-1108-<slug> を使用。既存 issue-1108 系ブランチ・worktree なし"

    → implement-issue へ handoff 可能

  5. squne121 commented on Jun 21, 2026

    @squne121
    OwnerAuthor

    Draft PR を作成しました: #1120

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

    bugtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions