Skip to content

実装: check-codex-agents.mjs へ delegation graph 整合検証 CLI を追加する #1840

Closed as not planned

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1833"
goal_ref: "check-codex-agents.mjs へ graph policy / agent delegation metadata の双方向整合チェックを CLI subcommand として追加する(既存 hook 配線は変更しない)"
change_kind: code

Parent Issue

#1833

Parent Goal Ref

Current Validated Scope

  • scripts/check-codex-agents.mjs に新規 CLI subcommand(例: --validate-delegation-graph)を追加し、codex_subagent_graph_policy.v1.json の schema 検証、.codex/agents/*.toml の DELEGATION_POLICY metadata 検証、両者の双方向整合(policy の edges[] に存在する child role が対応する agent の allowed_child_roles と一致するか等)を検査する。
  • 既存の --hook-pretool 経路(.codex/hooks.json の active PreToolUse wiring)は一切変更しない。 新規 subcommand は orchestrator skill が明示的に呼び出す独立した検証専用モードとして追加する。
  • .codex/hooks.json は変更しない。

Remaining Parent Gaps

  • 実際の loop skill からの呼び出し組み込みは Child 8 で扱う。
  • read-only nested canary の有効化は Child 9 で扱う。

Outcome

check-codex-agents.mjs --validate-delegation-graph が graph policy と agent delegation metadata の不整合(unknown child role、read-only agent の write lease 要求、write-capable edge の single-writer policy 違反)を検出して非ゼロ exit を返し、既存の --hook-pretool 挙動が回帰していないことがテストで確認されている状態。

In Scope

  • scripts/check-codex-agents.mjs に --validate-delegation-graph subcommand を追加し、codex_subagent_graph_policy.v1.json を読み込んで schema 妥当性を検証する。
  • 同 subcommand が .codex/agents/*.toml の DELEGATION_POLICY block を parse し、graph policy の edges[] と allowed_child_roles の双方向整合を検査する(graph policy にあって agent 定義にない child role、agent 定義にあって graph policy にない child role をそれぞれ検出)。
  • read_only permission の agent(implementation-designer 等)が write_lease: exclusive を要求する定義になっていないかを検査する。
  • 既存の --hook-pretool モードのテスト(tests/**/test_check_codex_agents*.{mjs,js} 相当)が変更なしで PASS することを確認する回帰テストを追加する。

Out of Scope

Acceptance Criteria

  • AC1: check-codex-agents.mjs --validate-delegation-graph サブコマンドが実装されている。
  • AC2: graph policy にあって agent 定義にない child role を含む fixture に対して非ゼロ exit を返す。
  • AC3: read-only agent が write_lease: exclusive を要求する fixture に対して非ゼロ exit を返す。
  • AC4: 正常系 fixture(現行 導入: Codex CLI Multi-Agent V2 へ移行し、明示的な委譲グラフとbounded nested delegation harnessを導入する #1833 child 6 成果物相当)に対してゼロ exit を返す。
  • AC5: 既存 --hook-pretool の既存テストが変更なしで PASS する(回帰なし)。
  • AC6: .codex/hooks.json が本 Issue の diff に含まれない。

Verification Commands

# AC1
$ rg -n "validate-delegation-graph" scripts/check-codex-agents.mjs
# AC2
$ node scripts/check-codex-agents.mjs --validate-delegation-graph --fixture tests/fixtures/check-codex-agents/violation-unknown-child-role.json
# AC3
$ node scripts/check-codex-agents.mjs --validate-delegation-graph --fixture tests/fixtures/check-codex-agents/violation-readonly-write-lease.json
# AC4
$ node scripts/check-codex-agents.mjs --validate-delegation-graph --fixture tests/fixtures/check-codex-agents/valid-graph-agent-parity.json
# AC5
$ pnpm test -- check-codex-agents
# AC6
$ git diff --name-only main -- .codex/hooks.json

Allowed Paths

  • scripts/check-codex-agents.mjs
  • tests/fixtures/check-codex-agents/**
  • tests/**/check-codex-agents*.test.*

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 との調整を人間へ確認する)
  • 既存 --hook-pretool 挙動に回帰が生じた場合

Required Skills

なし

Required Design References

  • docs/dev/session-recording-policy.md
  • docs/dev/agent-skill-boundaries.md

Scope Delta(任意)

N/A

Activity

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

    @squne121
    OwnerAuthor

    not planned への整理

    本Issue全体は廃止した graph policy と独自 DELEGATION_POLICY の双方向checkerを目的としており、独立した残存scopeはありません。native config、最小agent instruction、実runtime smokeへ置き換えます。

    scripts/check-codex-agents.mjs に代替graph subsystemを追加せず、.codex/hooks.jsonも変更しません。

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/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions