Repository navigation
feat: retire orphaned codex-hook-adapter.mjs と adapter-only tests - #2428
Conversation
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2428/ The preview will be removed when this PR is closed. |
判定: REQUEST_CHANGESPR #2428 の方向性、つまり native Codex CLI を repository から retire した以上、孤立した ただし、現状は retirement が production policy と repository SSOT まで完結していません。新しい harness を増やす必要はありません。むしろ残存した Codex-specific control path と stale contract を削る方向が適切です。 優先度 | Finding | 判定 -- | -- | -- P1 / BLOCKER | git_mutation_command_policy.py に retired Codex adapter 用の実行可能な authorization valueが残っている | 修正必須 P1 / HIGH | stable SSOT hook-boundaries.md が、存在しない Codex hook をまだ「active」と規定している | 同 PR 修正推奨 P1 / HIGH | OPEN Issue #1852 / #2050 が削除対象 adapter / .codex/** の実装を要求したまま | merge と同時に disposition 必須 P2 / MEDIUM | #2412 AC2 が要求する complete inventory が PR body に列挙されておらず、filename grep では semantic residue を見逃した | evidence 修正推奨1. BLOCKER — retired adapter の authorization lane が production code に残っているこれが最大の問題です。 現在の
を保持しています。しかもコメントだけではなく、実際の remote-write transaction の直前でこの集合を authorization 判定に使っています。 つまり #2428 は adapter と「adapter を参照するテスト」は消していますが、
を残しています。 これは「重大なセキュリティ脆弱性」とまでは断定しません。他の precondition も存在するためです。しかし retirement としては明確に不完全です。また source comment 自身が、この boundary string は secret ではなく caller authentication でもないと説明しています。したがって dead caller identity を残す有用性がありません。 しかも #2412 は、 ここは harness を追加するのではなく単純に、 へ縮め、Codex adapter 前提のコメントを削除し、既存テストに
を1ケース足す程度で十分です。 これは security 強化というより dead control-plane branch の削除です。ワークフローを重くしません。 2. HIGH — |
| 優先度 | Finding | 判定 |
|---|---|---|
| P1 / BLOCKER | git_mutation_command_policy.py に retired Codex adapter 用の実行可能な authorization valueが残っている |
修正必須 |
| P1 / HIGH | stable SSOT hook-boundaries.md が、存在しない Codex hook をまだ「active」と規定している |
同 PR 修正推奨 |
| P1 / HIGH | OPEN Issue #1852 / #2050 が削除対象 adapter / .codex/** の実装を要求したまま |
merge と同時に disposition 必須 |
| P2 / MEDIUM | #2412 AC2 が要求する complete inventory が PR body に列挙されておらず、filename grep では semantic residue を見逃した | evidence 修正推奨 |
1. BLOCKER — retired adapter の authorization lane が production code に残っている
これが最大の問題です。
現在の scripts/agent-guards/git_mutation_command_policy.py は、
_AUTHORIZED_EXECUTION_BOUNDARY_LAYERS = {"worktree_scope_guard_denied", "codex_hook_adapter_pretooluse"}
を保持しています。しかもコメントだけではなく、実際の remote-write transaction の直前でこの集合を authorization 判定に使っています。
つまり #2428 は adapter と「adapter を参照するテスト」は消していますが、
codex_hook_adapter_pretooluseという、もう存在しない caller を production policy が trusted boundary として受理する能力
を残しています。
これは「重大なセキュリティ脆弱性」とまでは断定しません。他の precondition も存在するためです。しかし retirement としては明確に不完全です。また source comment 自身が、この boundary string は secret ではなく caller authentication でもないと説明しています。したがって dead caller identity を残す有用性がありません。
しかも #2412 は、git_mutation_command_policy.py 内の adapter reference を「historical/design-rationale prose」と分類して Out of Scope にしています。
実態はそうではなく、comment + executable allowlist です。
ここは harness を追加するのではなく単純に、
_AUTHORIZED_EXECUTION_BOUNDARY_LAYERS = frozenset(
{"worktree_scope_guard_denied"}
)へ縮め、Codex adapter 前提のコメントを削除し、既存テストに
codex_hook_adapter_pretooluse -> execution_not_authorized_for_boundary_layer
を1ケース足す程度で十分です。
これは security 強化というより dead control-plane branch の削除です。ワークフローを重くしません。
2. HIGH — docs/dev/hook-boundaries.md が retirement 後の世界と矛盾する
docs/dev/hook-boundaries.md は status: stable で、hook boundary の正本を名乗っています。しかし現在も、
project-local Codex hook の active allowlist は
SessionEndとSubagentStopの passive recorder
と書き、.codex/hooks.json を active configuration として説明しています。
一方、
- PR feat: retire native Codex CLI assets and documentation #2409 で
.codex/**は削除済み - PR feat: retire orphaned codex-hook-adapter.mjs と adapter-only tests #2428 で passive recorder 自体も削除
- 実装: retire Codex CLI assets and documentation(Phase 3, Child 3 of #2154) #2161 の Desired Destination は native Codex executable consumer の撤去
です。
ここを残すと、今後 Claude Code / Claude-GPT が stable SSOT を読んだ際に、
「Codex passive recorder は active なはずなのに実装がない」
という逆方向の修復を始める可能性があります。
session-recording-policy.md は少なくとも Codex section を historical と明記しています。
hook-boundaries.md も同様に historical framing にするか、active Codex section を削除するのが適切です。
これは新しい checker や docs drift harness を作る話ではありません。stale prose を消すだけでよいです。
3. HIGH — OPEN backlog が削除後の architecture を逆行させる
少なくとも以下の2件が現在 OPEN のままです。
Issue #1852 は、まさに削除される codex-hook-adapter.mjs に対して write budget / file-type validation を実装する Issue です。
Issue #2050 はさらに、
codex-hook-adapter.mjsのSubagentStop.codex/config.toml.codex/hooks.json.codex/hooks/session-recording-composite.mjs
を実装対象にしています。
#2428 merge 後にこれらを通常の implementation queue へ流すと、retire した architecture を agent が再導入しようとする可能性があります。
個人趣味開発なら dependency graph や stale-Issue detector を新設する必要はありません。#2428 merge に合わせて、
- 実装: codex-hook-adapter.mjs の write budget と ファイル type 検証を修正する #1852 →
not_planned / superseded by #2161 + #2412 - 実装: native session continuation canary の resume phase に bounded timeout retry を追加し、一時的な wait timeout 観測で completion 判定を確定させない #2050 → Codex-specific implementation は superseded。await-all convergence 自体がまだ必要なら Claude-native / Claude-GPT 現行 runtime を前提に再 refinement
で十分です。
特に #1852 の defect は、adapter 自体を削除するなら直さないのが最善です。余計な安全実装を増やさないという今回の方針にも合います。
4. MEDIUM — AC2 の inventory evidence が弱く、実際に semantic residue を見逃した
#2412 AC2 は、fresh HEAD 上の git grep 全 hit を分類し、PR body に記録することを要求しています。
ところが #2428 body は、
all hit が test-only / docs-historical / comment-only
production inbound producer count == 0
という集約結果だけで、path-by-path inventory を掲載していません。
通常なら軽微ですが、今回は実際に codex_hook_adapter_pretooluse という production semantic residue が見つかったため、単なる証跡不足ではありません。
filename だけの
git grep 'codex-hook-adapter\.mjs'
に加えて、今回の DELETE_CHAIN では少なくとも一度だけ、
git grep -n -E -- \
'codex_hook_adapter_pretooluse|CODEX_PASSIVE_RECORDING_DIR|codex_passive_session_record|passive-events\.jsonl|codex-hook-adapter\.mjs'程度の semantic sweep を行えば十分です。
これも新規 harness にする必要はなく、one-shot verification command で足ります。
upstream Codex との照合
一点重要なのは、Codex hooks 自体が obsolete だから削除するわけではないことです。
現在の upstream openai/codex には Hook event schema と hook runtime/engine が依然として実装され、SubagentStop、SessionEnd、PreToolUse 等の lifecycle が存在します。([GitHub]1)
したがって #2412/#2428 の rationale は現在のまま、
upstream 機能が死んだからではなく、loop-protocol が native Codex CLI runtime を意図的に retire したため
とするのが正しいです。
PR #2409 が一度 boundary/fail-open/recorder tests を「provider-neutral advisory recorder」として RETAIN した履歴もあります。
その後 #2412 で「実体は Codex-specific env/schema/lifecycle にしか接続されず producer 0」と再評価して DELETE へ転換したこと自体は合理的です。
推奨する最小 fix_delta
大規模な再 refinement や新規 harness は不要です。
git_mutation_command_policy.py から codex_hook_adapter_pretooluse の executable authorization を削除することを merge blocker にし、対応する focused regression test を更新する。その上で hook-boundaries.md の active Codex recorder 記述を historical 化し、PR body に semantic inventory 結果を追記するのが最小構成です。
#1852/#2050 はコードに混載せず、merge 前後の GitHub housekeeping として superseded / reframe すればよいです。
最終 CI は現 head で green まで到達しており、今回の問題は「テストが足りない」というより 削除境界の classification が1段浅いことです。したがって CI/harness をさらに増やすより、dead production authority・stale SSOT・stale backlog を削る方が、このリポジトリには有用です。
結論として、DELETE_CHAIN 自体は KEEP。PR #2428 は現状のまま merge せず、上記 P1 の production authorization residue を除去してから merge を推奨します。
…2412) PR #2409 merged (8675869) and removed .codex/hooks.json / .codex/hooks/session-recording-composite.mjs, leaving scripts/session-recording/codex-hook-adapter.mjs as an orphaned native Codex CLI runtime asset with production_inbound_producer_count == 0 (verified via fresh-HEAD git grep inventory). DELETE_CHAIN: - scripts/session-recording/codex-hook-adapter.mjs (adapter) - 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 (discovered mid-implementation: sole consumer of codex-harness-advisory-recorder's exported `invoke` helper, which spawns the adapter directly -- deleting the recorder test alone breaks this file's import and fails pnpm 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 Mechanical cleanup of stale references: - scripts/agent-guards/tests/test_git_mutation_command_policy.py: removed the adapter direct-reference guard assertion that read the now-deleted source file. - .github/workflows/ci.yml: removed the 3 dead pytest steps, dropped the 3 deleted test paths from collect-only/pytest_args/session-recording prefix classification, and reworded a comment to stop referencing the deleted filename. - .github/ci/python-test-plan.json: removed the secondary_coverage entry for the 3 deleted test paths. Runtime verification: not_applicable (static cleanup + tracked-file inventory only; no native Codex runtime session to exercise). Closes #2412
…ue (#2412) OWNER REQUEST_CHANGES review on PR #2428 (#2428 (comment)) found that scripts/agent-guards/git_mutation_command_policy.py still authorized `boundary_layer=codex_hook_adapter_pretooluse` -- a live caller identity for the now-deleted native Codex CLI hook adapter -- in the remote-write authorization gate used by execute_existing_branch_update_transaction and execute_initial_branch_create_transaction. - _AUTHORIZED_EXECUTION_BOUNDARY_LAYERS narrows to frozenset({"worktree_scope_guard_denied"}); no caller in the repo passes codex_hook_adapter_pretooluse anymore (verified via git grep). - Add a focused regression test asserting --boundary-layer codex_hook_adapter_pretooluse is now rejected with execution_not_authorized_for_boundary_layer, same as any other unknown caller. - docs/dev/hook-boundaries.md's "Codex advisory hook allowlist" section historicized to match docs/dev/session-recording-policy.md's existing historical framing for the same retired architecture -- it previously described the passive recorder as currently active, which could prompt a future agent to reintroduce the retired architecture. Closes #2412
e0ec0c0 to
a5566b1
Compare
Summary
8675869e18cff37efb62914f81490d323e4ee0ce、fresh default-branch HEADd9a251a872280cd1e208dfa697b7daeb64d194c0)が native Codex CLI runtime を retire し.codex/hooks.json/.codex/hooks/session-recording-composite.mjsを削除した結果、orphan となったscripts/session-recording/codex-hook-adapter.mjsを DELETE_CHAIN で削除する。git grep -n -- 'codex-hook-adapter\.mjs'による complete tracked-file inventory を実施し、production inbound producer count == 0 を確認した(Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 Decision Gate に従う)。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)を削除した。tests/hooks/codex-harness-advisory-fail-open.test.tsは当初 Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 の Allowed Paths に含まれていなかったが、tests/hooks/codex-harness-advisory-recorder.test.tsが export するinvokeヘルパー(アダプタを直接 spawn する)の唯一の consumer であることがpnpm test失敗を通じて判明した。独立した fresh-HEAD 調査(read-only、git grep + 全文読解)で「同ファイルはアダプタの fail-open 挙動のみを検証しており、他に独立した production contract を持たない」ことを確認し、direct operator instruction による bounded contract repair(Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 本文への Allowed Paths / In Scope / AC3 / 新規 VC 追加)を経て DELETE_CHAIN に追加した。新たな production inbound producer は発見されていない(既存のproduction_inbound_producer_count == 0の結論は変更なし)。scripts/agent-guards/tests/test_git_mutation_command_policy.pyの adapter direct-reference guard assertion を削除し、.github/workflows/ci.ymlから削除済み3テストパスへの参照(通常実行・xdist実行・collect-only target・ci_test_selectionartifact のpytest_args・session-recording prefix 判定・存在 assertion・コメント)を除去し、.github/ci/python-test-plan.jsonのsecondary_coverage.dedicated_lanesから該当3エントリを除去した。scripts/agent-guards/git_mutation_command_policy.pyの_AUTHORIZED_EXECUTION_BOUNDARY_LAYERSに、削除済みアダプタが渡していたcodex_hook_adapter_pretooluseという 実行可能な authorization value が残存し、remote-write transaction の直前で実際に authorization 判定に使われていることが判明した(Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 は当該箇所を誤って「historical/design-rationale prose」として Out of Scope 扱いしていた)。_AUTHORIZED_EXECUTION_BOUNDARY_LAYERSをfrozenset({"worktree_scope_guard_denied"})へ縮小し、--boundary-layer codex_hook_adapter_pretooluseが他の未知値と同様にexecution_not_authorized_for_boundary_layerで拒否されることを検証する focused regression test を追加した。あわせてdocs/dev/hook-boundaries.mdの「Codex advisory hook allowlist」節を、docs/dev/session-recording-policy.mdの既存 historical framing に合わせて historicize した。AC2 の詳細インベントリ(fresh HEAD
ef2c7175、OWNER 指摘 P2 反映)git grep -n -- 'codex-hook-adapter\.mjs'の全 hit を分類し、以下の表にまとめた(production inbound producer / test-only / docs-historical / fixture の4分類)。scripts/session-recording/codex-hook-adapter.mjstests/hooks/codex-harness-advisory-boundary.test.tstests/hooks/codex-harness-advisory-recorder.test.tstests/hooks/codex-harness-workflow-gates.test.tstests/hooks/codex-harness-advisory-fail-open.test.tsinvoke唯一の consumer)tests/session_recording/codex/test_hook_adapter.pytests/session_recording/codex/test_initial_branch_create_lane.pytests/session_recording/codex/test_external_manifest_publish.pyscripts/agent-guards/tests/test_git_mutation_command_policy.pyscripts/agent-guards/git_mutation_command_policy.pycodex_hook_adapter_pretooluseという 別の識別子が executable authorization value として残っていたため本 PR で除去(filename grep だけでは検出不能な semantic residue).github/workflows/ci.yml.claude/scripts/check_session_recording_runtime_safety.py.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.mdscripts/agent-guards/tests/test_skill_runtime_exec_session_manifest.pyscripts/session-recording/bootstrap-source-bound-readiness.mjsproduction inbound producer count は 0 である(
.codex/hooks.jsonおよび composite hook は既に不在であることを確認済み)。追加の semantic sweep(filename 文字列に依存しない識別子を横断検索、OWNER 提案):
この sweep で実際に
codex_hook_adapter_pretooluseという production 側の semantic residue(上記のgit_mutation_command_policy.pyの authorization value)を発見し、本 PR で除去した。Checks
pnpm typecheckpnpm lintpnpm test(1874 passed, 105 files)uv run --locked pytest -q scripts/agent-guards/tests/test_git_mutation_command_policy.py(37 passed)pnpm buildSchema Change Applicability
not_schema_changeproduction_inbound_producer_count == 0)ことを確認した上での adapter・adapter-only tests・その参照の完全削除である。adapter が書いていたpassive-events.jsonlフォーマットの consumer も同時に廃止されるため、residual schema consumer は存在しない。Schema Consumer Inventory
N/A —
not_schema_changeのため対象外。Compatibility Decision(互換性判定)
N/AN/AN/AN/AVisual Impact Declaration(視覚影響申告)
本 PR は DOM/CSS の変更を含まないが、
.github/workflows/ci.ymlの編集がmeta_policy_changeとして visual-impact-policy に検出され、既定 surface(combat-hud-critical/combat-hud-running)が影響候補として自動列挙されたため、以下の宣言でverified_unchangedを明示する。実際の変更内容は native Codex CLI adapter とその専用テストの削除、および CI 上の該当パス参照の mechanical cleanup のみであり、UI/DOM/CSS は一切変更していない。Safety Claim Matrix
codex-hook-adapter.mjsは削除前の時点で live production inbound producer を持たない(fresh HEAD 上で.codex/hooks.json/ composite hook が既に不在)git_mutation_command_policy.pyの remote-write gate(execute_existing_branch_update_transaction/execute_initial_branch_create_transaction)から、削除済みアダプタ用のcodex_hook_adapter_pretooluseauthorization value を除去し、残る唯一の authorized caller はworktree_scope_guard_denied(Claude Code 側の trusted in-process caller)のみになる。gate の deny-by-default 挙動自体は変更せず、認可対象の縮小のみ_AUTHORIZED_EXECUTION_BOUNDARY_LAYERSの変更差分(本 PR)。新規 focused regression testtest_retired_codex_hook_adapter_boundary_layer_is_no_longer_authorizedが--boundary-layer codex_hook_adapter_pretooluseの deny を検証。uv run --locked pytest -q scripts/agent-guards/tests/test_git_mutation_command_policy.py→ 37 passedNotes
tests/hooks/codex-harness-advisory-fail-open.test.tsの追加削除、およびcodex_hook_adapter_pretooluseauthorization residue の除去は、いずれも Issue 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412 本文を controlled transaction(issue-refinement-loop/edit-issue経由、body_sha256 追跡済み)で bounded contract repair した上で反映済み。後者は OWNER の PR レビュー(issuecomment-5466835712)による。not_planned(superseded by 実装: retire Codex CLI assets and documentation(Phase 3, Child 3 of #2154) #2161 + 実装: scripts/session-recording/codex-hook-adapter.mjs の残存 .codex 参照を削除する #2412)で close 済み、Issue 実装: native session continuation canary の resume phase に bounded timeout retry を追加し、一時的な wait timeout 観測で completion 判定を確定させない #2050 は Codex-specific な AC/Allowed Paths の superseded 範囲を明記した上で今後の re-refinement 推奨コメントを投稿済み(いずれも本 PR のコード変更範囲外)。