Skip to content

実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #2409 の merge 後、native Codex CLI runtime の retirement により orphan となる scripts/session-recording/codex-hook-adapter.mjs を、fresh default-branch HEAD の complete tracked-file inventory に基づいて削除する"
change_kind: code
prerequisite: "PR #2409 merged; implementation authority is the fresh default-branch HEAD after that merge"
decision_gate: "merged PR #2409 and production_inbound_producer_count == 0 => DELETE_CHAIN; merged PR #2409 and production_inbound_producer_count > 0 => STOP/re-refinement"
tracked_inventory_authority: "git grep; includes hidden tracked files; bare rg -n pattern . is forbidden"
runtime_verification_applicability: not_applicable

Parent Issue

none

Parent Goal Ref

  • Goal: native Codex CLI runtime を repository から retire し、残存する runtime-specific asset を除去する。
  • Desired Destination: PR feat: retire native Codex CLI assets and documentation #2409 が .codex/** と session-recording composite を削除した fresh default-branch HEAD 上で、native Codex runtime の live production inbound chain が存在しない。

Current Validated Scope

  • PR feat: retire native Codex CLI assets and documentation #2409 merge 後の fresh default-branch HEAD だけを implementation authority として、scripts/session-recording/codex-hook-adapter.mjs への全 tracked-file reference を git grep で inventory・分類する。
  • production inbound producer が 0 のときだけ adapter と adapter-only test DELETE_CHAIN を実施し、削除により stale になる guard assertion を更新する。
  • fresh inventory で必要性が確認された場合だけ、CI test-path reference と provider-neutral test 内の adapter-specific assertion を最小限更新する。

Remaining Parent Gaps

なし

Goal

PR #2409 merge 後に orphan となる native Codex-specific adapter DELETE_CHAIN を、fresh complete inventory の decision gate に従って安全に完了する。

Outcome

PR #2409 merged の fresh default-branch HEAD で production inbound producer が 0 と確認された場合に限り、adapter と adapter-only tests が削除され、unintended executable reference が 0 であることを tracked-file authority と直接 existence check で検証できる状態。

Prerequisite

Decision Gate

  1. PR feat: retire native Codex CLI assets and documentation #2409 merged を確認してから fresh default-branch HEAD を取得する。
  2. git grep による complete tracked-file inventory を実施し、各 hit を production inbound producer、test-only、docs-historical、fixture のいずれかへ分類して PR 本文に記録する。git grep は hidden/tracked files を含む正本であり、bare rg -n <pattern> . を用いてはならない。
  3. merged かつ production inbound producer count が 0 の場合だけ、adapter、adapter-only tests、および stale guard assertion の DELETE_CHAIN を実施する。
  4. merged 後に production inbound producer count が 1 以上の場合は adapter を変更せず、inventory を記録して STOP/re-refinement する。provider-neutral fallback は作成しない。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: native Codex runtime retirement 後の静的 cleanup、tracked-file inventory、ファイル存在確認、および通常品質ゲートだけで検証でき、runtime session の実行は対象外であるため。

In Scope

  • scripts/session-recording/codex-hook-adapter.mjs の DELETE_CHAIN(Decision Gate の DELETE 条件を満たす場合のみ)。
  • adapter-only candidates の fresh HEAD 再分類と、adapter-only と確認できた test の削除(tests/hooks/codex-harness-advisory-fail-open.test.ts を含む、tests/hooks/codex-harness-advisory-*.test.ts の adapter-only DELETE candidates)。
  • scripts/agent-guards/tests/test_git_mutation_command_policy.py にある adapter source direct-reference assertion の削除または更新。
  • .github/workflows/ci.yml の削除 test path 参照(通常実行・xdist 実行・collect-only target・ci_test_selection artifact の pytest_args・session-recording prefix 判定・存在 assertion)の required mechanical cleanup。fresh main で該当参照の存在は確認済みであり、条件付きではない。
  • .github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes から、削除される3つの adapter-only test path(tests/session_recording/codex/test_hook_adapter.py、test_initial_branch_create_lane.py、test_external_manifest_publish.py)を除去する required mechanical cleanup。fresh main で本 JSON がこれら3パスを保持していることを確認済みであり、条件付きではない。
  • tests/codex/test_scope_rollup_runner_agent_config.py の adapter-specific assertion が fresh inventory で stale と確認できた場合に限る最小更新。provider-neutral behavior は保持する。
  • OWNER の PR feat: retire orphaned codex-hook-adapter.mjs と adapter-only tests #2428 REQUEST_CHANGES レビュー(https://github.com/squne121/loop-protocol/pull/2428#issuecomment-5466835712)を反映した fix_delta: scripts/agent-guards/git_mutation_command_policy.py から dead な codex_hook_adapter_pretooluse 認可値とその Codex-adapter 固有コメントを機械的に除去し(focused regression test を追加)、docs/dev/hook-boundaries.md の stale な Codex hook allowlist 記述を historicize する。新規 harness やセキュリティ強化ではなく、dead control-plane branch の除去と stale SSOT prose の訂正のみ。

Out of Scope

Acceptance Criteria

  • AC1: Implementation 開始前に PR feat: retire native Codex CLI assets and documentation #2409 の merged 状態を確認し、merge 後の fresh default-branch HEAD を implementation authority として記録する。未マージなら implementation は開始されない。
  • AC2: fresh HEAD 上の complete tracked-file inventory は git grep で行われ、adapter reference の全 hit が production inbound producer、test-only、docs-historical、fixture に分類されて PR 本文へ記録される。hidden/tracked files を欠落させる bare rg -n <pattern> . は inventory に用いない。
  • AC3: PR feat: retire native Codex CLI assets and documentation #2409 merged かつ production inbound producer count が 0 の場合だけ、scripts/session-recording/codex-hook-adapter.mjs と fresh HEAD で adapter-only と確認された tests(tests/hooks/codex-harness-advisory-fail-open.test.ts を含む。同ファイルは codex-harness-advisory-recorder.test.ts の invoke helper の唯一の consumer であり、recorder test の削除に伴い併せて削除する)を削除し、adapter direct-reference の stale guard assertion を削除または更新する。
  • AC4: PR feat: retire native Codex CLI assets and documentation #2409 merged 後に production inbound producer count が 1 以上の場合、adapter を変更せず、inventory を記録して STOP/re-refinement する。provider-neutral fallback は追加しない。
  • AC5: DELETE_CHAIN を選択した場合、adapter file は存在せず、tracked files 内の unintended executable adapter reference は 0 である。docs-historical、fixture、または PR inventory record は executable reference として数えないが、AC2 の分類対象には含める。
  • AC6: DELETE_CHAIN に必要な変更は Allowed Paths に限定される。.github/workflows/ci.yml と .github/ci/python-test-plan.json は required mechanical cleanup として変更され、tests/codex/test_scope_rollup_runner_agent_config.py は Current Validated Scope の条件を満たすときだけ変更される。
  • AC11: DELETE_CHAIN 完了後、.github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes と .github/workflows/ci.yml に削除済み3ファイル(tests/session_recording/codex/test_hook_adapter.py、test_initial_branch_create_lane.py、test_external_manifest_publish.py)へのdangling pathが残っていないことを、.github 配下限定の git grep VC で検証する。これとは独立に、scripts/ci/verify_python_test_lane.py による CI topology 不変条件検証(python-test-core が node/npm/pnpm を起動しない等)が成功する。
  • AC7: pnpm typecheck が成功する。
  • AC8: pnpm lint が成功する。
  • AC9: pnpm test が成功する。
  • AC10: pnpm build が成功する。
  • AC12: scripts/agent-guards/git_mutation_command_policy.py の _AUTHORIZED_EXECUTION_BOUNDARY_LAYERS から codex_hook_adapter_pretooluse を除去し(残るのは worktree_scope_guard_denied のみ)、これを説明する Codex-adapter 固有のコメントブロックを除去または更新する。scripts/agent-guards/tests/test_git_mutation_command_policy.py に、boundary_layer="codex_hook_adapter_pretooluse" が他の未知/未認可値と同様に EXECUTION_NOT_AUTHORIZED_FOR_BOUNDARY_LAYER として拒否されることを検証する focused regression test を追加する(execute_existing_branch_update_transaction と execute_initial_branch_create_transaction の少なくとも一方、または両方の gate レベルテストとして、既存の worktree_scope_guard_denied のテストと同じ形式で追加する)。docs/dev/hook-boundaries.md の「Codex advisory hook allowlist」節(21〜27 行目付近)が Codex passive recorder を現在時制の「active」として記述しないよう、削除するか docs/dev/session-recording-policy.md の Codex 節(## Codex CLI Hook Boundary(Codex CLI フック境界、historical))と同様の historical framing へ改める。

Verification Commands

# AC1
# vc-role: decision_gate
# baseline-expect: deferred
$ gh pr view 2409 --repo squne121/loop-protocol --json state,isDraft,mergedAt
# Expected baseline: deferred because DELETE_CHAIN implementation has not started yet. PR #2409 is confirmed MERGED (merge commit `8675869e18cff37efb62914f81490d323e4ee0ce`) as of this refinement; implementation must still re-run this against the fresh default-branch HEAD at implementation start and require state MERGED, isDraft false, mergedAt non-null.
# AC2
# vc-role: inventory
# baseline-expect: deferred
$ git grep -n -- 'codex-hook-adapter\.mjs'
# Expected baseline: deferred because DELETE_CHAIN implementation has not started yet. PR #2409 is confirmed MERGED. Fresh main inventory at refinement time found production inbound producer count = 0 (`.codex/hooks.json` and `.codex/hooks/session-recording-composite.mjs` are absent from fresh main). Implementation must re-run this against the fresh default-branch HEAD at implementation start using the same classification. A zero exit status is not interpreted as producer count.
# AC3
# vc-role: existence_check
# baseline-expect: deferred
$ test ! -e scripts/session-recording/codex-hook-adapter.mjs
# Expected baseline: fails before DELETE_CHAIN (the adapter file currently exists) and passes after DELETE_CHAIN. PR #2409 is confirmed MERGED; implementation executes this against the fresh default-branch HEAD at implementation start.
# AC4
# vc-role: decision_gate
# baseline-expect: deferred
$ git grep -n -- 'codex-hook-adapter\.mjs'
# Expected baseline: PR #2409 is confirmed MERGED and fresh inventory at refinement time found production inbound producer count = 0, so DELETE_CHAIN is currently authorized. Implementation must re-verify against the fresh default-branch HEAD at implementation start; a production inbound producer hit at that time requires STOP/re-refinement rather than adapter mutation.
# AC5
# vc-role: regression_gate
# baseline-expect: deferred
$ git grep -n -- 'codex-hook-adapter\.mjs' -- scripts/session-recording/codex-hook-adapter.mjs tests/hooks/codex-harness-advisory-boundary.test.ts tests/hooks/codex-harness-advisory-recorder.test.ts tests/hooks/codex-harness-workflow-gates.test.ts tests/hooks/codex-harness-advisory-fail-open.test.ts tests/session_recording/codex/test_hook_adapter.py tests/session_recording/codex/test_initial_branch_create_lane.py tests/session_recording/codex/test_external_manifest_publish.py scripts/agent-guards/tests/test_git_mutation_command_policy.py .github/workflows/ci.yml .github/ci/python-test-plan.json tests/codex/test_scope_rollup_runner_agent_config.py
# Expected baseline: fails before DELETE_CHAIN (tracked references remain in this Issue's own Allowed Paths) because PR #2409 is confirmed MERGED but DELETE_CHAIN has not been executed yet. After DELETE_CHAIN, exit 1 is the required zero-result result when no unintended executable reference remains within the paths this Issue manages. This VC is intentionally scoped to the exact Allowed Paths file list (not their containing directories) -- matching the exact claim that DELETE_CHAIN leaves no unintended executable reference within this Issue's own Allowed Paths. Pre-existing comment-only references to the adapter filename in files outside these exact paths (e.g. .claude/scripts/, scripts/agent-guards/git_mutation_command_policy.py, scripts/session-recording/bootstrap-source-bound-readiness.mjs, scripts/agent-guards/tests/test_skill_runtime_exec_session_manifest.py, .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md) are historical/design-rationale prose, not executable references, and are out of scope for this Issue (do not widen this path scope to directory-level, which would incorrectly re-include those out-of-scope comment references).
# AC5
# vc-role: regression_gate
# baseline-expect: deferred
$ git grep -n -- 'codex-harness-advisory-recorder' -- tests/ .github/
# Expected baseline: deferred because DELETE_CHAIN implementation has not started yet. Currently exits 0 (one match: tests/hooks/codex-harness-advisory-fail-open.test.ts imports `invoke` from tests/hooks/codex-harness-advisory-recorder.test). After DELETE_CHAIN deletes both tests/hooks/codex-harness-advisory-recorder.test.ts and tests/hooks/codex-harness-advisory-fail-open.test.ts, it must exit 1 (zero matches), confirming no dangling tracked-file reference to the deleted recorder test module remains.
# AC6
# vc-role: scope_check
# baseline-expect: deferred
$ git diff --name-only
# Expected baseline: PR #2409 is confirmed MERGED; pr-review-judge executes this against the fresh default-branch HEAD at implementation start and verifies every changed path is listed in Allowed Paths and each conditional path meets its stated condition.
# AC7
# vc-role: regression_gate
# baseline-expect: pass
$ pnpm typecheck
# AC8
# vc-role: regression_gate
# baseline-expect: pass
$ pnpm lint
# AC9
# vc-role: regression_gate
# baseline-expect: pass
$ pnpm test
# AC10
# vc-role: regression_gate
# baseline-expect: pass
$ pnpm build
# AC11
# vc-role: regression_gate
# baseline-expect: deferred
$ uv run --locked python scripts/ci/verify_python_test_lane.py --ci-yml .github/workflows/ci.yml
# Expected baseline: deferred because DELETE_CHAIN implementation has not started yet. This script already exists on fresh main and is expected to already pass independently of this Issue. This VC verifies CI python-test lane topology invariants only (e.g. python-test-core never invokes node/npm/pnpm); it is an unrelated regression gate and does NOT verify dangling-path removal from `.github/ci/python-test-plan.json` — that is verified only by the third AC11 VC below.
# AC11
# vc-role: regression_gate
# baseline-expect: deferred
$ uv run --locked pytest -q scripts/ci/tests/test_verify_python_test_lane.py
# Expected baseline: deferred because DELETE_CHAIN implementation has not started yet. This test already exists on fresh main and is expected to already pass independently of this Issue.
# AC11
# vc-role: regression_gate
# baseline-expect: deferred
$ git grep -n -e 'tests/session_recording/codex/test_hook_adapter.py' -e 'tests/session_recording/codex/test_initial_branch_create_lane.py' -e 'tests/session_recording/codex/test_external_manifest_publish.py' -- .github
# Expected baseline: deferred because DELETE_CHAIN implementation has not started yet. This is the sole VC verifying the dangling-path claim; it is intentionally scoped to `.github` only (not `scripts`/`tests`), matching the exact claim that the three deleted-test paths remain referenced only in `.github/ci/python-test-plan.json` and `.github/workflows/ci.yml`. It currently exits 0 (matches found). After DELETE_CHAIN and the `.github/ci/python-test-plan.json` / `.github/workflows/ci.yml` cleanup it must exit 1 (zero matches). Do not widen this path scope to `scripts`/`tests`: unrelated docs/comment references to these filenames exist outside Allowed Paths (e.g. `scripts/agent-guards/tests/test_skill_runtime_exec_session_manifest.py`) and are out of scope for this Issue.
# AC12
# vc-role: regression_gate
# baseline-expect: fail
$ git grep -n -- 'codex_hook_adapter_pretooluse' -- scripts/agent-guards/git_mutation_command_policy.py
# Expected baseline: this refinement independently re-ran this command against fresh origin/main (`ef2c717530c55f9fae79b5881396ab24dee401cd`) and confirmed it currently exits 0 with exactly 3 matches: lines 122 and 129 (explanatory comment prose referencing the string) and line 133 (the frozenset literal `{"worktree_scope_guard_denied", "codex_hook_adapter_pretooluse"}`). A separate, out-of-scope-for-this-VC comment at line 120 references the adapter file path (not this string) and is not counted here. After the fix, this command must exit 1 (zero matches) -- the value is fully removed from the authorized boundary-layer set and from its explanatory comment.
# AC12
# vc-role: regression_gate
# baseline-expect: fail
$ git grep -n -E -- 'codex_hook_adapter_pretooluse' -- scripts/agent-guards/tests/test_git_mutation_command_policy.py
# Expected baseline: this refinement independently re-ran this command against fresh origin/main and confirmed it currently exits 1 (zero matches). After the fix, the new focused regression test must reference this literal to assert it is now rejected, so this command must exit 0 (one or more matches).
# AC12
# vc-role: semantic_sweep
# baseline-expect: informational (non-zero both before and after; not a zero-result gate)
$ git grep -n -E -e 'codex_hook_adapter_pretooluse' -e 'CODEX_PASSIVE_RECORDING_DIR' -e 'codex_passive_session_record' -e 'passive-events\.jsonl' -e 'codex-hook-adapter\.mjs' -- ':(exclude)docs/**'
# Expected baseline: this refinement independently re-ran this command against fresh origin/main and confirmed it currently exits 0 with matches across (a) files already in this Issue's own Allowed Paths that are DELETE_CHAIN candidates or already-in-scope edit targets -- `scripts/session-recording/codex-hook-adapter.mjs`, `tests/hooks/codex-harness-advisory-boundary.test.ts`, `tests/hooks/codex-harness-advisory-recorder.test.ts`, `tests/hooks/codex-harness-workflow-gates.test.ts`, `tests/session_recording/codex/test_hook_adapter.py`, `tests/session_recording/codex/test_initial_branch_create_lane.py`, `tests/session_recording/codex/test_external_manifest_publish.py`, `scripts/agent-guards/tests/test_git_mutation_command_policy.py`, `scripts/agent-guards/git_mutation_command_policy.py`, and `.github/workflows/ci.yml` (comment-only mentions at lines 3314/3329/3485) -- and (b) four files that are NOT in this Issue's Allowed Paths and are explicitly named here as accepted pre-existing out-of-scope comment/prose references, matching the same "intentionally scoped" precedent already used for AC5/AC11 in this Issue: `.claude/scripts/check_session_recording_runtime_safety.py` (comment, line 1294), `.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md` (prose, line 136), `scripts/agent-guards/tests/test_skill_runtime_exec_session_manifest.py` (comment, line 15 -- the file the OWNER named directly), and `scripts/session-recording/bootstrap-source-bound-readiness.mjs` (comment, line 20). This VC is a one-shot semantic sweep for reviewer awareness, not a zero-result regression gate: after DELETE_CHAIN and this AC's fix it is expected to still exit 0 (non-zero), with remaining matches limited to (b) plus whatever legitimate references remain inside this Issue's own Allowed Paths (e.g. the new regression test's intentional reference to `codex_hook_adapter_pretooluse`). Do not widen this VC's scope to require the four (b) files to be edited -- they are out of this Issue's Allowed Paths and are not part of this fix_delta.

Allowed Paths

  • scripts/session-recording/codex-hook-adapter.mjs
  • tests/hooks/codex-harness-advisory-boundary.test.ts
  • tests/hooks/codex-harness-advisory-recorder.test.ts
  • tests/hooks/codex-harness-workflow-gates.test.ts
  • tests/hooks/codex-harness-advisory-fail-open.test.ts(adapter-only DELETE candidate: sole consumer of codex-harness-advisory-recorder.test.ts's exported invoke helper, which spawns the adapter directly; deleting the recorder test without this file breaks the vitest import and fails pnpm test — verified via fresh-HEAD investigation, no independent production contract under test)
  • tests/session_recording/codex/test_hook_adapter.py
  • tests/session_recording/codex/test_initial_branch_create_lane.py
  • tests/session_recording/codex/test_external_manifest_publish.py
  • scripts/agent-guards/tests/test_git_mutation_command_policy.py
  • .github/workflows/ci.yml(required mechanical cleanup。fresh main で stale deleted-test path reference の存在を確認済み)
  • .github/ci/python-test-plan.json(required mechanical cleanup。fresh main で secondary_coverage.dedicated_lanes が削除対象3ファイルを保持していることを確認済み)
  • tests/codex/test_scope_rollup_runner_agent_config.py (only if fresh inventory finds an adapter-specific stale assertion; retain provider-neutral behavior)
  • scripts/agent-guards/git_mutation_command_policy.py(P1 BLOCKER fix: remove the dead codex_hook_adapter_pretooluse authorized-boundary-layer value and its now-stale Codex-adapter-specific comment block; _AUTHORIZED_EXECUTION_BOUNDARY_LAYERS narrows to frozenset({"worktree_scope_guard_denied"}). No caller anywhere in the repo passes codex_hook_adapter_pretooluse — verified dead authorization surface, not docs-historical prose as previously classified)
  • docs/dev/hook-boundaries.md(P1 HIGH fix: historicize the "Codex advisory hook allowlist" section — PR feat: retire native Codex CLI assets and documentation #2409 removed .codex/** and PR feat: retire orphaned codex-hook-adapter.mjs と adapter-only tests #2428 removed the passive recorder adapter itself, so this stable SSOT's present-tense "active allowlist" framing is now stale and could cause a future agent to reintroduce the retired architecture)

Stop Conditions

  • PR feat: retire native Codex CLI assets and documentation #2409 が merged でない、または fresh default-branch HEAD を取得できない場合。
  • fresh inventory で production inbound producer count が 1 以上の場合。adapter を変更せず inventory を記録して STOP/re-refinement する。
  • Allowed Paths 外の変更が必要と判明した場合。
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合。
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)。
  • 後続 Phase / 別スコープへの波及が判明した場合。
  • nested SubAgent delegation が必要になった場合。
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合。

Required Skills

なし

Required Design References

  • docs/dev/session-recording-policy.md
  • docs/dev/workflow.md
  • docs/dev/runtime-verification-policy.md

Scope Delta(任意)

N/A

Notes for Reviewer

  • Canonical Step 4 rewrite。Step 2 root-owned review の route は canonical_step2_route: step_4、checked body SHA は sha256:74322da6ee3bff82558f234cbd6a50fb61e7a249cd28067d9335d である。
  • pre-rewrite 調査時の default main は 1661311e92fb6cc23f0adfee0487ac503abca5dc、PR feat: retire native Codex CLI assets and documentation #2409 は OPEN / Draft / unmerged、head は 718e921b0c10cc2ab8dd77e7500a352a0fea7345 だった。この情報は implementation authority ではない。
  • pre-merge main の production inbound chain は .codex/hooks.json → .codex/hooks/session-recording-composite.mjs → direct adapter import。PR feat: retire native Codex CLI assets and documentation #2409 は .codex/** と composite を削除する予定であるため、adapter removal は post-merge fresh inventory まで実施しない。
  • rationale は repository が native Codex CLI runtime を retire したため adapter が orphan になることである。upstream hook obsolete は rationale にしない。
  • adapter-only DELETE candidates は tests/hooks/codex-harness-advisory-boundary.test.ts、tests/hooks/codex-harness-advisory-recorder.test.ts、tests/hooks/codex-harness-workflow-gates.test.ts、tests/session_recording/codex/test_hook_adapter.py、tests/session_recording/codex/test_initial_branch_create_lane.py、tests/session_recording/codex/test_external_manifest_publish.py。PR feat: retire native Codex CLI assets and documentation #2409 の test changes を fresh HEAD で再分類する。
  • Stop Conditions は implementation contract の停止指示であり、refinement loop の停止指示ではない。
  • 2026-08-30 追加 refinement(anchor: issuecomment-5466420466、OWNER REQUEST_CHANGES): PR feat: retire native Codex CLI assets and documentation #2409 は現在 MERGED(merge commit 8675869e18cff37efb62914f81490d323e4ee0ce)。この refinement 時点の fresh main 調査で .codex/hooks.json と .codex/hooks/session-recording-composite.mjs は削除済みと確認し、production inbound producer count は 0 である(DELETE_CHAIN 継続で問題ない)。ただしこの調査結果は implementation authority ではなく、実装時は改めて default-branch HEAD で再検証する。
  • OWNER レビューにより、.github/ci/python-test-plan.json(secondary_coverage.dedicated_lanes に削除対象3ファイルを保持し、Python test target set の SSOT を自称)が Allowed Paths から欠落していたため追加した。同時に .github/workflows/ci.yml の扱いを conditional から required mechanical cleanup へ変更した。fresh main 調査で .github/workflows/ci.yml に削除対象 test path への参照(通常実行・xdist・collect-only・ci_test_selection artifact・session-recording prefix 判定・存在 assertion)が複数確認されている。
  • scripts/ci/verify_python_test_lane.py と対応するテスト(scripts/ci/tests/test_verify_python_test_lane.py)は既に fresh main に存在するため新規スクリプトは作成しない。AC11 の VC はこの既存スクリプトと git grep による stale reference 検査のみを追加する。新しい runtime harness、generic compatibility layer、provider-neutral recorder は作らない。
  • 2026-08-30 追加 addendum(実装中の operator 直接指示による): tests/hooks/codex-harness-advisory-fail-open.test.ts を adapter-only DELETE_CHAIN と Allowed Paths に追加した。実装時に、同ファイルが tests/hooks/codex-harness-advisory-recorder.test.ts の invoke helper を import するテスト間依存を発見したためであり、独立した fresh-HEAD 調査(read-only)で新たな production inbound producer は確認されなかった(既存の production_inbound_producer_count == 0 の結論および DELETE_CHAIN semantics は変更しない)。
  • 2026-08-30 追加 addendum(OWNER の PR feat: retire orphaned codex-hook-adapter.mjs と adapter-only tests #2428 REQUEST_CHANGES レビュー、feat: retire orphaned codex-hook-adapter.mjs と adapter-only tests #2428 (comment) を反映): 本 addendum は OWNER 自身が明示した「推奨する最小 fix_delta」を実装するものである。独立検証の結果、codex_hook_adapter_pretooluse は scripts/agent-guards/git_mutation_command_policy.py の _AUTHORIZED_EXECUTION_BOUNDARY_LAYERS に現存する dead な authorization surface であり(git grep -n "codex_hook_adapter_pretooluse" で repo 全体を検索した結果、実際にこの値を渡す caller は存在しないことを確認済み)、本 Issue がこれまで docs-historical prose として分類していたのは誤りだったと確認した。同時に docs/dev/hook-boundaries.md の「Codex advisory hook allowlist」節が historicize を必要としていることも確認した。Issue 実装: codex-hook-adapter.mjs の write budget と ファイル type 検証を修正する #1852・実装: native session continuation canary の resume phase に bounded timeout retry を追加し、一時的な wait timeout 観測で completion 判定を確定させない #2050 の disposition(not_planned/superseded)判断と PR feat: retire orphaned codex-hook-adapter.mjs と adapter-only tests #2428 本文への semantic inventory 追記は、本 Issue のコードスコープ外の GitHub housekeeping(前者は該当 Issue 自体、後者は PR 本文更新)として扱い、本 Issue の Allowed Paths には追加しない。

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Aug 29, 2026
  2. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    敵対的レビューの結論は、#2412 の目的自体は妥当ですが、現行 contract のまま実装開始するのは反対です。特に AC1 の producer 判定が壊れており、#2409 未マージ状態で adapter を誤って orphan と判定できます。

    判定

    REQUEST CHANGES 相当。

    優先度順では以下です。

    1. [BLOCKER] AC1 の rg が唯一の producer を探索しない
    2. [HIGH] feat: retire native Codex CLI assets and documentation #2409 merge 前でも削除 branch に入れる contract になっている
    3. [MEDIUM] 「producer があるなら provider-neutral 化」という分岐がアーキテクチャ的に不要
    4. [MEDIUM] SSOT と実装の時系列整合を feat: retire native Codex CLI assets and documentation #2409 merge 後 snapshot に固定していない
    5. [LOW] zero-match verification の書き方が曖昧

    1. BLOCKER — producer inventory の VC が producer を見落とす

    #2412 は AC1 として、

    rg -n "codex-hook-adapter" .

    を指定しています。一方、Issue 自身の Notes for Reviewer では、現在の唯一の producer が

    .codex/hooks/session-recording-composite.mjs
    

    だと認識しています。

    実際の main でも、このファイルは adapter を直接 import しています。

    import '../../scripts/session-recording/codex-hook-adapter.mjs'

    ところが ripgrep は既定では dot-directory を探索しません。.codex/ は hidden directory なので、この AC1 はまさに確認したい唯一の producer を除外します。ripgrep の公式ガイド・man page も hidden files/directories は既定で skip され、--hidden が必要だと明記しています。 ([manpages.debian.org]1)

    したがって現在でも、

    rg -n "codex-hook-adapter" .

    の結果だけ見れば、

    producer なし → adapter DELETE

    という誤った結論に到達可能です。

    これは #2412 の中心的な decision gate を壊しています。

    修正案

    最低でも AC1 を、

    rg --hidden -n \
      --glob '!.git/**' \
      'codex-hook-adapter' .

    へ変更すべきです。

    さらに「producer」を調べるのであれば文字列一致だけでなく、

    rg --hidden -n \
      --glob '!.git/**' \
      'import .*codex-hook-adapter|codex-hook-adapter\.mjs' .

    程度まで意味を限定した方がよいです。

    #2409 自身も、通常 rg が .claude/ / .github/ を見落としたことを既に認識し、--hidden sweep を追加しています。つまり #2412 は直前の親作業で実際に踏んだ事故を再導入しています。


    2. HIGH — #2409 merge 前に実装できてしまう

    2026年8月30日時点で PR #2409 は、

    • OPEN
    • Draft
    • mergeable
    • 未マージ

    です。

    しかも #2409 の changed files には、

    • .codex/hooks.json
    • .codex/hooks/session-recording-composite.mjs
    • .codex/**

    の削除が含まれていますが、scripts/session-recording/codex-hook-adapter.mjs 自体は変更対象に入っていません。

    つまり #2412 は事実上、

    #2409 が producer を消した後に残る orphan を cleanup する

    ための post-merge cleanup Issue です。

    ところが現在の contract は単に、

    着手前に PR #2409 のマージ状態を再確認

    としか書いていません。

    これは弱いです。

    #2409 未マージ時に AC1 の壊れた rg を実行すれば、producer が存在しているにもかかわらず削除 branch に進めます。

    推奨

    実装 gate を明示的に固定します。

    prerequisites:
      - pr: 2409
        required_state: merged

    あるいは Stop Conditions に、

    - PR #2409 が未マージの場合は実装せず停止する
    

    を追加するのが適切です。

    個人趣味開発なら複雑な dependency harness は不要です。単純な merge prerequisite 一つで十分です。


    3. MEDIUM — provider-neutral 化 branch は捨てた方がよい

    現在の scope は、

    producer 不在 → DELETE
    producer 存在 → .codex 部分だけ provider-neutral 化

    となっています。

    後半は不要だと思います。

    現在の adapter は名前だけ Codex なのではありません。

    • CODEX_PASSIVE_RECORDING_DIR
    • schema: 'codex_passive_session_record/v1'
    • SessionEnd
    • SubagentStop
    • {"continue":true}

    という Codex hook protocol adapter です。

    上流 Codex も現在 SessionEnd / SubagentStop 等の hook lifecycle を実装しており、.codex/hooks.json / config layer から hook を discovery します。 ([GitHub]2)

    特に SubagentStop は stdout JSON semantics を持つ Codex hook protocol です。 ([GitHub]3)

    したがって、

    resolve(homedir(), '.codex', 'session-recording')

    だけを generic path にしても provider-neutral adapter にはなりません。

    これは典型的な false generalization です。

    より単純な disposition

    #2412 は次の二択で十分です。

    provider-neutral replacement は作らない。

    将来 Claude Code や別 agent runtime に同種 recorder が必要になった時点で、その runtime の hook schema に合わせて別 Issue で設計すればよいです。

    これはユーザーの「有用性優先・harness を増やさない」という方針にも合っています。


    4. MEDIUM — session-recording-policy を「現在の SSOT」としてそのまま読めない

    #2412 は Required Design References に、

    docs/dev/session-recording-policy.md
    

    を指定しています。

    しかし現在の main の同文書は、

    scripts/session-recording/codex-hook-adapter.mjs が scope-rollup の Node adapter

    であるような非常に大きな旧 architecture をまだ記述しています。

    一方、現在の adapter 実装は単純な passive JSONL recorder だけであり、

    • scope-rollup capture
    • subprocess transport
    • readiness artifact
    • Python producer

    などを実装していません。

    つまり main 時点では document と implementation が既に歴史的にズレています。

    #2409 はまさに docs/dev/session-recording-policy.md を変更対象に含め、Codex retirement に追随させています。

    したがって #2412 の inventory は、

    #2409 merged HEAD の docs + implementation

    を authority にすべきであり、現在の main SSOT を無条件に consumer evidence として扱うべきではありません。

    これも prerequisite を #2409 merged に固定すればほぼ自然に解決します。


    5. LOW — AC2 の zero-match VC は明示した方がよい

    現在の AC2 VC は、

    rg -c "\.codex" scripts/session-recording/codex-hook-adapter.mjs

    です。

    zero match は rg では通常 exit status 1 です。

    人間が stdout の 0 を読むだけなら問題ありませんが、agent が VC を機械実行すると、

    exit 1 = verification failure

    と分類する可能性があります。

    例えば、

    ! rg -n '\.codex' scripts/session-recording/codex-hook-adapter.mjs

    の方が contract として明瞭です。

    ただし推奨 disposition は adapter DELETE なので、より直接的には、

    test ! -e scripts/session-recording/codex-hook-adapter.mjs

    でよいです。


    テスト inventory について

    現在 tests/hooks/codex-harness-advisory-recorder.test.ts は adapter を直接 subprocess 起動しています。

    したがって adapter を DELETE するなら、この test は明確に DELETE_CHAIN です。

    一方、codex-harness-workflow-gates.test.ts は adapter と .codex/hooks.json の双方を読み込んで negative-token test を行っています。

    #2409 が .codex/hooks.json を削除するため、この test は #2409 内ですでに変更対象です。

    ここでも、#2412 が #2409 と並行して走る合理性はありません。

    #2409 merge → fresh HEAD で残った adapter test consumer だけ再 inventory

    が一番安定します。


    外部実装との照合

    Codex hook 自体は2026年8月現在も upstream で普通に実装されています。

    • SessionEnd runtime が存在し、root session に対して hook dispatch する。 ([GitHub]2)
    • SubagentStop を含む hook schema が upstream に存在する。 ([GitHub]4)
    • project .codex/hooks.json は Codex の正式 discovery location の一つ。 ([GitHub]3)
    • 直近でも Codex CLI 0.147.0 の SubagentStop lifecycle bug が報告されており、hook subsystem 自体は active development 中です。 ([GitHub]5)

    したがって #2412 の rationale は、

    「.codex が古い仕様だから消す」

    ではありません。

    正確には、

    この repository が native Codex CLI runtime を意図的に retire したため、その専用 adapter も orphan になる

    です。

    この distinction は維持した方がよいです。


    推奨する contract の簡略形

    #2412 はかなり縮められます。

    goal:
      PR #2409 merge 後に orphan となった
      scripts/session-recording/codex-hook-adapter.mjs
      と専用テストを削除する
    
    prerequisite:
      PR #2409 must be merged
    
    inventory:
      rg --hidden -n --glob '!.git/**' \
        'codex-hook-adapter(\.mjs)?' .
    
    decision:
      producer == 0:
        delete adapter and adapter-only tests
      producer > 0:
        stop and report inventory

    そして provider-neutral fallback branch は削除します。

    Acceptance Criteria も、

    AC1 #2409 が merged
    AC2 --hidden inventory で production producer 0
    AC3 adapter DELETE
    AC4 adapter-only tests DELETE
    AC5 repository 内に unintended executable reference 0
    AC6 focused tests
    AC7 pnpm test
    

    程度で十分です。

    pnpm typecheck / lint / test / build 全部を残しても害は小さいですが、今回のような2〜数ファイル cleanup なら、個人開発としては pnpm test + relevant lint/typecheck 程度でも十分だと思います。新しい runtime harness は不要です。


    最終 disposition

    Issue 自体は KEEP。ただし実装前 refinement が必要です。

    最重要修正はこの3点です。

    1. AC1 の全 repo inventory を必ず rg --hidden にする。
    2. PR feat: retire native Codex CLI assets and documentation #2409 merged を hard prerequisite にする。
    3. producer が残っていた場合の「provider-neutral 化」を廃止し、STOPして再評価にする。

    この形なら #2412 は非常に小さく、意味の明確な orphan cleanup になります。現状のままだと、直前の #2409 が発見した hidden-directory search の失敗をそのまま再現する contract になっています。

  3. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    推奨アクションは、#2412 の refinement を今すぐ行い、実装だけを #2409 merge 後に遅延させることです。#2409 はまだ Draft・未マージで、現在の main には実際に .codex/hooks/session-recording-composite.mjs → codex-hook-adapter.mjs の producer が残っています。

    アンカーの rg 指摘も正しいです。ripgrep はデフォルトで hidden files/directories を除外し、--hidden で有効化する仕様です。([GitHub]1) また upstream Codex には現在も SessionEnd / SubagentStop hook schema が存在するため、「Codex の仕様が古いから削除」ではなく「このリポジトリが native Codex runtime を retire するため専用 adapter が orphan になる」という rationale を維持するのが適切です。([GitHub]2)

    そのまま Claude-GPT に渡すなら、以下を推奨します。

    #2412 (comment)

    を direct human context の anchor comment として扱い、Issue #2412 に対して issue-refinement-loop を実行してください。

    今回は Issue refinement が目的です。Issue #2412 の実装そのものは行わないでください。

    OWNER / human judgment

    以下はこのプロンプトで明示する OWNER 判断です。これらについて追加の人間承認を求めないでください。

    1. Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 自体は KEEP とする。

    2. refinement は PR feat: retire native Codex CLI assets and documentation #2409 の merge 前でも今すぐ実施してよい。

    3. ただし Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 の実装開始条件として PR feat: retire native Codex CLI assets and documentation #2409 merged を hard prerequisite にする。

    4. producer / consumer inventory に bare な
      rg -n "codex-hook-adapter" .
      を使用してはならない。
      hidden directory を含めた tracked repository 全体を確認できる方法を contract に採用すること。
      例:

      • rg --hidden -n --glob '!.git/**' ...
      • または tracked-file authority として同等以上に確実な git grep
    5. feat: retire native Codex CLI assets and documentation #2409 merge 後の fresh default-branch HEAD を基準に producer / consumer inventory を取り直す。

    6. disposition は以下に単純化する。

    7. 現在の
      「producer が存在する場合は .codex path だけ provider-neutral 化する」
      branch は削除する。
      codex-hook-adapter.mjs は path だけでなく Codex hook protocol / schema / event semantics を持つため、path の generic 化だけで provider-neutral implementation とは扱わない。

    8. rationale は
      「upstream Codex hooks が obsolete だから削除する」
      ではなく、
      「この repository が native Codex CLI runtime を retire するため、その専用 adapter が orphan になる」
      とする。

    9. zero-match verification は exit status semantics を曖昧にしない。
      adapter DELETE disposition なら、例えば
      test ! -e scripts/session-recording/codex-hook-adapter.mjs
      のような直接的 VC を優先する。

    10. この cleanup のためだけに新しい harness、schema、ledger、state store、migration framework、generic compatibility layer を追加しない。

    11. feat: retire native Codex CLI assets and documentation #2409 本体の AC / VC / Allowed Paths を 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 から変更しない。

    12. Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 の現在の Stop Conditions は implementation contract の refinement 対象であり、issue-refinement-loop control-plane 自体を止めるための指示として解釈しない。

    人間承認

    この refinement loop は人間承認不要で最後まで進めてください。

    以下について都度確認を求めないでください。

    • refinement iteration の継続
    • Issue 本文の更新
    • Machine-Readable Contract の修正
    • AC / VC / Allowed Paths / Stop Conditions / Notes for Reviewer の修正
    • trusted contract patch plan の適用
    • canonical workflow が明示的に許可した deterministic repair
    • Issue コメントによる調査結果・refinement 結果の記録
    • stale workflow label の canonical hygiene
    • 必要な GitHub read
    • 必要な Web research
    • repository 内の read-only 調査
    • refinement 用一時 artifact の生成
    • SubAgent の起動

    ただし Claude Code / Claude-GPT 自体の permission mode を変更するという意味ではありません。
    --dangerously-skip-permissions 等をこの指示から勝手に追加しないでください。
    repository の loop approval と runtime permission model は分離してください。

    canonical issue-refinement-loop を使用する

    最初に issue-refinement-loop Skill をロードし、Skill / command registry / planner が定義する canonical path を使用してください。

    anchor は human origin として明示されているので、canonical main root / default branch から必要な場合は、

    preflight.run.with_human_context

    を使用してください。

    対象:

    • repo: squne121/loop-protocol
    • issue: 2412
    • anchor:
      https://github.com/squne121/loop-protocol/issues/2412#issuecomment-5465769531

    run_refinement_preflight.py 等の内部 wrapper を手書きで直接 bypass せず、skill_runtime_exec.py と command registry が規定する canonical executor を使用してください。

    preflight.run.with_human_context が trusted contract patch plan を生成し、canonical workflow が contract mutation を許可した場合は、

    contract_update.run.with_human_context

    を実行してよいです。

    NEXT_ACTION / STATUS / REPAIR_ACTION / COMMANDS_JSON 等は prose で再実装せず、Skill の routing contract に従ってください。

    issue_editor_required や deterministic repair が canonical に返された場合も、人間への確認を挟まず、Skill が規定する consumer / repair path を実行して fresh preflight に戻ってください。

    ただし、canonical workflow が最終的に human_judgment_required を返した場合:

    • 上記 OWNER 判断ですでに答えが明示されている論点なら、この prompt を human judgment として正規の human-context lane から消費できるか確認する
    • repository の canonical mechanism を手動 bypass しない
    • この prompt を消費した後も、まったく別の新規 material decision について human_judgment_required が残る場合だけ hard blocker として報告する

    SubAgent を必ず使用する

    調査は main agent 一人で完結させず、Skill が要求・許可する SubAgent を使用してください。

    少なくとも repository investigation は SubAgent に委譲してください。
    external claim が refinement decision に影響する場合は web-researcher も使用してください。

    可能なら互いに独立した調査を並列化してください。例:

    ただし nested SubAgent delegation は行わせないでください。

    起動したすべての SubAgent / Task が terminal state になるまで必ず待ってください。

    一部 SubAgent の結果だけで Issue mutation や最終結論を確定しないでください。
    全 SubAgent の結果を join してから refinement decision を確定してください。

    SubAgent が失敗した場合も放置せず、terminal state と failure reason を回収してください。

    必須調査

    少なくとも以下を fresh に確認してください。

    1. PR #2409

    #2409 が未マージでも refinement は続行してください。
    未マージを理由に refinement 自体を停止しないでください。

    2. 現在の producer / consumer

    以下を文字列名だけでなく意味ベースでも調査してください。

    • .codex/hooks/session-recording-composite.mjs
    • scripts/session-recording/codex-hook-adapter.mjs
    • direct import / subprocess execution
    • CI / script / hook configuration
    • tests
    • docs-only reference
    • historical reference
    • synthetic fixture reference

    production producer、test-only consumer、docs/historical reference を区別してください。

    3. tests

    特に現在の Issue に列挙されている test files を fresh inventory し、

    を分類してください。

    Issue の現在の Allowed Paths をそのまま信用せず、fresh evidence に基づいて refinement してください。

    ただし scope を不用意に巨大化しないでください。

    4. docs / SSOT

    docs/dev/session-recording-policy.md は現在の main と #2409 merge 後で authority が変わり得るため、

    を区別してください。

    #2412 implementation の authority は #2409 merged 後の fresh HEAD に固定してください。

    5. external evidence

    外部調査が必要なら公式・一次ソースを優先してください。

    特に確認する場合:

    • ripgrep hidden file / hidden directory semantics
    • OpenAI Codex の current hook events / hook schema

    ただし external research を理由に architecture を拡張しないでください。

    Issue #2412 の期待する refinement destination

    最終的な Issue contract は概ね次の意味になるよう refinement してください。
    文言・schema は repository の現行 convention に合わせてください。

    Goal

    PR #2409 merge 後に native Codex CLI runtime の producer が撤去された結果 orphan となる
    scripts/session-recording/codex-hook-adapter.mjs
    および adapter-only test を cleanup する。

    Prerequisite

    PR #2409 must be merged before implementation.

    これは refinement 自体の prerequisite ではない。

    Decision gate

    post-#2409 fresh default-branch HEAD で complete producer inventory を実行する。

    • production producer == 0:
      adapter + dedicated orphan tests を削除
    • production producer > 0:
      実装しない。inventory を記録して re-refinement / STOP
    • provider-neutral fallback implementation:
      作成しない

    AC / VC

    少なくとも次を machine-verifiable にする。

    • feat: retire native Codex CLI assets and documentation #2409 merged の確認
    • hidden / tracked files を欠落させない producer inventory
    • production producer 0 の確認
    • adapter file 不在
    • adapter-only test の deletion / necessary update
    • unintended executable reference 0
    • relevant focused verification
    • repository の通常 quality gates のうち、この cleanup に適切なもの

    既存 repository policy が pnpm typecheck / lint / test / build を要求するなら保持して構いません。
    単に小さな cleanup だからという理由だけで validation authority を勝手に弱めないでください。

    Runtime Verification Applicability

    静的 orphan cleanup で十分なら not_applicable を維持して構いません。
    不要な runtime harness は追加しないでください。

    作業権限

    この refinement の完遂に必要な範囲で、以下を許可します。

    Issue 本文を修正するために別途承認を求めないでください。

    一方、以下はしないでください。

    既存 working tree に他作業の変更がある場合、それを消したり上書きしたりしないでください。

    loop completion

    default の bounded iteration を、人間承認なしで回してください。

    review が needs-fix / request_changes なら max iteration 未満では自動継続してください。

    各 iteration で必要なら:

    investigation
    → review
    → Issue rewrite / trusted contract update
    → fresh preflight
    → fresh review

    まで回してください。

    review が approve / proceed に到達したら refinement 完了です。

    今回やらないこと

    Issue #2412 の implementation は開始しないでください。

    refinement 完了後に #2409 が未マージなら、
    「#2412 contract は implementation-ready だが prerequisite #2409 merged 待ち」
    という状態で終了してください。

    #2409 が偶然すでにマージ済みでも、この prompt の目的は refinement なので implement-issue へ自動遷移しないでください。

    最終報告

    最後に簡潔に以下を報告してください。

    次の推奨アクションは evidence に従って決めてください。
    想定される正常系は:

    1. 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 refinement 完了
    2. feat: retire native Codex CLI assets and documentation #2409 merge
    3. fresh main で 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 implementation
    4. adapter / orphan tests cleanup
    5. verification / review / merge

    です。

    この形なら、アンカーコメントの内容を単なる参考意見ではなく、今回の human-context refinement の具体的な OWNER 判断として与えつつ、repository の canonical control-plane 自体は迂回しない構成になります。特に「#2409 未マージだから refinement まで停止する」という誤った終わり方を防いでいます。

  4. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    Refinement complete — implementation prerequisite pending

    Refined contract

    • Implementation は PR feat: retire native Codex CLI assets and documentation #2409 が merged になるまで開始しない。
    • feat: retire native Codex CLI assets and documentation #2409 merge 後の fresh default-branch HEAD で git grep を tracked-file authority として inventory を再取得し、production inbound producer / test-only / docs-historical / fixture を分類する。
    • production inbound producer が 0 の場合だけ adapter と adapter-only test の DELETE_CHAIN を実施する。1 以上なら adapter を変更せず STOP / re-refinement する。
    • provider-neutral fallback は廃止した。削除理由は upstream hooks の obsolete ではなく、この repository が native Codex CLI runtime を retire することで専用 adapter が orphan になるためである。
    • adapter deletion は直接存在確認で検証し、post-delete tracked-file zero-match の exit-status semantics も明記した。

    Evidence at refinement time

    • PR feat: retire native Codex CLI assets and documentation #2409: OPEN / Draft / unmerged、head 718e921b0c10cc2ab8dd77e7500a352a0fea7345。
    • Current main の live inbound chain は .codex/hooks.json → .codex/hooks/session-recording-composite.mjs → adapter import。feat: retire native Codex CLI assets and documentation #2409 は .codex/** と composite を削除予定だが adapter は残すため、現在の main で cleanup は実施しない。
    • Adapter-only candidate tests、stale guard assertion、条件付き CI reference/provider-neutral test assertion を fresh post-merge inventory により最小限再分類する。

    Human escalation は不要。実装への自動遷移は、この refinement run では行わない。

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []

    Next action: PR #2409 を merge した後、fresh default-branch HEAD で Issue #2412 の prerequisite と decision gate を再検証してから DELETE_CHAIN implementation を開始する。

  5. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST CHANGES。 ただし、#2412 の中心方針である codex-hook-adapter.mjs の DELETE_CHAIN 自体には賛成です。

    前回までの blocker だった「#2409 未マージ」はすでに解消しています。現在の main は 8675869e18cff37efb62914f81490d323e4ee0ce で、これは native Codex CLI retirement の PR #2409 のマージコミットです。 一方 #2412 の現 body は #2409 マージ前の 2026-08-30 01:21 UTC に最後に更新されており、post-merge fresh inventory の結果はまだ contract に反映されていません。

    旧 production chain だった .codex/hooks.json と .codex/hooks/session-recording-composite.mjs は fresh main から消滅済みです。したがって production inbound producer = 0 → DELETE という判断は妥当です。#2161 の Desired Destination も native Codex CLI の executable consumer を消し、Claude native / claude-gpt を provider-neutral authority に残すことです。

    敵対的レビュー結果

    優先度 | Finding | 判定 -- | -- | -- P0 | .github/ci/python-test-plan.json が Allowed Paths から欠落 | 実装 blocker P1 | .github/workflows/ci.yml 更新は conditional ではなく確定で必要 | contract 修正 P1 | #2409 の「provider-neutral RETAIN」分類と実テストの実態が食い違う | DELETE でよい P2 | AC7–10 は Python/CI topology 変更への直接証拠になっていない | focused VC 追加 P2 | post-merge inventory に合わせて baseline 文言を更新していない | 軽微な contract drift

    P0 — Allowed Paths が fresh main の CI SSOT を含んでいない

    これが最大の問題です。

    #2412 は「Allowed Paths 外の変更が必要なら STOP」と明記していますが、Allowed Paths に .github/ci/python-test-plan.json がありません。

    ところが fresh main の python-test-plan.json は自身を Python test target set の Single source of truth と明記したうえで、secondary_coverage.dedicated_lanes に次の3ファイルを現在も保持しています。

    tests/session_recording/codex/test_hook_adapter.py、test_initial_branch_create_lane.py、test_external_manifest_publish.py です。

    つまり現在の contract で DELETE_CHAIN を実行すると、

    tests を削除 → python-test-plan.json に dangling path が残る
    または
    python-test-plan.json を直す → Allowed Paths 違反で STOP

    になります。

    #2412 の Allowed Paths に .github/ci/python-test-plan.json を追加するのが必須です。 新しい harness も schema も要りません。

    P1 — .github/workflows/ci.yml 更新も「必要なら」ではなく確定

    Issue は現在、

    .github/workflows/ci.yml に削除 test path が残る場合に限る最小更新

    としています。

    fresh main を見ると、条件は既に成立しています。CI には少なくとも、

    test_hook_adapter.py の通常実行、同ファイルの xdist 実行、test_initial_branch_create_lane.py の専用実行、collect-only target、ci_test_selection artifact の pytest_args、session-recording prefix 判定、存在 assertion

    が残っています。

    したがって In Scope / Allowed Paths は、

    .github/workflows/ci.yml: required mechanical cleanup

    へ変えてよいです。「fresh inventory で必要なら」という分岐を残す意味はもうありません。

    P1 — adapter-only tests は全部 DELETE でよい

    ここは #2409 の記述だけを見ると少し危険でした。#2409 は一部 codex-harness-advisory-* を provider-neutral behavior として RETAIN していました。

    しかし fresh main の実ファイルを見る限り、独立した provider-neutral harness ではありません。

    codex-harness-advisory-boundary.test.ts は adapter source を直接 readFileSync します。 codex-harness-advisory-recorder.test.ts は adapter を Node subprocess として直接起動します。 codex-harness-workflow-gates.test.ts も adapter を直接読み、そのコメントは現在でも adapter を「still a live, provider-neutral producer」と呼んでいます。これは #2409 後の architecture とは整合しません。

    Python 側も同様で、test_hook_adapter.py、test_initial_branch_create_lane.py、test_external_manifest_publish.py はすべて adapter path を直接定義し、起動または source inspection しています。

    したがって これらの「一般的な性質」を救うために新しい generic passive-recorder test harness を作る必要はありません。 production implementation が消えるなら、その implementation の「network を使わない」「transcript を保存しない」を検証する test も役目を終えます。

    これは個人趣味開発としてかなり重要で、ここで「provider-neutral invariant を保存しよう」とすると、存在しない production mechanism のためだけに test infrastructure を残すことになります。

    P2 — 現 Verification Commands は CI cleanup を直接検証していない

    pnpm test は package.json 上、

    vitest run ...

    です。Python pytest suite ではありません。

    したがって AC7–10 の pnpm typecheck / lint / test / build を全部成功させても、今回重要な

    python-test-plan.json と ci.yml の整合性

    は直接検証できません。

    逆に full runtime smoke や native Codex 起動を追加する必要もありません。#2412 の runtime_verification_applicability: not_applicable はそのままで正しいです。

    最小追加ならこれで十分です。

    uv run --locked python scripts/ci/verify_python_test_lane.py \
      --ci-yml .github/workflows/ci.yml
    

    uv run --locked pytest -q
    scripts/ci/tests/test_verify_python_test_lane.py

    削除対象 Python test path の CI / plan 残留を直接確認

    if git grep -n
    -e 'tests/session_recording/codex/test_hook_adapter.py'
    -e 'tests/session_recording/codex/test_initial_branch_create_lane.py'
    -e 'tests/session_recording/codex/test_external_manifest_publish.py'
    -- .github scripts tests; then
    echo "stale deleted-test reference remains" >&2
    exit 1
    fi

    そのうえで既存の pnpm typecheck / lint / test / build は通常品質ゲートとして残して構いません。新しい runtime harness や専用 checker は不要です。

    外部実装との照合

    前回の refinement で rg から git grep に変えた判断は維持すべきです。Git 公式ドキュメント上、git grep は tracked files / index / tree object を検索するコマンドです。(Git) また Git pathspec の exclude magic も正式仕様なので、AC5 の docs/fixture exclusion 方針自体に問題はありません。(Git)

    前回問題になった ripgrep は、公式 GUIDE のとおり hidden files/directories をデフォルトで除外します。(GitHub) したがって fresh tracked inventory の authority を git grep に固定した現在の #2412 は改善されています。

    また Codex hook 自体が obsolete だから adapter を消す、という説明にはしてはいけません。 OpenAI の現行 Codex 実装には現在も SessionEnd、SubagentStart、SubagentStop 等の hook event が実装されています。(GitHub) SessionEnd の実行コードも現行 upstream に存在します。(GitHub)

    現在の adapter 自身も CODEX_PASSIVE_RECORDING_DIR、codex_passive_session_record/v1、~/.codex/session-recording という明確な Codex-specific contract を持ちます。

    したがって現在の Issue に既に入った、

    upstream hook obsolete ではなく、この repository が native Codex CLI runtime を retire したから削除する

    という rationale は正しいです。

    推奨 disposition

    #2412 は KEEP + 小規模 controlled reframe。実装方針は DELETE_CHAIN のままです。

    変更すべき本質は3点だけです。

    1. .github/ci/python-test-plan.json を In Scope / Allowed Paths に追加し、3つの dedicated-lane path を削除対象にする。

    2. .github/workflows/ci.yml を conditional ではなく、fresh main で確認済みの required mechanical cleanup にする。

    3. CI topology の focused verification を追加する。runtime smoke、generic compatibility layer、provider-neutral recorder、追加 security harness は作らない。

    これを反映すれば、production inbound producer が消えている現在の main では、人間の追加設計判断を要求するような問題ではありません。#2412 は adapter、専用テスト、CI/test-plan の dangling reference を機械的に落として閉じるのが最も品質と保守性のバランスが良いです。

    ## 判定

    REQUEST CHANGES。 ただし、#2412 の中心方針である codex-hook-adapter.mjs の DELETE_CHAIN 自体には賛成です。

    前回までの blocker だった「#2409 未マージ」はすでに解消しています。現在の main は 8675869e18cff37efb62914f81490d323e4ee0ce で、これは native Codex CLI retirement の PR #2409 のマージコミットです。 一方 #2412 の現 body は #2409 マージ前の 2026-08-30 01:21 UTC に最後に更新されており、post-merge fresh inventory の結果はまだ contract に反映されていません。

    旧 production chain だった .codex/hooks.json と .codex/hooks/session-recording-composite.mjs は fresh main から消滅済みです。したがって production inbound producer = 0 → DELETE という判断は妥当です。#2161 の Desired Destination も native Codex CLI の executable consumer を消し、Claude native / claude-gpt を provider-neutral authority に残すことです。

    敵対的レビュー結果

    優先度 Finding 判定
    P0 .github/ci/python-test-plan.json が Allowed Paths から欠落 実装 blocker
    P1 .github/workflows/ci.yml 更新は conditional ではなく確定で必要 contract 修正
    P1 #2409 の「provider-neutral RETAIN」分類と実テストの実態が食い違う DELETE でよい
    P2 AC7–10 は Python/CI topology 変更への直接証拠になっていない focused VC 追加
    P2 post-merge inventory に合わせて baseline 文言を更新していない 軽微な contract drift

    P0 — Allowed Paths が fresh main の CI SSOT を含んでいない

    これが最大の問題です。

    #2412 は「Allowed Paths 外の変更が必要なら STOP」と明記していますが、Allowed Paths に .github/ci/python-test-plan.json がありません。

    ところが fresh main の python-test-plan.json は自身を Python test target set の Single source of truth と明記したうえで、secondary_coverage.dedicated_lanes に次の3ファイルを現在も保持しています。

    tests/session_recording/codex/test_hook_adapter.py、test_initial_branch_create_lane.py、test_external_manifest_publish.py です。

    つまり現在の contract で DELETE_CHAIN を実行すると、

    tests を削除 → python-test-plan.json に dangling path が残る
    または
    python-test-plan.json を直す → Allowed Paths 違反で STOP

    になります。

    #2412 の Allowed Paths に .github/ci/python-test-plan.json を追加するのが必須です。 新しい harness も schema も要りません。

    P1 — .github/workflows/ci.yml 更新も「必要なら」ではなく確定

    Issue は現在、

    .github/workflows/ci.yml に削除 test path が残る場合に限る最小更新

    としています。

    fresh main を見ると、条件は既に成立しています。CI には少なくとも、

    test_hook_adapter.py の通常実行、同ファイルの xdist 実行、test_initial_branch_create_lane.py の専用実行、collect-only target、ci_test_selection artifact の pytest_args、session-recording prefix 判定、存在 assertion

    が残っています。

    したがって In Scope / Allowed Paths は、

    .github/workflows/ci.yml: required mechanical cleanup

    へ変えてよいです。「fresh inventory で必要なら」という分岐を残す意味はもうありません。

    P1 — adapter-only tests は全部 DELETE でよい

    ここは #2409 の記述だけを見ると少し危険でした。#2409 は一部 codex-harness-advisory-* を provider-neutral behavior として RETAIN していました。

    しかし fresh main の実ファイルを見る限り、独立した provider-neutral harness ではありません。

    codex-harness-advisory-boundary.test.ts は adapter source を直接 readFileSync します。 codex-harness-advisory-recorder.test.ts は adapter を Node subprocess として直接起動します。 codex-harness-workflow-gates.test.ts も adapter を直接読み、そのコメントは現在でも adapter を「still a live, provider-neutral producer」と呼んでいます。これは #2409 後の architecture とは整合しません。

    Python 側も同様で、test_hook_adapter.py、test_initial_branch_create_lane.py、test_external_manifest_publish.py はすべて adapter path を直接定義し、起動または source inspection しています。

    したがって これらの「一般的な性質」を救うために新しい generic passive-recorder test harness を作る必要はありません。 production implementation が消えるなら、その implementation の「network を使わない」「transcript を保存しない」を検証する test も役目を終えます。

    これは個人趣味開発としてかなり重要で、ここで「provider-neutral invariant を保存しよう」とすると、存在しない production mechanism のためだけに test infrastructure を残すことになります。

    P2 — 現 Verification Commands は CI cleanup を直接検証していない

    pnpm test は package.json 上、

    vitest run ...
    

    です。Python pytest suite ではありません。

    したがって AC7–10 の pnpm typecheck / lint / test / build を全部成功させても、今回重要な

    python-test-plan.json と ci.yml の整合性

    は直接検証できません。

    逆に full runtime smoke や native Codex 起動を追加する必要もありません。#2412 の runtime_verification_applicability: not_applicable はそのままで正しいです。

    最小追加ならこれで十分です。

    uv run --locked python scripts/ci/verify_python_test_lane.py \
      --ci-yml .github/workflows/ci.yml
    
    uv run --locked pytest -q \
      scripts/ci/tests/test_verify_python_test_lane.py
    
    # 削除対象 Python test path の CI / plan 残留を直接確認
    if git grep -n \
      -e 'tests/session_recording/codex/test_hook_adapter.py' \
      -e 'tests/session_recording/codex/test_initial_branch_create_lane.py' \
      -e 'tests/session_recording/codex/test_external_manifest_publish.py' \
      -- .github scripts tests; then
      echo "stale deleted-test reference remains" >&2
      exit 1
    fi

    そのうえで既存の pnpm typecheck / lint / test / build は通常品質ゲートとして残して構いません。新しい runtime harness や専用 checker は不要です。

    外部実装との照合

    前回の refinement で rg から git grep に変えた判断は維持すべきです。Git 公式ドキュメント上、git grep は tracked files / index / tree object を検索するコマンドです。(Git) また Git pathspec の exclude magic も正式仕様なので、AC5 の docs/fixture exclusion 方針自体に問題はありません。(Git)

    前回問題になった ripgrep は、公式 GUIDE のとおり hidden files/directories をデフォルトで除外します。([GitHub]3) したがって fresh tracked inventory の authority を git grep に固定した現在の #2412 は改善されています。

    また Codex hook 自体が obsolete だから adapter を消す、という説明にはしてはいけません。 OpenAI の現行 Codex 実装には現在も SessionEnd、SubagentStart、SubagentStop 等の hook event が実装されています。([GitHub]4) SessionEnd の実行コードも現行 upstream に存在します。([GitHub]5)

    現在の adapter 自身も CODEX_PASSIVE_RECORDING_DIR、codex_passive_session_record/v1、~/.codex/session-recording という明確な Codex-specific contract を持ちます。

    したがって現在の Issue に既に入った、

    upstream hook obsolete ではなく、この repository が native Codex CLI runtime を retire したから削除する

    という rationale は正しいです。

    推奨 disposition

    #2412 は KEEP + 小規模 controlled reframe。実装方針は DELETE_CHAIN のままです。

    変更すべき本質は3点だけです。

    1. .github/ci/python-test-plan.json を In Scope / Allowed Paths に追加し、3つの dedicated-lane path を削除対象にする。
    2. .github/workflows/ci.yml を conditional ではなく、fresh main で確認済みの required mechanical cleanup にする。
    3. CI topology の focused verification を追加する。runtime smoke、generic compatibility layer、provider-neutral recorder、追加 security harness は作らない。

    これを反映すれば、production inbound producer が消えている現在の main では、人間の追加設計判断を要求するような問題ではありません。#2412 は adapter、専用テスト、CI/test-plan の dangling reference を機械的に落として閉じるのが最も品質と保守性のバランスが良いです。

  6. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  7. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    Refinement complete — approved(anchor: issuecomment-5466420466、OWNER REQUEST_CHANGES)

    • Anchor: 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 (comment) (direct human context, OWNER REQUEST_CHANGES)
    • Final classification: feedback_update_required(DELETE_CHAIN 方針自体は継続。3点の contract 修正)
    • Final deterministic review: approve / proceed(reviewed body SHA sha256:25286fddba72e38bea73a452c4947e3b8410fa2a4c02d0f41921e8a9e3349ebe)
    • Step 2.5 semantic design review: effective_verdict: approve(2 iteration。blocker 1件・medium 1件を解消、残る low 1件は non-blocking の cleanup 候補として記録)
    • Final Gate: root_entry_router.run_root_transition() → route: invoke_impl_review_loop, reason: fresh_review_go_live_equality, invoked: true

    反映した修正(OWNER REQUEST_CHANGES 3点 + baseline drift)

    1. .github/ci/python-test-plan.json(secondary_coverage.dedicated_lanes に削除対象3ファイルを保持、SSOT を自称)を In Scope / Allowed Paths に required mechanical cleanup として追加。
    2. .github/workflows/ci.yml の扱いを conditional から required mechanical cleanup へ変更(fresh main で削除対象 test path への複数参照を確認済み)。
    3. AC11 + focused Verification Commands を追加(既存の scripts/ci/verify_python_test_lane.py / 対応 pytest の呼び出しと、.github 配下限定の git grep dangling-path 検査)。新しい runtime harness・generic compatibility layer・provider-neutral recorder は作成しない。
    4. VC の "Expected baseline" 文言から誤りだった「PR feat: retire native Codex CLI assets and documentation #2409 is unmerged」を除去し、PR feat: retire native Codex CLI assets and documentation #2409 が MERGED(merge commit 8675869e18cff37efb62914f81490d323e4ee0ce)であることを反映。

    Semantic review で追加検出・修正した issue

    • Step 2.5 が AC11 第3 VC の grep scope が広すぎ(.github scripts tests)、Allowed Paths 外のコメント行に誤ヒットして DELETE_CHAIN 後も VC が exit 1 にならない blocker を検出。.github のみへ narrow して解消。
    • AC11 本文が verify_python_test_lane.py の PASS を dangling-path 除去の証拠であるかのように誤解を招く記述だった medium finding を、2つの独立した主張への分割で解消。
    • 残る low finding(AC11 VC1/VC2 の baseline-expect: deferred ラベルが AC7-10 の pass 規約と整合しない)は non-blocking のため今回は見送り、次回小改訂の cleanup 候補として記録。

    Evidence(fresh origin/main 独立検証)

    • production inbound producer count = 0(.codex/hooks.json と .codex/hooks/session-recording-composite.mjs は origin/main に存在しない)。
    • .github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes に削除対象3ファイルが存在することを確認済み。
    • .github/workflows/ci.yml に削除対象 test path への複数参照(通常実行・xdist・collect-only・ci_test_selection artifact・prefix tuple・存在 assertion)を確認済み。
    • scripts/ci/verify_python_test_lane.py と対応するテストは既に fresh main に存在し、実行して PASS することを確認済み。
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        body_sha256: "sha256:25286fddba72e38bea73a452c4947e3b8410fa2a4c02d0f41921e8a9e3349ebe"
      route:
        route: invoke_impl_review_loop
        reason: fresh_review_go_live_equality
        reviewed_base_sha: "d9a251a872280cd1e208dfa697b7daeb64d194c0"
        observed_base_sha: "d9a251a872280cd1e208dfa697b7daeb64d194c0"
        invoked: true

    Next action: impl-review-loop への handoff が authorize 済み(invoked: true)。同一 turn 内で control-plane が起動する。

  8. self-assigned this
    on Aug 30, 2026
  9. squne121 commented on Aug 30, 2026

    @squne121
    OwnerAuthor

    推奨は、別 Issue を作らず #2412 を bounded controlled reframe して、そのまま既存 impl-review-loop を再開です。

    今回の停止は新しい設計判断ではありません。tests/hooks/codex-harness-advisory-fail-open.test.ts は削除対象 recorder test の invoke() を import し、invoke() は削除対象 codex-hook-adapter.mjs を直接起動しています。したがって fail-open test も adapter-only DELETE_CHAIN です。

    一方、#2412 は既に「fresh HEAD で adapter-only と判明した test の削除」を In Scope にしていますが、Allowed Paths には fail-open test が漏れています。さらに Issue 自身が「Allowed Paths 外の変更が必要なら implementation は停止」としつつ、その Stop Conditions は refinement loop の停止指示ではないと明記しています。つまり implementation-worker の停止は正しいが、人間へ判断を戻す必要まではなく、refinement で機械的に契約を修復するのが自然です。

    また、単に Allowed Paths を1行追加するだけでなく、今回の見落とし原因だった「adapter 文字列を直接含まない test-to-test import」も、新しい harness を作らず git grep の focused VC を1本追加して閉じるのがよいです。

    以下をそのまま Claude Code に渡す形を推奨します。

    Issue #2412 の現在停止している impl-review-loop を、契約の最小修復を行ったうえで再開し、マージ直前まで人間承認不要で完遂してください。

    対象:
    #2412

    既存の OWNER human context:
    #2412 (comment)

    現在の停止状況:

    • PR feat: retire native Codex CLI assets and documentation #2409 は MERGED 済み。
    • DELETE_CHAIN は選択済み。
    • 既存 worktree:
      .claude/worktrees/issue-2412-codex-hook-adapter-cleanup
    • 未コミット差分は保持されている。
    • AC1〜AC6、AC7 typecheck、AC8 lint、AC11 は通過済み。
    • pnpm test で tests/hooks/codex-harness-advisory-fail-open.test.ts が失敗した。
    • 原因は、このファイルが削除対象
      tests/hooks/codex-harness-advisory-recorder.test.ts
      から invoke を import しているため。
    • その invoke は
      scripts/session-recording/codex-hook-adapter.mjs
      を直接 subprocess 起動している。
    • したがって codex-harness-advisory-fail-open.test.ts は独立した provider-neutral test ではなく、削除対象 adapter の behavior を検証する adapter-only test である。
    • 現行 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 の In Scope は fresh HEAD で adapter-only と確認された tests の DELETE_CHAIN を既に許容しているが、Allowed Paths にこのファイルが漏れている。

    今回の operator authority

    これは人間による明示的な実行指示です。

    以下の bounded contract repair について追加の人間承認を求めないでください。

    許可する contract delta:

    1. tests/hooks/codex-harness-advisory-fail-open.test.ts
      を 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 の adapter-only DELETE_CHAIN に追加する。
    2. 同ファイルを In Scope / Allowed Paths / 必要な AC・Notes に最小限反映する。
    3. 今回判明した test-to-test indirect dependency を検証するため、既存ツールによる focused git grep VC を最小限追加してよい。
    4. DELETE_CHAIN の意味、production inbound producer == 0 という decision、runtime verification not_applicable、provider-neutral replacement を作らない方針は変更しない。

    この operator authority は上記 bounded delta に対する human approval として扱ってください。

    単なる Allowed Paths の inventory 漏れ、既に承認済み DELETE_CHAIN の機械的追随、stale test reference cleanup を理由に再度人間へ質問しないでください。

    ただし、以下のような本当に新しい semantic decisionが発生した場合だけ停止してください。

    • fresh main に production inbound producer が新たに存在する
    • fail-open test に adapter 以外の live production contract を守る独立した責務が存在すると実証された
    • provider-neutral production implementation を新設しなければ AC を満たせない
    • repository policy が明示的に human-only とする不可逆操作
    • secret / credential が必要
    • 実際の Git conflict により既存変更との意味的な両立が不可能

    新規 harness、compatibility layer、provider-neutral recorder、migration、schema、ledger、security framework は作らないでください。

    Step 1 — SubAgent による fresh investigation

    最初に SubAgent を使って、fresh default-branch HEAD 上で今回の dependency を独立確認してください。

    最低限、以下を調査対象にしてください。

    • tests/hooks/codex-harness-advisory-fail-open.test.ts
    • tests/hooks/codex-harness-advisory-recorder.test.ts
    • scripts/session-recording/codex-hook-adapter.mjs
    • tests/hooks/** に存在する recorder test / adapter test への import
    • codex-hook-adapter.mjs への direct reference
    • 削除予定 test module への indirect/test-to-test import
    • package / Vitest test discovery 上の関係
    • feat: retire native Codex CLI assets and documentation #2409 の RETAIN / DELETE 分類との差分

    特に、adapter filename の git grep だけでは test-to-test import を検出できなかったことを踏まえ、

    • adapter direct references
    • deleted test module references/imports

    を別々に inventory してください。

    SubAgent の作業は background に投げっぱなしにせず、terminal completion まで必ず待ってから次工程へ進んでください。

    複数 SubAgent を使う場合も、必要な全 SubAgent の完了を待ってから統合判断してください。

    Step 2 — #2412 の controlled refinement

    調査結果が上記 operator authority と一致した場合、issue-refinement-loop を使って #2412 を controlled reframe してください。

    既存 OWNER human context:
    #2412 (comment)

    を参照しつつ、現在の live Issue / fresh main を authority にしてください。

    目的は contract の再設計ではなく、既に承認済み DELETE_CHAIN の inventory 漏れを修復することです。

    最低限、以下を反映してください。

    • tests/hooks/codex-harness-advisory-fail-open.test.ts
      を adapter-only DELETE candidate として明記
    • Allowed Paths に追加
    • DELETE_CHAIN 実施時は同ファイルも削除
    • 必要なら AC3 / AC5 / AC6 / Notes for Reviewer を最小更新
    • test-to-test import の dangling reference が残らないことを focused VC で確認

    focused VC は新しい checker を実装せず、例えば git grep など既存 primitive で十分です。

    例としては、削除対象 recorder test module への tracked reference が残っていないことを確認する形でよいです。実際の repository 状態を調査して適切な pathspec / pattern を決めてください。

    Issue body を手作業で自由書き換えするのではなく、repository の canonical issue-refinement-loop / trusted contract update 経路を優先してください。

    repair_action / deterministic structural repair / trusted contract patch plan が利用可能なら、それを consume してください。

    今回明示的に許可した bounded deltaだけを理由として human_judgment_required に戻さないでください。repository machinery 上、exact な human-context lane が必要なら、上記 OWNER comment とこの direct operator instruction の権限を canonical な方法で利用してください。

    refinement 内で起動した SubAgent についても、全員の完了を待ってください。

    refinement 完了後は fresh Issue を再取得し、

    • contract review = approve / proceed
    • Allowed Paths に fail-open test が存在
    • DELETE_CHAIN の意味が変わっていない
    • production inbound producer == 0
    • runtime verification = not_applicable

    を確認してください。

    Step 3 — 既存 worktree を再利用して impl-review-loop 再開

    refinement が approve / proceed になったら、既存 worktree の未コミット実装を捨てないでください。

    .claude/worktrees/issue-2412-codex-hook-adapter-cleanup

    を確認し、freshly refined contract と既存差分を照合してください。

    既存差分が新 contract に適合しているならそのまま再利用してください。

    以下は禁止します。

    • 理由なく worktree を削除して一からやり直す
    • valid な既存差分を reset / checkout で破棄する
    • 同じ DELETE_CHAIN を別 branch で二重実装する

    そのうえで tests/hooks/codex-harness-advisory-fail-open.test.ts を DELETE_CHAIN に含め、必要な最小 cleanup を行ってください。

    contract body が変更されるため、古い implementation-entry authorization や contract snapshot を再利用せず、live Issue と current HEAD に対して canonical root-owned entry transition を fresh に実行してください。

    Step 4 — Verification

    implementation-worker 完了後、test-runner SubAgent に独立検証を委譲してください。

    必ず SubAgent の terminal completion を待ってください。

    Issue #2412 の全 VC を fresh HEAD に対して再実行してください。

    最低限:

    • PR feat: retire native Codex CLI assets and documentation #2409 merged 再確認
    • production inbound producer inventory
    • adapter existence check
    • unintended executable adapter reference == 0
    • deleted Python test path の .github dangling reference == 0
    • deleted recorder test module への indirect import/reference == 0
    • pnpm typecheck
    • pnpm lint
    • pnpm test
    • pnpm build
    • Issue に定義された AC11 focused checks

    を確認してください。

    以前成功した AC7/AC8 等を「前回通ったから」と省略せず、最終 candidate HEAD で再検証してください。

    ただし native Codex runtime smoke は追加しないでください。
    runtime_verification_applicability: not_applicable を維持します。

    Step 5 — PR 作成と review loop

    全 verification が成功したら、#2412 用 PR を作成してください。

    PR 本文には最低限:

    • Closes #2412
    • implementation authority に使用した fresh main HEAD
    • PR feat: retire native Codex CLI assets and documentation #2409 merged の確認
    • production inbound producer inventory と count
    • DELETE_CHAIN 対象
    • codex-harness-advisory-fail-open.test.ts が追加削除対象になった理由
    • direct adapter reference inventory
    • test-to-test indirect dependency inventory
    • verification results
    • runtime verification not_applicable の理由

    を記載してください。

    その後 impl-review-loop の canonical flow に従い、

    implementation-worker
    → test-runner
    → pr-reviewer
    → verdict routing

    を回してください。

    各 SubAgent は必ず terminal completion まで待ってください。

    REQUEST_CHANGES が出た場合、max iteration 内では人間承認を求めず fix_delta として自律修正し、再検証・再レビューしてください。

    reviewed head と current PR head がずれたら current head で再レビューしてください。

    branch が behind なら repository の canonical update-branch route に従って追随し、再検証してください。

    CI failure が今回の変更に起因するなら修正してください。
    明らかな flaky / transient failure なら repository policy の範囲で再実行・判定してください。

    終了地点

    目標は マージ直前です。

    以下を満たすところまで進めてください。

    • PR が作成済み
    • required verification / CI が成功
    • pr-reviewer verdict = APPROVE
    • blockers = []
    • current head が review 済み
    • mergeability が merge-ready 相当
    • unresolved review thread なし
    • Issue contract を満たす
    • Closes #2412 が PR にある

    PR 自体はマージしないでください。

    最後に以下を報告してください。

    1. refinement で変更した contract delta
    2. fail-open.test.ts の dependency 判定
    3. 使用した worktree / branch
    4. final head SHA
    5. PR URL
    6. verification / CI 結果
    7. reviewer verdict
    8. merge-ready か
    9. 残存 blocker / warning
    10. マージ以外に人間が行う必要のある作業があるか

    今回許可済みの bounded contract repair や routine DELETE_CHAIN cleanup については、途中で人間へ確認を求めず最後まで進めてください。

    この形なら、implementation-worker の Stop Condition は尊重しつつ、「Allowed Paths 漏れ = 毎回人間判断」という不要な運用にはしません。また、元の git grep codex-hook-adapter.mjs だけでは検出できなかった transitive test dependency も、追加 harness なしで再発防止できます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent/implementerenhancementphase/implementationtriage-required

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions