Skip to content

feat(codex): enable multi-agent v2 config - #1879

Merged
squne121 merged 7 commits into
mainfrom
worktree-issue-1835-codex-config-toml-multi-agent-v2-max-dep
Jul 31, 2026
Merged

squne121 merged 7 commits into
mainfrom
worktree-issue-1835-codex-config-toml-multi-agent-v2-max-dep

Conversation

@squne121

@squne121 squne121 commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • repository-pinned Codex CLI 向けに Multi-Agent V2 を明示有効化し、総 active thread 上限を strict integer 4 に固定しました。
  • legacy [agents].max_depth を撤去し、config checker・consumer validator・dedicated pytest で strict 型・値・不在条件を検証します。
  • parity checker の delegation prose は allowed | blocked | unknown の advisory hint として報告し、--strict の失敗根拠にはしません。
  • consumer regression と Python test-plan SSOT を更新し、current-head CI の ci_test_selection/v1 coverage を成立させます。

受け入れ条件の達成状況

検証コマンド結果

次の検証は修正後の current HEAD で再実行し、設定契約と各consumerの整合を日本語の確認観点とともに記録しました。

  • uv run --locked pytest tests/test_check_impl_review_loop_codex_dispatch.py -q — dedicated checker: PASS (30)
  • uv run --locked pytest tests/test_codex_agent_bridge_contract.py -q — bridge regression: PASS (25)
  • uv run --locked pytest tests/codex/test_codex_permission_profile_config.py -q — config consumer regression: PASS (23)
  • uv run --locked python3 scripts/check_impl_review_loop_codex_dispatch.py --assert-project-multi-agent-v2-config — strict config checker: PASS
  • uv run --locked python3 scripts/check_claude_codex_agent_parity.py --strict — strict parity: PASS
  • codex --strict-config -c 'features.multi_agent_v2.enabled=false' -c 'agents.max_depth=1' doctor --summary --no-color — V1 rollback loader acceptance: PASS
  • uv run --locked python3 scripts/ci/python_test_plan.py --emit run-argv --mode parallel --format lines — test-plan loader: PASS
  • codex --strict-config doctor --summary --no-color — config loader acceptance: PASS (codex-cli 0.146.0)

Allowed Paths 遵守

Runtime Verification Evidence

この節は実行時に確認した証跡を示し、宣言だけを能力証明として扱わないための境界も日本語で明記します。

Checks

AC14–AC18のローカル証跡と conflict integration後の dedicated再検証は、current HEAD 6fec6078d2a5c79b5c34d7ec630726e7503bcdce のCI成功に再bindして確認しました。

Schema Change Applicability

設定スキーマの変更範囲と、利用側が追従する責務を日本語で説明します。

  • decision: schema_change
  • 対象: .codex/config.toml の [features.multi_agent_v2] declaration と legacy [agents].max_depth の撤去。
  • 影響: repository-owned config contract、dispatch checker、parity checker、config consumer validator、Python test plan。

Schema Consumer Inventory

Before

  • V2 project declaration は存在せず、nested-delegation parity と config consumer validator は legacy [agents].max_depth = 1 に依存し、dedicated checker test は CI plan に未登録でした。

After

  • [features.multi_agent_v2] の strict boolean enabled = true と strict integer concurrency 4 を declaration し、consumer validator は型安全に参照します。delegation proseはadvisory hintとして分離され、dedicated test は Python test-plan に登録されます。
Consumer ファイル 更新有無 備考
.codex/config.toml はい V2 enabled と concurrency=4 を repository-pinned declaration として追加。
scripts/check_impl_review_loop_codex_dispatch.py はい strict TOML type/value と max_depth absence を検証。
scripts/check_claude_codex_agent_parity.py はい V2 declaration と agent metadata で delegation parity を判定。
scripts/check_codex_agent_config.py はい config consumer validation を V2 contract と整合。
tests/codex/test_codex_permission_profile_config.py はい consumer fixture を legacy max_depth から分離。
tests/test_codex_agent_bridge_contract.py はい delegation prose advisory とconfig consumerのstable diagnosticを回帰検証。
.github/ci/python-test-plan.json はい dedicated checker test を python-test / ci_test_selection/v1 対象に登録。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
concurrency は root を含む strict integer 4 に固定される yes - dedicated pytest と config checker -
legacy max_depth の有無だけで agent の nested delegation を推論しない yes - strict parity と config consumer regression -
delegation prose heuristic をruntime capabilityやstrict authorityとして扱わない yes root→agent smokeの実行 bridge regressionとadvisory report #1835
V1 rollback は strict false/strict integer 1 へのpositive assertionで検証する yes fresh runtime smoke dedicated pytestとloader acceptance #1835
dedicated checker test は CI selection に含まれる yes - python-test-plan loader と AC13 check -
live nested runtime capability は config declaration だけで証明しない no #1842 の canary Issue contract と runtime applicability #1842

CI Test Performance Decision

CI対象の追加はテスト計画SSOTだけに限定し、選択証跡を機械可読な形式と日本語の判断理由で残します。これは性能改善・性能非劣化を主張しないselection correctnessの記録であり、current head 6fec6078d2a5c79b5c34d7ec630726e7503bcdce のCI成功をreviewer gateの根拠とします。

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 1835
  pr_number: 1879
  decision_scope: ci_change
  changed_paths:
    - .codex/config.toml
    - .github/ci/python-test-plan.json
    - docs/dev/workflow.md
    - scripts/check_claude_codex_agent_parity.py
    - scripts/check_codex_agent_config.py
    - scripts/check_impl_review_loop_codex_dispatch.py
    - tests/codex/test_codex_permission_profile_config.py
    - tests/test_codex_agent_bridge_contract.py
    - tests/test_check_impl_review_loop_codex_dispatch.py
  lane_classification:
    fast_static:
      applicable: true
      evidence: ["Python checker/reportのstatic regressionをRuffで確認"]
      required_commands:
        - "uv run --locked ruff check scripts/check_impl_review_loop_codex_dispatch.py scripts/check_claude_codex_agent_parity.py scripts/check_codex_agent_config.py tests/test_check_impl_review_loop_codex_dispatch.py tests/test_codex_agent_bridge_contract.py"
    python_unit:
      applicable: true
      evidence:
        - "Python checker と dedicated / consumer pytest を更新"
        - "tests/test_check_impl_review_loop_codex_dispatch.py を python-test plan SSOT に登録"
      required_commands:
        - "uv run --locked pytest tests/test_check_impl_review_loop_codex_dispatch.py -q"
        - "uv run --locked pytest tests/test_codex_agent_bridge_contract.py -q"
        - "uv run --locked pytest tests/codex/test_codex_permission_profile_config.py -q"
    contract_artifact:
      applicable: true
      evidence:
        - ".github/ci/python-test-plan.json の ci_test_selection/v1 対象を更新"
        - "Multi-Agent V2 config declaration と consumer checker contract を更新"
      required_commands:
        - "uv run --locked python3 scripts/ci/python_test_plan.py --emit run-argv --mode parallel --format lines"
        - "uv run --locked python3 scripts/check_impl_review_loop_codex_dispatch.py --assert-project-multi-agent-v2-config"
        - "uv run --locked python3 scripts/check_claude_codex_agent_parity.py --strict"
    integration:
      applicable: false
      evidence: ["アプリケーション実行経路、UI、外部サービス連携の変更なし"]
      required_commands: []
  baseline_inputs:
    ci_runtime_baseline_v1_available: false
    run_count: 0
    p50_p95_ready: false
  artifact_consistency:
    ci_test_selection_v1_checked: true
    missing_pytest_args: []
  risk_flags: []
  reviewer_gate:
    approve_allowed: true
    required_evidence: [CI_CHECK_RUN_SCOPED]
    approve_denied_reason: null
  follow_up_required: []

Notes

@squne121

Copy link
Copy Markdown
Owner Author

Overlap Preflight Warnings(advisory, #1851)

overlap preflight evidence の検証で以下の warning が検出されましたが、advisory telemetry のため PR 作成はブロックされていません。

  • E_OVERLAP_PREFLIGHT_UNSAFE_ROUTE: unsafe_route:'human_review_required'

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1879 closed).

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST_CHANGES

Mergeability

  • mergeable=MERGEABLE, merge_state_status=BLOCKED

Evidence Check

  • AC1–9・AC11: PASS
  • AC10: #1842 所有の pr_review_only のため SKIP
  • Allowed Paths: OK(5 files、rename なし)
  • Required CI evaluator: 5件 PASS。ただし current-head CI summary は failed。

Blockers

  • F1: python-test-core、node-backed-hook-tests、python-test、ci-verdict-summary が current head で失敗。
  • F2: docs/dev/workflow.md の日本語コンテンツ検査が失敗。
  • F3: PR本文に受け入れ条件、検証結果、Allowed Paths、Runtime Verification Evidence の必須節がない。
LOOP_VERDICT_V2:
  verdict: REQUEST_CHANGES
  reviewed_head_sha: "50d9f3d86ad669f9c4c1564bc34c1ea25ac43a2e"
  merge_ready: false
  mergeability:
    mergeable: MERGEABLE
    merge_state_status: BLOCKED
  blockers:
    - "F1: current-head CI failure"
    - "F2: docs Japanese-content gate failure"
    - "F3: PR evidence/body hygiene insufficiency"
  required_auto_actions:
    - kind: update_pr_body_hygiene
      executor: implementation-worker
      skill: open-pr.update_pr
      blocking_merge_ready: true
      mechanical: true
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    schema: ALLOWED_PATHS_GATE_RESULT_V1
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - .codex/config.toml
      - docs/dev/workflow.md
      - scripts/check_claude_codex_agent_parity.py
      - scripts/check_impl_review_loop_codex_dispatch.py
      - tests/test_check_impl_review_loop_codex_dispatch.py
    violations: []
  allowed_paths_gate_source: review_subagent

@squne121

Copy link
Copy Markdown
Owner Author

Verdict: REQUEST_CHANGES

Mergeability

  • mergeable=MERGEABLE, merge_state_status=BEHIND

Evidence Check

Blockers

  • PR本文の CI_TEST_PERFORMANCE_DECISION_V1 が完全スキーマを満たさず、reviewer gate の理由が欠落している。
LOOP_VERDICT_V2:
  verdict: REQUEST_CHANGES
  reviewed_head_sha: "a644578e2442e378353e22d26cea5602863ddc2f"
  merge_ready: false
  mergeability:
    mergeable: MERGEABLE
    merge_state_status: BEHIND
  blockers:
    - "P1: CI_TEST_PERFORMANCE_DECISION_V1 body schema incomplete"
  required_auto_actions:
    - kind: update_pr_body_hygiene
      executor: implementation-worker
      skill: open-pr.update_pr
      blocking_merge_ready: true
      mechanical: true
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - .codex/config.toml
      - .github/ci/python-test-plan.json
      - docs/dev/workflow.md
      - scripts/check_claude_codex_agent_parity.py
      - scripts/check_codex_agent_config.py
      - scripts/check_impl_review_loop_codex_dispatch.py
      - tests/codex/test_codex_permission_profile_config.py
      - tests/test_check_impl_review_loop_codex_dispatch.py
    violations: []
  allowed_paths_gate_source: review_subagent

@squne121

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN

Evidence Check

  • AC1–9・AC11・AC12: current head で PASS
  • AC10・AC13: 契約どおり pr_review_only のため SKIP
  • Allowed Paths: OK(8 files、rename なし)
  • Required CI: passed、CI summary: all_pass
  • CI_TEST_PERFORMANCE_DECISION_V1: 完全スキーマ。性能改善の主張なしのため baseline 未準備は non-blocking。

Blockers

  • なし
LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "85d62971c273dc0ad81cff46a40248fdc692bc1a"
  merge_ready: true
  mergeability:
    mergeable: MERGEABLE
    merge_state_status: CLEAN
  blockers: []
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - .codex/config.toml
      - .github/ci/python-test-plan.json
      - docs/dev/workflow.md
      - scripts/check_claude_codex_agent_parity.py
      - scripts/check_codex_agent_config.py
      - scripts/check_impl_review_loop_codex_dispatch.py
      - tests/codex/test_codex_permission_profile_config.py
      - tests/test_check_impl_review_loop_codex_dispatch.py
    violations: []
  allowed_paths_gate_source: review_subagent

@squne121

Copy link
Copy Markdown
Owner Author

you asked

message time: 2026-07-31 23:48:17

#1879
内容について関連Issue、PR、リポジトリ資産、コメントを参照した上で敵対的レビューして。
取り扱う技術や配布物の実装をWEB検索し高品質化してほしい。


chatgpt response

PR #1879の差分、関連Issue・PR、レビュー履歴、現行mainの契約・テスト資産を追跡し、公式仕様と照合します。再現可能な問題を重大度順に、手順と修正案付きで提示します。


chatgpt response

具体的な退行候補として、--config-pathの既定値によりassertion flagなしでもcheckerが成功します。専用テストにもno-flagケースがありません。


chatgpt response

上流0.146.0ではV2のfork_turns既定値がallで、agent_type併用時に既存custom-agent起動を破壊し得ます。さらに説明文だけでnested delegationを判定する実装は実runtimeと矛盾します。


chatgpt response

敵対的レビュー結果

判定: REQUEST_CHANGES

確認対象は PR #1879 の current HEAD 85d62971c273dc0ad81cff46a40248fdc692bc1a。PR は OPEN・Draft・GitHub 上は mergeable ですが、Multi-Agent V2 を repository default として有効化するには、実行時権限、既存 custom-agent dispatch、validator の三点に merge-blocking な欠陥があります。V2 採用方針そのものではなく、有効化順序と証明方法が問題です。

Blocking findings

[P1] V2 subagent が agent-local permission profile を失い、親の write-capable profileを継承する

現在の root session は loop-protocol-personal-dev を既定とし、:workspace 相当の workspace write と広い開発用ネットワーク許可を持ちます。一方、issue-reviewer などの read-only agent は loop-protocol-readonly を明示しています。

しかし Codex CLI 0.146.0 の V2 spawn 実装は、次の順序です。

  1. apply_spawn_agent_role() で custom-agent role を適用する。
  2. その直後に apply_spawn_agent_runtime_overrides() を再実行する。
  3. 後者が turn.permission_profile()、つまり親 thread の実効 profile を子へ設定する。

したがって role TOML の default_permissions は、spawn の最終段階で親 profile に上書きされます。

これは机上の推測ではありません。リポジトリにコミット済みの Codex 0.146.0 実runtime artifactも、read-only agent と implementation-worker の双方について、子 thread の permission profile が同一で、root session の profileを反映していたと記録しています。read-only agent の書き込み試行はその環境では拒否されていますが、拒否理由は read-only profile ではなく、全書き込みに共通する approval policy 側でした。つまり read-only role の実効性は証明されていません。

親 #1833 は single-writer と read-only specialist を設計上の不変条件にしています。この挙動では、read-only reviewer、investigator、test-runner に workspace-write profileが渡り得るため、その不変条件を満たしません。

上流でも、V2 が role-specific sandbox を親の permission profile で上書きする問題を含む failure chain が報告されています。(GitHub)

必要な修正

  • この挙動が修正された Codex CLI releaseを確認して pinするか、0.146.0 に対する明示的な patchを適用する。
  • 修正済み releaseがない場合、multi_agent_v2.enabled = true を mergeしない。
  • live smokeで、子 thread の observed permission profileを検証する。
    • read-only agent: loop-protocol-readonly が観測され、workspace writeが profile理由で拒否される。
    • write agent: loop-protocol-rtk が観測され、Allowed Paths内の限定 writeが成功する。
  • root profileを read-only に変えるだけでは不十分です。同じ親 profileが全childへコピーされるなら、今度は implementation-worker も write不能になり、role分離を実現できません。

[P1] V2有効化が dispatch contract移行より先行し、既知の first-call failureを正式運用へ持ち込む

親 #1833 は、すべての Codex dispatchに agent_type、task_name、fork_turns: none、出力契約を指定することを要求しています。ところが、その構造化 marker導入を担当する #1838 は現在も OPENであり、PR #1879 自身も #1838 を変更対象外としています。

現在の canonical skillは custom agent名の指定を自然言語で要求するだけで、task_name と fork_turns: none を機械可読な dispatch packetとして固定していません。

Codex CLI 0.146.0 の V2実装では、fork_turns を省略すると all、すなわち full-history forkになります。また task_name は必須フィールドです。

full-history forkと agent_type の併用は拒否されます。リポジトリ自身の実行ログでも、implementation-worker の起動時に最初の呼び出しが fork_turns: "all" となって拒否され、その後モデルが fork_turns: "none" へ自己修正して二回目で成功しています。

したがって現状は、

決定論的に正しい dispatch

ではなく、

最初の tool call は失敗し、モデルがエラーメッセージを理解して再試行できれば成功

です。bounded loop、headless execution、compact contextでは、この自己修正を保証できません。失敗をそのまま agent unavailable、implementation failure、iteration exhaustionとして扱う経路が残ります。

過去の PR #1850 も config loader受理と実runtime capabilityを明確に分離していました。その probe一式を削除した PR #1868 は、代替を on-demand live canaryとしています。今回 config doctorだけで有効化を完了扱いにするのは、その証拠境界と整合しません。

必要な修正

推奨順序は次です。

  1. 実装: canonical Skill の dispatch instruction と checker を最小構成へ移行する #1838 の最小 dispatch markerを先に mergeする。
  2. 全root dispatchへ、少なくとも以下を固定する。
    • task_name
    • agent_type
    • fork_turns: none
    • bounded task packet
    • wait/join policy
    • output validator
  3. その後に feat(codex): enable multi-agent v2 config #1879 を rebaseして V2を有効化する。

順序を変更しないなら、#1879では enabled = false の declarationだけを先に導入し、#1838 merge後に true へ切り替えるべきです。

#1842 は implementation-worker -> implementation-designer のnested edge canaryです。rootから既存 implementation-worker、test-runner、pr-reviewer を正しい V2引数で起動できることの検証とは別物です。


[P1] parity checkerが「自由文に特定語がない」ことを nested delegation禁止の証拠にしている

変更後の check_claude_codex_agent_parity.py は、agent instructionsに次のいずれかが含まれるかを substring検索しています。

  • spawn_agents_on_csv
  • recursive delegation
  • child agent spawn
  • spawn subagents

一致がなければ nested_delegation_blocked = True、一致すれば False としています。

これは capability検証でも、禁止設定の検証でもありません。単なる文面検査です。

例えば次の指示は、意味上は delegation禁止です。

Do not spawn subagents.

しかし spawn subagents が substring一致するため、現checkerは「delegation許可」と判定します。逆に禁止を明記しない agentは、V2 tool surfaceを利用可能でも「blocked」と判定されます。

このため --strict の PASSは、nested delegationが runtimeで禁止されていることを一切証明しません。PR本文の「V2 declaration と agent metadataで delegation parityを判定する」という説明より弱い実装です。

必要な修正

  • 構造化 metadataがまだない agentは blocked = True ではなく unknown とする。
  • prose keywordを authorityにしない。
  • 実装: canonical Skill の dispatch instruction と checker を最小構成へ移行する #1838 の marker、後続の graph policy、agent delegation metadataのいずれかを機械可読に解析する。
  • 少なくとも以下の mutation testsを追加する。
    • Do not spawn subagents は禁止。
    • spawn subagents は許可。
    • 同義語だけの指示は unknown。
    • metadata欠落は strict PASSにしない。
  • runtime tool availabilityと「agentに使わせないという宣言」は別フィールドとして保持する。

[P1] assertion未指定の checkerが、何も検査せず成功する

check_impl_review_loop_codex_dispatch.py は --config-path に既定値を追加しましたが、assertion flag有無の判定に any(vars(args).values()) を使っています。

args.config_path は常に truthyな Path なので、assertion flagを一つも指定しなくても usage errorになりません。その後はどの検査分岐にも入らず、成功メッセージを出して 0 を返します。

つまり、現在の制御フローでは次が false greenになります。

uv run --locked python3 scripts/check_impl_review_loop_codex_dispatch.py

新規テストは常に assertion flagを渡しており、この経路を検証していません。また test_checker_preserves_existing_explicit_spawn_note_assertion は関数が callableであることを確認した後、--assert-project-multi-agent-v2-config を実行しているだけで、--assert-explicit-spawn-notes を実際には呼び出していません。

必要な修正

判定対象を assertion booleanだけに限定してください。

assertion_selected = any(
    (
        args.assert_project_multi_agent_v2_config,
        args.assert_no_max_depth_setting,
        args.assert_no_project_profile_routing,
        args.assert_explicit_spawn_notes,
        args.assert_no_scope_rollup_runner_auto_spawn_note,
    )
)
if not assertion_selected:
    parser.error("specify at least one assertion flag")

追加テスト:

no assertion flag
  exit: 2
  stdout: OKを含まない
  stderr: usageを含む

さらに --assert-explicit-spawn-notes を subprocessで実行し、各対象skillから固定文を削除したfixtureが非ゼロになることを確認すべきです。

Additional findings

[P2] rollback手順が「正しいrollback」を検証せず、意図的な失敗だけを確認している

追加された手順は、

  1. V2を enabled = false にする。
  2. [agents].max_depth = 1 を復元する。
  3. --assert-no-max-depth-setting を実行する。
  4. 非ゼロ終了を期待する。

という構成です。

しかしこの checkerは、正しい V1 rollbackだけでなく、以下でも同じように失敗します。

  • max_depth = 0
  • max_depth = 99
  • max_depth = "1"
  • malformed TOML
  • config file不存在
  • V2設定の破損

したがって、非ゼロは rollback成功の証拠ではありません。

修正案

--assert-project-multi-agent-v1-config を追加し、以下を positive assertionとして exit 0で検証してください。

features.multi_agent_v2.enabled is strict false
agents.max_depth is strict integer 1
V2 concurrency keyの扱いがrollback方針と一致
codex --strict-config doctor が成功
fresh sessionがV1として起動

rollback verificationは「期待どおり失敗した」ではなく、「期待する V1状態に一致して成功した」であるべきです。


[P2] 文法的に正しい wrong-shaped TOMLで tracebackする

checkerは次の形で tableを仮定しています。

config.get("features", {}).get("multi_agent_v2")

そのため、次のような文法上は正しいTOMLを渡すと、str に .get() を呼んで AttributeError になります。

features = "not-a-table"

read_toml() が捕捉するのは OSError と TOMLDecodeError だけなので、AC5が要求する stable diagnostic / no tracebackを満たしません。同じ前提は check_codex_agent_config.py のconsumer側にもあります。

また、FileNotFoundError、PermissionErrorをすべて malformed TOML と報告するのも診断として不正確です。

必要なnegative fixturesは少なくとも以下です。

features = "string"
features = 1
features = ["array"]
[features]
multi_agent_v2 = "string"
agents = "string"

各階層で isinstance(value, dict) を確認し、I/O errorとparse errorを別diagnosticにしてください。


[P2] PR本文自身が approval禁止を宣言している

PR本文の CI_TEST_PERFORMANCE_DECISION_V1 は、current-head CI successを記載する一方で、baseline不足を理由に reviewer_gate.approve_allowed: false としています。それにもかかわらず follow_up_required: [] です。

これは実装とは別の契約整合問題ですが、machine-readable bodyを正本とするなら、現状態で APPROVEはできません。

次のいずれかが必要です。

  • 必要な ci_runtime_baseline_v1 と p50/p95 evidenceを生成する。
  • この変更に性能比較が適用不能であることを根拠付きで再分類する。
  • follow_up_required に具体的な解消作業を記録する。

approve_allowed: false を残したまま close-readyを主張すべきではありません。

Merge条件

最低限、次を満たすまで merge不可です。

  1. Codex 0.146.0 の role permission上書きを解消するか、修正版へ pinする。
  2. read-only/write-capable childの effective permissionを live runtimeで検証する。
  3. 実装: canonical Skill の dispatch instruction と checker を最小構成へ移行する #1838 の task_name / agent_type / fork_turns: none migrationを先行またはatomicに導入する。
  4. root → existing custom-agent の V2 smokeを追加する。実装: Claude Code / Codex CLI の bounded read-only nested delegation canary を実行する #1842 の nested canaryとは分離する。
  5. no-assertion checker false greenを修正する。
  6. parity checkerの prose keyword authorityを撤去し、未証明状態を unknown にする。
  7. rollbackを positive V1 assertionへ置換する。
  8. wrong-shaped TOMLと実際の --assert-explicit-spawn-notes mutation testを追加する。
  9. current HEADに束縛された CIと live runtime evidenceを再取得する。

CIの成功自体は認識しています。ただし最上位二件は通常のunit test不足ではなく、OpenAI Codex 0.146.0 tagged sourceと、当該リポジトリにコミット済みの実runtime traceの双方で確認できる実装上の問題です。このセッションではリポジトリのテストをローカル再実行しておらず、current-head差分、GitHub Actions結果、関連Issue・PR・artifact、上流実装を基に判定しています。


you asked

message time: 2026-08-01 00:36:16

「[P1] V2 subagent が agent-local permission profile を失い、親の write-capable profileを継承する」上流での実装不備なら、甘んじて受け入れることにします。現時点では、サブエージェントのパーミッションをパーミッションルールを使って制限することはできないと認識しました。いつか上流で改善されることを願いつつ、運用を継続したいと思います。
「[P1] parity checkerが「自由文に特定語がない」ことを nested delegation禁止の証拠にしている」クロードコードとコーデックスCLI間で実装仕様が違うものについて、厳密に同等の設計を保つことは、個人趣味開発の領域から過剰な領域だと思うので、緩やかな確率論的な比較でいいのではないかと思います。

動作検証についてはワークツリー配下でセッションを起動し、その出力およびセッションログを参照して、サブエージェントの発火状態やコンテクストの状態を確認する必要があると思います。開発環境にはherdrが導入されているので、ワークツリー配下でAIエージェント用のペーンを起動してClaudeCodeとCodexCLIの検証用セッションを起動し、動作検証用のプロンプトを送信、メインセッションから動作を確認する手もあります。


chatgpt response

方針変更を反映し、#1879のblockerを再分類します。herdrでのClaude Code/Codex CLI実セッション検証が、どこまで今回PRのmerge条件として妥当かも実装・ログ形式に照らして整理します。

方針としては妥当です。ただしHerdrの表示状態はオーケストレーション用であり、Claude Code/Codexの実行証跡そのものではありません。証拠は各セッションの出力とネイティブログから、必要フィールドだけ抽出するのが適切です。

再評価

その方針で妥当です。前回の二件は次のように再分類します。

指摘 再分類 扱い
V2 childが親permission profileを継承 accepted_upstream_limitation merge blockerから除外
delegation parityが自然言語heuristic advisory_heuristic 厳密な同等性・security proofを要求しない

Codex 0.146.0でagent-local permission profileが実効sandboxへ反映されないことは、このリポジトリの既存runtime artifactでも観測済みです。したがって「設定宣言は保持するが、実行時の権限制限としては信用しない」という境界が現実的です。

ただし、PR本文のSafety Claim Matrixには次を明記すべきです。

agent_local_permission_enforcement:
  status: not_available
  reason: upstream_runtime_limitation
  accepted_by_owner: true
  security_claim: prohibited
  operational_mitigation:
    - root/main thread remains the control-plane
    - read-only intent is prompt-level, not sandbox-enforced
    - actual diff and git status are checked after delegated work
    - write-capable tasks are not run concurrently in one worktree

parity checkerについて

緩やかな比較で十分ですが、現在の実装はheuristicをnested_delegation_blockedという断定的な値へ変換し、--strictでfail-level driftとして扱っています。これは「確率論的な比較」ではなく、依然としてblocking authorityです。

追加の複雑なgraph schemaは不要です。最小修正は次のどちらかです。

  • delegation比較だけをwarningへ降格する。
  • フィールド名をdelegation_intent_hint相当に変え、allowed | blocked | unknownを参考表示するがexit codeへ影響させない。

model、output contract、mutation boundaryなど、比較価値がある項目はstrictのままでも構いません。Claude CodeとCodex CLIのdelegation semanticsだけをadvisoryに分離するのが過不足のない設計です。

動作検証方針

Herdrを使う案が適切です。ただし、役割を次のように分けます。

  • Herdr: worktree、pane、process、入力、待機、画面出力の管理。
  • Claude/Codexのネイティブログ: subagent発火、agent identity、context、tool callの証拠。
  • Git: ファイル非変更・差分汚染がないことの最終証拠。

HerdrのClaude Code/Codex integrationはsession identityを取得できますが、両者のworking、blocked、done判定はscreen manifestが権威です。したがって、Herdrの状態表示だけをsubagent発火証明にはできません。(Herdr)

推奨構成

PR #1879のworktreeを一つのHerdr workspaceとして開き、CodexとClaudeは別tabで順番に実行します。同じworktreeで同時実行する必要はありません。

PR_WT=/absolute/path/to/worktree-issue-1835-codex-config-toml-multi-agent-v2-max-dep

created=$(
  herdr workspace create \
    --cwd "$PR_WT" \
    --label pr1879-runtime \
    --no-focus
)

workspace_id=$(printf '%s\n' "$created" | jq -r '.result.workspace.workspace_id')
codex_pane=$(printf '%s\n' "$created" | jq -r '.result.root_pane.pane_id')

claude_tab=$(
  herdr tab create \
    --workspace "$workspace_id" \
    --cwd "$PR_WT" \
    --label claude-smoke \
    --no-focus
)

claude_pane=$(printf '%s\n' "$claude_tab" | jq -r '.result.root_pane.pane_id')

Herdrはworkspace作成時にroot paneを返し、tab作成時にもroot paneを返すため、IDを推測せずJSONから取得できます。(Herdr)

1. Codex V2 runtime smoke

Codexはcodex exec --jsonをpane内で実行する方法が最も検証しやすいです。interactive UIを観察する必要が生じた場合だけ、herdr agent startへ切り替えます。

検証プロンプト

PR #1879 current-head runtime smokeを実行してください。

これはread-only検証です。
ファイル編集、apply_patch、git mutation、commit、push、GitHub mutationを禁止します。

手順:
1. 現在のcwd、git HEAD、Codex CLI versionを取得する。
2. .codex/config.tomlを読み、features.multi_agent_v2.enabledと
   max_concurrent_threads_per_sessionの値を確認する。
3. Multi-Agent V2のspawn_agentを1回だけ使用する。
   - task_name: pr1879_probe
   - agent_type: codebase-investigator
   - fork_turns: none
4. childには次だけを依頼する。
   - cwdとgit HEADを返す
   - .codex/config.tomlの上記2値を返す
   - 自身のagent role、agent path、depthが認識できる場合は返す
   - ファイルを編集しない
5. childの完了を待つ。
6. git status --porcelain=v1が空であることを確認する。
7. 最後にPR1879_CODEX_SMOKE_DONEと出力する。

PARENT_ONLY_SENTINEL_1879_A91C はparent context専用です。
childへのmessageにはこの文字列を含めないでください。

実行と観察:

herdr pane run "$codex_pane" \
  'umask 077; codex exec --json "<上記プロンプト>"'

herdr pane wait-output "$codex_pane" \
  --regex 'PR1879_CODEX_SMOKE_DONE|error|failed' \
  --timeout 240000

herdr pane read "$codex_pane" \
  --source recent-unwrapped \
  --lines 180

pane run、pane wait-output、pane readは、agent UIの状態推定を介さずraw terminal processを操作する用途です。(Herdr)

Codex側の合格条件

  • parentのcwdとHEADがPR feat(codex): enable multi-agent v2 config #1879 worktreeに一致する。
  • multi_agent_versionがV2。
  • parent rolloutにspawn_agent function callがある。
  • argumentsにtask_name=pr1879_probe、agent_type=codebase-investigator、fork_turns=noneがある。
  • child rolloutのsession_metaにparent thread、depth、agent path、agent roleがある。
  • childが正常終了し、結果がparentへ戻る。
  • child rolloutにPARENT_ONLY_SENTINEL_1879_A91Cがない。
  • 前後のgit status --porcelain=v1が空。

Codexで実際に注入されたcontextを確認する場合、rollout JSONLが事実上のsource of truthです。OpenAI Codex repositoryの回答でも、~/.codex/sessions/**/rollout-*.jsonlのsession_meta、base instructions、cwd、instruction blocksを確認する方法が案内されています。(GitHub)

raw rollout全体をPRへ貼らず、次のようなフィールドだけを抽出します。

CODEX_DIR=${CODEX_HOME:-"$HOME/.codex"}

rg -l '"agent_path":"/root/pr1879_probe"' \
  "$CODEX_DIR/sessions" |
  tail -n 1

対象child rolloutに対して:

jq -c '
  select(.type == "session_meta")
  | {
      id: .payload.id,
      cwd: .payload.cwd,
      cli_version: .payload.cli_version,
      source: .payload.source,
      multi_agent_version: .payload.multi_agent_version
    }
' "$CHILD_ROLLOUT" |
head -n 1

if rg -q 'PARENT_ONLY_SENTINEL_1879_A91C' "$CHILD_ROLLOUT"; then
  echo "context_isolation=fail"
else
  echo "context_isolation=pass"
fi

2. Claude Code comparison smoke

Claude側は厳密なCodex parity判定ではなく、次だけを観察します。

  • 指定したsubagent typeが発火したか。
  • bounded taskが完了したか。
  • parent contextがどの程度伝播したか。
  • worktreeが変更されなかったか。

再現性を優先するならinteractive sessionより、Herdr pane内でClaude Codeのprint modeを使います。Claude Codeは--output-format stream-jsonと--verboseを公式に提供しています。(Claude Platform Docs)

検証プロンプト

PR #1879に関連するClaude Code subagent smokeを実行してください。

これはread-only検証です。
ファイル編集、git mutation、commit、push、GitHub mutationを禁止します。

codebase-investigator subagentを1回だけ起動し、次を依頼してください。
- 現在のcwdとgit HEADを返す
- .codex/config.tomlの
  features.multi_agent_v2.enabledと
  max_concurrent_threads_per_sessionを返す
- ファイルを編集しない

subagentの完了を待ち、結果を要約してください。
最後にgit status --porcelain=v1が空であることを確認し、
PR1879_CLAUDE_SMOKE_DONEと出力してください。

PARENT_ONLY_SENTINEL_1879_C42D はparent context専用です。
subagentの依頼文には含めないでください。

実行例:

herdr pane run "$claude_pane" \
  'umask 077; claude -p \
    --output-format stream-json \
    --verbose \
    --max-turns 8 \
    "<上記プロンプト>"'

herdr pane wait-output "$claude_pane" \
  --regex 'PR1879_CLAUDE_SMOKE_DONE|error_max_turns|error_during_execution' \
  --timeout 240000

herdr pane read "$claude_pane" \
  --source recent-unwrapped \
  --lines 180

Claude側でsentinelがchildへ渡った場合も、それだけでfailにはしません。Claude CodeとCodexのcontext modelの差として記録します。合格条件は、subagent発火、bounded task完了、結果返却、worktree非変更です。

PRへ残す証拠

新規artifact schemaや専用publisherは不要です。PR本文またはコメントへ、次の短い表だけを残せば十分です。

項目 Codex Claude
tested HEAD SHA SHA
CLI version version version
cwd worktree path worktree path
child requested codebase-investigator codebase-investigator
child observed role/path/depth subagent type/session
context sentinel absent/present absent/present
completion pass/fail pass/fail
worktree clean yes/no yes/no

raw transcript、encrypted reasoning、tool stdout全量はコミットしません。Herdrのpane historyも、terminal出力にprompt、token、secretが含まれ得るため既定では無効です。この検証のためだけに有効化する必要はありません。(Herdr)

改訂後のmerge判断

このowner decisionを採用するなら、以下はblockerから外せます。

  • agent-local permission profileの実効 enforcement。
  • Claude/Codexのnested-delegation厳密同等性。
  • #1838の全marker実装を#1879の必須predecessorにすること。

一方、次は引き続き修正対象です。

  1. assertion flagなしでcheckerが成功するfalse green
  2. wrong-shaped TOMLでraw tracebackになり得る問題
  3. delegation heuristicを--strictのblocking authorityとして扱っている不整合
  4. PR本文のapprove_allowed: falseとAPPROVE主張の矛盾
  5. current HEADでの実V2 dispatch smoke未実施

上記の決定論的な不具合を直し、Herdr経由のbounded runtime smokeが通れば、上流permission limitationを受容したうえでPR #1879をmergeする判断は合理的です。現時点の判定は、範囲を縮小したREQUEST_CHANGESです。PRのcurrent HEADは引き続き85d62971c273dc0ad81cff46a40248fdc692bc1aです。


Powered by AI Exporter

@squne121
squne121 marked this pull request as ready for review July 31, 2026 17:02
@squne121
squne121 merged commit af511e1 into main Jul 31, 2026
25 checks passed
@squne121
squne121 deleted the worktree-issue-1835-codex-config-toml-multi-agent-v2-max-dep branch July 31, 2026 17:03
@squne121

Copy link
Copy Markdown
Owner Author

POST_MERGE_CLEANUP_REPORT_V1

POST_MERGE_CLEANUP_REPORT_V1:
  schema_version: 1
  merged_pr_number: 1879
  linked_issue_number: 1835
  cleanup_status: ok
  actions_taken:
    - worktree_remove: "/home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/issue-1835-codex-config-toml-multi-agent-v2-max-dep"
    - branch_delete: "worktree-issue-1835-codex-config-toml-multi-agent-v2-max-dep"
  main_sync:
    branch: main
    head: "af511e178119ba059133719b7cc17c9bbc58ea56"
    origin_main: "af511e178119ba059133719b7cc17c9bbc58ea56"
    status: synchronized
  readback:
    linked_worktree_present: false
    linked_branch_present: false
    root_worktree_clean: true
    other_worktrees_preserved: true
    other_branches_preserved: true
    tmp_preserved: true
  parent_issue:
    number: 1833
    state: OPEN
    recommended_action: keep_open
  follow_up_issue_requests: []

@squne121

Copy link
Copy Markdown
Owner Author

IMPL_REVIEW_LOOP_EVIDENCE_V1

IMPL_REVIEW_LOOP_EVIDENCE_V1:
  issue_number: 1835
  implementation_head_sha: "df12f35d8fb23d733f075ee3f6c3ab55735913e1"
  conflict_resolution:
    upstream_main_sha: "f94d8823957c9d0591e653ed5358fdce6a066d07"
    merge_commit: "85aadf0e3f56534f575f88d8cbf5d5447ae9db21"
    integration_commit: "6fec6078d2a5c79b5c34d7ec630726e7503bcdce"
    conflict_path: docs/dev/workflow.md
    result: pass
  verification:
    tested_head_sha: "6fec6078d2a5c79b5c34d7ec630726e7503bcdce"
    dedicated_checker_pytest: "30 passed"
    bridge_pytest: "25 passed"
    config_consumer_pytest: "23 passed"
    targeted_ruff: pass
    strict_parity: pass
    codex_strict_config_doctor: pass
    ac19_runtime_smoke: pass_carry_forward_runtime_surface_unchanged
  review:
    verdict: APPROVE
    reviewed_head_sha: "6fec6078d2a5c79b5c34d7ec630726e7503bcdce"
    blockers: []
  termination:
    status: draft_pr_ready
    merge_ready_before_merge: true
  evidence_publication_policy:
    current_comment: PR
    improvement_issue: "#1889"
    legacy_issue_comments_retained: true

補足: 本PRより前のIssueコメントは監査履歴として保持する。以後のimpl-review-loop終了系証跡のPRコメント統一は #1889 で実装する。

squne121 added a commit that referenced this pull request Aug 2, 2026
…nly 化に追従させる (#1959)

* fix(tests): test_agent_parity.py を NESTED_DELEGATION_001 の advisory-only 化に追従させる (#1948)

PR #1879(af511e17)で scripts/check_claude_codex_agent_parity.py の
compare_parity() から strict な NESTED_DELEGATION_001 drift 判定が削除され、
delegation_intent_hint(blocked | allowed | unknown)による advisory-only
ヒントへ置き換わったが、tests/test_agent_parity.py 側が追従しておらず
main の regression gate が baseline で FAIL していた。

- TestNestedDelegation 配下の該当テストを advisory 判定へ書き換え、
  strict-drift 前提の stale なテスト名・docstring・fixture 参照を是正
- TestAdvisoryDelegationSemantics を新設し、hint 不一致が drift を生成
  しないこと・STATUS/exit code に影響しないこと・
  classify_delegation_intent_hint() の三値分類+blocked 優先を固定
- tests/test_agent_parity.py を .github/ci/python-test-plan.json の
  required Python unit lane に登録

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(tests): PR #1959 REQUEST_CHANGES に対応し advisory-only delegation 契約を強化

Issue #1948 の再レビュー(REQUEST_CHANGES)で指摘された7項目に対応する。

1. AC2: delegation_intent_hint の不一致そのものを明示的に assert してから
   no-drift/STATUS/exit-code を検証するよう変更。
2. AC3: nested_delegation_report の全要素を反復検証し、値のドメインも固定。
   旧キー(claude_blocked/codex_blocked/match)の非存在も明示的に assert。
3. .codex/config.toml の V1([agents].max_depth) / V2
   ([features.multi_agent_v2]) fixture を分離し、通常テストは実リポジトリ
   と同じ V2 をデフォルトにする。V2 が max_depth を authority扱いしない
   専用回帰テストを追加。
4. drift/fail を含む逆向き語彙のテスト名・fixture名を advisory な実際の
   挙動に合わせて改名(drift-claude-delegation-mismatch.md →
   advisory-claude-delegation-mismatch.md 含む)。
5. scripts/check_claude_codex_agent_parity.py の docstring を advisory-only
   設計に合わせて修正(schema/permission のみ fail-level、delegation は
   advisory-only)。
6. delegation advisory の表現を delegation_intent_hint mismatch に限定し、
   将来の正規化 delegation policy(#1943)まで advisory とは解釈されない
   よう文言を narrow化。

tests/test_agent_parity.py 78件 (test_codex_agent_bridge_contract.py 含む)
全PASS。

* fix(tests): fixture md を日本語 prose 比率チェック(CI)に適合させる

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: .codex/config.toml へ Multi-Agent V2 を有効化し max_depth 依存を撤去する

1 participant