Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1833"
depends_on: "#1830"
goal_ref: "Codex CLI Multi-Agent V2 移行の Phase 0: runtime capability を artifact 化し、後続 child の前提を固定する"
change_kind: workflowParent Issue
Parent Goal Ref
- Goal: Codex CLI の Multi-Agent V2 を有効化し、main session を唯一の control-plane とする明示的な委譲グラフを、新規 enforcing hook を追加せず導入する。
- Desired Destination: 単独改善(parent 導入: Codex CLI Multi-Agent V2 へ移行し、明示的な委譲グラフとbounded nested delegation harnessを導入する #1833 の Phase 0)。以降の child(graph policy、task packet、agent 定義変更等)はこの Issue の artifact を前提にする。
Dependency
- 実行条件: 実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830(Codex enforcing harness を quarantine し、advisory session recorder のみ維持する)が current main へマージ済みであること。
- 理由: 実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 マージにより
.codex/hooks.jsonの active allowlist が SessionEnd passive recorder + 条件付き SubagentStop recorder へ変わり、passive recorder の出力フィールド仕様が確定する。実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 未マージの状態で本 Issue の recorder 相関調査を実施すると、artifact が旧 enforcement hook 構成を正本化してしまい、実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 マージ後に無効化される。
Current Validated Scope
- Codex CLI のバージョンと
[features.multi_agent_v2]config schema の読み込み可否を artifact へ記録するスクリプトを追加する。 - 既存 session recording adapter(
scripts/session-recording/codex-hook-adapter.mjs)と関連 fixture を read-only で調査し、SessionEnd / 条件付き SubagentStop の passive recorder ログが parent-child spawn 相関(agent_id/agent_type/session_id/turn_id/agent_transcript_path等)に使える情報を含むかを調査結果 artifact にまとめる。 - 新規 hook は追加しない。
.codex/hooks.jsonは変更しない。
Remaining Parent Gaps
- graph policy JSON・validator の実装は Child 3 で扱う。
- task packet の実装は Child 4 で扱う。
Outcome
artifacts/codex-multi-agent-v2/runtime-capability.json に以下が記録され、対応する unit test が PASS している状態。
- Codex CLI version と V2 config schema 読み込み結果(
v2_config_schema_loadable) - provenance フィールド:
repo_head_sha、.codex/hooks.jsonの SHA、codex-hook-adapter.mjsの SHA、recorder_generation(実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 マージ前後を区別する世代識別子) - passive recorder ログの相関可能フィールド一覧(
agent_id/agent_type/session_id/turn_id/agent_transcript_path等が SubagentStop hook input / SessionEnd hook input / passive recorder output / Codex rollout・session metadata / 親のspawn_agentrequest・result のいずれに存在するかの内訳)、または「相関可能フィールドなし」の明記
In Scope
scripts/agent-guards/probe_codex_v2_runtime_capability.pyを新規作成し、codex --version(またはそれに相当する既存の version 取得手段)と.codex/config.tomlへの[features.multi_agent_v2]block 読み込み可否を検証し、artifacts/codex-multi-agent-v2/runtime-capability.jsonにrepo_head_sha/.codex/hooks.jsonSHA / adapter SHA /recorder_generationを含めて記録する。- CLI 機能認識調査として、
spawn_agentが V2 形式で公開されるか、agent_type/task_name/fork_turnsが利用可能か、使用中の CLI / Desktop / モデルで V2 が選択されるか、nested delegation が利用可能かを確認し artifact へ記録する(実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 非依存)。 docs/dev/session-recording-policy.mdおよびscripts/session-recording/codex-hook-adapter.mjsを read-only で調査し、SessionEnd / 条件付き SubagentStop passive recorder が出力するログにagent_id/agent_type/session_id/turn_id/agent_transcript_path相当のフィールドが、SubagentStop hook input・SessionEnd hook input・passive recorder output・Codex rollout/session metadata・親のspawn_agentrequest/result のどこに存在するかを確認する(実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 依存)。- 上記調査結果を
docs/dev/codex-multi-agent-v2-runtime-evidence.mdに記録する(含まれる場合は該当フィールド名とログの出力先、含まれない場合はその旨と「orchestrator 自己申告記録のみに依拠する」という後続 child への影響を明記)。 tests/agent-guards/test_probe_codex_v2_runtime_capability.pyを追加し、offline fixture(config.toml サンプル)で正常系・schema 読み込み失敗系・既知 failure mode(Codex binary 不在、executable が symlink/shim、version 出力が空/非SemVer/timeout、feature 未認識、feature 認識済みだが disabled、config loader rejection、subprocess malformed JSON)を検証する。
Out of Scope
.codex/hooks.jsonの変更(実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 の管轄)。- graph policy JSON・validator 本体の実装(Child 3)。
- task packet の実装(Child 4)。
.codex/config.tomlへの実際の V2 有効化設定の書き込み(Child 2)。
Non-Goals
- Codex session/rollout ログの読み取り範囲は canonicalize された既知の Codex session/state directory のみに限定し、symlink・別 UID 所有・非 regular file は拒否する。追跡対象期間・最大ファイル数・総 bytes を上限で制限する。
last_assistant_message/ prompt / response / tool arguments の内容は読み出し・出力しない。artifact へ保存するのはキー名・型・存在有無・件数・digest のみとする。- 絶対パスや利用者名は artifact へ保存しない(basename または redacted locator のみ)。
- raw JSONL やセッション transcript 断片をリポジトリへ commit しない。
- 読み取り不能な session/state directory は
unavailableとして扱い、fixture ベースの調査結果を live evidence へ昇格しない。
Acceptance Criteria
- AC1:
probe_codex_v2_runtime_capability.pyが Codex CLI version を artifact JSON に記録する。 - AC2: 同スクリプトが
[features.multi_agent_v2]config schema の読み込み可否を artifact JSON のv2_config_schema_loadableフィールドに記録する。 - AC3:
docs/dev/codex-multi-agent-v2-runtime-evidence.mdが passive recorder ログの相関可能フィールド調査結果(含む/含まないいずれか)を明記する。 - AC4: 新規 unit test が offline fixture で正常系・schema 読み込み失敗系・既知 failure mode ともに PASS する。
- AC5: 本 Issue の変更が
.codex/hooks.jsonを一切変更していない。 - AC6: artifact JSON が
repo_head_sha/.codex/hooks.jsonSHA / adapter SHA /recorder_generationの provenance フィールドを含む。
Verification Commands
# AC1
# baseline-expect: fail
$ test -f artifacts/codex-multi-agent-v2/runtime-capability.json
# AC2
# baseline-expect: fail
$ rg -n "v2_config_schema_loadable" scripts/agent-guards/probe_codex_v2_runtime_capability.py
# AC3
# baseline-expect: fail
$ test -f docs/dev/codex-multi-agent-v2-runtime-evidence.md
# AC4
$ uv run --locked pytest tests/agent-guards/test_probe_codex_v2_runtime_capability.py -q
# AC5
# baseline-expect: pass
$ git diff --name-only main -- .codex/hooks.json
# AC6
# baseline-expect: fail
$ rg -n "recorder_generation" scripts/agent-guards/probe_codex_v2_runtime_capability.pyRuntime Verification Applicability
- decision: not_applicable
- reason: 本 Issue は probe script による capability artifact 生成と offline fixture ベースの unit test のみで完結し、ゲームループやマルチコンポーネント間の runtime 統合検証は不要。
Allowed Paths
scripts/agent-guards/probe_codex_v2_runtime_capability.pytests/agent-guards/test_probe_codex_v2_runtime_capability.pydocs/dev/codex-multi-agent-v2-runtime-evidence.mdartifacts/codex-multi-agent-v2/runtime-capability.json.github/ci/python-test-plan.json(追加: CI の ci_test_selection gate に新規テストディレクトリ tests/agent-guards/ を登録するための追加修正。PR 実装: Codex Multi-Agent V2 runtime capability を artifact 化する #1850 iteration 2 で判明)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
.codex/hooks.jsonの変更が必要と判明した場合(即停止し 実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 との調整を人間へ確認する)- 着手時点で 実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 が current main へ未マージの場合(即停止し 実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 のマージ状況を人間へ確認する)
Required Skills
なし
Required Design References
- docs/dev/session-recording-policy.md
- docs/dev/workflow.md
- 実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830
Scope Delta(任意)
N/A
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jul 29, 2026
「docs/dev/session-recording-policy.md および scripts/session-recording/codex-hook-adapter.mjs を read-only で調査し、SessionEnd / 条件付き SubagentStop passive recorder が出力するログに agent_type / task_name / parent_session_id 相当のフィールドが含まれるかを確認する。」であるけど、このリポジトリの成果物はオリジナルの情報じゃないから、ローカル作業環境のセッションログを参照した方が適切ではないか。
個人趣味開発だから、リポジトリ外のファイルだったら、リードオンリーなら許可する。
squne121 commentedon Jul 29, 2026
you asked
message time: 2026-07-29 22:17:18
#1834
内容について関連Issue、PR、リポジトリ資産、コメントを参照した上で敵対的レビューして。
取り扱う技術や配布物の実装をWEB検索し高品質化してほしい。
chatgpt response
Issue #1834の本文・コメント・関連PR/Issueを起点に、実装資産とCI上の前提まで照合します。その後、採用技術の公式仕様と配布実装を外部一次資料で検証し、重大度順の敵対的レビューにまとめます。
現時点では #1834 に対応するPRは見つかっておらず、Issue本文と親Issueの設計契約が主な評価対象です。特に「設定schemaをどう検証するか」と「passive recorderの証拠能力」が、実装前に崩れやすい箇所です。
Issue本文の「repository内のadapterを読めば相関フィールドの有無が分かる」という前提は、現状のコード検索だけでも弱いです。実際のhook入力payloadとローカル保存ログの両方を分離して確認します。
判定
REQUEST_CHANGES
方向性自体は妥当です。Phase 0で「実際に利用できるCodex CLI機能」と「相関に使える観測データ」を固定する必要があります。
ただし現状の #1834 は、将来のpassive recorder、現在の複合hook、Codexの設定schema、実際のruntime tool surfaceを同じ“runtime capability”として扱っており、後続Issueが誤った前提へ依存する危険があります。
P0 Blocker 1: #1830完了前に調査すると、旧recorderを正本化する
#1834は「#1830後も残るSessionEnd/条件付きSubagentStop passive recorder」の能力を調べる設計です。しかし現在のリポジトリでは、
.codex/hooks.jsonにまだSubagentStart、PreToolUse、PermissionRequest、Stop、SubagentStopが配線され、SessionEndは存在しません。現在のadapterもpassive recorderではありません。manifest生成後にpost-run verifierを呼び、検証失敗時には
continue:falseを返します。またSubagentStop時にはscope-rollup captureも残っています。一方、#1830が定義する目標状態は、SessionEndと必要時のみのSubagentStopに限定したfail-open recorderです。#1830は現在もopenです。
修正要求
depends_on: "#1830"を追加する。repo_head_sha、.codex/hooks.jsonSHA、adapter SHA、recorder_generationを必須記録する。この順序制約がなければ、#1834のartifactは完成直後に無効化されます。
P0 Blocker 2:
v2_config_schema_loadableが何を証明するのか不明現行AC2は、単一のboolean
v2_config_schema_loadableを要求しています。しかし、少なくとも以下は別の事実です。
公式の現行schemaには
[features.multi_agent_v2]が定義され、V2では[agents].max_depthが無視される設計です。しかし、schema定義とruntime側のfeature解決は別経路です。(GitHub)また公式リポジトリでも、公開schemaとruntime受理内容が一致しなかった事例が報告されています。したがって最新mainのschemaを読むだけでも、
tomllibでfixtureを読むだけでも、インストール済みbinaryの受理能力は証明できません。(GitHub)booleanは廃止し、最低でも次へ分解すべきです。
{ "config_capability": { "toml_parseable": true, "version_matched_schema_validation": "pass", "cli_config_load": "pass", "feature_known": "yes", "feature_effective": "enabled" } }各値は
pass / fail / unavailable / not_runなどの閉じたenumにし、reason_codeと実行コマンドのexit codeを保持してください。Codex CLIにはfeature一覧を確認する経路とstrict config処理があります。probeは可能な範囲でインストール済みCLI自身のconfig loaderを使い、最新upstream schemaだけを正本にしない設計が必要です。(GitHub)
P0 Blocker 3: configを読めても「runtime capability」は証明されない
現在のテストはofflineのconfig fixtureだけです。これでは以下を確認できません。
spawn_agentがV2形式で公開されるかagent_type、task_name、fork_turnsが利用可能か上流でも、モデルやクライアントsurfaceによってV2の有効状態や公開パラメータが異なるという報告があります。少なくとも、設定ファイル受理だけでtool surfaceを推定するのは安全ではありません。(GitHub)
外部API実行や実subagent起動をPhase 0で許可しないなら、artifactは次のように明記すべきです。
{ "runtime_dispatch_capability": { "status": "not_run", "reason_code": "live_runtime_probe_out_of_scope" } }その場合、artifact名も実態に合わせて
config-and-observability-capability.jsonとするか、「runtime support confirmed」と解釈できない契約にしてください。#1835の開始条件は
cli_config_load == passでよい一方、nested canaryを扱う後続childは別途live runtime evidenceを要求すべきです。P0 Blocker 4: hook入力、recorder出力、rolloutログを混同している
現在の公式
SubagentStopinput schemaには、次のフィールドがあります。agent_idagent_typesession_idturn_idagent_transcript_pathしかし
task_nameとparent_session_id/parent_thread_idはありません。公式
SessionEndschemaはさらに限定され、session_id、cwd、reason、transcript_pathだけです。agent_typeもありません。リポジトリ内の0.145.0 fixtureも、
agent_typeはありますが、task_nameと親IDはありません。さらに重大なのは、現在のrepo adapterがhook payloadのこれらの値をmanifestへ保存していないことです。producer引数には
issue-768:impl:001が固定値として入り、payloadは相関metadata生成に使われていません。したがって、AC3の調査結果は次のsurface別matrixにする必要があります。
各surfaceについて、
present / absent / unstable / discarded_by_recorderを記録してください。ユーザーコメントにある「ローカル作業環境のセッションログを参照する方が適切」という指摘は正しいです。
Codexのthread/rollout側には親threadとの関係を保持する実装面があります。したがって、相関は一つのhook payloadに依存せず、親spawn記録の
task_name、子session metadataの親ID、SubagentStopのagent_id/agent_typeを結合する方式として検証するのが妥当です。(GitHub)P1 Major: ローカルログの読み取り境界が未定義
リポジトリ外ファイルをread-onlyで読む許可だけでは不十分です。Codex session JSONLやtranscriptには、プロンプト、コード、tool引数、絶対パス、場合によっては秘匿情報が含まれ得ます。
probeには次の制限が必要です。
last_assistant_message、prompt、response、tool argumentsは読み出し・出力しない。これをIssue本文、テスト、artifact schemaの三箇所で固定すべきです。
P1 Major: artifactが環境依存snapshotであることを表現できない
現在のOutcomeでは、1台の環境で生成したJSONを後続childの固定前提にしています。Codex CLI更新、PATH変更、Desktop側runtime変更、config変更、#1830マージのいずれでも結果が陳腐化します。
最低限、以下をprovenanceとして持たせる必要があります。
{ "schema": "CODEX_MULTI_AGENT_V2_RUNTIME_CAPABILITY_V2", "generated_at": "...", "repo_head_sha": "...", "platform": "...", "architecture": "...", "runtime_surface": "cli", "codex_version_raw": "...", "codex_executable_realpath_redacted": "...", "codex_executable_sha256": "...", "config_sha256": "...", "hooks_sha256": "...", "adapter_sha256": "...", "probe_script_sha256": "...", "fixture_release_pin": "codex-0.145.0" }現在の
.codex/config.toml自身も、「project-local configはruntime routingの証拠ではない」と明記しています。artifactの有効条件は日時ではなく、上記入力digestが変わっていないことにしてください。
P1 Major: unit testの異常系が不足
「正常系」と「schema読み込み失敗系」だけでは不十分です。追加すべきなのは以下です。
upstream fixtureとlive evidenceは別の判定にし、fixture PASSをlive runtime PASSへ昇格させない必要があります。リポジトリの既存policyにも同じ境界が明記されています。
P2: Verification Commandsが存在確認に偏っている
現在のコマンドは、
rgでフィールド名がソース内にあること、ドキュメントやartifactが存在することしか確認していません。例えばAC2は、次のようにartifact値そのものを検証すべきです。
専用validatorを増やさないなら、unit test内で閉じたkey集合、enum、provenance、redactionを検証してください。
AC5もローカルの
mainとの差分ではなく、PRのmerge-baseまたはCIが取得したchanged-files集合で.codex/hooks.json非変更を確認する方が堅牢です。推奨するIssue修正方針
#1834は次の到達点へ変更するのが妥当です。
特に必須なのは次の3点です。
v2_config_schema_loadablebooleanを複数の状態へ分解する。この修正なしで実装すると、テストはPASSしても、後続childが必要とする「V2が実際に使える」「親子spawnを相関できる」という前提は証明されません。
you asked
message time: 2026-07-29 22:44:37
#1834 (comment)
「docs/dev/session-recording-policy.md および scripts/session-recording/codex-hook-adapter.mjs を read-only で調査し、SessionEnd / 条件付き SubagentStop passive recorder が出力するログに agent_type / task_name / parent_session_id 相当のフィールドが含まれるかを確認する。」であるけど、このリポジトリの成果物はオリジナルの情報じゃないから、ローカル作業環境のセッションログを参照した方が適切ではないか。
個人趣味開発だから、リポジトリ外のファイルだったら、リードオンリーなら許可する。
chatgpt response
コメントの妥当性を、Issue本文と現行Codexのhook/session情報面を分けて確認します。論点は「一次証拠を何にするか」と「repo内実装をどこまで補助証拠として残すか」です。
コメントの指摘は妥当です。
ただし結論は「リポジトリ内の文書・adapterを調査対象から外す」ではなく、一次証拠と補助証拠を分離するのが適切です。
推奨する証拠の優先順位
1. 一次証拠:ローカルの実行時データ
実際の作業環境で生成された次のデータをread-onlyで調査します。
Issueの目的は「現在のCodex runtimeで親子相関に何が使えるか」の確認です。したがって、repository内の説明ではなく、実際にインストールされているCodex CLIが生成したデータを一次証拠にすべきです。コメントはこの点を正しく指摘しています。
2. 補助証拠:repository内のadapter・policy・fixture
一方、次の調査は残す必要があります。
codex-hook-adapter.mjsが入力payloadのどのフィールドを保存するか例えば、runtimeのhook payloadに
agent_typeが存在しても、adapterが保存していなければ、passive recorderのログからは利用できません。したがって、次の3層を別々に記録する必要があります。
現行Issue本文は、repository内のadapterを読むことでCだけでなくAやBまで判定できるように書かれており、ここが不正確です。
特に確認すべきフィールド
単に
agent_type / task_name / parent_session_idを検索するだけでは不足します。名称が異なる可能性があるため、相当フィールドも調べます。なお、公式の現行
SubagentStophook input schemaではagent_id、agent_type、session_id、turn_idはありますが、task_nameと明示的な親session IDはありません。SessionEndはさらに限定され、session_id、cwd、reason、transcript_pathが中心です。したがって、親子相関は一つのログだけでは完結せず、親のspawn記録と子session/SubagentStop記録の結合が必要になる可能性が高いです。
Issue本文の修正方針
次のように変更するのが適切です。
**Document Title: **
ローカル作業環境のCodex session/rolloutログ、hook input payload、およびpassive recorderの実出力をread-onlyで調査し、parent-child spawn相関に利用可能なフィールドを確認する。
docs/dev/session-recording-policy.md、scripts/session-recording/codex-hook-adapter.mjs、関連fixtureは補助証拠として調査し、runtimeまたはhook inputに存在するフィールドがpassive recorder出力へ実際に永続化されるか、途中で欠落・変換されるかを確認する。調査結果では、以下を別々に記録する。
リポジトリ外のファイルはread-onlyで参照してよい。ただし、prompt、response、tool arguments、assistant message本文その他の内容データをartifactまたはドキュメントへ転載しない。記録対象はフィールド名、型、存在有無、件数、必要最小限のdigestおよびredacted locatorに限定する。
ローカルファイル参照時の境界
「read-onlyなら何でも可」より、次を固定した方が安全です。
unavailableとし、fixture結果をlive evidenceへ昇格しない要するに、コメントの方向でIssue本文を修正すべきです。
ローカルsessionログを一次証拠、repository内のadapter・policy・fixtureを「保存経路と意味を解釈するための補助証拠」と位置付けるのが最も正確です。
Powered by AI Exporter
squne121 commentedon Jul 29, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jul 29, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 29, 2026
Contract Review Result
squne121 commentedon Jul 29, 2026
実装完了・PR 起票
f5430c9e3a1c5fb2ec406801e496b7508852b81e, mergeable: MERGEABLE)scripts/agent-guards/probe_codex_v2_runtime_capability.py/tests/agent-guards/test_probe_codex_v2_runtime_capability.py/docs/dev/codex-multi-agent-v2-runtime-evidence.md/artifacts/codex-multi-agent-v2/runtime-capability.json).codex/hooks.json差分なし)PR 起票プロセスに関する報告
本 PR は open_pr.py の overlap preflight hard gate(C3 title_goal_disjoint)を 人間承認済みで bypass し、
gh pr createを直接実行して起票した。fix: python-test-plan の targets に tests/agent-guards/ を追加登録する (#1834)
squne121 commentedon Jul 29, 2026
Contract Review Result
fix: privacy漏洩・stale証跡・schema受理判定の欠陥を修正する (#1834)
chore: 修正後HEADでruntime-capability artifactを再生成する (#1834)
実装: Codex Multi-Agent V2 runtime capability を artifact 化する (#1850)