Repository navigation
Closed
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "Codex CLI 実行時の impl-review-loop / post-merge-cleanup が root thread 直接実行ではなく、明示 spawn された custom agent と event-derived launch ledger によって repo-side deterministic guardrail として監査可能になる"
change_kind: workflowParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: Codex CLI 実行時に impl-review-loop / post-merge-cleanup の SubAgent dispatch を self-report 非依存の deterministic guardrail として監査可能にする
- Desired Destination: 既存
.codex/agents/*.toml定義、.codex/hooks.json、launch ledger validator、impl-review-loop handoff docs、fixture tests が揃い、root-thread data-plane 実行と evidence 不足を fail-closed で検出できる状態
Current Validated Scope
- 既存
.codex/agents/implementation-worker.toml/test-runner.toml/pr-reviewer.toml/post-merge-cleanup-worker.tomlを「新規追加」前提ではなく required model / reasoning / permission / runtime limitation を持つ監査対象として更新する .codex/config.tomlに[agents] max_depth = 1を反映し、project-local config を Codex profile routing の証拠として扱わない方針を明記する.codex/hooks.jsonとscripts/check-codex-agents.mjsを含む既存 hook wiring を監査対象にし、trust state / skipped / disabled / unsupported tool path / Codex binary unavailable を fail-closed に分類する.claude/skills/impl-review-loop/の Step 1 / 2 / 4 と post-merge handoff の Codex 実行時注意書きを更新し、root thread が data-plane を直接実行しない契約を明文化するdocs/dev/agent-skill-boundaries.mdと必要最小限の workflow docs に、repo-side deterministic guardrail と feat(#579 follow-up): AC7 real spawn verification with OpenAI API key environment #601 への deferred boundary を追記するscripts/check_codex_agent_config.py/scripts/check_claude_codex_agent_parity.py/scripts/check_impl_review_loop_codex_dispatch.py/scripts/check_subagent_launch_ledger.pyを追加または更新するtests/fixtures/subagent-ledger/と必要な config fixture を追加し、PR test: hooks tests の CI 取りこぼしを防ぐ (#682) #763 相当ログの replay audit を fail fixture として固定する
Remaining Parent Gaps
- main thread context budget gate (
MAIN_THREAD_CONTEXT_BUDGET_V1) は別 Issue で扱う - OpenAI API key 実環境での real spawn 実測証跡取得は feat(#579 follow-up): AC7 real spawn verification with OpenAI API key environment #601 の follow-up として残す
Outcome
既存 .codex/agents/*.toml、.codex/hooks.json、scripts/check-codex-agents.mjs、Codex dispatch / launch-ledger validator scripts、fixture tests、impl-review-loop / docs の handoff 更新を含むコミットが追加され、Codex CLI での impl-review-loop / post-merge-cleanup が明示 spawn された custom agent と event-derived SUBAGENT_LAUNCH_LEDGER_V1 によって監査され、root thread による file edit / test run / git commit / git push / review judgment の直接実行、および trusted evidence 不足が validator で fail になる状態。
In Scope
- 既存 Codex custom agent 定義の required field / model / reasoning / permission / runtime limitation の更新と
.claude/agents/*.mdとの role parity 検証 [agents] max_depth = 1の固定と nested recursion 禁止- impl-review-loop / post-merge-cleanup の Codex handoff 文言追加
SUBAGENT_LAUNCH_LEDGER_V1の strict schema、canonical evidence source、validator 実装- worker self-report を advisory に落とし、spawn evidence は hook / event / trusted generated artifact に限定するルールの導入
- root-thread data-plane 実行検出、wrong runtime config 検出、missing-launch 検出、hook trust failure 検出の negative fixtures 追加
- PR test: hooks tests の CI 取りこぼしを防ぐ (#682) #763 相当ログを replay fixture 化し、現状 fail を再現する監査テスト追加
Out of Scope
- Codex CLI 本体の変更
- OpenAI subscription / ChatGPT plan の自動検出
- project-local
.codex/config.tomlからprofile/profilesを上書きする仕組みの導入 - raw child transcript の公開保存
- root context budget 最適化そのもの(別 Issue で扱う)
- OpenAI API key 環境での live spawn 実証(feat(#579 follow-up): AC7 real spawn verification with OpenAI API key environment #601 で扱う)
Acceptance Criteria
- AC1:
.codex/agents/implementation-worker.toml/test-runner.toml/pr-reviewer.toml/post-merge-cleanup-worker.tomlが存在し、Codex custom agent 必須 field と repo が要求する runtime limitation field を満たす - AC2:
scripts/check_codex_agent_config.pyが既存 agent TOML とscripts/check-codex-agents.mjsの expected runtime contract を照合し、actual model / reasoning effort / default_permissions / runtime_dependency_status の不一致を fail にする - AC3:
.codex/config.tomlで[agents] max_depth = 1が固定され、project-local config を profile routing の証拠に使わないことが docs / validator で明記される - AC4: impl-review-loop の Step 1 / 2 / 4 と post-merge handoff docs に、Codex 実行時は root thread が data-plane を直接実行せず該当 custom agent を明示 spawn することが書かれている
- AC5:
SUBAGENT_LAUNCH_LEDGER_V1validator が strict schema を持ち、valid fixture を通し、generated_by: workerのみ・missing launch・wrong runtime config・root-threadgit push・root-thread test execution・root-thread file edit / review judgment を含む invalid fixture を fail にする - AC6: hook trust state が
untrusted/skipped/disabled、unsupported tool path 観測、Codex binary unavailable の fixture に対して launch-ledger or dispatch validator が fail-closed になる - AC7: PR test: hooks tests の CI 取りこぼしを防ぐ (#682) #763 replay fixture に対して
subagent_launch_evidence_missingとroot_thread_data_plane_execution_observedを返す fail audit が固定される - AC8: Runtime Verification Applicability が
decision: deferredとして feat(#579 follow-up): AC7 real spawn verification with OpenAI API key environment #601 を明示し、この Issue の成功条件が live spawn 実証ではなく repo-side deterministic guardrail の実装であることが本文に記載される
Verification Commands
# AC1
# preflight-scope: runtime_only
$ python3 scripts/check_codex_agent_config.py --assert-required-fields
# AC2
# preflight-scope: runtime_only
$ python3 scripts/check_codex_agent_config.py --assert-runtime-contract
# AC3
# preflight-scope: runtime_only
$ python3 scripts/check_impl_review_loop_codex_dispatch.py --assert-max-depth --assert-no-project-profile-routing
# AC4
# preflight-scope: runtime_only
$ python3 scripts/check_impl_review_loop_codex_dispatch.py --assert-explicit-spawn-notes
# AC5
# preflight-scope: runtime_only
$ python3 scripts/check_subagent_launch_ledger.py tests/fixtures/subagent-ledger/valid.json
# AC6
# preflight-scope: runtime_only
$ python3 scripts/check_subagent_launch_ledger.py tests/fixtures/subagent-ledger/hook-untrusted.json
# AC7
# preflight-scope: runtime_only
$ python3 scripts/check_subagent_launch_ledger.py tests/fixtures/subagent-ledger/pr763-replay.json
# AC8
# preflight-scope: runtime_only
$ python3 .claude/skills/review-issue/scripts/check_issue_contract.py --file tmp/issue-764-body.md --jsonAllowed Paths
.codex/config.toml.codex/hooks.json.codex/agents/implementation-worker.toml.codex/agents/test-runner.toml.codex/agents/pr-reviewer.toml.codex/agents/post-merge-cleanup-worker.toml.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/step-1-implementation.md.claude/skills/impl-review-loop/steps/step-2-verification.md.claude/skills/impl-review-loop/steps/step-4-pr-review.md.claude/skills/post-merge-cleanup/SKILL.mddocs/dev/agent-skill-boundaries.mddocs/dev/workflow.mdscripts/check-codex-agents.mjsscripts/check_codex_agent_config.pyscripts/check_claude_codex_agent_parity.pyscripts/check_impl_review_loop_codex_dispatch.pyscripts/check_subagent_launch_ledger.pytests/fixtures/subagent-ledger/tests/fixtures/codex-agent-config/
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
.codex/rules/default.rulesの新規追加や変更が必要と判明した場合- launch ledger の canonical evidence source を repo-side deterministic input に固定できない場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Scope Delta(任意)
owner comment #4649560282 を受けて、profile routing 仮定を縮退し、self-report 非依存の launch evidence / hook trust fail-closed / #601 deferred boundary を明示する方向へ reframe した。
Runtime Verification Applicability
decision: deferred
deferred_destination: "issue #601"
destination_type: issue
destination_ref: "#601"
deferred_verification_condition: "OpenAI API key を直接利用できる環境で custom agent の real spawn と child-agent event evidence を取得できたときに live runtime verification を行う。本 Issue では live spawn 実証ではなく、evidence が無い場合に fail-closed する repo-side deterministic guardrail を完了条件とする。"Notes for Reviewer
- PR 実装: pr-review-judge が PR 実 diff × Allowed Paths から ALLOWED_PATHS_GATE_RESULT_V1 を独立再計算する review-subagent gate (#758) #762 の review-subagent gate 改善方針(PR 実 diff を canonical source とし worker self-report を advisory に落とす)と整合すること
.codex/hooks.jsonとscripts/check-codex-agents.mjsは local guardrail であり security boundary ではない。trust state / skipped / unsupported tool path / unavailable を fail-closed に分類すること- project-local
.codex/config.tomlは profile routing の証拠として扱わず、actual runtime contract と docs wording を validator 対象にすること - PR test: hooks tests の CI 取りこぼしを防ぐ (#682) #763 の公開作業ログ相当 fixture は「現状 fail」を固定する監査用途であり、raw transcript 全文の保存は目的に含めない
- feat(#579 follow-up): AC7 real spawn verification with OpenAI API key environment #601 は real spawn 実測証跡取得の follow-up であり、本 Issue は repo-side deterministic guardrail を先に整備する
Delivery Rule
1 Issue = 1 PR- worktree は
.claude/worktrees/issue-<番号>-<slug>/を使う - Draft PR を既定とし、validator と fixture replay が通るまで Review Ready にしない
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jun 8, 2026
[-]実装: Codex CLI で impl-review-loop の明示 SubAgent spawn と launch ledger gate を導入する[/-][+]実装: Codex CLI で impl-review-loop の明示 SubAgent spawn 監査を repo-side deterministic guardrail として導入する[/+]squne121 commentedon Jun 8, 2026
Contract Snapshot (2026-06-08T14:13:25Z)
# preflight-scope: runtime_onlyを付けた runtime/deferred verification として扱う。.claude/worktrees/issue-764-codex-subagent-ledgerworktree-issue-764-codex-subagent-ledgerfix: harden subagent ledger audit (#764)
feat: add codex subagent launch guardrails (#767)
squne121 commentedon Jun 8, 2026
Implemented by PR #767 and merged into main on 2026-06-09 JST. post-merge-cleanup で local branch/worktree cleanup に進みます。