Skip to content

実装: Codex V2 runtime capability probe のテスト厳密化とテストディレクトリ命名重複を解消する #1861

Closed as not planned

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
depends_on: "#1834"
goal_ref: "Issue #1834 / PR #1850 の人間レビューで特定された non-blocking follow-up(テスト厳密化とテストディレクトリ命名重複の解消)を完了する"
change_kind: code

Parent Issue

なし(単独改善。Issue #1834 / PR #1850 のレビュー follow-up)

Parent Goal Ref

Precondition(着手前に必ず確認する)

本 Issue は #1834(GitHub native issue dependency として登録済み、blocked_by: #1834)に加えて、以下の Precondition を満たすまで着手しない。

precondition:
  decision_issue: "#1860"
  required_decision:
    - retain_probe_and_tests
    - remove_probe_and_tests
  on_retain:
    implement_this_issue: true
  on_remove:
    close_as_superseded: true
    removal_scope: "#1860 の Multi-Agent V2 整理 child"
  • #1860(OPEN)は Multi-Agent V2 系資産(本 Issue が対象とする scripts/agent-guards/probe_codex_v2_runtime_capability.py とそのテストを含む)の retain/delete を再判定する上位方針 Issue である。
  • #1860 が retain_probe_and_tests に決した場合のみ本 Issue を実装する。remove_probe_and_tests に決した場合は本 Issue を #1860 の整理 child へ統合し、本 Issue は superseded として close する。
  • state/blocked ラベルを付与し、#1860 の決定が確定するまでキューに入れない。

Current Validated Scope

  • tests/agent-guards/test_probe_codex_v2_runtime_capability.py の fake Codex CLI runner を、substring match ではなく expected-call queue ベースの exact 検証(未登録呼出し・欠落呼出し・重複呼出し・順序変更のいずれも検出する)へ変更する。
  • tests/agent-guards/(ハイフン)と既存 tests/agent_guards/(アンダースコア)のディレクトリ命名重複を tests/agent_guards/ へ統合する。
  • CI の python-test-plan 正本(.github/ci/python-test-plan.json)から旧 target tests/agent-guards/ を削除し、移行後の構成と一致させる。

Remaining Parent Gaps

なし

Outcome

tests/agent_guards/test_probe_codex_v2_runtime_capability.py(移行後の唯一の配置先)の fake runner が exact expected-call queue によって未登録呼出し・欠落呼出し・重複呼出し・意図しない順序変更のすべてを検出し、capture_output / text / timeout / cwd / env / 未知 kwargs を厳密検証し、常時真の no-op assertion が存在せず、.github/ci/python-test-plan.json が tests/agent-guards/ を含まず tests/agent_guards/ のみを target とし、統合後の tests/agent_guards/ 配下の pytest が全件 PASS している状態。

In Scope

  1. tests/agent-guards/test_probe_codex_v2_runtime_capability.py を tests/agent_guards/test_probe_codex_v2_runtime_capability.py へ移動する。
  2. .github/ci/python-test-plan.json の targets から旧 target "tests/agent-guards/" を削除する("tests/agent_guards/" は維持する)。
  3. fake runner を " ".join(cmd) substring match から、expected-call queue(collections.deque 等)による exact tuple(argv) 照合へ置換する。
  4. response / FileNotFoundError / TimeoutExpired を含む全 dispatch を exact argv ベースの expected-call model に統一する。
  5. 未登録の argv による呼出しを AssertionError にする(unexpected call)。
  6. 登録済みだが未消費の expected call を assert_exhausted() 相当の呼び出しで検出できるようにする(missing call)。
  7. 呼出しの重複・欠落・意図しない順序変更を検出する専用テストを追加する。
  8. fake runner の呼出し検証で capture_output / text / timeout / cwd / env / 未知 kwargs の存在と値を厳密に検証する(デフォルト引数で暗黙に一致させない)。
  9. assert str(tmp_path) not in call["env"]["CODEX_HOME"] or True の常時真 no-op assertion を削除し、隔離 CODEX_HOME が絶対パスであること・ambient CODEX_HOME と異なること・tmp_path と異なり tmp_path の親でもないことを検証する assertion に置き換える。
  10. 統合後、test_probe_codex_v2_runtime_capability.py の import パス・tests/agent_guards/conftest.py 依存が既存ファイル群と矛盾しないことを、対象テストの --collect-only で確認する。
  11. 移動先テストファイルに test_python_test_plan_check_paths_passes / test_verify_lane_union_passes を追加し、scripts/ci/python_test_plan.py --emit scope-argv --check-paths --format json と scripts/ci/verify_lane_union.py をそれぞれ subprocess 実行して returncode 0 を assert する(VC preflight の uv run allowlist は pytest 経由の呼び出しのみを許可するため、この 2 スクリプトを直接 VC として実行することはできない)。

Out of Scope

  • scripts/agent-guards/probe_codex_v2_runtime_capability.py 本体のロジック変更(Issue 実装: Codex Multi-Agent V2 runtime capability を artifact 化する #1834 で確定済みの probe 挙動は変えない)。
  • artifacts/codex-multi-agent-v2/runtime-capability.json の内容変更(live canary 実施は別 Issue で扱う)。
  • JSON Schema 追加・CI freshness gate の追加(別 Issue で扱う)。
  • tests/agent_guards/conftest.py および tests/agent_guards/ 配下の既存テストファイル(移行対象以外)の変更。
  • .github/workflows/ci.yml の変更(workflow は plan を動的に読むため不要)。
  • #1862(新規 JSON Schema・digest freshness gate 追加)・#1863(V2 live canary 追加投資)との統合。両 Issue は #1860 の方針確定を別途待つ。

Acceptance Criteria

  • AC1: 移動先 tests/agent_guards/test_probe_codex_v2_runtime_capability.py が存在し、旧ディレクトリ tests/agent-guards/ が存在しない。
  • AC2: .github/ci/python-test-plan.json の targets に "tests/agent-guards/" が存在せず、"tests/agent_guards/" が存在する。
  • AC3: fake runner の全 dispatch が exact tuple(argv) 照合であり、" ".join(cmd) を用いた substring/prefix fallback が存在しない。
  • AC4: 未登録の argv を受け取った場合に AssertionError を送出する(unexpected call)。
  • AC5: 登録済みだが未実行の expected call が存在する場合、検証用の exhaustion チェックが失敗する(missing call)。
  • AC6: 呼出しの重複・欠落・意図しない順序変更を検出する専用テストが存在し PASS する。
  • AC7: capture_output / text / timeout / cwd / env / 未知 kwargs の存在と値を厳密に検証するテストが存在し PASS する。
  • AC8: assert ... or True のような常時真になる assertion がテストファイル中に存在しない。
  • AC9: 移動先テストファイルの --collect-only が成功し、当該ファイルおよび tests/agent_guards/ 配下の pytest が全件 PASS する。
  • AC10: python_test_plan.py --emit scope-argv --check-paths と verify_lane_union.py がともに成功する。これを VC preflight allowlist の範囲内で検証するため、移動先テストファイルに test_python_test_plan_check_paths_passes / test_verify_lane_union_passes の 2 つの pytest wrapper(両スクリプトを subprocess で実行し returncode 0 を assert する)を追加する。
  • AC11: git diff で scripts/agent-guards/probe_codex_v2_runtime_capability.py / artifacts/codex-multi-agent-v2/runtime-capability.json / schema ファイル / tests/agent_guards/conftest.py に差分がない。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は fake runner の contract test 厳密化・テストディレクトリ統合・CI test-plan 正本更新のみで完結し、ゲームループやマルチコンポーネント間の runtime 統合検証は不要。

Verification Commands

# AC1
# baseline-expect: fail
$ test -f tests/agent_guards/test_probe_codex_v2_runtime_capability.py
# AC1
# baseline-expect: fail
$ test ! -d tests/agent-guards

# AC2
# baseline-expect: fail
$ ! rg -nF '"tests/agent-guards/"' .github/ci/python-test-plan.json
# AC2
# baseline-expect: pass
$ rg -nF '"tests/agent_guards/"' .github/ci/python-test-plan.json

# AC3
# baseline-expect: fail
$ ! rg -qF '" ".join(cmd)' tests/agent_guards/test_probe_codex_v2_runtime_capability.py

# AC4
# baseline-expect: fail
$ rg -q 'def test_unregistered_argv_is_rejected' tests/agent_guards/test_probe_codex_v2_runtime_capability.py

# AC5
# baseline-expect: fail
$ rg -q 'def test_missing_expected_call_is_rejected' tests/agent_guards/test_probe_codex_v2_runtime_capability.py

# AC6
# baseline-expect: fail
$ rg -q 'def test_duplicate_call_is_rejected' tests/agent_guards/test_probe_codex_v2_runtime_capability.py

# AC7
# baseline-expect: fail
$ rg -q 'def test_capture_text_timeout_cwd_env_are_explicit_and_exact' tests/agent_guards/test_probe_codex_v2_runtime_capability.py

# AC8
# baseline-expect: fail
$ ! rg -qF 'or True' tests/agent_guards/test_probe_codex_v2_runtime_capability.py

# AC9
# baseline-expect: fail
$ uv run python3 -m pytest --collect-only tests/agent_guards/test_probe_codex_v2_runtime_capability.py -q
# AC9
# baseline-expect: fail
$ uv run python3 -m pytest tests/agent_guards/ -q

# AC10
# baseline-expect: fail
$ rg -q 'def test_python_test_plan_check_paths_passes' tests/agent_guards/test_probe_codex_v2_runtime_capability.py
# AC10
# baseline-expect: fail
$ rg -q 'def test_verify_lane_union_passes' tests/agent_guards/test_probe_codex_v2_runtime_capability.py
# AC10
# baseline-expect: fail
$ uv run python3 -m pytest tests/agent_guards/test_probe_codex_v2_runtime_capability.py::test_python_test_plan_check_paths_passes -q
# AC10
# baseline-expect: fail
$ uv run python3 -m pytest tests/agent_guards/test_probe_codex_v2_runtime_capability.py::test_verify_lane_union_passes -q

# AC11
# baseline-expect: pass
$ git diff --quiet main -- scripts/agent-guards/probe_codex_v2_runtime_capability.py artifacts/codex-multi-agent-v2/runtime-capability.json tests/agent_guards/conftest.py

Allowed Paths

  • tests/agent-guards/test_probe_codex_v2_runtime_capability.py
  • tests/agent_guards/test_probe_codex_v2_runtime_capability.py
  • .github/ci/python-test-plan.json

tests/agent_guards/ 配下の既存ファイル(conftest.py 含む)は Allowed Paths に含まない。変更が必要と判明した場合は Scope Delta として報告する。

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 着手時点で #1860 が retain_probe_and_tests / remove_probe_and_tests のいずれにも決していない場合(即停止し #1860 の決定を人間へ確認する)

Required Skills

なし

Required Design References

Scope Delta(任意)

N/A

Notes for Reviewer

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 30, 2026
  2. squne121 commented on Jul 30, 2026

    @squne121
    OwnerAuthor

    create-issue transaction partial-failure

    Issue: #1861
    Failure stage: issue-ids
    Message: issue-ids failed

    Requested:

    Failure context: command=gh api graphql -f query=
    query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){issue(number:$number){id databaseId}}} -F owner=squne121 -F name=loop-protocol -F number=1850
    output=gh: Could not resolve to an Issue with the number of 1850.
    matching_issue_numbers=[1861]
    issue_number=1861

    Recovery hint: stage 'issue-ids' encountered an unexpected failure.
    Generic guidance: verify the issue state manually and re-run the transaction if safe.
    gh issue view 1861 --repo squne121/loop-protocol --json number,title,labels,state
    idempotent re-run: depends on the specific failure

    Please recover deterministically before re-running the create issue transaction.

  3. squne121 commented on Jul 30, 2026

    @squne121
    OwnerAuthor

    結論

    判定は REQUEST_CHANGES。Issue #1861 は現状の契約のままでは着手不可です。

    主目的である「substring fake runner の厳密化」と「テストディレクトリ統合」は妥当です。しかし、次の二点が先に解消されていません。

    1. tests/agent-guards/ を削除すると、CI の正本である .github/ci/python-test-plan.json に残った旧パスにより確実に CI が失敗する一方、この計画ファイルは Allowed Paths に含まれていません。
    2. 上位方針 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 が Multi-Agent V2 系資産の存廃を再判定し、場合によっては単一エージェント運用へ戻す方針を掲げています。保持するか削除するか未決定の資産へ追加投資する順序になっています。

    敵対的レビュー findings

    P0: AC3を満たすとCIが必ず壊れ、修正はAllowed Paths違反になる

    現在の .github/ci/python-test-plan.json は Python テスト対象の「Single source of truth」と明記され、tests/agent_guards/ と tests/agent-guards/ の両方を target に含めています。plan loader は --check-paths 指定時に全 target の存在を検査し、欠落があれば PlanError を送出します。CI workflow もこの検査を実際に fail-closed で実行しています。

    したがって、Issue #1861 の AC3 に従って tests/agent-guards/ を削除すると、次の状態になります。

    AC3: PASS
    python_test_plan --check-paths: FAIL
    CI: FAIL
    

    しかし Issue の Allowed Paths は旧テストファイルと tests/agent_guards/ だけで、.github/ci/python-test-plan.json を含みません。さらに「Allowed Paths 外の変更が必要なら停止」と規定しています。つまり、現在の契約を遵守した実装では成功状態に到達できません。

    必須修正

    • .github/ci/python-test-plan.json を Allowed Paths に追加する。
    • target から "tests/agent-guards/" を削除する。
    • "tests/agent_guards/" は維持する。
    • plan path check と lane-union 検証を Acceptance Criteria に追加する。
    • workflow 自体は plan を動的に読むため、.github/workflows/ci.yml の変更は不要です。

    これは任意の改善ではなく、Issue を実装可能にするための契約修正です。


    P1: #1860による存廃判断を無視しており、実装順序が逆転している

    Issue #1861 は parent_issue: none、Remaining Parent Gaps: なし としていますが、対象テストは #1834/PR #1850 で導入され、#1834 は #1833「Codex Multi-Agent V2 移行」の Phase 0 です。

    一方、直前の #1860 は、#1833 を「個人開発では過剰投資の可能性がある」と明記し、Multi-Agent V2・ledger・manifest の authority を廃止して単一エージェント運用を既定へ戻すための整理 child を予定しています。また、新しい schema、digest、artifact authority を追加しない方針を固定しています。

    関連する #1862 は新しい JSON Schema と digest freshness gate を追加する内容であり、#1860 の固定方針と直接衝突しています。#1863 も V2 live canary への追加投資です。この三件を独立した non-blocking follow-up として並列実装するのは、現在のリポジトリ方針と整合していません。

    #1861には次の事前判定を追加すべきです。

    precondition:
      decision_issue: "#1860"
      required_decision:
        - retain_probe_and_tests
        - remove_probe_and_tests
    
    on_retain:
      implement_this_issue: true
    
    on_remove:
      close_as_superseded: true
      removal_scope: "#1860 の Multi-Agent V2 整理 child"

    #1861自体は小規模ですが、削除予定のテストを先に精密化するのはサンクコストです。技術的 P0 を修正した後も、#1860 による retain/delete 判定を着手条件とするのが妥当です。


    P1: tuple(argv) 辞書化だけでは「呼ばれなかったコマンド」を検出できない

    現在の fake runner は joined argv の substring を順番に調べ、未一致なら成功を返します。例えば --help は exec --help にも一致するため、先に登録された短い marker が後者を飲み込みます。これは #1861 が解消しようとしている実害です。

    ただし、Issue が指定する「dict[tuple(argv), response] と未登録 argv の AssertionError」だけでは不十分です。

    例えば production が誤って codex exec --help を呼ばなくなっても、runner に登録されたその response は未使用のまま残ります。現在のテストは codex --help の内容だけでも期待値を満たせるため、テストが成功する可能性があります。production は現在二つの help command を順に実行しています。

    厳密化すべき対象は「未知の追加呼出し」だけではなく、次の全てです。

    • 余分な呼出し
    • 欠落した呼出し
    • 重複呼出し
    • 意図しない順序変更
    • 同一 argv の再試行回数
    • 未消費の expected response

    辞書ではなく、原則として expected-call queue を使うべきです。

    class StrictRunner:
        def __call__(self, cmd, **kwargs):
            if not self.expected:
                raise AssertionError(f"unexpected subprocess call: {tuple(cmd)!r}")
    
            expected = self.expected.popleft()
            assert tuple(cmd) == expected.argv
            expected.assert_kwargs(kwargs)
    
            if isinstance(expected.outcome, BaseException):
                raise expected.outcome
            return expected.outcome
    
        def assert_exhausted(self) -> None:
            assert not self.expected, f"missing subprocess calls: {list(self.expected)!r}"

    呼出し順が契約でないケースだけ、queue の代わりに multiset/Counter と消費確認を使うべきです。単なる tuple-key dictionary は、同じ argv を異なる結果で複数回実行するテストも表現できません。


    P1: fake runnerのデフォルト引数が、本番コードのkwargs欠落を隠蔽する

    現在の fake runner は次のシグネチャです。

    def _runner(
        cmd,
        capture_output=True,
        text=True,
        timeout=None,
        cwd=None,
        env=None,
    ):

    このため、production が誤って capture_output=True や text=True を渡さなくなっても、fake 側のデフォルト値によって「渡されたように見える」ため、テストは検出できません。実際の subprocess.run のデフォルトは capture_output=False、text=None です。 ([Python documentation]1)

    production の _run は現在、capture_output=True、text=True、指定 timeout、および必要に応じて cwd と env を渡しています。これらは subprocess 呼出し契約そのものです。Python の仕様上、env を渡すと通常の環境継承の代わりにその mapping が使用され、cwd もプロセス解決・実行コンテキストへ影響します。 ([Python documentation]1)

    元の PR #1850 レビューも、follow-up の strict fake に対して以下を要求していました。

    未登録commandはAssertionError
    argv exact match
    cwd exact match
    env policy確認
    timeout確認
    return code確認
    

    #1861 はこの要求を argv と未登録 command だけに縮退させています。元レビューを完全には回収していません。

    必要な設計

    • fake は期待値と同じ値をデフォルト引数にしない。
    • def __call__(self, cmd, **kwargs) または _MISSING sentinel を使用する。
    • capture_output と text は「キーが存在し、値が True」であることを検査する。
    • timeout は呼出しごとの正確な値を検査する。
    • config-loader の全四呼出しについて cwd == str(repo_root) を検査する。
    • env は ambient environment を維持しつつ、CODEX_HOME だけが隔離先へ上書きされたことを検査する。
    • unexpected kwargs も拒否する。
    • call history に保存する env は参照ではなく dict(env) の snapshot にする。

    Codex は CLI override、project config、user config の優先順位を持ち、project .codex/config.toml は current working directory と trust 状態に依存して読み込まれます。したがって cwd と隔離 CODEX_HOME はテストの周辺情報ではなく、probe の意味を決める入力です。 ([OpenAI Developers]2)


    P1: 現在のテストには常に成功するassertionが残っている

    隔離 CODEX_HOME の検査には次の assertion があります。

    assert str(tmp_path) not in call["env"]["CODEX_HOME"] or True

    or True により、どのような値でも必ず成功します。Issue の目的が「テスト厳密化」である以上、これを残したまま exact argv だけ直すのは不十分です。しかし #1861 の In Scope/AC には、この no-op assertion の除去が含まれていません。

    少なくとも次を検証すべきです。

    codex_home = Path(call["env"]["CODEX_HOME"])
    
    assert codex_home.is_absolute()
    assert call["env"]["CODEX_HOME"] != os.environ.get("CODEX_HOME")
    assert codex_home != tmp_path
    assert tmp_path not in codex_home.parents

    さらに、四つの config-loader invocation が同じ隔離 CODEX_HOME を使うこと、ambient 環境の sentinel 変数が保持されることを検査すべきです。


    P2: Verification CommandsがAcceptance Criteriaを正しく検証していない

    AC1 の検証は次です。

    rg -c '" ".join(cmd)' ...

    AC1を満たした状態では文字列が存在しないため、ripgrep は count 0 を表示するのではなく、通常は no-match の exit status 1 を返します。したがって、そのまま検証コマンドとして実行すると「望ましい状態なのに失敗」します。ripgrep は match 時に 0、no-match 時に 1、エラー時に 2 を返します。 ([mankier.com]3)

    また、AC2 の rg -n "AssertionError" はコメントや dead code に文字列が存在するだけでも成功します。AC3/AC4も、移動先テストファイルの明示的な存在や、strict-runner の負の回帰ケースを保証していません。

    必要なのはソース文字列の存在確認ではなく、次の振る舞いを実行するテストです。

    def test_unregistered_argv_is_rejected(): ...
    def test_missing_expected_call_is_rejected(): ...
    def test_duplicate_call_is_rejected(): ...
    def test_help_and_exec_help_are_distinct(): ...
    def test_capture_text_timeout_are_explicit_and_exact(): ...
    def test_config_loader_cwd_and_env_policy_are_exact(): ...
    def test_expected_call_sequence_is_fully_consumed(): ...

    ソース上の補助検査を残すなら、否定条件には !、リテラルには -F を使うべきです。


    P2: ディレクトリ移動は単純なrenameではなく、pytest import contextを変える

    このリポジトリは pytest を --import-mode=importlib で実行しています。importlib mode は test directory を自動的に sys.path へ追加しません。既存の tests/agent_guards/conftest.py はそれを補うため、ディレクトリ自身を sys.path に追加します。 ([pytestドキュメント]4)

    したがって、テストを tests/agent_guards/ へ移動すると、それまで適用されなかった conftest が ancestor として適用され、import namespace が変わります。全体 pytest の PASS だけでなく、対象ファイルの collection と import を独立して検証すべきです。

    また、Issue の次の記述は誤解を招きます。

    scripts/agent-guards/probe_codex_v2_runtime_capability.py からの相対 import 解決(_SCRIPT_PATH = ...)を更新する

    _SCRIPT_PATH は production script ではなくテストファイル側にあります。しかもハイフン形式からアンダースコア形式への移動でもディレクトリ深度は変わらないため、現在の parents[2] は原則変更不要です。production script は Out of Scope のまま維持すべきです。

    Allowed Paths の tests/agent_guards/ も広すぎます。無関係な既存テストや conftest.py を変更できるため、移動先ファイルを完全指定すべきです。


    P2: 依存関係の登録が失敗したままになっている

    Issue 作成トランザクションは dependency として #1850 を登録しようとしましたが、repository.issue(number: 1850) で PR を Issue として取得しようとして失敗しています。ラベル付与までは成功しましたが、dependency relation は登録されていません。

    依存モデルが Issue node を要求するなら、正しい登録は次です。

    depends_on: "#1834"
    source_pr: "#1850"
    source_review: "PR #1850 final human review"

    #1834 は実際の導入 Issue、#1850 はその実装とレビュー証跡です。PR を dependency Issue として登録するべきではありません。


    上流Codex実装を踏まえた技術補正

    2026年7月30日時点の OpenAI Codex ソースでは、multi_agent は Stable/default enabled、multi_agent_v2 も Stable ですが default disabled として別 feature に残っています。MultiAgentV2ConfigToml は unknown field を拒否し、max_concurrent_threads_per_session に最小値1を定義しています。したがって、現在の positive/unknown-key/wrong-type/zero-concurrency の四ケースという構成自体は上流実装と整合しています。

    ただし、公開設定ドキュメントで利用者向けに案内されているのは主に multi_agent、agents.enabled、agents.max_concurrent_threads_per_session です。公開 config reference には multi_agent_v2 自体は掲載されていません。公開ドキュメントも common flag table は内部・開発中 feature の全件一覧ではないと明記しています。したがって、「公開ドキュメントにないから無効」とも、「fake unit test が通るから現行 CLI で利用可能」とも判断できません。 ([OpenAI Developers]2)

    この境界は次のように維持すべきです。


    推奨する修正版Issue契約

    Allowed Paths

    tests/agent-guards/test_probe_codex_v2_runtime_capability.py
    tests/agent_guards/test_probe_codex_v2_runtime_capability.py
    .github/ci/python-test-plan.json
    

    tests/agent_guards/ 全体は許可しません。conftest.py や既存テストを変更する必要が出た場合は Scope Delta とします。

    In Scope

    1. テストファイルを tests/agent_guards/ へ移動する。
    2. test plan から旧 target tests/agent-guards/ を削除する。
    3. fake runner を exact expected-call model へ置換する。
    4. response、FileNotFoundError、TimeoutExpired の全 dispatch を exact argv に統一する。
    5. unexpected call と missing call の双方を fail させる。
    6. capture_output、text、timeout、cwd、env、unexpected kwargs を検査する。
    7. or True の no-op assertion を削除する。
    8. production script、artifact、schema、conftest は変更しない。

    Acceptance Criteria

    AC1  移動先テストファイルが存在し、旧ディレクトリが存在しない
    AC2  python-test-plan に旧targetがなく、新targetが一度だけ存在する
    AC3  全fake dispatchがexact argvであり、substring/prefix fallbackがない
    AC4  未登録argvがAssertionErrorになる
    AC5  登録済みだが未実行のcallがassert_exhaustedで失敗する
    AC6  重複・欠落・意図しない順序変更を検出する
    AC7  subprocess kwargsの存在と値を実API契約どおり検証する
    AC8  隔離CODEX_HOME assertionに常時真となる経路がない
    AC9  対象テストのcollection、対象テスト、agent_guards全体がPASSする
    AC10 test-plan path checkとlane-union検証がPASSする
    AC11 production script・artifact・schema・conftestにdiffがない
    

    Verification Commands

    test -f tests/agent_guards/test_probe_codex_v2_runtime_capability.py
    test ! -d tests/agent-guards
    
    ! rg -nF '" ".join(cmd)' \
      tests/agent_guards/test_probe_codex_v2_runtime_capability.py
    
    ! rg -nF 'or True' \
      tests/agent_guards/test_probe_codex_v2_runtime_capability.py
    
    ! rg -nF '"tests/agent-guards/"' .github/ci/python-test-plan.json
    rg -nF '"tests/agent_guards/"' .github/ci/python-test-plan.json
    
    python3 scripts/ci/python_test_plan.py \
      --emit scope-argv \
      --check-paths \
      --format json >/dev/null
    
    uv run --locked python scripts/ci/verify_lane_union.py
    
    uv run --locked python3 -m pytest \
      --collect-only \
      tests/agent_guards/test_probe_codex_v2_runtime_capability.py \
      -q
    
    uv run --locked python3 -m pytest \
      tests/agent_guards/test_probe_codex_v2_runtime_capability.py \
      -q
    
    uv run --locked python3 -m pytest tests/agent_guards/ -q

    最終判定

    ISSUE_REVIEW_VERDICT:
      issue: 1861
      verdict: REQUEST_CHANGES
      issue_ready: false
    
      blockers:
        - category: impossible_ci_contract
          reason: >
            AC3で削除するtests/agent-guards/がpython-test-planのtargetに残るが、
            同planはAllowed Paths外であり、CIの--check-pathsが必ず失敗する。
    
        - category: unresolved_retention_decision
          reason: >
            #1860が#1833およびMulti-Agent V2関連資産の
            retain/delete分類を未確定としており、追加投資の前提がない。
    
      required_contract_changes:
        - ".github/ci/python-test-plan.jsonをAllowed Pathsへ追加"
        - "旧pytest targetを削除するACを追加"
        - "strict runnerをunexpected-callだけでなくmissing-callも検査"
        - "cwd/env/timeout/capture_output/textを契約化"
        - "常時真のor True assertionを削除"
        - "Verification Commandsを否定条件とbehavioral testへ修正"
        - "Allowed Pathsを移動元・移動先の完全パスへ限定"
        - "#1834をdependency、#1850をprovenanceとして再登録"
    
      recommended_disposition:
        before_implementation: "HOLD"
        after_1860_decision:
          retain: "修正版契約で実装"
          remove: "#1860整理childへ統合し#1861をsuperseded close"

    現状の #1861 は「小さな follow-up」に見えますが、CI正本の更新漏れにより、契約どおり実装すると必ず失敗します。まず Issue 本文を修正し、#1860 の retain/delete 判断へ束縛してから着手すべきです。

  4. added
    state/blocked
    on Jul 30, 2026
  5. squne121 commented on Jul 30, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  6. squne121 commented on Jul 30, 2026

    @squne121
    OwnerAuthor

    結論

    implementation-worker の停止は正常です。Issue #1861 は、#1860 に retain_probe_and_tests または remove_probe_and_tests が記録されていなければ即停止する、と明示しています。これは実装上の障害ではなく、Issue契約が意図的に人間へ留保した存廃判断です。

    今回の推奨判断は、次です。

    remove_probe_and_tests を採用する。
    #1861 は実装せず、#1860 のクリーンアップ子Issueへ統合して superseded としてcloseする。

    なぜ削除を推奨するか

    1. 名前に反して、runtime capabilityを検証していない

    既存artifactは overall_status: partial で、実際の spawn_agent 実行検証は not_run です。確認できているのは主にCodexのバージョン、feature flag認識、config loaderのaccept/rejectであり、Multi-Agent V2が実運用で使えることは証明していません。

    evidence文書自身も、「runtime capabilityは未実証」「agent_type、task_name、fork_turns、nested delegationのruntime availabilityは未確認」と明記しています。

    したがって、約900行のprobeと大規模なfake-runnerテストを厳密化しても、最も知りたい「現在のCodex環境で実際にspawnできるか」には答えられません。

    2. 現在のリポジトリ内に実利用consumerが見つからない

    GitHubコード検索で見つかった参照は、次の4資産だけでした。

    • probe本体
    • evidence文書
    • 生成artifact
    • probe自身のテスト

    後続処理や実装時gateなど、独立したcommitted consumerは確認できませんでした。

    つまり現在は、probeを維持するためにprobeをテストしている自己完結系です。

    3. #1833系列はPhase 0以降が未実装

    probeは #1833 の9段階Multi-Agent V2導入計画におけるPhase 0として作られました。#1834は完了していますが、V2有効化、graph policy、task packet、delegation metadata、validator、nested canaryなどの後続 #1835〜#1842 は現在もOPENです。

    その後、#1860 が「単一エージェントを既定へ戻し、Multi-Agent V2・ledger・manifestのauthorityを整理する」方向へ転換しています。したがって、未導入の仕組みを支えるPhase 0 probeだけを先に高品質化するのはサンクコストになります。

    4. Codexの実装変化に対して、静的artifactは弱い

    OpenAIの現行Codex実装には multi_agent_v2 設定自体は存在しています。したがって削除判断は「Multi-Agent V2が存在しない」という意味ではありません。([GitHub]1)

    一方、公式リポジトリでは、fork_turns の既定動作、role/model override、tool schema表示、モデル選択などについて、2026年にも複数の挙動差・不具合報告があります。([GitHub]2)

    この種の機能は、過去のCLIバージョンで生成したcommitted artifactよりも、実際に利用する直前のlive canaryで判定する方が正確です。

    推奨アクション

    1. 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 に remove_probe_and_tests のowner decisionを記録する。

    2. 削除専用のクリーンアップ子Issueを作る。既に適切な子Issueがある場合はそこへ統合する。

    3. 実装: Codex V2 runtime capability probe のテスト厳密化とテストディレクトリ命名重複を解消する #1861 に「#1860の判断によりsuperseded」とコメントし、not planned でcloseする。

    4. クリーンアップ子Issueで以下を削除する。

      • scripts/agent-guards/probe_codex_v2_runtime_capability.py
      • tests/agent-guards/test_probe_codex_v2_runtime_capability.py
      • artifacts/codex-multi-agent-v2/runtime-capability.json
      • docs/dev/codex-multi-agent-v2-runtime-evidence.md
      • .github/ci/python-test-plan.json の tests/agent-guards/ target
    5. 将来Multi-Agentを実際に導入するときは、committed evidence chainを復活させず、利用直前に次だけを実施する。

      • codex --version
      • codex features list
      • 隔離環境でのconfig loader確認
      • read-onlyな実 spawn_agent canary
      • 失敗時は通常の診断として報告し、全開発を停止するauthorityにはしない

    #1862のJSON Schema/CI freshness gateと、#1863のcommitted artifact更新も、同じ判断が確定するまで実装すべきではありません。少なくともblock状態を維持し、クリーンアップ子Issueでclose可否を判定するのが安全です。

    #1860 に記録する判断文

    Owner Decision: Codex V2 runtime capability probe assets

    decision: remove_probe_and_tests
    decided_at: 2026-07-30
    authority: human_owner
    applies_to:
      - scripts/agent-guards/probe_codex_v2_runtime_capability.py
      - tests/agent-guards/test_probe_codex_v2_runtime_capability.py
      - artifacts/codex-multi-agent-v2/runtime-capability.json
      - docs/dev/codex-multi-agent-v2-runtime-evidence.md
      - .github/ci/python-test-plan.json の tests/agent-guards/ target
    consequence:
      issue_1861: close_as_superseded
      implementation_scope: "#1860 配下の Multi-Agent V2 整理/クリーンアップ child"

    Decision rationale

    Issue #1834 / PR #1850 で追加されたprobeは、Codex CLIのバージョン、feature flag認識、config loaderのaccept/rejectを記録するPhase 0診断資産であるが、実際の spawn_agent Multi-Agent V2 runtime capabilityは検証していない。

    現時点では、このprobe artifactを実装判断または実行時gateとして使用するcommitted consumerが存在せず、#1833の後続Multi-Agent V2導入childrenも未完了である。今後の方針は #1860 のminimal harness化とし、利用されていないPhase 0 evidence chainへ追加のテスト・schema・freshness gateを投資しない。

    将来Multi-Agent機能を実際に利用する場合は、committed artifactをauthoritative evidenceとして維持せず、利用直前に現在のCodex CLIを対象としたread-only live canaryを実行する。canaryの失敗は診断情報として扱い、通常の開発作業全体を停止するblocking authorityにはしない。

    Required follow-up

    • 実装: Codex V2 runtime capability probe のテスト厳密化とテストディレクトリ命名重複を解消する #1861 は実装せず、クリーンアップchildへ統合したうえで superseded / not planned としてcloseする。
    • probe本体、専用テスト、committed artifact、専用evidence文書、Python test planの旧targetをクリーンアップchildで削除する。
    • #1862および#1863は実装を開始せず、同じクリーンアップchildでcloseまたは再分類する。
    • 削除前にコード検索を実施し、現在のconsumerが発見された場合のみ停止して人間へ報告する。

    impl-review-loop 再開用プロンプト

    リポジトリ squne121/loop-protocol で、Issue #1860 の人間判断を次のとおり確定したものとして処理してください。

    owner_decision:
      decision_issue: "#1860"
      decision: remove_probe_and_tests
      issue_1861_disposition: close_as_superseded
      removal_scope: "#1860 配下の Multi-Agent V2 整理/クリーンアップ child"

    目的は、Issue #1861を実装することではありません。Issue #1834 / PR #1850で追加されたCodex Multi-Agent V2 Phase 0 probe関連資産を、#1860のminimal harness方針に従って安全に整理することです。

    Step 1: live stateと依存関係の確認

    GitHub上の最新状態を取得してください。

    次の資産について、現在の参照元とconsumerをリポジトリ全体から検索してください。

    scripts/agent-guards/probe_codex_v2_runtime_capability.py
    tests/agent-guards/test_probe_codex_v2_runtime_capability.py
    artifacts/codex-multi-agent-v2/runtime-capability.json
    docs/dev/codex-multi-agent-v2-runtime-evidence.md
    CODEX_MULTI_AGENT_V2_RUNTIME_CAPABILITY_V1
    v2_config_schema_loadable
    runtime-capability.json
    tests/agent-guards/
    

    probe、専用test、artifact、evidence文書以外に、実行時consumer、CI gate、production code、別のテストが存在する場合は実装を停止し、次を報告してください。

    status: human_review_required
    reason: unexpected_live_consumer_found
    consumers:
      - path:
        usage:
        removal_impact:
    minimal_human_action:

    単なるIssue本文、PR本文、履歴上の参照、削除対象自身からの参照はblocking consumerに含めないでください。

    Step 2: GitHub上の決定記録とIssue整理

    #1860 の本文またはowner decision commentに、以下を明示してください。

    decision: remove_probe_and_tests
    issue_1861: close_as_superseded
    replacement_policy:
      capability_check: on_demand_live_canary
      committed_runtime_artifact: prohibited
      blocking_authority: prohibited

    既存の適切なクリーンアップchildがない場合は、#1860配下に新しいimplementation childを起票してください。

    childのscopeは次に限定してください。

    - probe本体の削除
    - probe専用testの削除
    - committed runtime-capability artifactの削除
    - 専用runtime evidence文書の削除
    - .github/ci/python-test-plan.json から tests/agent-guards/ targetを削除
    - 削除対象への残存参照の修正
    

    #1861には、#1860のowner decisionにより実装不要となり、クリーンアップchildへ統合された旨をコメントしてください。その後、state_reason: not_planned でcloseしてください。

    #1862と#1863は自動実装しないでください。#1860の判断と競合するため、クリーンアップchildの関連Issueとして記録し、closeまたは再分類候補として報告してください。人間判断なしに新しいschema、CI gate、artifact、canary harnessを追加しないでください。

    Step 3: 実装

    canonical repositoryとcanonical worktreeを確認し、default branchへ直接変更しないでください。クリーンアップchild専用branch/worktreeを作成してください。

    consumerが存在しないことを確認した後、次を削除してください。

    scripts/agent-guards/probe_codex_v2_runtime_capability.py
    tests/agent-guards/test_probe_codex_v2_runtime_capability.py
    artifacts/codex-multi-agent-v2/runtime-capability.json
    docs/dev/codex-multi-agent-v2-runtime-evidence.md
    

    .github/ci/python-test-plan.json から、削除後に存在しなくなる次のtargetだけを削除してください。

    "tests/agent-guards/"

    既存の tests/agent_guards/ targetは維持してください。

    次は禁止します。

    Step 4: 検証

    最低限、次を実行してください。リポジトリの正規コマンドが異なる場合は、現行mainのSSOTを確認して同等コマンドへ置き換えてください。

    test ! -e scripts/agent-guards/probe_codex_v2_runtime_capability.py
    test ! -e tests/agent-guards/test_probe_codex_v2_runtime_capability.py
    test ! -e artifacts/codex-multi-agent-v2/runtime-capability.json
    test ! -e docs/dev/codex-multi-agent-v2-runtime-evidence.md
    
    ! rg -n \
      'probe_codex_v2_runtime_capability|CODEX_MULTI_AGENT_V2_RUNTIME_CAPABILITY_V1|runtime-capability\.json|v2_config_schema_loadable' \
      --glob '!*.lock' .
    
    ! rg -nF '"tests/agent-guards/"' .github/ci/python-test-plan.json
    rg -nF '"tests/agent_guards/"' .github/ci/python-test-plan.json
    
    uv run python3 scripts/ci/python_test_plan.py \
      --emit scope-argv \
      --check-paths \
      --format json
    
    uv run python3 scripts/ci/verify_lane_union.py
    uv run python3 -m pytest tests/agent_guards/ -q

    rgでIssue番号や履歴文書など、削除対象の由来を説明する非実行参照だけが検出された場合は、機械的に全削除せず、参照の性質を分類してください。

    すべての変更ファイルがクリーンアップchildのAllowed Paths内であることを確認してください。

    Step 5: 独立レビューとPR

    実装者とは別のreviewerで、次を確認してください。

    • 実consumerを誤って削除していない
    • tests/agent_guards/ を誤って削除またはtest planから除外していない
    • .codex/config.toml と .codex/hooks.json に差分がない
    • 新しい代替artifactまたは独自gateを追加していない
    • #1861のテスト厳密化を別名で実装していない
    • residual referenceが実行経路に残っていない
    • CI test selectionが壊れていない

    検証成功後、Draft PRを作成してください。

    PRは次を明記してください。

    - Closes: クリーンアップchild
    - Supersedes: #1861
    - Parent decision: #1860 remove_probe_and_tests
    - Does not implement: #1862, #1863, #1835〜#1842
    - No merge performed
    

    最終出力は次の形式にしてください。

    IMPL_REVIEW_LOOP_RESULT_V1:
      status: completed | blocked | human_review_required
      owner_decision: remove_probe_and_tests
      decision_issue: 1860
      cleanup_issue:
      superseded_issue: 1861
      pr_url:
      deleted_paths:
      modified_paths:
      unexpected_consumers: []
      verification:
        python_test_plan_check_paths:
        verify_lane_union:
        agent_guards_pytest:
        residual_reference_check:
      independent_review:
        verdict:
        blockers: []
      merge_performed: false

    このプロンプトは、#1861を無理に再開せず、存廃決定を正本化してから削除PRへ移行する構成です。GitHub更新権限を与えない運用では、Step 2を「コメント・Issue変更案を出力するだけ」に置き換えてください。

  7. squne121 commented on Jul 30, 2026

    @squne121
    OwnerAuthor

    Superseded by owner decision

    親 Issue #1860 のコメント(#1860 (comment) )で、リポジトリ owner が Codex V2 runtime capability probe 関連資産について remove_probe_and_tests を決定しました。

    owner_decision:
      decision_issue: "#1860"
      decision: remove_probe_and_tests
      issue_1861_disposition: close_as_superseded

    この決定により、本 Issue(probe のテスト厳密化)は実装せず、削除スコープの cleanup child issue #1866 へ統合します。

    本 Issue は not planned として close します。

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/implementationstate/blocked

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions