Skip to content

実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188

Closed as not planned

Description

@squne121

Source

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #2185 で Claude 側 worktree_scope_guard.py に追加した materialize_cleanup_contract.py の --check/--consume allowlist を Codex CLI 側の execpolicy matrix にも鏡写しし、両エージェント経路の防御を対称にする"
change_kind: code

Parent Issue

none(単独改善・PR #2185 の follow-up)

Parent Goal Ref

  • Goal: 該当なし(親 Issue なし)
  • Desired Destination: 該当なし(親 Issue なし)

Current Validated Scope

  • scripts/ci/codex_execpolicy_matrix.py に materialize_cleanup_contract.py --check(agent-allow)と --consume(agent-deny, human-only)の allow/deny ケースを追加
  • scripts/ci/tests/test_codex_execpolicy_matrix.py / tests/codex/test_execpolicy_matrix.py に対応するテストケースを追加(既存の cleanup_exec.py 系ケースの構造を参照)

Remaining Parent Gaps

なし(本 Issue で追加した execpolicy matrix ケースをもって、PR #2185 が意図的に据え置いた follow-up は解消される想定)

Outcome

scripts/ci/codex_execpolicy_matrix.py に materialize_cleanup_contract.py --check(agent 発行 allow)と --consume(agent 発行 deny、human-only)の allow/deny ケースが追加され、対応する scripts/ci/tests/test_codex_execpolicy_matrix.py と tests/codex/test_execpolicy_matrix.py のテストが green になっている状態。これにより PR #2185 で Claude 側 worktree_scope_guard.py に追加された allowlist 形状(--check は bool_flags に含め agent-allow、--consume/--contract-id/--expected-contract-sha256 は allowlist から意図的に除外し agent-deny)が Codex CLI 側 execpolicy matrix にも鏡写しされる。

Runtime Verification Applicability

  • decision: immediate
  • reason: pinned Codex CLI binary で expected_execpolicy を実測する必要があり、静的検証のみでは完結しないため(下記 Stop Conditions 参照)

In Scope

  • scripts/ci/codex_execpolicy_matrix.py の execpolicy_case_definitions に、materialize_cleanup_contract.py --check(agent-allow 相当)と --consume(agent-deny 相当、human-only)を模した argv ケースを追加する
  • 追加ケースの expected_execpolicy は pinned Codex CLI 実測値に基づいて設定する(推測値を書かない。詳細は Stop Conditions 参照)
  • scripts/ci/tests/test_codex_execpolicy_matrix.py と tests/codex/test_execpolicy_matrix.py に、新規ケースを検証する対応するテスト・fixture 更新を追加する
  • PR feat: cleanup executor に one-shot discard lane と compare-and-delete を追加する #2185 の scripts/agent-guards/worktree_scope_guard.py(_AGENT_OPS_ARG_SPECS["scripts/agent-ops/materialize_cleanup_contract.py"])と tests/agent_guards/test_worktree_scope_guard.py(test_materialize_check_allowed_real_hook / test_materialize_consume_denied_real_hook)の allow/deny 形状を参照実装として、Codex 側ケースの意図(--check allow / --consume deny)を一致させる

Out of Scope

  • scripts/agent-guards/worktree_scope_guard.py および Claude 側 hook の変更(PR feat: cleanup executor に one-shot discard lane と compare-and-delete を追加する #2185 で完了済み)
  • materialize_cleanup_contract.py / cleanup_exec.py / cleanup_contract_v3.py 本体のロジック変更
  • execpolicy matrix 全体のリファクタリング(既存ケースの再設計は行わない。新規ケース追加のみ)
  • .codex/rules/default.rules の static rule 変更(execpolicy 実測結果次第で別途要否判断が必要になった場合は本 Issue のスコープ外とし、follow-up として扱う)

Acceptance Criteria

  • AC1: scripts/ci/codex_execpolicy_matrix.py の execpolicy_case_definitions に materialize_cleanup_contract.py --check を含む argv ケース(label に materialize_check を含む)が追加されている
  • AC2: scripts/ci/codex_execpolicy_matrix.py の execpolicy_case_definitions に materialize_cleanup_contract.py --consume を含む argv ケース(label に materialize_consume を含む)が追加され、expected_guard_pair が deny になっている
  • AC3: scripts/ci/tests/test_codex_execpolicy_matrix.py に AC1/AC2 で追加したケースに対応するテストが存在する
  • AC4: tests/codex/test_execpolicy_matrix.py が既存テストを壊さず PASS する

Verification Commands

# AC1
$ rg -c "materialize_check" scripts/ci/codex_execpolicy_matrix.py
# AC2
$ rg -c "materialize_consume" scripts/ci/codex_execpolicy_matrix.py
# AC3
$ rg -c "materialize_check" scripts/ci/tests/test_codex_execpolicy_matrix.py
# AC3
$ rg -c "materialize_consume" scripts/ci/tests/test_codex_execpolicy_matrix.py
# AC4
$ uv run --locked pytest tests/codex/test_execpolicy_matrix.py -q
# AC4
$ uv run --locked pytest scripts/ci/tests/test_codex_execpolicy_matrix.py -q

Allowed Paths

  • scripts/ci/codex_execpolicy_matrix.py
  • scripts/ci/tests/test_codex_execpolicy_matrix.py
  • tests/codex/test_execpolicy_matrix.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 環境/ツール前提条件: 本 Issue の AC1/AC2/AC5 は pinned Codex CLI バイナリ(.codex 配下の pin 定義に従うバージョン)が実装環境で利用可能であることを前提とする。pinned バイナリが用意できない環境では expected_execpolicy を推測で埋めず、直ちに作業を停止して人間に環境準備を依頼すること(PR feat: cleanup executor に one-shot discard lane と compare-and-delete を追加する #2185 でこの follow-up が据え置かれた理由そのものであり、同じ回避不能な制約が本 Issue にも適用される)

Required Skills

なし

Required Design References

  • scripts/agent-guards/worktree_scope_guard.py(_AGENT_OPS_ARG_SPECS["scripts/agent-ops/materialize_cleanup_contract.py"] — mirror 対象の allow/deny 形状)
  • tests/agent_guards/test_worktree_scope_guard.py(test_materialize_check_allowed_real_hook / test_materialize_consume_denied_real_hook — mirror 対象のテスト意図)
  • docs/dev/agent-skill-boundaries.md

Scope Delta(任意)

N/A

Notes for Reviewer

Activity

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

    @squne121
    OwnerAuthor

    AI駆動開発におけるCodex CLI の運用は廃止する方針なので関連するGitHubイシューも順次クローズされていくべき認識です。

  3. squne121 commented on Aug 16, 2026

    @squne121
    OwnerAuthor

    結論

    #2188 は実装せず、not_planned でクローズするのが妥当です。
    指定 OWNER コメントは「AI駆動開発における Codex CLI 運用を廃止し、関連 Issue も順次クローズする」という明示的な最新方針です。 しかも既に #2154 が「Codex CLI 実行系を廃止して Claude Code dual-runtime へ移行する」migration authority であり、#2160 が Codex 固有 parity contract の除去、#2161 が Codex CLI asset/documentation の inventory-first retirement を担当しています。

    敵対的に見ると、#2188 は「小さな follow-up」ではなく、廃止対象の runtime に新しい互換性契約と CI 保守負債を追加する Issue になっています。

    敵対的レビュー

    1. [P0] 最新の architecture authority と目的が正面衝突しています。
      実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 は parent_issue: none とし、「Claude と Codex の両エージェント経路の防御を対称にする」ことを goal に置いています。 しかし現在の destination はそもそも「Claude/Codex CLI の二経路を維持する」ことではありません。.claude/agents を provider-neutral SSOT にして Codex-specific parity を除去し、その後 .codex/** や Codex-specific bridge tests/runtime adapters を撤去する設計です。
      よって 実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 の正しい後継先は implementation PR ではなく、実装: retire Codex CLI assets and documentation(Phase 3, Child 3 of #2154) #2161 の producer/consumer inventory に対象資産を登録することです。

    2. [P0] 「防御を対称にする」という threat model が誤っています。
      元の 実装: codex execpolicy gate を fail-open から fail-closed へ修正し、execpolicy と hook の責務境界を明確化する (#1137 Blocker10 follow-up) #1150 は Codex execpolicy を coarse routing layer と定義し、exact argv・cleanup contract・one-shot authorization は別の runtime guard が担う、と明確に分離しています。 .codex/rules/default.rules 自身も rules を security boundary とみなさず、controlled executor の正確な argv/value 検査は runtime guard が実際の enforcement だと記述しています。
      OpenAI の現行設計も、技術的境界を sandbox に置き、rules/approval をその外側での実行判断に使う layered posture です。(OpenAI) Codex execpolicy matrix に同じ allow/deny 行を増やしても、PR feat: cleanup executor に one-shot discard lane と compare-and-delete を追加する #2185 の cleanup safety が強くなるわけではありません。

    3. [P1] 「mirror」のテスト仕様が、実際の PR feat: cleanup executor に one-shot discard lane と compare-and-delete を追加する #2185 契約を mirror していません。
      現行 worktree_scope_guard.py は --check だけを agent に許し、--consume、--contract-id、--expected-contract-sha256 をすべて allowlist から除外しています。さらに --flag=value、duplicate flag、unknown flag、positionals も拒否します。 実装本体でも destructive --consume は、事前発行された immutable contract の nonce と SHA-256 digest の双方が必要です。
      ところが 実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 の AC は実質「materialize_check という label がある」「materialize_consume があって guard_pair=deny」という程度です。 これでは exact valid consume shape、digest binding、--flag=value、duplicate、unknown flag を再現しません。仮に 実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 を残すなら AC 自体が不足しています。

    4. [P1] Runtime Verification contract が自己矛盾しています。
      実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 は「pinned Codex CLI で実測し、expected_execpolicy を推測してはいけない」と要求する一方、Acceptance Criteria は AC1~AC4しかなく、Stop Conditions では存在しない AC5 を参照しています。さらに Verification Commands は rg -c と Python tests が主体で、実測 provenance の PR ログは AC にしていません。
      既存 matrix は version・package・native executable・SHA・raw JSON 等を machine-readable artifact に残せる設計です。 人間が PR 本文へログを貼る方式へ退化させる理由がありません。実装するなら「pinned binary artifact readback」を AC にすべきですが、今回は廃止対象なのでその投資自体を止めるべきです。

    5. [P1] pinned binary の所在記述が誤っており、しかも古い版を新規 contract に固定しようとしています。
      実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 は「.codex 配下の pin 定義に従う」と書いていますが、current main の .codex/config.toml に CLI version pin はありません。 実際の required CI lane は .github/workflows/ci.yml で @openai/[email protected] / codex-cli 0.142.0 を直接固定しています。
      OpenAI 公式 changelog では 2026年8月7日に 0.147.0 が公開済みで、0.142 系自体も 0.142.5 まで更新されています。([OpenAI Developers]2) 0.142.5 には Responses WebSocket payload の trace logging 修正もありますが、これは 実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 の CI lane がその問題に直接さらされているという意味ではありません。重要なのは、0.142.0 が historical behavior snapshot になっていることです。廃止対象 runtime に対して、その古い挙動をさらに parity test として固定する合理性は低いです。

    6. [P2] upstream semantics との乖離が進んでおり、legacy test の意味が曖昧です。
      current OpenAI docs では prefix_rule 自体は positional exact-prefix ですが、単純な bash -lc / bash -c の compound command は tree-sitter で分解し、各 command を別々に評価して最も restrictive な結果を採用します。([OpenAI Developers]3) 一方 current repo の .rules コメントは、bash -lc wrapper を別の blanket bash -> prompt rule で処理する必要があるという、より古い execpolicy model を前提にしています。
      0.142.0 当時の挙動としてその説明が正しい可能性はありますが、現行 Codex 一般仕様として固定してはいけません。残すなら必ず「0.142.0 compatibility snapshot」と version-scope すべきです。しかし migration 方針上は retire の方が自然です。

    PR #2185 の安全設計について

    ここは #2188 と切り離すべきです。PR #2185 の OWNER security review で本当に問題になったのは、execpolicy parity ではなく、approval substitution、verification-to-destruction TOCTOU、branch の他 worktree 使用、exact human handoff といった destructive transaction の境界でした。

    その方向性は Git 自身の primitive とも整合しています。git worktree remove はデフォルトで dirty worktree を削除せず、force が必要です。git update-ref は expected old OID を指定した compare-and-delete が可能で、ref value が変化していれば削除しません。([Git]4) この runtime revalidation + lock + non-force removal + CAS が cleanup の重要な防御であり、Codex execpolicy matrix はその代替にはなりません。

    推奨 disposition

    #2188 は closed / not_planned とし、理由は「OWNER の Codex CLI retirement 方針および #2154/#2160/#2161 に superseded。PR #2185 の security boundary は Claude/runtime-independent cleanup implementation 側ですでに成立しており、legacy Codex parity の新規追加は行わない」とするのが最も整合的です。

    ただし、Codex 関連 Issue を一括で全部 close するのも誤りです。#2154、#2160、#2161 のように「Codex を廃止するために必要な migration/retirement Issue」は存続させる必要があります。#2161 の inventory には少なくとも codex_execpolicy_matrix.py、その2系統の tests、.codex/rules/default.rules、codex-execpolicy CI job とその downstream verifier を producer/consumer として取り込んだ上で、zero-reference 化してから撤去するのが安全です。

    判定: REQUEST_CHANGES ではなく、Issue 自体を NOT_PLANNED / SUPERSEDED にするレベルです。 #2188 の仕様を修正して実装を続けるより、#2161 の retirement contract を高品質化する方が現在の設計判断に一致します。

    GitHub 上の変更・コメント投稿・Issue クローズ操作は行っていません。

  4. squne121 commented on Aug 16, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(#2188)

    • termination_reason: superseded_by_decision
    • anchor comment: 実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 (comment) (OWNER、author_association: OWNER、trusted)
    • classification: superseded_by_decision
      • 人間(OWNER)が明示的に NOT_PLANNED クローズを推奨し、根拠を提示している
      • Outcome を in-place で修正しても目的(Claude/Codex 両経路の防御を対称にする)自体が現行 architecture direction(Codex CLI 廃止)と衝突するため維持できない
      • 代替先が既に存在する(#2161 が Phase 3 retirement inventory として codex_execpolicy_matrix.py 系ファイルの producer/consumer 登録・zero-reference 化・撤去を担当)

    事実確認(repository evidence、この session で直接検証済み)

    • #2154(OPEN, delivery-rollup parent, closure_children: [2158, 2160, 2161]): goal は「Claude Code を共通 development harness とし Codex CLI 実行系を段階的に廃止する」
    • #2160(OPEN, Phase 2, parent #2154): .claude/agents ↔ .codex/agents parity を dual-provider portability contract へ置換
    • #2161(OPEN, Phase 3, parent #2154): producer/consumer inventory 先行で Codex CLI asset/documentation を段階的撤去
    • .codex/config.toml に CLI version pin は存在しない(grep -n "version|pin" 0 件)— 実装: codex execpolicy matrix に materialize_cleanup_contract.py の --check/--consume 許可・拒否ケースを追加する #2188 の Stop Conditions 記載(「.codex 配下の pin 定義に従う」)は現状の repo と不整合
    • .github/workflows/ci.yml の codex-execpolicy job が @openai/[email protected] / codex-cli 0.142.0 を直接固定(L3009-3010)— pin の実体は CI 側にあり、.codex/config.toml ではない
    • scripts/agent-guards/worktree_scope_guard.py の materialize_cleanup_contract.py allow/deny 形状(--check は bool_flags に含め agent-allow、--consume/--contract-id/--expected-contract-sha256 は allowlist から除外し agent-deny)は既に PR feat: cleanup executor に one-shot discard lane と compare-and-delete を追加する #2185 で実装済みであることを確認

    以上より、anchor comment の dispositive claim(#2154/#2160/#2161 の存在・scope、pin 記述の齟齬、PR #2185 の実装状況)はすべて repository 上で独立に確認でき、追加の外部 web 調査は不要と判断した。

    結論

    #2188 は closed / not_planned とする。理由: OWNER の Codex CLI retirement 方針、および #2154/#2160/#2161 に superseded。PR #2185 の security boundary(approval substitution・verification-to-destruction TOCTOU・branch の他 worktree 使用・exact human handoff 等)は Claude/runtime-independent cleanup 実装側で既に成立しており、廃止対象 runtime(Codex CLI execpolicy matrix)に新規の legacy parity 投資を追加しない。codex_execpolicy_matrix.py 系ファイル(本 Issue が対象にしていたテストを含む)の producer/consumer inventory への登録・zero-reference 化・撤去は #2161 のスコープで扱う。

    follow-up 新規起票は行わない(#2161 が既存 tracking issue として十分にカバーしている)。

    schema_version: FOLLOW_UP_MATERIALIZATION_RESULT_V1
    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

No one assigned

    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