Skip to content

feat: Codex scope-rollup capture を復旧 (#1527) - #1534

Merged
squne121 merged 13 commits into
mainfrom
worktree-issue-1527-codex-subagentstop-scope-rollup-capture
Jul 21, 2026
Merged

squne121 merged 13 commits into
mainfrom
worktree-issue-1527-codex-subagentstop-scope-rollup-capture

Conversation

@squne121

@squne121 squne121 commented Jul 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • SubagentStop の scope-rollup capture の decision authority を既存 Python producer に維持したまま、eligibility/readiness の受理経路を固定 private location authority に限定した(Scope Delta (2))。
  • adapter は Node のみで固定 location の eligibility/readiness artifact を pre-spawn 検証し、無効な場合は producer を一切起動せず固定 skip reason を返す。
  • producer は同じ固定 location artifact を独立に再検証し(defense in depth)、timestamp lifecycle を「事前生成が正」の方向に是正し、sidecar provenance に artifact digest と検証結果を記録する。
  • Claude session_manifest_coordinator.sh の raw-payload 経路はゲート env 未設定のため無回帰。
  • bootstrap は Python locked sync・PyYAML import smoke・producer py_compile smoke を実際に完了してから readiness artifact を atomic 生成する。
  • timeout 後は bounded grace + kill(-pgid, 0) liveness 確認を追加。
  • deploy-pages.yml の deploy-main に deploy-pr と同等の uv/python provisioning を追加。

Closes #1527(関連 Issue を完了扱いにします)

Fix Delta 対応(PR #1534 review #issuecomment-5010193289 への対応)

敵対的レビューが確認した P0/P1 Blocker 7 件と P2 High 2 件のうち、Issue #1527 Scope Delta (2) が許可する範囲で以下を是正した:

Blocker 対応
P0: source-bound eligibility が自己申告 .claude/scripts/check_session_recording_runtime_safety.py を固定 private location authority として実装し、payload 由来の inline object/任意パス/artifacts[] fuzzy-match/source_bound(_artifacts) キーを producer から完全に削除した
P0: timestamp lifecycle が逆向き eligibility.generated_at <= hook_received_at、eligibility.generated_at <= marker.generated_at、hook_received_at < expires_at、readiness.generated_at <= hook_received_at に是正
P0: live Codex 成功経路が未配線 adapter の shouldRunScopeRollupCapture を Node-only pre-spawn gate に置き換え、無効な artifact では producer を起動しない
P0: 共有 producer が Claude capture を回帰させる eligibility 強制は SCOPE_ROLLUP_REQUIRE_SOURCE_BOUND_ELIGIBILITY=1(Codex adapter の trusted process spawn のみが設定)でのみ有効化。Claude coordinator は raw payload のまま無回帰(test_claude_coordinator_raw_payload_still_captures_without_regression で検証)
P1: bootstrap が readiness を準備しない bootstrap-source-bound-readiness.mjs を実装し直し、uv sync --locked・interpreter realpath/version 解決・PyYAML import smoke・producer py_compile smoke を完了してから artifact を書く。失敗時は nonzero exit で prepared: true を書かない
P1: timeout の hard termination 未実証 bounded grace(500ms) + kill(-pgid, 0) liveness 確認を追加し、pgid_liveness.py fixture で PID/PGID 記録・adapter 終了後の不在検証を実施
P1: deploy-main に uv provisioning がない deploy-pages.yml の deploy-main に deploy-pr と同一の uv python install / uv sync --locked --group dev を追加
P2: test-only seam が production から未隔離 未対応(フォローアップ、下記参照)
P2: AC11 test / sidecar assertion 不足 sidecar assertion を capture_status/parser_status/routing_action/capture_sha256/invocation_id/agent_type/capture_source/provenance digest まで拡張

未対応(follow-up 推奨): test-only executable seam(NODE_ENV === 'test')は mutable environment 依存のまま残した。production hook entrypoint から NODE_ENV=test を設定できないことの保証は本 PR の範囲では実施していない。

Checks

  • pnpm typecheck — PASS
  • pnpm lint — PASS
  • pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts(14 passed)
  • uv run --locked pytest .claude/hooks/tests/test_scope_rollup_capture.py(13 passed)
  • uv run --locked pytest .claude/hooks/tests/(902 passed)
  • pnpm test(98 files / 1,594 tests)
  • pnpm build
  • uv run --locked ruff check --select E,F(対象ファイル、0 violation)
  • current-head CI / runtime review(この本文では未実行・未主張)

受け入れ条件の達成状況(Acceptance Criteria Status)

  • AC1: 固定 location に valid eligibility artifact がない official-wire fixture は、producer を起動せず固定 skip reason を返す(official wire without source-bound eligibility skips capture)。
  • AC2: missing / stale / invalid / mismatched artifact を fail-closed skip にする(source-bound eligibility rejects missing stale invalid and mismatched artifacts)。
  • AC3: valid artifact で canonical .txt を 1 件、0600 で生成(valid eligibility writes canonical capture)。
  • AC4: marker parse / capture path / sidecar / duplicate 判定は producer に残す(rg VC)。
  • AC5: non-target sidecar と semantic rejection の fail-open。
  • AC6: timeout の process group 終了・late write 不在。
  • AC7: bootstrap が readiness artifact を実プロビジョニング後に生成。
  • AC8: unprepared readiness は sync せず skip。
  • AC9: production transport は test override を無視し child env を allowlist。
  • AC10: .codex/hooks.json の single-composite registration は変更なし。
  • AC11: adapter subprocess verification と live Codex smoke の区別を明示(policy doc + test)。
  • AC12: eligibility/readiness の受理経路を固定 private location のみに限定(test_eligibility_rejects_payload_inline_or_arbitrary_path_artifacts)。
  • AC13: repo root realpath / policy digest / secret-policy digest / mode 0600 / no-symlink / additionalProperties: false の binding 検証(test_eligibility_binding_rejects_wrong_repo_head_policy_mode_owner_symlink)。
  • AC14: timestamp lifecycle を事前生成が正の方向に是正(test_eligibility_lifecycle_requires_pregenerated_artifact_before_marker_and_expiry)。
  • AC15: sidecar provenance に artifact digest と検証結果を記録(test_sidecar_provenance_records_artifact_digest_and_verification_verdict)。
  • AC16: Claude raw-payload capture の無回帰(test_claude_coordinator_raw_payload_still_captures_without_regression)。
  • AC17: bootstrap の実プロビジョニングと uv run --no-sync hot path(pnpm run session-recording:capture-hot-path-check)。
  • AC18: bounded grace + process group liveness 確認(timeout waits bounded grace and verifies process group liveness absence)。
  • AC19: deploy-main の uv/python provisioning parity。

検証コマンド結果(Verification Command Results)

  • AC1-AC3, AC5, AC6, AC8, AC9, AC18: pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "<title>" — 全て個別実行で PASS。
  • AC4: rg -n "capture_scope_rollup_final_response.py" scripts/session-recording/codex-hook-adapter.mjs — PASS。
  • AC7: pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "bootstrap writes source-bound readiness artifact" — PASS。
  • AC10: rg -n "composite" .codex/hooks.json — PASS。
  • AC11: rg -n "adapter path verified" docs/dev/session-recording-policy.md — PASS。
  • AC12-AC16: uv run --locked pytest .claude/hooks/tests/test_scope_rollup_capture.py -k "<name>" — 全て個別実行で PASS。
  • AC17: rg -n "no-sync" package.json — PASS。
  • AC19: rg -n "Issue #1527: deploy-main uv/python provisioning parity" .github/workflows/deploy-pages.yml — PASS。
  • Issue contract の pr-review-only VC、current-head CI、live Codex smoke は PR review の責務であり、この本文では PASS を主張しない。

許可パスの遵守(Allowed Paths Compliance)

  • contract snapshot: 実装: Codex の SubagentStop scope-rollup capture を復旧する #1527 (comment)
  • contract body SHA: sha256:96213a70c82b14e6f77329f3d8b1d148b47034e30c14710211041184fc44593b
  • fix_delta root source: https://github.com/squne121/loop-protocol/pull/1534#issuecomment-5010193289(reviewed head 4e8d6d754215ada16460bbe291a3b6817c912da1)
  • implementation HEAD: a666f185199358458da118d53847feb0d43b9cc4
  • actual changed files: .claude/hooks/capture_scope_rollup_final_response.py、.claude/hooks/tests/test_scope_rollup_capture.py、.claude/scripts/check_session_recording_runtime_safety.py、.github/workflows/ci.yml、.github/workflows/deploy-pages.yml、docs/dev/session-recording-policy.md、package.json、scripts/session-recording/bootstrap-source-bound-readiness.mjs、scripts/session-recording/codex-hook-adapter.mjs、tests/fixtures/hooks/codex-scope-rollup-runner-stop.json、tests/fixtures/hooks/codex-subagent-stop-allow.json、tests/fixtures/hooks/scope-rollup-capture/env-probe.py、tests/fixtures/hooks/scope-rollup-capture/late_writer.py、tests/fixtures/hooks/scope-rollup-capture/nonzero.py、tests/fixtures/hooks/scope-rollup-capture/pgid_liveness.py、tests/fixtures/hooks/scope-rollup-capture/timeout.py、tests/hooks/codex-scope-rollup-capture.test.ts、tests/hooks/hooks-stdout-policy.test.ts。
  • 上記は Issue 実装: Codex の SubagentStop scope-rollup capture を復旧する #1527 本文の Allowed Paths(Scope Delta (2) 含む)に含まれます。契約 fingerprint / CI runtime verdict は別 gate で確認します。

動作検証証跡(Runtime Verification Evidence)

  • 固定 location eligibility/readiness の missing/invalid/stale/binding-mismatch fail-closed、timestamp lifecycle(事前生成が正)、sidecar provenance digest、Claude raw-payload 無回帰は uv run --locked pytest .claude/hooks/tests/test_scope_rollup_capture.py(13 passed)で実プロセス経由(subprocess)検証しました。
  • 固定 location eligibility/readiness の Node-only pre-spawn gate、canonical capture、process-tree timeout の bounded grace + liveness 確認、bootstrap の実プロビジョニングは pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts(14 passed)で実プロセス経由(spawnSync/execFileSync)検証しました。
  • capture child の stdout/stderr は adapter hook output に転送しません。
  • pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "timeout waits bounded grace and verifies process group liveness absence" は fixture が記録した PID/PGID を adapter 終了後に kill(-pgid, 0) で liveness 不在検証しています(8000ms timeout)。
  • live Codex smoke は未実施です。したがって本証跡は adapter path verified / producer path verified に限られ、runtime-active / production trust の確認を意味しません。

Schema Change Applicability

  • decision: not_schema_change
  • reason: SCOPE_ROLLUP_CAPTURE_RESULT_V1 のキー集合・canonical capture format は変更していません(provenance 内の既存キー4件の値を条件付きで埋めるのみで、新規トップレベルキーの追加はありません)。eligibility/readiness artifact の schema(SESSION_RECORDING_SCOPE_ROLLUP_ELIGIBILITY_V1 / SESSION_RECORDING_SCOPE_ROLLUP_READINESS_V1)は producer 出力ではなく producer 入力の internal contract であり、Issue 実装: Codex の SubagentStop scope-rollup capture を復旧する #1527 Scope Delta (2) が明示的に許可した範囲です。

Schema Consumer Inventory

変更対象 schema: N/A(SCOPE_ROLLUP_CAPTURE_RESULT_V1 出力 schema の変更なし)

before/after 差分(変更前後の項目): canonical .txt と SCOPE_ROLLUP_CAPTURE_RESULT_V1 の出力キー集合は変更なし。provenance.eligibility_artifact_digest 等 4 キーは既存 provenance dict 内で当初から存在し、値が null(ungated)または sha256:...(gated)になる。

Consumer 列挙(rg コマンド例と結果): producer は .claude/hooks/capture_scope_rollup_final_response.py、adapter は scripts/session-recording/codex-hook-adapter.mjs、eligibility authority は .claude/scripts/check_session_recording_runtime_safety.py、readiness authority は scripts/session-recording/bootstrap-source-bound-readiness.mjs。

Consumer 更新状況: 既存 SCOPE_ROLLUP_CAPTURE_RESULT_V1 の consumer(.claude/hooks/session_manifest_coordinator.sh 経由の Claude flow)は無加工のまま migration 不要。

互換性判断の記録(Compatibility Decision)

  • change_type: additive_input_validation
  • compatibility: existing_output_compatible
  • migration_required: no
  • migration_or_followup: N/A
  • reason: Codex-gated 経路(env flag 明示時のみ)以外は fail-closed skip も schema 変更もなく、出力 schema を拡張しません。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
eligibility/readiness は固定 private location からのみ受理し、hook payload 由来の inline/任意パス/fuzzy-match は受理しない yes live hook payload の実配線 test_eligibility_rejects_payload_inline_or_arbitrary_path_artifacts #1527 current-head PR review
eligibility artifact の binding(repo/policy/secret-policy digest, mode, symlink)不一致は fail-closed yes 本番 owner/mode の実運用 test_eligibility_binding_rejects_wrong_repo_head_policy_mode_owner_symlink #1527 current-head PR review
timestamp lifecycle は事前生成が正の方向で判定する yes wall-clock drift test_eligibility_lifecycle_requires_pregenerated_artifact_before_marker_and_expiry #1527 current-head PR review
Claude raw-payload capture は無回帰 yes 本番 Claude hook 実配線 test_claude_coordinator_raw_payload_still_captures_without_regression #1527 current-head PR review
adapter は Node のみで pre-spawn 判定し、無効時に producer を起動しない yes live Codex hook 実配線 official wire without source-bound eligibility skips capture #1527 current-head PR review
timeout が bounded grace 後に process group liveness 不在を確認する yes WSL2 以外の production runtime timeout waits bounded grace and verifies process group liveness absence #1527 runtime review
bootstrap は locked sync/import smoke/py_compile を実施してから readiness を書く yes 本番 network/uv registry 到達性 bootstrap writes source-bound readiness artifact #1527 current-head PR review
test-only executable seam が production から完全隔離されている no - 未対応(NODE_ENV 環境変数依存のまま) follow-up Issue 未起票
live Codex trust を adapter test で主張しない yes live smoke 未実施 AC11 の明示 + policy doc #1527

CI テスト性能判断

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 1527
  pr_number: 1534
  decision_scope: ci_change
  changed_paths:
    - ".github/workflows/ci.yml"
    - ".github/workflows/deploy-pages.yml"
    - "package.json"
  lane_classification:
    fast_static:
      applicable: true
      required_commands: ["pnpm lint", "pnpm typecheck"]
    python_unit:
      applicable: true
      required_commands: ["uv run --locked pytest .claude/hooks/tests/"]
    contract_artifact:
      applicable: true
      required_commands: ["pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts"]
    integration:
      applicable: true
      required_commands: ["pnpm test", "pnpm build"]
  baseline_inputs:
    ci_runtime_baseline_v1_available: false
  artifact_consistency:
    ci_test_selection_v1_checked: false
    missing_pytest_args: []
  risk_flags:
    - "deploy-main へのuv/python provisioning追加でjob実行時間が増加する可能性(deploy-prと同等のprovisioningコストを負う)"
  reviewer_gate:
    approve_allowed: false
    required_evidence: ["current-head CI", "ci_runtime_baseline_v1"]
    approve_denied_reason: "この本文の更新では current-head CI/runtime verdict を再取得していないため"

セッション記録ポリシー(Session Recording Policy)

  • live Codex smoke は未実施です。
  • adapter subprocess test / producer subprocess test の成功は hook runtime-active / trust の証明ではありません。
  • policy checker の current-head 結果はこの本文で主張しません。
  • docs/dev/session-recording-policy.md の「Codex SubagentStop における scope-rollup capture の記録(実装: Codex の SubagentStop scope-rollup capture を復旧する #1527、Scope Delta (2))」節に、固定 private location authority・binding 検証・timestamp lifecycle・bootstrap 実プロビジョニング・process-tree bounded grace の詳細を追記しました。

Notes

既存 producer への限定委譲と隔離 fixture 検証を追加する。

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions

github-actions Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1534 closed).

@squne121

Copy link
Copy Markdown
Owner Author

検証結果レポート

Issue #1527: 実装: Codex の SubagentStop scope-rollup capture を復旧する

reviewed_head_sha: 6e479c5316d853c05163af42ce45efad9d95bdbd

AC 確認コマンド 実行結果(要約) exit code 判定
AC1 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "target valid marker writes canonical capture" 1 passed 0 FAIL(要求された runtime artifact 不在)
AC2 rg -n "CODEX_SCOPE_ROLLUP_CAPTURE_SCRIPT" scripts/session-recording/codex-hook-adapter.mjs 1 件検出 0 PASS
AC3 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "non-target writes diagnostic sidecar only" 1 passed 0 FAIL(要求された runtime artifact 不在)
AC4 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "eligibility matrix skips denied and stop-hook payloads" 1 passed 0 PASS
AC5 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "semantic rejection remains fail-open" 1 passed 0 FAIL(要求された runtime artifact 不在)
AC6 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "transport failures are bounded and redacted" 1 passed 0 FAIL(要求された runtime artifact 不在)
AC7 rg -n "scope-rollup.*pre-provision" docs/dev/session-recording-policy.md 1 件検出 0 PASS
AC8 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "adapter verification is distinct from live Codex trust" 1 passed 0 PASS

pnpm の直接実行は環境ポリシーで拒否されたため、コマンド本体・引数を変えず rtk pnpm を実行ラッパーとして使用しました。フォールバックは使用していません。

総合判定

  • 全 AC PASS: NO
  • FAIL した AC: AC1, AC3, AC5, AC6
  • SKIP した AC: なし
  • human_review_required: NO
  • mergeable: MERGEABLE
  • merge_state_status: BLOCKED(規約上の総合 FAIL 要因。原因の推測・解消はしていません)

FAIL 詳細

Issue contract が AC1/AC3/AC5/AC6 に対して要求する artifacts/runtime-verification-AC*-<timestamp>.log は、検証対象 worktree に artifacts/ directory 自体が存在せず確認できませんでした。exit code 0 のテスト成功を runtime evidence の PASS には変換しません。

TEST_VERDICT:
  result: FAIL
  head_sha: 6e479c5316d853c05163af42ce45efad9d95bdbd
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 4
  verification_commands_fail: 4
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t target valid marker writes canonical capture"
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: false
      human_review_required: false
      stop_condition_triggered: false
      notes: "test passed; required runtime artifact absent"
    - ac: AC3
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t non-target writes diagnostic sidecar only"
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: false
      human_review_required: false
      stop_condition_triggered: false
      notes: "test passed; required runtime artifact absent"
    - ac: AC5
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t semantic rejection remains fail-open"
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: false
      human_review_required: false
      stop_condition_triggered: false
      notes: "test passed; required runtime artifact absent"
    - ac: AC6
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t transport failures are bounded and redacted"
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: false
      human_review_required: false
      stop_condition_triggered: false
      notes: "test passed; required runtime artifact absent"

@squne121

Copy link
Copy Markdown
Owner Author

検証結果レポート(Iteration 1)

Issue #1527: 実装: Codex の SubagentStop scope-rollup capture を復旧する

  • reviewed_head_sha: 6e479c5316d853c05163af42ce45efad9d95bdbd
  • PR current head: 6e479c5316d853c05163af42ce45efad9d95bdbd(一致)
  • 4 件の runtime artifact は同一 worktree に存在し、PR 本文の 4 参照とも一致しました。各 artifact は対応 VC の PASS / exit 0 を記録しています。
AC 確認コマンド 実行結果(要約) exit code 判定
AC1 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "target valid marker writes canonical capture" 1 passed 0 PASS
AC2 rg -n "CODEX_SCOPE_ROLLUP_CAPTURE_SCRIPT" scripts/session-recording/codex-hook-adapter.mjs 1 件検出 0 PASS
AC3 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "non-target writes diagnostic sidecar only" 1 passed 0 PASS
AC4 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "eligibility matrix skips denied and stop-hook payloads" 1 passed 0 PASS
AC5 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "semantic rejection remains fail-open" 1 passed 0 PASS
AC6 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "transport failures are bounded and redacted" 1 passed 0 PASS
AC7 rg -n "scope-rollup.*pre-provision" docs/dev/session-recording-policy.md 1 件検出 0 PASS
AC8 pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t "adapter verification is distinct from live Codex trust" 1 passed 0 PASS

pnpm の直接実行は環境ポリシーで拒否されたため、コマンド本体・引数を変えず rtk pnpm を実行ラッパーとして使用しました。フォールバックは使用していません。

総合判定

  • 全 AC PASS: YES
  • FAIL した AC: なし
  • SKIP した AC: なし
  • human_review_required: NO
  • mergeable: MERGEABLE
  • merge_state_status: BLOCKED

mergeStateStatus=BLOCKED は test-runner 規約上の総合 FAIL 要因です。原因の推測・解消は行っていません。

TEST_VERDICT:
  result: FAIL
  head_sha: 6e479c5316d853c05163af42ce45efad9d95bdbd
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 8
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t target valid marker writes canonical capture"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifact exists and records PASS on current-head worktree"
    - ac: AC3
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t non-target writes diagnostic sidecar only"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifact exists and records PASS on current-head worktree"
    - ac: AC5
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t semantic rejection remains fail-open"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifact exists and records PASS on current-head worktree"
    - ac: AC6
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t transport failures are bounded and redacted"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifact exists and records PASS on current-head worktree"
VC_ADJUDICATION_RESULT_V1:
  schema_version: 1
  overall_status: indeterminate
  blocking: true
  rerun_required: true
  per_ac: []
  evidence_refs: []
  source_integrity:
    contract_snapshot_present: false
    current_vc_result_present: false
    diff_summary_present: false
    allowed_paths_present: false
    evidence_complete: false
    evidence_fresh: true
    head_sha: 6e479c5316d853c05163af42ce45efad9d95bdbd
  errors:
    - formal_adjudication_inputs_not_available_to_test_runner
  artifact_ref: null
  artifact_digest: null
  stdout_truncated: false
  omitted_fields: []

@squne121
squne121 marked this pull request as ready for review July 15, 2026 17:24
@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  issue: 1527
  pr: 1534
  expected_head: 6148ba52ef8086f543881acfbf9c70f232a761f5
  observed_head: 6148ba52ef8086f543881acfbf9c70f232a761f5
  mergeable: MERGEABLE
  merge_state_status: BEHIND
  branch_behind_main: true
  baseline_only: false
  verification_commands_pass: 8
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"target valid marker writes canonical capture\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifacts/runtime-verification-AC1-20260715T174243Z.log; HEAD binding confirmed"
    - ac: AC2
      command: "rg -n \"CODEX_SCOPE_ROLLUP_CAPTURE_SCRIPT\" scripts/session-recording/codex-hook-adapter.mjs"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "line 62"
    - ac: AC3
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"non-target writes diagnostic sidecar only\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifacts/runtime-verification-AC3-20260715T174243Z.log; HEAD binding confirmed"
    - ac: AC4
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"eligibility matrix skips denied and stop-hook payloads\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "1 passed"
    - ac: AC5
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"semantic rejection remains fail-open\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifacts/runtime-verification-AC5-20260715T174243Z.log; HEAD binding confirmed"
    - ac: AC6
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"transport failures are bounded and redacted\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "artifacts/runtime-verification-AC6-20260715T174243Z.log; HEAD binding confirmed"
    - ac: AC7
      command: "rg -n \"scope-rollup.*pre-provision\" docs/dev/session-recording-policy.md"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "line 44"
    - ac: AC8
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"adapter verification is distinct from live Codex trust\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "1 passed"

指定 HEAD で全 8 VC が成功しました。GitHub は MERGEABLE / BEHIND です。BEHIND は current-head 検証の失敗ではありません。

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST_CHANGES

Mergeability

  • mergeable=MERGEABLE、merge_state_status=BEHIND

Evidence Check

  • TEST_VERDICT_MACHINE: reviewed head 6148ba52ef8086f543881acfbf9c70f232a761f5 に対し 8/8 PASS、SKIP/fallback なし。AC1/3/5/6 の runtime artifact は同一 HEAD に bind されています。
  • CI: ci_verdict_summary.py は同 HEAD で all_pass(条件付き skipped 5件は除外)でした。
  • Allowed Paths: fresh contract snapshot を source として指定しましたが、snapshot に expected_contract_fingerprint がなく、review gate は indeterminate(merge-blocking)です。実 changed files を契約へ確定的に bind できません。
  • PR 本文に必須の「受け入れ条件の達成状況」「検証コマンド結果」「Allowed Paths 遵守」セクションおよび AC ごとの [x] 根拠がありません。
  • CI テスト性能判断は ci_change かつ reviewer_gate.approve_allowed: false です。ci_runtime_baseline_v1 比較が未提出のため、current-head CI 成功だけでは承認できません。

Blockers

  • contract snapshot の expected_contract_fingerprint 欠落により Allowed Paths gate が indeterminate。
  • CI workflow 変更について required の runtime baseline 比較が未提出。

Required auto actions

  • PR 本文の定型 AC/検証/Allowed Paths セクションを実証拠とともに補完する。
  • BEHIND ブランチを更新し、更新後 HEAD で再検証する。

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "6148ba52ef8086f543881acfbf9c70f232a761f5"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "BEHIND"
blockers:
  - "allowed_paths_gate: expected_contract_fingerprint_missing により indeterminate(merge-blocking)"
  - "ci_change の ci_runtime_baseline_v1 比較が未提出で、CI_TEST_PERFORMANCE_DECISION_V1.reviewer_gate.approve_allowed が false"
required_auto_actions:
  - kind: update_pr_body_hygiene
    executor: implementation-worker
    skill: open-pr.update_pr
    blocking_merge_ready: true
    mechanical: true
  - kind: update_branch
    executor: implementation-worker
    skill: implement-issue.update_branch
    blocking_merge_ready: true
    mechanical: true
    expected_head_sha: "6148ba52ef8086f543881acfbf9c70f232a761f5"
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: indeterminate
  changed_files_source: git_diff_unvalidated_diff_base_head
  changed_files: []
  changed_file_records: []
  audited_paths: []
  violations: []
  producer_role: review_subagent
  worker_report_used_as_canonical: false
  reason: "expected_contract_fingerprint_missing (merge-blocking)"
allowed_paths_gate_source: review_subagent

Copy link
Copy Markdown
Owner Author

最終検証結果(更新後 HEAD)

指定 HEAD 4b5a6c68f94e75f448991c74fc91c18e1457956b は PR の現在 HEAD と一致し、GitHub は MERGEABLE / CLEAN、必須チェックは成功です。

Issue #1527 の 8 VC は逐語の引数・パターンで実行し、すべて exit 0 でした(実行環境ポリシー上の rtk pnpm は pnpm 呼出しのラッパーとしてのみ使用)。

ただし AC1/AC3/AC5/AC6 の runtime artifact はすべて旧 HEAD 6148ba52ef8086f543881acfbf9c70f232a761f5 に bind されており、現 HEAD に bind された artifact を確認できません。VC 自体の再実行は成功しましたが、要求された new-head binding を満たせないため fail-closed で FAIL とします。

TEST_VERDICT:
  result: FAIL
  issue: 1527
  pr: 1534
  expected_head: "4b5a6c68f94e75f448991c74fc91c18e1457956b"
  observed_head: "4b5a6c68f94e75f448991c74fc91c18e1457956b"
  mergeable: MERGEABLE
  merge_state_status: CLEAN
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 8
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"target valid marker writes canonical capture\""
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: true
      human_review_required: true
      stop_condition_triggered: true
      notes: "VC は現 HEAD で成功。artifact は runtime-verification-AC1-20260715T174243Z.log のみで、HEAD 6148ba52ef8086f543881acfbf9c70f232a761f5 に bind。現 HEAD の artifact なし"
    - ac: AC3
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"non-target writes diagnostic sidecar only\""
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: true
      human_review_required: true
      stop_condition_triggered: true
      notes: "VC は現 HEAD で成功。artifact は runtime-verification-AC3-20260715T174243Z.log のみで、HEAD 6148ba52ef8086f543881acfbf9c70f232a761f5 に bind。現 HEAD の artifact なし"
    - ac: AC5
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"semantic rejection remains fail-open\""
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: true
      human_review_required: true
      stop_condition_triggered: true
      notes: "VC は現 HEAD で成功。artifact は runtime-verification-AC5-20260715T174243Z.log のみで、HEAD 6148ba52ef8086f543881acfbf9c70f232a761f5 に bind。現 HEAD の artifact なし"
    - ac: AC6
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"transport failures are bounded and redacted\""
      exit_code: 0
      status: fail
      fallback_detected: false
      artifact_present: true
      human_review_required: true
      stop_condition_triggered: true
      notes: "VC は現 HEAD で成功。artifact は runtime-verification-AC6-20260715T174243Z.log のみで、HEAD 6148ba52ef8086f543881acfbf9c70f232a761f5 に bind。現 HEAD の artifact なし"

@squne121

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  head_sha: "4b5a6c68f94e75f448991c74fc91c18e1457956b"
  mergeable: MERGEABLE
  merge_state_status: CLEAN
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 8
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"target valid marker writes canonical capture\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "RTK wrapper 経由で実行。artifacts/runtime-verification-AC1-20260715T180440Z.log は current head に bind され、PASS。"
    - ac: AC3
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"non-target writes diagnostic sidecar only\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "RTK wrapper 経由で実行。artifacts/runtime-verification-AC3-20260715T180440Z.log は current head に bind され、PASS。"
    - ac: AC5
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"semantic rejection remains fail-open\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "RTK wrapper 経由で実行。artifacts/runtime-verification-AC5-20260715T180440Z.log は current head に bind され、PASS。"
    - ac: AC6
      command: "pnpm exec vitest run tests/hooks/codex-scope-rollup-capture.test.ts -t \"transport failures are bounded and redacted\""
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: true
      human_review_required: false
      stop_condition_triggered: false
      notes: "RTK wrapper 経由で実行。artifacts/runtime-verification-AC6-20260715T180440Z.log は current head に bind され、PASS。"

Issue #1527 の Verification Commands 8件を current head で再実行し、すべて exit 0 でした。Vitest の 6 skipped は -t による非選択テストであり、VC の SKIP ではありません。PR 本文の AC1/3/5/6 artifact 参照はすべて存在し、各 artifact の HEAD は 4b5a6c68f94e75f448991c74fc91c18e1457956b と一致します。GitHub required checks は SUCCESS、PR は MERGEABLE / CLEAN です。live Codex smoke は未実施であり、adapter path verified の範囲に限定します。

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST_CHANGES

Evidence Check

  • current head 4b5a6c68f94e75f448991c74fc91c18e1457956b に TEST_VERDICT_MACHINE 8/8 PASS、SKIP/fallback なし。AC1/3/5/6 の runtime artifact は current head に bind。
  • ci_verdict_summary.py は current head で all_pass。PR は MERGEABLE / CLEAN。
  • contract snapshot は fresh ですが、expected_contract_fingerprint を含まず、Allowed Paths gate は決定論的に indeterminate です。
  • CI workflow を含むため CI_TEST_PERFORMANCE_DECISION_V1 を確認。baseline_insufficient かつ reviewer_gate.approve_allowed: false のため承認できません。

Blockers

  • Allowed Paths の expected fingerprint を snapshot に記録し、review gate が source-bound ok となる証跡が必要です。
  • CI runtime baseline (ci_runtime_baseline_v1) との比較が未提出です。

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "4b5a6c68f94e75f448991c74fc91c18e1457956b"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers:
  - "allowed_paths_gate: fresh snapshot に expected_contract_fingerprint がなく indeterminate(merge-blocking)"
  - "ci_change: CI_TEST_PERFORMANCE_DECISION_V1.reviewer_gate.approve_allowed が false(ci_runtime_baseline_v1 比較未提出)"
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: indeterminate
  changed_files_source: github_pull_request_files_api_with_previous_filename
  changed_files:
    - .github/workflows/ci.yml
    - .github/workflows/deploy-pages.yml
    - docs/dev/session-recording-policy.md
    - scripts/session-recording/codex-hook-adapter.mjs
    - tests/fixtures/hooks/codex-scope-rollup-runner-stop.json
    - tests/fixtures/hooks/codex-subagent-stop-allow.json
    - tests/fixtures/hooks/scope-rollup-capture/nonzero.py
    - tests/fixtures/hooks/scope-rollup-capture/timeout.py
    - tests/hooks/codex-scope-rollup-capture.test.ts
    - tests/hooks/hooks-stdout-policy.test.ts
  reason: "expected_contract_fingerprint_missing (merge-blocking)"
  producer_role: review_subagent
  worker_report_used_as_canonical: false
allowed_paths_gate_source: review_subagent

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最終手動レビュー(限定 waiver)

レビュー対象は current HEAD 6c1e9973f90780b0311deac093bd7949e90c5a64 です。ライブ確認では MERGEABLE / CLEAN、ci_verdict_summary.py は all_pass、Issue #1527 の 8 VC はすべて exit 0 でした。AC1/AC3/AC5/AC6 の runtime artifact は PR 本文に当該 HEAD で bind され、専用 worktree に実在します。

Vitest の非選択 6 件は -t による対象外テストであり、VC の SKIP、exit 77、fallback ではありません。

MANUAL_GATE_WAIVER_V1

pr_number: 1534
reviewed_head_sha: "6c1e9973f90780b0311deac093bd7949e90c5a64"
authorization: user_direct
waived_gates:
  - expected_contract_fingerprint_missing
  - ci_runtime_baseline_v1_missing
scope: "PR #1534 only"
non_waived_gates:
  - head_consistency
  - allowed_path_fact_disclosure
  - verification_commands
  - runtime_evidence
  - ci
  - mergeability
followups:
  - "#1537"
  - "#1538"

事実として、Allowed Paths gate は fresh snapshot の expected_contract_fingerprint 欠落により indeterminate のままです。また CI baseline reviewer gate は ci_runtime_baseline_v1 未提出のため approve_allowed: false のままです。いずれも ok とは扱いません。今回の承認はこの二点だけを PR #1534 に限定して waive するものです。

#1537 と #1538 は未実装の恒久対応 follow-up です。前者は source-bound contract fingerprint の materialize、後者は CI performance baseline の性能主張・provisioning 判定境界を扱います。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "6c1e9973f90780b0311deac093bd7949e90c5a64"
merge_ready: true
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: indeterminate
  changed_files_source: github_pull_request_files_api_with_previous_filename
  changed_files:
    - .github/workflows/ci.yml
    - .github/workflows/deploy-pages.yml
    - docs/dev/session-recording-policy.md
    - scripts/session-recording/codex-hook-adapter.mjs
    - tests/fixtures/hooks/codex-scope-rollup-runner-stop.json
    - tests/fixtures/hooks/codex-subagent-stop-allow.json
    - tests/fixtures/hooks/scope-rollup-capture/nonzero.py
    - tests/fixtures/hooks/scope-rollup-capture/timeout.py
    - tests/hooks/codex-scope-rollup-capture.test.ts
    - tests/hooks/hooks-stdout-policy.test.ts
  reason: "expected_contract_fingerprint_missing; manually waived for PR #1534 only"
allowed_paths_gate_source: review_subagent
manual_waiver_applied: true

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • reviewed head: 6c1e9973f90780b0311deac093bd7949e90c5a64
  • GitHub: MERGEABLE / CLEAN、Draft ではありません。

Evidence Check

  • Linked Issue: PR 本文の Closes #1527、Issue #1527 の 8 AC / 8 VC、Allowed Paths をライブで照合しました。
  • CI: ci_verdict_summary.py --expected-head-sha は同一 HEAD で all_pass。ci_test_selection/v1 artifact も同 HEAD で G1 pass、head consistency (G4) も pass です。
  • VC / runtime: 当該 worktree の同一 HEAD で capture test 全体は 7 passed。AC2 / AC7 の rg も pass。PR 本文の AC1/3/5/6 runtime artifact 記録および live-Codex-smoke を主張しない境界を確認しました。
  • Allowed Paths: GitHub PR files API の 10 files(rename なし)はすべて Issue contract の Allowed Paths 内です。snapshot は expected_contract_fingerprint 不在のため gate は indeterminate のままであり、ok とは扱いません。
  • Safety / schema: Safety Claim Matrix は bounded な主張と一致し、Schema Change Applicability は not_schema_change と diff に整合します。

限定 waiver の適用

OWNER review #pullrequestreview-4712759364 の MANUAL_GATE_WAIVER_V1 を current HEAD に限定して再確認しました。waive するのは次の二点だけです。

  • expected_contract_fingerprint_missing
  • ci_runtime_baseline_v1_missing

head consistency、Allowed Paths の事実開示、VC、runtime evidence、CI、mergeability は waiver 対象外として再確認済みです。

Blockers

  • なし(上記二点は PR #1534 限定の明示 waiver を適用)。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "6c1e9973f90780b0311deac093bd7949e90c5a64"
merge_ready: true
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: indeterminate
  changed_files_source: github_pull_request_files_api_with_previous_filename
  changed_files:
    - .github/workflows/ci.yml
    - .github/workflows/deploy-pages.yml
    - docs/dev/session-recording-policy.md
    - scripts/session-recording/codex-hook-adapter.mjs
    - tests/fixtures/hooks/codex-scope-rollup-runner-stop.json
    - tests/fixtures/hooks/codex-subagent-stop-allow.json
    - tests/fixtures/hooks/scope-rollup-capture/nonzero.py
    - tests/fixtures/hooks/scope-rollup-capture/timeout.py
    - tests/hooks/codex-scope-rollup-capture.test.ts
    - tests/hooks/hooks-stdout-policy.test.ts
  reason: "expected_contract_fingerprint_missing; MANUAL_GATE_WAIVER_V1 applies to PR #1534 only"
  producer_role: review_subagent
  worker_report_used_as_canonical: false
allowed_paths_gate_source: review_subagent
manual_waiver_applied: true
manual_waiver_scope: "PR #1534 only; expected_contract_fingerprint_missing and ci_runtime_baseline_v1_missing only"

@squne121

Copy link
Copy Markdown
Owner Author

敵対的レビュー結果

Verdict: REQUEST_CHANGES

レビュー対象は current HEAD 6c1e9973f90780b0311deac093bd7949e90c5a64 です。PR は open / mergeable で、PR 本文上は CI・受け入れ条件とも PASS とされています。ただし live Codex smoke は意図的に未実施であり、以下の3件はその未実施部分とプロセス境界に存在する、独立した merge blocker です。

優先度 | 判定 | 指摘 -- | -- | -- P0 | Blocker | 公式 Codex の SubagentStop payload では eligibility matrix を評価できない P1 | Blocker | 5秒 timeout が uv の子孫 Python を終了させず、hard bound が成立しない P1 | Blocker | production pre-provision が実装されず、uv run --locked が hook 内で同期処理を起こし得る P2 | High | テストが sidecar 契約・実 wire・孤児プロセスを検証していない P2 | High | test-only override と子プロセス環境の production 境界がない

Issue #1527 が要求するのは、単なる「adapter subprocess test が通る」ことではありません。秘密モード・public checkpoint・visibility mapping・guard decision を含む capture eligibility と、5秒以内の hard termination を実運用経路で成立させることです。


1. [P0 / Blocker] 公式 Codex wire では安全条件を評価できない

問題

公式 openai/codex の現行 SubagentStopCommandInput が送る項目は、概ね次です。

  • session_id

  • turn_id

  • transcript_path

  • agent_transcript_path

  • cwd

  • hook_event_name

  • model

  • permission_mode

  • stop_hook_active

  • agent_id

  • agent_type

  • last_assistant_message

PR の eligibility に必要な以下の項目は存在しません。

  • secrets_mode

  • public_checkpoint_enabled

  • unknown_visibility_mapping

  • touched_paths

公式の serializer も上記の固定フィールドから JSON を生成して、そのまま hook dispatcher に渡しています。

一方、PR の adapter は eligibility 定数として安全値を宣言していますが、実判定は次のようになっています。

  • public_checkpoint_enabled === true のときだけ deny

  • unknown_visibility_mapping === true のときだけ deny

  • secrets_mode が truthy かつ none 以外のときだけ deny

  • 各キーが欠落、null、誤った型の場合は通過

  • shouldRunScopeRollupCapture() は event と stop_hook_active しか再確認しない

したがって公式 wire をそのまま受け取る通常運用では evaluateGuard() が null を返し、stop_hook_active: false であれば capture producer が起動します。

リポジトリ内の hook wiring に補完処理もありません。.codex/hooks.json は composite を直接起動し、composite は adapter を import しているだけです。

現在のテスト fixture は、公式 wire に存在しない secrets_mode と touched_paths を人工的に追加しています。この fixture による PASS は live Codex での eligibility を証明していません。

影響

PR 本文の以下の主張は、公式 Codex CLI を前提にすると成立しません。

guard allow の SubagentStop だけが既存 producer を起動する

実際には「危険値が payload に明示的に埋め込まれていない SubagentStop」が capture 対象です。公式 payload はまさにその形です。

これは Schema Change Applicability: not_schema_change 自体よりも、Schema Consumer Inventory を N/A としたことが問題です。adapter は公式 Codex hook input schema の新しい意味論的 consumer であり、その wire compatibility がテストされていません。PR 本文の schema inventory と safety claim は修正が必要です。

必須修正

hook payload に存在しない制御値を「存在する前提」で判定してはいけません。以下の構造へ変更すべきです。

  1. 既存の runtime safety verifier から、capture eligibility を表す private・source-bound artifact を事前生成する。

  2. artifact を少なくとも次へ bind する。

    • repo root

    • HEAD または関連 policy digest

    • secret-policy digest

    • public checkpoint / visibility 判定

    • secrets_mode

    • 生成時刻と有効期限

  3. adapter はその artifact を読み、missing / stale / invalid の場合は capture を skip する。

  4. hook 自体は fail-open で session を継続してよいが、capture eligibility は fail-closed にする。

  5. 公式 SubagentStopCommandInput と同じ fixture を追加し、存在しない project-specific keys に依存しないことを検証する。

リポジトリには既に、public checkpoint、visibility unknown、secrets mode を fail-closed に評価する .claude/scripts/check_session_recording_runtime_safety.py があります。これはネットワーク確認を含むため5秒の hot path で毎回実行すべきではありませんが、bootstrap または session start 時に eligibility artifact を生成する authority として再利用できます。


2. [P1 / Blocker] SIGKILL timeout は uv の子孫を終了させない

問題

現在の実装は次の topology です。

Node adapter
└─ uv
   └─ Python producer
      └─ optional descendants

adapter が timeout 時に kill するのは、spawnSync() が直接管理している uv プロセスです。

Node.js の公式仕様では、signal は直接の child process に送られます。また Linux では親を kill しても、その子孫プロセスは自動的には終了しないことが明記されています。killed 相当の状態も、signal が送信されたことを表すだけで termination の保証ではありません。 (Node.js)

同じ transport topology を Node.js 22.16.0 / uv 0.10.0 で再現したところ、1秒 timeout 後に uv は SIGKILL されましたが、3秒後も target Python とその孫プロセスが PPID=1 で生存していました。これは完全なPR環境の再現ではなく process supervision の再現ですが、問題となる Node → uv → Python の終了動作は一致しています。

timeout process-tree 再現ログ

現在の timeout fixture は単に30秒 sleep するだけです。テストは adapter の経過時間と stderr redaction しか確認せず、fixture process が終了したか、遅延書き込みが発生しなかったかを確認していません。

影響

PR 本文の「5,000 ms の SIGKILL timeout」は、adapter の戻り時間については概ね成立しても、capture 処理全体の hard termination にはなっていません。

想定される破綻は以下です。

  • timeout 後も Python producer が動作する

  • adapter が capture_timeout を返した後に canonical artifact / sidecar が遅延生成される

  • 次の invocation と競合して duplicate / stale 判定が非決定的になる

  • cold environment で起動した uv の download / install worker が孤児化する

  • timeout テスト自身が sleeper process を残す可能性がある

必須修正

同期 spawnSync() ではなく、process-tree supervision を持つ非同期 transport が必要です。

POSIX では次の構造が妥当です。

  • spawn(..., { detached: true }) で独立 process group を生成

  • stdin を書いて明示的に close

  • stdout / stderr が不要なら ignore、必要なら上限付きで drain

  • timeout 時に process group 全体へ signal

  • group termination 後の close を別の短い上限で待つ

  • group が残っていないことを確認

Windows では Job Object または taskkill /T /F 相当の tree termination abstraction が必要です。

さらに、後述の pre-provision 後は uv を hot path から外し、固定された Python interpreter を直接起動する方が安全です。

テスト fixture も次へ変更すべきです。

  • 自身の PID を private temp file に記録

  • grandchild を生成

  • timeout 後に sentinel file を書こうとする

  • adapter 終了後に target / grandchild が存在しないことを確認

  • sentinel と capture artifact が後から現れないことを確認

  • timeout reason code が完全一致することを確認


3. [P1 / Blocker] production pre-provision は文書化されただけで、実装されていない

問題

PR は test job と deploy-pr job に以下を追加しています。

  • uv python install

  • uv sync --locked --group dev

しかしこれは GitHub Actions runner の準備であって、実際に Codex hook が動く developer workspace や agent workspace の provisioning ではありません。変更ファイルにも onboarding/bootstrap/installer は含まれていません。

uv の公式仕様では、project 内の uv run は command 実行前に project environment を作成・更新します。--locked は lockfile を変更しないという制約であり、environment sync を無効化するものではありません。sync を避けるオプションは --no-sync です。 (Astral Docs)

したがって、現在の production command:

uv run --locked python3 ...

は以下の場合に5秒 budget 内で環境準備を始める可能性があります。

  • .venv がない

  • .venv が lockfile と不一致

  • Python が未導入

  • cache miss

  • dependency が未導入

さらに session-recording-policy の同じ節には、Codex hook runtime を「Node.js と repo script だけで deterministic に再実行可能」とする記述と、Node.js・uv・Python・PyYAML を必須とする記述が併存しています。SSOT 内で runtime dependency contract が矛盾しています。

影響

  • clean checkout の最初の capture が高確率で timeout / fail-open になる

  • CI success は、実ユーザー環境の readiness を証明しない

  • timeout と dependency sync が同じ5秒 budgetを奪い合う

  • Finding 2 と組み合わさると、timeout 後に provisioning worker が残る

  • AC7 の「pre-provision」は運用指示であり、配布物の実装契約になっていない

必須修正

production 配布物に、実行可能な bootstrap contract を追加すべきです。

例:

pnpm hooks:bootstrap

bootstrap は次を行います。

  1. 対応 Python version を確定・導入

  2. hook 用の最小 dependency group だけを locked sync

  3. import yaml と producer import を smoke test

  4. readiness artifact を atomic write

  5. readiness artifact を以下へ bind

    • uv.lock digest

    • .python-version

    • interpreter realpath/version

    • producer script digest

    • repo root

hot path は readiness artifact を検証し、成功時だけ次のいずれかを実行します。

  • 専用 .venv の Python を直接起動

  • uv run --no-sync で実行

readiness がない場合は、5秒かけて同期を試みるのではなく、固定 reason code capture_environment_unprepared で即座に skip すべきです。

依存も dev group 全体ではなく、PyYAML など capture producer に必要なものだけを含む専用 runtime group に分離する方が再現性と起動コストの両面で適切です。


4. [P2 / High] テストが実際の契約を十分に検証していない

Sidecar の意味内容を検証していない

target test は次だけを確認しています。

  • .txt が1件

  • 内容が final response と一致

  • mode が 0600

  • .capture.yaml が1件

sidecar の以下は確認されていません。

  • capture_status

  • capture_mode

  • parser_status

  • capture_routing_action

  • invocation_id

  • capture_path

  • capture_sha256

  • capture_source

  • provenance

producer はこれらを正式な record として出力しています。件数だけの assertion では、空・壊れた・不整合な sidecar でもテストが通ります。

Eligibility test が明示的危険値しか検証していない

現在の matrix test は、危険値を fixture に人工的に追加したケースだけです。以下がありません。

  • key absent

  • null

  • "false" のような型違い

  • 0 / object / array

  • 公式 wire と同じ payload

  • trusted eligibility source missing / stale

これは Finding 1 をそのまま見逃すテスト構造です。

AC8 test が実質的に tautology

AC8 test は adapter file の存在と、固定文字列が自分自身を含むことしか検証していません。live trust を主張しないという方針を検証する executable assertion にはなっていません。

AC8 は、たとえば evidence metadata に以下を固定して検証すべきです。

verification_scope: adapter_subprocess
runtime_active_hook_verified: false
project_trust_verified: false
live_codex_smoke: false

それが実装対象でないなら、意味のない test を置くより documentation-only AC として明示する方が正確です。


5. [P2 / High] test-only override と子プロセス環境が production から分離されていない

override が本番コードで常時有効

CODEX_SCOPE_ROLLUP_CAPTURE_SCRIPT は path が fixture root 配下なら受理されますが、test mode の認証や execution mode の判定はありません。ドキュメントは test-only としていますが、コード上は production hook でも同じ環境変数が有効です。

悪意ある攻撃者を想定しなくても、shell profile、CI wrapper、agent launcher に環境変数が残れば、production capture が timeout/nonzero fixture に切り替わります。

環境変数による dependency injection を廃止し、transport を module 化してテストから関数引数で fixture executable を注入する方が適切です。production CLI path は常に canonical producer のみを参照すべきです。

子プロセスが全環境を継承

spawnSync() に env が指定されていないため、Node.js の仕様上、親の process.env が継承されます。 (Node.js)

その結果、少なくとも以下が producer behavior に影響できます。

  • SCOPE_ROLLUP_CAPTURE_DIR

  • PYTHONPATH

  • PYTHONHOME

  • UV_*

  • virtualenv 関連変数

  • proxy / index 設定

Python producer は SCOPE_ROLLUP_CAPTURE_DIR をそのまま capture root として解決します。path validation 自体はその root 内への書き込みを確認していますが、root の authority は environment 側にあります。

production transport は child environment を allowlist 方式で構築すべきです。

  • 必須の PATH / locale / private capture root のみ

  • PYTHONPATH、PYTHONHOME、不要な UV_* を除外

  • PYTHONNOUSERSITE=1

  • PYTHONSAFEPATH=1

  • capture root を runtime-owned private directory に固定

  • test override は production CLI から除去


CI artifact の評価

current-head の ci-runtime-baseline-test-1 artifact も確認しました。計測されている phase は以下だけです。

  • pnpm_install: 3,597 ms

  • pnpm_manifest_check: 791 ms

  • pnpm_test: 38,786 ms

追加された uv python install と uv sync --locked --group dev は run_timed の外にあるため、artifact に含まれていません。

current-head CI baseline artifact

これは #1538 で既に認識されている governance gap です。current-head CI success は functional evidence にはなりますが、未計測 provisioning の性能非劣化を示しません。PR 本文も性能改善を主張していないため、これ単独を新しい merge blocker にはしません。ただし「5秒 budget 内で常に起動できる」という runtime claim の証拠にも使えません。


評価できる点

設計方針として正しい部分もあります。

  • marker parse、canonical filename、duplicate/stale 判定を既存 Python producer に残している

  • JSON を一度 parse しつつ、producer には re-stringify せず raw input を渡している

  • producer は path を検証し、O_EXCL / O_NOFOLLOW と 0600 で atomic write している

  • child stdout/stderr を hook stdout に直接流していない

これらは #772、#869、#933、#1074 で積み上げた責務境界と概ね整合します。

ただし、producer 内部の堅牢性が高くても、producer を起動する eligibility と、producer を終了させる transport が破綻していれば安全契約全体は成立しません。


Merge 条件

このPRを approve できる最低条件は次の3点です。

  1. 公式 Codex wire に存在しない制御値への依存を廃止し、trusted・source-bound な eligibility authority を導入する。

  2. timeout 時に uv だけでなく Python を含む process tree 全体を確実に終了し、孤児・遅延 artifact がないことをテストする。

  3. production workspace 用の pre-provision / readiness contract を実装し、hook hot path では environment sync や Python download を行わない。

これらを直した後、公式 wire fixture、sidecar schema assertion、missing/stale eligibility、grandchild termination、late-write absence を current HEAD で再検証する必要があります。現状の green CI と adapter subprocess test 7件は、上記3つの blocker を覆っていません。

# 敵対的レビュー結果

Verdict: REQUEST_CHANGES

レビュー対象は current HEAD 6c1e9973f90780b0311deac093bd7949e90c5a64 です。PR は open / mergeable で、PR 本文上は CI・受け入れ条件とも PASS とされています。ただし live Codex smoke は意図的に未実施であり、以下の3件はその未実施部分とプロセス境界に存在する、独立した merge blocker です。

優先度 判定 指摘
P0 Blocker 公式 Codex の SubagentStop payload では eligibility matrix を評価できない
P1 Blocker 5秒 timeout が uv の子孫 Python を終了させず、hard bound が成立しない
P1 Blocker production pre-provision が実装されず、uv run --locked が hook 内で同期処理を起こし得る
P2 High テストが sidecar 契約・実 wire・孤児プロセスを検証していない
P2 High test-only override と子プロセス環境の production 境界がない

Issue #1527 が要求するのは、単なる「adapter subprocess test が通る」ことではありません。秘密モード・public checkpoint・visibility mapping・guard decision を含む capture eligibility と、5秒以内の hard termination を実運用経路で成立させることです。


1. [P0 / Blocker] 公式 Codex wire では安全条件を評価できない

問題

公式 openai/codex の現行 SubagentStopCommandInput が送る項目は、概ね次です。

  • session_id
  • turn_id
  • transcript_path
  • agent_transcript_path
  • cwd
  • hook_event_name
  • model
  • permission_mode
  • stop_hook_active
  • agent_id
  • agent_type
  • last_assistant_message

PR の eligibility に必要な以下の項目は存在しません。

  • secrets_mode
  • public_checkpoint_enabled
  • unknown_visibility_mapping
  • touched_paths

公式の serializer も上記の固定フィールドから JSON を生成して、そのまま hook dispatcher に渡しています。

一方、PR の adapter は eligibility 定数として安全値を宣言していますが、実判定は次のようになっています。

  • public_checkpoint_enabled === true のときだけ deny
  • unknown_visibility_mapping === true のときだけ deny
  • secrets_mode が truthy かつ none 以外のときだけ deny
  • 各キーが欠落、null、誤った型の場合は通過
  • shouldRunScopeRollupCapture() は event と stop_hook_active しか再確認しない

したがって公式 wire をそのまま受け取る通常運用では evaluateGuard() が null を返し、stop_hook_active: false であれば capture producer が起動します。

リポジトリ内の hook wiring に補完処理もありません。.codex/hooks.json は composite を直接起動し、composite は adapter を import しているだけです。

現在のテスト fixture は、公式 wire に存在しない secrets_mode と touched_paths を人工的に追加しています。この fixture による PASS は live Codex での eligibility を証明していません。

影響

PR 本文の以下の主張は、公式 Codex CLI を前提にすると成立しません。

guard allow の SubagentStop だけが既存 producer を起動する

実際には「危険値が payload に明示的に埋め込まれていない SubagentStop」が capture 対象です。公式 payload はまさにその形です。

これは Schema Change Applicability: not_schema_change 自体よりも、Schema Consumer Inventory を N/A としたことが問題です。adapter は公式 Codex hook input schema の新しい意味論的 consumer であり、その wire compatibility がテストされていません。PR 本文の schema inventory と safety claim は修正が必要です。

必須修正

hook payload に存在しない制御値を「存在する前提」で判定してはいけません。以下の構造へ変更すべきです。

  1. 既存の runtime safety verifier から、capture eligibility を表す private・source-bound artifact を事前生成する。

  2. artifact を少なくとも次へ bind する。

    • repo root
    • HEAD または関連 policy digest
    • secret-policy digest
    • public checkpoint / visibility 判定
    • secrets_mode
    • 生成時刻と有効期限
  3. adapter はその artifact を読み、missing / stale / invalid の場合は capture を skip する。

  4. hook 自体は fail-open で session を継続してよいが、capture eligibility は fail-closed にする。

  5. 公式 SubagentStopCommandInput と同じ fixture を追加し、存在しない project-specific keys に依存しないことを検証する。

リポジトリには既に、public checkpoint、visibility unknown、secrets mode を fail-closed に評価する .claude/scripts/check_session_recording_runtime_safety.py があります。これはネットワーク確認を含むため5秒の hot path で毎回実行すべきではありませんが、bootstrap または session start 時に eligibility artifact を生成する authority として再利用できます。


2. [P1 / Blocker] SIGKILL timeout は uv の子孫を終了させない

問題

現在の実装は次の topology です。

Node adapter
└─ uv
   └─ Python producer
      └─ optional descendants

adapter が timeout 時に kill するのは、spawnSync() が直接管理している uv プロセスです。

Node.js の公式仕様では、signal は直接の child process に送られます。また Linux では親を kill しても、その子孫プロセスは自動的には終了しないことが明記されています。killed 相当の状態も、signal が送信されたことを表すだけで termination の保証ではありません。 (Node.js)

同じ transport topology を Node.js 22.16.0 / uv 0.10.0 で再現したところ、1秒 timeout 後に uv は SIGKILL されましたが、3秒後も target Python とその孫プロセスが PPID=1 で生存していました。これは完全なPR環境の再現ではなく process supervision の再現ですが、問題となる Node → uv → Python の終了動作は一致しています。

[timeout process-tree 再現ログ](sandbox:/mnt/data/pr1534-timeout-repro.txt)

現在の timeout fixture は単に30秒 sleep するだけです。テストは adapter の経過時間と stderr redaction しか確認せず、fixture process が終了したか、遅延書き込みが発生しなかったかを確認していません。

影響

PR 本文の「5,000 ms の SIGKILL timeout」は、adapter の戻り時間については概ね成立しても、capture 処理全体の hard termination にはなっていません。

想定される破綻は以下です。

  • timeout 後も Python producer が動作する
  • adapter が capture_timeout を返した後に canonical artifact / sidecar が遅延生成される
  • 次の invocation と競合して duplicate / stale 判定が非決定的になる
  • cold environment で起動した uv の download / install worker が孤児化する
  • timeout テスト自身が sleeper process を残す可能性がある

必須修正

同期 spawnSync() ではなく、process-tree supervision を持つ非同期 transport が必要です。

POSIX では次の構造が妥当です。

  • spawn(..., { detached: true }) で独立 process group を生成
  • stdin を書いて明示的に close
  • stdout / stderr が不要なら ignore、必要なら上限付きで drain
  • timeout 時に process group 全体へ signal
  • group termination 後の close を別の短い上限で待つ
  • group が残っていないことを確認

Windows では Job Object または taskkill /T /F 相当の tree termination abstraction が必要です。

さらに、後述の pre-provision 後は uv を hot path から外し、固定された Python interpreter を直接起動する方が安全です。

テスト fixture も次へ変更すべきです。

  • 自身の PID を private temp file に記録
  • grandchild を生成
  • timeout 後に sentinel file を書こうとする
  • adapter 終了後に target / grandchild が存在しないことを確認
  • sentinel と capture artifact が後から現れないことを確認
  • timeout reason code が完全一致することを確認

3. [P1 / Blocker] production pre-provision は文書化されただけで、実装されていない

問題

PR は test job と deploy-pr job に以下を追加しています。

  • uv python install
  • uv sync --locked --group dev

しかしこれは GitHub Actions runner の準備であって、実際に Codex hook が動く developer workspace や agent workspace の provisioning ではありません。変更ファイルにも onboarding/bootstrap/installer は含まれていません。

uv の公式仕様では、project 内の uv run は command 実行前に project environment を作成・更新します。--locked は lockfile を変更しないという制約であり、environment sync を無効化するものではありません。sync を避けるオプションは --no-sync です。 ([Astral Docs]2)

したがって、現在の production command:

uv run --locked python3 ...

は以下の場合に5秒 budget 内で環境準備を始める可能性があります。

  • .venv がない
  • .venv が lockfile と不一致
  • Python が未導入
  • cache miss
  • dependency が未導入

さらに session-recording-policy の同じ節には、Codex hook runtime を「Node.js と repo script だけで deterministic に再実行可能」とする記述と、Node.js・uv・Python・PyYAML を必須とする記述が併存しています。SSOT 内で runtime dependency contract が矛盾しています。

影響

  • clean checkout の最初の capture が高確率で timeout / fail-open になる
  • CI success は、実ユーザー環境の readiness を証明しない
  • timeout と dependency sync が同じ5秒 budgetを奪い合う
  • Finding 2 と組み合わさると、timeout 後に provisioning worker が残る
  • AC7 の「pre-provision」は運用指示であり、配布物の実装契約になっていない

必須修正

production 配布物に、実行可能な bootstrap contract を追加すべきです。

例:

pnpm hooks:bootstrap

bootstrap は次を行います。

  1. 対応 Python version を確定・導入

  2. hook 用の最小 dependency group だけを locked sync

  3. import yaml と producer import を smoke test

  4. readiness artifact を atomic write

  5. readiness artifact を以下へ bind

    • uv.lock digest
    • .python-version
    • interpreter realpath/version
    • producer script digest
    • repo root

hot path は readiness artifact を検証し、成功時だけ次のいずれかを実行します。

  • 専用 .venv の Python を直接起動
  • uv run --no-sync で実行

readiness がない場合は、5秒かけて同期を試みるのではなく、固定 reason code capture_environment_unprepared で即座に skip すべきです。

依存も dev group 全体ではなく、PyYAML など capture producer に必要なものだけを含む専用 runtime group に分離する方が再現性と起動コストの両面で適切です。


4. [P2 / High] テストが実際の契約を十分に検証していない

Sidecar の意味内容を検証していない

target test は次だけを確認しています。

  • .txt が1件
  • 内容が final response と一致
  • mode が 0600
  • .capture.yaml が1件

sidecar の以下は確認されていません。

  • capture_status
  • capture_mode
  • parser_status
  • capture_routing_action
  • invocation_id
  • capture_path
  • capture_sha256
  • capture_source
  • provenance

producer はこれらを正式な record として出力しています。件数だけの assertion では、空・壊れた・不整合な sidecar でもテストが通ります。

Eligibility test が明示的危険値しか検証していない

現在の matrix test は、危険値を fixture に人工的に追加したケースだけです。以下がありません。

  • key absent
  • null
  • "false" のような型違い
  • 0 / object / array
  • 公式 wire と同じ payload
  • trusted eligibility source missing / stale

これは Finding 1 をそのまま見逃すテスト構造です。

AC8 test が実質的に tautology

AC8 test は adapter file の存在と、固定文字列が自分自身を含むことしか検証していません。live trust を主張しないという方針を検証する executable assertion にはなっていません。

AC8 は、たとえば evidence metadata に以下を固定して検証すべきです。

verification_scope: adapter_subprocess
runtime_active_hook_verified: false
project_trust_verified: false
live_codex_smoke: false

それが実装対象でないなら、意味のない test を置くより documentation-only AC として明示する方が正確です。


5. [P2 / High] test-only override と子プロセス環境が production から分離されていない

override が本番コードで常時有効

CODEX_SCOPE_ROLLUP_CAPTURE_SCRIPT は path が fixture root 配下なら受理されますが、test mode の認証や execution mode の判定はありません。ドキュメントは test-only としていますが、コード上は production hook でも同じ環境変数が有効です。

悪意ある攻撃者を想定しなくても、shell profile、CI wrapper、agent launcher に環境変数が残れば、production capture が timeout/nonzero fixture に切り替わります。

環境変数による dependency injection を廃止し、transport を module 化してテストから関数引数で fixture executable を注入する方が適切です。production CLI path は常に canonical producer のみを参照すべきです。

子プロセスが全環境を継承

spawnSync() に env が指定されていないため、Node.js の仕様上、親の process.env が継承されます。 (Node.js)

その結果、少なくとも以下が producer behavior に影響できます。

  • SCOPE_ROLLUP_CAPTURE_DIR
  • PYTHONPATH
  • PYTHONHOME
  • UV_*
  • virtualenv 関連変数
  • proxy / index 設定

Python producer は SCOPE_ROLLUP_CAPTURE_DIR をそのまま capture root として解決します。path validation 自体はその root 内への書き込みを確認していますが、root の authority は environment 側にあります。

production transport は child environment を allowlist 方式で構築すべきです。

  • 必須の PATH / locale / private capture root のみ
  • PYTHONPATH、PYTHONHOME、不要な UV_* を除外
  • PYTHONNOUSERSITE=1
  • PYTHONSAFEPATH=1
  • capture root を runtime-owned private directory に固定
  • test override は production CLI から除去

CI artifact の評価

current-head の ci-runtime-baseline-test-1 artifact も確認しました。計測されている phase は以下だけです。

  • pnpm_install: 3,597 ms
  • pnpm_manifest_check: 791 ms
  • pnpm_test: 38,786 ms

追加された uv python install と uv sync --locked --group dev は run_timed の外にあるため、artifact に含まれていません。

[current-head CI baseline artifact](sandbox:/mnt/data/ci-runtime-baseline-test-1.zip)

これは #1538 で既に認識されている governance gap です。current-head CI success は functional evidence にはなりますが、未計測 provisioning の性能非劣化を示しません。PR 本文も性能改善を主張していないため、これ単独を新しい merge blocker にはしません。ただし「5秒 budget 内で常に起動できる」という runtime claim の証拠にも使えません。


評価できる点

設計方針として正しい部分もあります。

  • marker parse、canonical filename、duplicate/stale 判定を既存 Python producer に残している
  • JSON を一度 parse しつつ、producer には re-stringify せず raw input を渡している
  • producer は path を検証し、O_EXCL / O_NOFOLLOW と 0600 で atomic write している
  • child stdout/stderr を hook stdout に直接流していない

これらは #772、#869、#933、#1074 で積み上げた責務境界と概ね整合します。

ただし、producer 内部の堅牢性が高くても、producer を起動する eligibility と、producer を終了させる transport が破綻していれば安全契約全体は成立しません。


Merge 条件

このPRを approve できる最低条件は次の3点です。

  1. 公式 Codex wire に存在しない制御値への依存を廃止し、trusted・source-bound な eligibility authority を導入する。
  2. timeout 時に uv だけでなく Python を含む process tree 全体を確実に終了し、孤児・遅延 artifact がないことをテストする。
  3. production workspace 用の pre-provision / readiness contract を実装し、hook hot path では environment sync や Python download を行わない。

これらを直した後、公式 wire fixture、sidecar schema assertion、missing/stale eligibility、grandchild termination、late-write absence を current HEAD で再検証する必要があります。現状の green CI と adapter subprocess test 7件は、上記3つの blocker を覆っていません。

@squne121

Copy link
Copy Markdown
Owner Author

敵対的レビュー結果

Verdict: REQUEST_CHANGES

レビュー対象は current HEAD 4e8d6d754215ada16460bbe291a3b6817c912da1、16 files / +949 -16 です。PR-triggered workflow は ci、deploy-pages、check-hook-integrity 等を含めて成功しています。したがって、以下は単なる CI failure ではなく、テストが誤った契約を検証していること、または production wiring を通っていないことによる false green です。

優先度 | 判定 | 指摘 -- | -- | -- P0 | Blocker | source-bound eligibility が authority ではなく、任意 payload による自己申告になっている P0 | Blocker | 正しい事前生成 lifecycle を timestamp 判定が必ず拒否する P0 | Blocker | live Codex の成功経路が配線されておらず、AC1 と逆に missing 時も producer を起動する P0 | Blocker | 共有 Python producer の変更により Claude capture を回帰させ、テスト helper が回帰を隠している P1 | Blocker | bootstrap は runtime を準備せず、uv run --locked は hot path で sync し得る P1 | Blocker | timeout の process-tree termination と late-write 不在が実証されていない P1 | Blocker | deploy-main だけ uv provisioning がなく、merge 後の配布経路が非再現的 P2 | High | test-only seam が mutable environment で有効化でき、production から隔離されていない P2 | High | AC11 test、sidecar assertions、current-head evidence に有意な検証不足がある

1. [P0 / Blocker] source-bound eligibility が実質的な自己申告

Issue #1527 の現行契約は、eligibility artifact の authority を runtime safety verifier とし、少なくとも次の情報への binding を要求しています。

  • repo root

  • HEAD または policy digest

  • secret-policy digest

  • public checkpoint / visibility 判定

  • secrets_mode

  • 生成時刻・有効期限

  • atomic private write と検証可能な schema

また、missing / invalid / stale / binding mismatch では producer を起動しない契約です。

ところが producer は、hook payload 内の次の値をそのまま eligibility authority として受理します。

  • top-level の inline object

  • 任意のファイルパス

  • source_bound / source_bound_artifacts 以下の object

  • artifacts 配列内で kind 等が部分一致する object

パスの固定、repo confinement、owner、mode、symlink、artifact schema、digest の検証もありません。

実際に検証しているのは、概ね以下だけです。

  • invocation_id

  • optional な transcript path

  • readiness の prepared / ready らしき値

  • 数個の timestamp の相対比較

prepared: "yes"、state: "prepared" のような文字列まで許可しています。一方で、契約上重要な repo / HEAD / policy / secret-policy / public checkpoint / visibility / secrets_mode / expiry は一切参照していません。

したがって、現在の「valid artifact」は eligibility attestation ではありません。同じ hook caller が、例えば次のような inline object を追加するだけで通過可能です。

{
  "source_bound_eligibility": {
    "invocation_id": "expected-id",
    "requested_at": "...",
    "generated_at": "future timestamp"
  },
  "source_bound_readiness": {
    "invocation_id": "expected-id",
    "generated_at": "later future timestamp",
    "prepared": true
  }
}

これは source-bound ではなく、decision input と authority が同じ payload にある自己申告です。特に official hook wire にない project-specific key を信頼するため、以前の blocker を別形式で再導入しています。

必須修正

eligibility は以下の境界に移す必要があります。

  1. .claude/scripts/check_session_recording_runtime_safety.py が strict schema の artifact を固定 private location に生成する。

  2. adapter が producer 起動前にその固定 location を検証する。

  3. inline object、任意 payload path、fuzzy artifact selection は廃止する。

  4. additionalProperties: false、artifact type/version、repo realpath、HEAD/policy/secret-policy digest、安全判定、generated_at、expires_at を必須化する。

  5. mode 0600、owner、regular file、no-symlink、サイズ上限を確認する。

  6. artifact digest と検証結果を sidecar provenance に記録する。


2. [P0 / Blocker] timestamp 判定が正しい lifecycle と逆向き

producer は eligibility artifact について、次の両方を要求しています。

eligibility.generated_at > marker.requested_at
eligibility.generated_at > marker.generated_at

すなわち、capture 対象の final response が生成された後に eligibility artifact が生成されていなければならないという判定です。

しかし Issue の契約は、eligibility を session start / bootstrap 等で事前生成し、producer 起動可否を決める authority としています。したがって、契約どおりの artifact は marker より古くなり、現在の producerには必ず eligibility_stale として拒否されます。

テストはこの矛盾を、次の人工的な時刻順序で隠しています。

marker generated_at      12:00:01
eligibility generated_at 12:00:02
readiness generated_at   12:00:03

つまりテスト helper が final response の後に artifact を捏造しており、production lifecycle の証明になっていません。

さらに current time と expires_at を検証していないため、未来時刻の artifact は事実上無期限に replay できます。

必須修正

時刻関係は少なくとも次であるべきです。

eligibility.generated_at <= hook_received_at
eligibility.generated_at <= marker.generated_at
hook_received_at < eligibility.expires_at
readiness.generated_at <= hook_received_at

時刻だけでなく、session ID、repo、HEAD / policy digest によって replay scope を閉じる必要があります。


3. [P0 / Blocker] live Codex の成功経路が存在しない

公式 Codex の current SubagentStop serializer が hook command に渡すのは、session/turn ID、transcript paths、cwd、event name、model、permission mode、stop state、agent ID/type、final message 等です。source-bound artifact path や project-specific safety field は含まれません。

リポジトリ側の wiring も、.codex/hooks.json から composite を直接起動し、composite は adapter を import するだけです。artifact path を付加する lifecycle はありません。

それにもかかわらず adapter の capture eligibility は、実質的に次だけです。

eventName === 'SubagentStop'
payload.stop_hook_active !== true

その後、artifact missing を adapter で判定せず、常に uv と Python producer を起動します。

Issue AC1 は、valid artifact がない official-wire-equivalent payload について、capture を起動せず固定 skip reason を返すことを要求しています。現在のテストは逆に、producer を起動して parser_rejected sidecar が生成されることを PASS 条件にしています。

この違いは重要です。現在の経路では artifact がない cold environment でも、先に uv run が環境解決・sync を開始してしまいます。

必須修正

adapter 内で、Python を起動する前に以下を行う必要があります。

official payload
  └─ fixed eligibility location を Node で検証
       ├─ missing/invalid/stale → capture_environment_unprepared / eligibility_* で即時 skip
       └─ valid allow
            └─ fixed prepared interpreter で producer 起動

producer は marker parse、canonical path、sidecar、duplicate 判定の authority に限定し、eligibility artifact の探索や任意パス解決を担当させるべきではありません。


4. [P0 / Blocker] 共有 producer の変更が Claude capture を壊している

PRは「Claude/Codex が同じ producer を共有する」設計を維持しています。過去の PR #933 は、この producer を exact-byte capture、canonical path、duplicate sidecar、provenance の正本として確立しました。PR #1074 は Claude coordinator の bounded/fail-open 実行を整備しています。

しかし今回、共有 producer に source-bound artifact を必須入力として追加した一方、Claude の production wiring は更新されていません。

Claude settings は Stop / SubagentStop を session_manifest_coordinator.sh に直接渡します。

coordinator は stdin を保存し、その元の payload をそのまま Python producer に渡しています。artifact の生成・探索・payload enrichment はありません。

したがって target Claude SubagentStop は新しい source-bound gate で parser_rejected となり、従来の canonical .txt を生成しません。

この回帰が pytest で見つからない理由は、テスト helper が coordinator 呼び出し前に、production には存在しない eligibility/readiness JSON を作成し、payload に注入しているためです。

これは典型的な test harness repairs production wiring です。

必須修正

設計は二択です。

  • 推奨: eligibility/readiness は Codex adapter の transport gate に置き、共有 producer の既存 semantic contract を変更しない。

  • producer に保持するなら、Claude/Codex の両方に同じ trusted lifecycle を実装し、test helper の enrichment を除去した raw coordinator integration test を追加する。

いずれの場合も、Claude の既存 valid capture fixture を無加工 payload で再実行し、canonical .txt と sidecar 全フィールドを確認する必要があります。


5. [P1 / Blocker] bootstrap は production readiness を準備していない

pnpm bootstrap が実行するスクリプトは、ランダムな invocation ID を作り、次のような JSON を書くだけです。

{
  "invocation_id": "...",
  "requested_at": "...",
  "generated_at": "...",
  "prepared": true,
  "state": "ready"
}

Python の導入、locked dependency group の sync、import yaml、producer import smoke、interpreter realpath/version、uv.lock / .python-version / producer digest の binding はありません。書き込み失敗も catch して、wrote no-op ... と表示したまま exit 0 になります。

また、デフォルトでは将来の marker と無関係な UUID が割り当てられます。これを official hook invocation ID に結び付ける wiring もありません。

その一方、hot path は固定 interpreter ではなく次を実行します。

uv run --locked python3 <producer>

uv の公式仕様では uv run は command 実行前に lock と environment sync を自動実行します。--locked は lockfile 更新を禁止するだけで、sync を禁止しません。sync を止めるオプションは --no-sync です。(Astral Docs)

この project の dev dependency group には pytest、pytest-xdist、ruff があり、uv は dev group をデフォルト sync 対象として扱います。したがって cold hot-path が capture に不要な dev dependencies まで解決する可能性があります。

よって PR 本文の AC8:

unprepared readiness で同期を行わず capture を skip

は成立しません。readiness の判定は Python producer 内なので、判定時点では既に uv run が起動済みです。

必須修正

bootstrap は実際に次を完了してから readiness を atomic write する必要があります。

  1. 対応 Python を確定。

  2. capture 専用の最小 dependency group を locked sync。

  3. producer と PyYAML の import smoke。

  4. fixed interpreter realpath/version を確定。

  5. repo / lock / Python version / producer digest に bind。

  6. failure 時は nonzero exit。虚偽の prepared: true を書かない。

hot path は fixed interpreter を直接実行するか、少なくとも uv run --no-sync と Python download 禁止を使用すべきです。


6. [P1 / Blocker] timeout の hard termination が実証されていない

旧実装から detached: true と負の PID への group signal に変更した方向性自体は妥当です。POSIX では detached child が新しい process group/session の leader になります。(Node.js)

ただし current code は timeout 時に次を行います。

  1. process group に SIGKILL

  2. direct child にも SIGKILL

  3. 直後に promise を capture_timeout で resolve

  4. close を待たない

  5. group または descendants の消滅を確認しない

Node.js の仕様上、signal delivery と process termination は同義ではなく、killed も termination を保証しません。また、単に親を kill しただけでは Linux 上の descendants は終了しません。現在は group kill を使用しているため旧コードより改善していますが、bounded close と liveness verification がない以上、AC6 の hard-bound 証明にはなっていません。(Node.js)

テスト fixture の grandchild は 10 秒後に sentinel を書きますが、テストは約3.5秒で adapter が戻った直後に sentinel 不在を確認するだけです。10秒を超えて待たず、PID も記録せず、child/grandchild の生存も確認していません。孤児が残っていてもテストは PASS します。

必須修正

  • timeout 後に別の短い grace budget で close を待つ。

  • POSIX group が消滅したことを kill(-pgid, 0) 等で確認する。

  • fixture が parent PID / child PID / PGID を private file に記録する。

  • adapter 終了後に両 PID の不存在を確認する。

  • sentinel delay を短くして、その delay を超えて不在を確認する。

  • process が別 session に escape する fixture も扱うか、非対応範囲を明示する。

  • Windows をサポート対象にするなら Job Object / tree-kill abstraction を別途実装する。


7. [P1 / Blocker] merge 後の deploy-main に uv provisioning がない

deploy-pages の pull-request job は、Python/uv setup、uv python install、uv sync --locked --group dev を行った後に pnpm test を実行します。

一方、main push 専用の deploy-main job は Node/pnpm のみを準備し、そのまま同じ pnpm test を実行します。Python/uv setup はありません。

pnpm test は新しい Codex capture Vitest を含み、そのテストは uv を spawn します。したがって main job は runner image に偶然 uv があることへ依存します。PR-triggered deploy-pages success は、条件上 deploy-main を実行していないため、この経路を検証していません。

必須修正

Python/uv provisioning を reusable local action に統一し、少なくとも次の両方から呼ぶべきです。

deploy-main
deploy-pr

あるいは Python-backed hook integration test を generic pnpm test から明示的な runtime job に分離し、required check として固定します。


8. [P2 / High] test-only executable seam が production から隔離されていない

test override の可否は次だけで決まります。

process.env.NODE_ENV === 'test'

NODE_ENV は production caller も設定可能な通常の環境変数です。この状態で CODEX_SCOPE_ROLLUP_CAPTURE_SCRIPT が repository fixture directory 内を指すと、canonical producer 以外の fixture が実行されます。

現在の AC9 test は NODE_ENV=production のとき override が無視されることを確認しているだけで、production hook entrypoint から NODE_ENV=test を設定できないことは保証していません。

test injection は mutable environment ではなく、export されない関数への dependency injection、または別 test harness entrypoint に分離すべきです。


テスト・証跡上の追加問題

AC11 test は adapter file の存在を確認した後、固定文字列が自分自身を含むことを検査しているだけです。

expect('adapter path verified').toContain('adapter path verified')

これは runtime-active / trust を主張しないことの executable assertion ではありません。

valid capture test も canonical .txt の内容・mode・sidecar件数は確認しますが、Issue AC3 が求める以下の整合性を十分に検査していません。

  • capture_status

  • parser_status

  • routing_action

  • capture_sha256

  • invocation_id

  • agent_type

  • capture_source

  • artifact binding provenance

さらに PR 本文の runtime evidence は implementation HEAD 1ea8e111... を記載している一方、current HEAD は 4e8d6d... です。以前の限定 waiver / approval も reviewed head 6c1e9973... に bind されています。current-head workflow は緑ですが、過去 approval と runtime artifact は現行HEADへ自動的には継承できません。 (GitHub)


関連資産を踏まえた設計判断

関連PRの既存境界は一貫しています。

今回の実装は、eligibility・readiness・transport responsibility を producer に混在させたことで、この境界を崩しています。producer は artifact content authority に留め、起動可否、runtime readiness、fixed interpreter、timeout supervision は adapter/coordinator transport layerで所有する方が既存設計と整合します。


最小限必要な再設計

bootstrap / session start
  ├─ runtime-safety verifier
  │    └─ strict eligibility artifact
  ├─ locked capture runtime preparation
  │    └─ fixed interpreter + import smoke
  └─ strict readiness artifact
        ├─ repo/head/policy/lock/interpreter/producer binding
        └─ atomic 0600 write

SubagentStop hot path
├─ adapter が Node-only で artifact 2件を検証
├─ invalid/missing/stale
│ └─ fixed reason で即時 skip、manifest flow 継続
└─ valid allow
├─ fixed interpreter を直接 spawn
├─ bounded process-group supervision
└─ Python producer
├─ marker parse
├─ canonical txt write
├─ duplicate/stale semantics
└─ complete sidecar provenance

必要な regression matrix は以下です。

  • official Codex wireそのもの

  • raw Claude coordinator payload

  • forged inline artifact

  • arbitrary path / symlink / wrong owner / wrong mode

  • wrong repo / HEAD / policy / secret-policy digest

  • expired / future-dated / replay artifact

  • bootstrap failureの nonzero

  • cold environmentで producerを起動しないこと

  • uv が PATH に存在しない unprepared case

  • child/grandchild PID termination

  • late sentinel delay経過後の不在

  • main push workflow相当の clean runner

review_verdict:
reviewed_head: 4e8d6d754215ada16460bbe291a3b6817c912da1
verdict: REQUEST_CHANGES
current_pr_ci: success
merge_blockers:
- eligibility authority and binding are not implemented
- eligibility timestamp lifecycle is reversed
- live Codex valid-capture path is not wired
- shared producer regresses Claude capture
- bootstrap/readiness and no-sync contract are not implemented
- process-tree hard termination is not proven
- deploy-main runtime dependency is undeclared

フルテストスイートのローカル再実行は行っていません。current-head GitHub workflow successを確認し、上記は現行差分・実配線・テスト helper・公式 Codex source・Node.js 22・uv の一次資料を突き合わせて判定しています。特に P0 の4件と uv --locked の問題は、環境依存の再現を必要としないコード/契約上の矛盾です。

# 敵対的レビュー結果

Verdict: REQUEST_CHANGES

レビュー対象は current HEAD 4e8d6d754215ada16460bbe291a3b6817c912da1、16 files / +949 -16 です。PR-triggered workflow は ci、deploy-pages、check-hook-integrity 等を含めて成功しています。したがって、以下は単なる CI failure ではなく、テストが誤った契約を検証していること、または production wiring を通っていないことによる false green です。

優先度 判定 指摘
P0 Blocker source-bound eligibility が authority ではなく、任意 payload による自己申告になっている
P0 Blocker 正しい事前生成 lifecycle を timestamp 判定が必ず拒否する
P0 Blocker live Codex の成功経路が配線されておらず、AC1 と逆に missing 時も producer を起動する
P0 Blocker 共有 Python producer の変更により Claude capture を回帰させ、テスト helper が回帰を隠している
P1 Blocker bootstrap は runtime を準備せず、uv run --locked は hot path で sync し得る
P1 Blocker timeout の process-tree termination と late-write 不在が実証されていない
P1 Blocker deploy-main だけ uv provisioning がなく、merge 後の配布経路が非再現的
P2 High test-only seam が mutable environment で有効化でき、production から隔離されていない
P2 High AC11 test、sidecar assertions、current-head evidence に有意な検証不足がある

1. [P0 / Blocker] source-bound eligibility が実質的な自己申告

Issue #1527 の現行契約は、eligibility artifact の authority を runtime safety verifier とし、少なくとも次の情報への binding を要求しています。

  • repo root
  • HEAD または policy digest
  • secret-policy digest
  • public checkpoint / visibility 判定
  • secrets_mode
  • 生成時刻・有効期限
  • atomic private write と検証可能な schema

また、missing / invalid / stale / binding mismatch では producer を起動しない契約です。

ところが producer は、hook payload 内の次の値をそのまま eligibility authority として受理します。

  • top-level の inline object
  • 任意のファイルパス
  • source_bound / source_bound_artifacts 以下の object
  • artifacts 配列内で kind 等が部分一致する object

パスの固定、repo confinement、owner、mode、symlink、artifact schema、digest の検証もありません。

実際に検証しているのは、概ね以下だけです。

  • invocation_id
  • optional な transcript path
  • readiness の prepared / ready らしき値
  • 数個の timestamp の相対比較

prepared: "yes"、state: "prepared" のような文字列まで許可しています。一方で、契約上重要な repo / HEAD / policy / secret-policy / public checkpoint / visibility / secrets_mode / expiry は一切参照していません。

したがって、現在の「valid artifact」は eligibility attestation ではありません。同じ hook caller が、例えば次のような inline object を追加するだけで通過可能です。

{
  "source_bound_eligibility": {
    "invocation_id": "expected-id",
    "requested_at": "...",
    "generated_at": "future timestamp"
  },
  "source_bound_readiness": {
    "invocation_id": "expected-id",
    "generated_at": "later future timestamp",
    "prepared": true
  }
}

これは source-bound ではなく、decision input と authority が同じ payload にある自己申告です。特に official hook wire にない project-specific key を信頼するため、以前の blocker を別形式で再導入しています。

必須修正

eligibility は以下の境界に移す必要があります。

  1. .claude/scripts/check_session_recording_runtime_safety.py が strict schema の artifact を固定 private location に生成する。
  2. adapter が producer 起動前にその固定 location を検証する。
  3. inline object、任意 payload path、fuzzy artifact selection は廃止する。
  4. additionalProperties: false、artifact type/version、repo realpath、HEAD/policy/secret-policy digest、安全判定、generated_at、expires_at を必須化する。
  5. mode 0600、owner、regular file、no-symlink、サイズ上限を確認する。
  6. artifact digest と検証結果を sidecar provenance に記録する。

2. [P0 / Blocker] timestamp 判定が正しい lifecycle と逆向き

producer は eligibility artifact について、次の両方を要求しています。

eligibility.generated_at > marker.requested_at
eligibility.generated_at > marker.generated_at

すなわち、capture 対象の final response が生成された後に eligibility artifact が生成されていなければならないという判定です。

しかし Issue の契約は、eligibility を session start / bootstrap 等で事前生成し、producer 起動可否を決める authority としています。したがって、契約どおりの artifact は marker より古くなり、現在の producerには必ず eligibility_stale として拒否されます。

テストはこの矛盾を、次の人工的な時刻順序で隠しています。

marker generated_at      12:00:01
eligibility generated_at 12:00:02
readiness generated_at   12:00:03

つまりテスト helper が final response の後に artifact を捏造しており、production lifecycle の証明になっていません。

さらに current time と expires_at を検証していないため、未来時刻の artifact は事実上無期限に replay できます。

必須修正

時刻関係は少なくとも次であるべきです。

eligibility.generated_at <= hook_received_at
eligibility.generated_at <= marker.generated_at
hook_received_at < eligibility.expires_at
readiness.generated_at <= hook_received_at

時刻だけでなく、session ID、repo、HEAD / policy digest によって replay scope を閉じる必要があります。


3. [P0 / Blocker] live Codex の成功経路が存在しない

公式 Codex の current SubagentStop serializer が hook command に渡すのは、session/turn ID、transcript paths、cwd、event name、model、permission mode、stop state、agent ID/type、final message 等です。source-bound artifact path や project-specific safety field は含まれません。

リポジトリ側の wiring も、.codex/hooks.json から composite を直接起動し、composite は adapter を import するだけです。artifact path を付加する lifecycle はありません。

それにもかかわらず adapter の capture eligibility は、実質的に次だけです。

eventName === 'SubagentStop'
payload.stop_hook_active !== true

その後、artifact missing を adapter で判定せず、常に uv と Python producer を起動します。

Issue AC1 は、valid artifact がない official-wire-equivalent payload について、capture を起動せず固定 skip reason を返すことを要求しています。現在のテストは逆に、producer を起動して parser_rejected sidecar が生成されることを PASS 条件にしています。

この違いは重要です。現在の経路では artifact がない cold environment でも、先に uv run が環境解決・sync を開始してしまいます。

必須修正

adapter 内で、Python を起動する前に以下を行う必要があります。

official payload
  └─ fixed eligibility location を Node で検証
       ├─ missing/invalid/stale → capture_environment_unprepared / eligibility_* で即時 skip
       └─ valid allow
            └─ fixed prepared interpreter で producer 起動

producer は marker parse、canonical path、sidecar、duplicate 判定の authority に限定し、eligibility artifact の探索や任意パス解決を担当させるべきではありません。


4. [P0 / Blocker] 共有 producer の変更が Claude capture を壊している

PRは「Claude/Codex が同じ producer を共有する」設計を維持しています。過去の PR #933 は、この producer を exact-byte capture、canonical path、duplicate sidecar、provenance の正本として確立しました。PR #1074 は Claude coordinator の bounded/fail-open 実行を整備しています。

しかし今回、共有 producer に source-bound artifact を必須入力として追加した一方、Claude の production wiring は更新されていません。

Claude settings は Stop / SubagentStop を session_manifest_coordinator.sh に直接渡します。

coordinator は stdin を保存し、その元の payload をそのまま Python producer に渡しています。artifact の生成・探索・payload enrichment はありません。

したがって target Claude SubagentStop は新しい source-bound gate で parser_rejected となり、従来の canonical .txt を生成しません。

この回帰が pytest で見つからない理由は、テスト helper が coordinator 呼び出し前に、production には存在しない eligibility/readiness JSON を作成し、payload に注入しているためです。

これは典型的な test harness repairs production wiring です。

必須修正

設計は二択です。

  • 推奨: eligibility/readiness は Codex adapter の transport gate に置き、共有 producer の既存 semantic contract を変更しない。
  • producer に保持するなら、Claude/Codex の両方に同じ trusted lifecycle を実装し、test helper の enrichment を除去した raw coordinator integration test を追加する。

いずれの場合も、Claude の既存 valid capture fixture を無加工 payload で再実行し、canonical .txt と sidecar 全フィールドを確認する必要があります。


5. [P1 / Blocker] bootstrap は production readiness を準備していない

pnpm bootstrap が実行するスクリプトは、ランダムな invocation ID を作り、次のような JSON を書くだけです。

{
  "invocation_id": "...",
  "requested_at": "...",
  "generated_at": "...",
  "prepared": true,
  "state": "ready"
}

Python の導入、locked dependency group の sync、import yaml、producer import smoke、interpreter realpath/version、uv.lock / .python-version / producer digest の binding はありません。書き込み失敗も catch して、wrote no-op ... と表示したまま exit 0 になります。

また、デフォルトでは将来の marker と無関係な UUID が割り当てられます。これを official hook invocation ID に結び付ける wiring もありません。

その一方、hot path は固定 interpreter ではなく次を実行します。

uv run --locked python3 <producer>

uv の公式仕様では uv run は command 実行前に lock と environment sync を自動実行します。--locked は lockfile 更新を禁止するだけで、sync を禁止しません。sync を止めるオプションは --no-sync です。([Astral Docs]1)

この project の dev dependency group には pytest、pytest-xdist、ruff があり、uv は dev group をデフォルト sync 対象として扱います。したがって cold hot-path が capture に不要な dev dependencies まで解決する可能性があります。

よって PR 本文の AC8:

unprepared readiness で同期を行わず capture を skip

は成立しません。readiness の判定は Python producer 内なので、判定時点では既に uv run が起動済みです。

必須修正

bootstrap は実際に次を完了してから readiness を atomic write する必要があります。

  1. 対応 Python を確定。
  2. capture 専用の最小 dependency group を locked sync。
  3. producer と PyYAML の import smoke。
  4. fixed interpreter realpath/version を確定。
  5. repo / lock / Python version / producer digest に bind。
  6. failure 時は nonzero exit。虚偽の prepared: true を書かない。

hot path は fixed interpreter を直接実行するか、少なくとも uv run --no-sync と Python download 禁止を使用すべきです。


6. [P1 / Blocker] timeout の hard termination が実証されていない

旧実装から detached: true と負の PID への group signal に変更した方向性自体は妥当です。POSIX では detached child が新しい process group/session の leader になります。([Node.js]2)

ただし current code は timeout 時に次を行います。

  1. process group に SIGKILL
  2. direct child にも SIGKILL
  3. 直後に promise を capture_timeout で resolve
  4. close を待たない
  5. group または descendants の消滅を確認しない

Node.js の仕様上、signal delivery と process termination は同義ではなく、killed も termination を保証しません。また、単に親を kill しただけでは Linux 上の descendants は終了しません。現在は group kill を使用しているため旧コードより改善していますが、bounded close と liveness verification がない以上、AC6 の hard-bound 証明にはなっていません。([Node.js]2)

テスト fixture の grandchild は 10 秒後に sentinel を書きますが、テストは約3.5秒で adapter が戻った直後に sentinel 不在を確認するだけです。10秒を超えて待たず、PID も記録せず、child/grandchild の生存も確認していません。孤児が残っていてもテストは PASS します。

必須修正

  • timeout 後に別の短い grace budget で close を待つ。
  • POSIX group が消滅したことを kill(-pgid, 0) 等で確認する。
  • fixture が parent PID / child PID / PGID を private file に記録する。
  • adapter 終了後に両 PID の不存在を確認する。
  • sentinel delay を短くして、その delay を超えて不在を確認する。
  • process が別 session に escape する fixture も扱うか、非対応範囲を明示する。
  • Windows をサポート対象にするなら Job Object / tree-kill abstraction を別途実装する。

7. [P1 / Blocker] merge 後の deploy-main に uv provisioning がない

deploy-pages の pull-request job は、Python/uv setup、uv python install、uv sync --locked --group dev を行った後に pnpm test を実行します。

一方、main push 専用の deploy-main job は Node/pnpm のみを準備し、そのまま同じ pnpm test を実行します。Python/uv setup はありません。

pnpm test は新しい Codex capture Vitest を含み、そのテストは uv を spawn します。したがって main job は runner image に偶然 uv があることへ依存します。PR-triggered deploy-pages success は、条件上 deploy-main を実行していないため、この経路を検証していません。

必須修正

Python/uv provisioning を reusable local action に統一し、少なくとも次の両方から呼ぶべきです。

deploy-main
deploy-pr

あるいは Python-backed hook integration test を generic pnpm test から明示的な runtime job に分離し、required check として固定します。


8. [P2 / High] test-only executable seam が production から隔離されていない

test override の可否は次だけで決まります。

process.env.NODE_ENV === 'test'

NODE_ENV は production caller も設定可能な通常の環境変数です。この状態で CODEX_SCOPE_ROLLUP_CAPTURE_SCRIPT が repository fixture directory 内を指すと、canonical producer 以外の fixture が実行されます。

現在の AC9 test は NODE_ENV=production のとき override が無視されることを確認しているだけで、production hook entrypoint から NODE_ENV=test を設定できないことは保証していません。

test injection は mutable environment ではなく、export されない関数への dependency injection、または別 test harness entrypoint に分離すべきです。


テスト・証跡上の追加問題

AC11 test は adapter file の存在を確認した後、固定文字列が自分自身を含むことを検査しているだけです。

expect('adapter path verified').toContain('adapter path verified')

これは runtime-active / trust を主張しないことの executable assertion ではありません。

valid capture test も canonical .txt の内容・mode・sidecar件数は確認しますが、Issue AC3 が求める以下の整合性を十分に検査していません。

  • capture_status
  • parser_status
  • routing_action
  • capture_sha256
  • invocation_id
  • agent_type
  • capture_source
  • artifact binding provenance

さらに PR 本文の runtime evidence は implementation HEAD 1ea8e111... を記載している一方、current HEAD は 4e8d6d... です。以前の限定 waiver / approval も reviewed head 6c1e9973... に bind されています。current-head workflow は緑ですが、過去 approval と runtime artifact は現行HEADへ自動的には継承できません。 ([GitHub]3)


関連資産を踏まえた設計判断

関連PRの既存境界は一貫しています。

今回の実装は、eligibility・readiness・transport responsibility を producer に混在させたことで、この境界を崩しています。producer は artifact content authority に留め、起動可否、runtime readiness、fixed interpreter、timeout supervision は adapter/coordinator transport layerで所有する方が既存設計と整合します。


最小限必要な再設計

bootstrap / session start
  ├─ runtime-safety verifier
  │    └─ strict eligibility artifact
  ├─ locked capture runtime preparation
  │    └─ fixed interpreter + import smoke
  └─ strict readiness artifact
        ├─ repo/head/policy/lock/interpreter/producer binding
        └─ atomic 0600 write

SubagentStop hot path
  ├─ adapter が Node-only で artifact 2件を検証
  ├─ invalid/missing/stale
  │    └─ fixed reason で即時 skip、manifest flow 継続
  └─ valid allow
       ├─ fixed interpreter を直接 spawn
       ├─ bounded process-group supervision
       └─ Python producer
            ├─ marker parse
            ├─ canonical txt write
            ├─ duplicate/stale semantics
            └─ complete sidecar provenance

必要な regression matrix は以下です。

  • official Codex wireそのもの
  • raw Claude coordinator payload
  • forged inline artifact
  • arbitrary path / symlink / wrong owner / wrong mode
  • wrong repo / HEAD / policy / secret-policy digest
  • expired / future-dated / replay artifact
  • bootstrap failureの nonzero
  • cold environmentで producerを起動しないこと
  • uv が PATH に存在しない unprepared case
  • child/grandchild PID termination
  • late sentinel delay経過後の不在
  • main push workflow相当の clean runner
review_verdict:
  reviewed_head: 4e8d6d754215ada16460bbe291a3b6817c912da1
  verdict: REQUEST_CHANGES
  current_pr_ci: success
  merge_blockers:
    - eligibility authority and binding are not implemented
    - eligibility timestamp lifecycle is reversed
    - live Codex valid-capture path is not wired
    - shared producer regresses Claude capture
    - bootstrap/readiness and no-sync contract are not implemented
    - process-tree hard termination is not proven
    - deploy-main runtime dependency is undeclared

フルテストスイートのローカル再実行は行っていません。current-head GitHub workflow successを確認し、上記は現行差分・実配線・テスト helper・公式 Codex source・Node.js 22・uv の一次資料を突き合わせて判定しています。特に P0 の4件と uv --locked の問題は、環境依存の再現を必要としないコード/契約上の矛盾です。

…odex-subagentstop-scope-rollup-capture

# Conflicts:
#	package.json
squne121 and others added 3 commits July 20, 2026 20:38
PR #1534 の敵対的レビュー(#1534 issuecomment-5010193289)で確認された P0/P1
blocker に対応する。eligibility/readiness の受理経路を hook payload 由来の
inline object・任意パス・artifacts[] fuzzy-match から、
.claude/scripts/check_session_recording_runtime_safety.py と
scripts/session-recording/bootstrap-source-bound-readiness.mjs が書く固定
private location のみに限定した。timestamp lifecycle を事前生成が正となる
方向に是正し、sidecar provenance に artifact digest と検証結果を記録する。
Codex adapter は Node のみで pre-spawn gate を行い、無効な場合は producer を
一切起動しない。Claude session_manifest_coordinator.sh の raw payload 経路は
ゲート env 未設定のため無回帰。process-tree timeout は bounded grace + pgid
liveness 確認を追加し、bootstrap は locked sync・import smoke・producer
py_compile を実際に完了してから readiness artifact を書く。deploy-pages.yml
の deploy-main に deploy-pr と同等の uv/python provisioning を追加した。
- package.json: session-recording:capture-hot-path-check に --locked を追加し governed Python invocation policy(#1193)違反を解消
- docs/dev/session-recording-policy.md: 見出し日本語比率不足を是正(PR Body Japanese Check FAIL の原因ブロック)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: Codex の SubagentStop scope-rollup capture を復旧する

1 participant