Skip to content

実装: test_stop_event_scrubs_producer_failure_stderr が実際の失敗 producer を起動するよう修正する #1435

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #1421 (Closes #1420) 外部アドバーサリアルレビュー P2 #4 (https://github.com/squne121/loop-protocol/pull/1421#issuecomment-4940413442): test_stop_event_scrubs_producer_failure_stderr が producer path の repoRoot 制約により実際に失敗 producer を起動せず vacuous test になっている問題を解消する"
change_kind: code

Parent Issue

none(単独改善)

Parent Goal Ref

Current Validated Scope

  • scripts/session-recording/codex-hook-adapter.mjs の producer path 解決ロジック(configuredProducerScript / producerScript)を、テストから安全に override 可能な形へ調整する(必要な場合のみ)
  • tests/session_recording/codex/test_hook_adapter.py の test_stop_event_scrubs_producer_failure_stderr を、実際に失敗 producer が起動される形に修正する

Remaining Parent Gaps

なし

Outcome

tests/session_recording/codex/test_hook_adapter.py::test_stop_event_scrubs_producer_failure_stderr が、機密値を stderr に書き出して exit 1 する producer を実際に起動した上で、その stderr に機密値が含まれないことを検証する状態になり、pytest で PASS していること。

In Scope

  • codex-hook-adapter.mjs の producer path 解決ロジックを、テストから安全に override できるよう調整する(無条件の任意パス実行にはしない。CODEX_HOOK_MANIFEST_ROOT の realpath 検証パターンを参考に、許可された base 配下であることを検証してから override を受け付ける。実装には fs.realpathSync 等の realpath 検証を用いる)
  • test_stop_event_scrubs_producer_failure_stderr を、実際に起動された producer の stderr を検証する形に書き換える
  • producer が実際に起動されたことを独立して確認するアサーションを追加する(producer 由来の副作用の確認等)

Out of Scope

  • codex-hook-adapter.mjs のガード判定ロジック(evaluateGuard 等)自体の変更
  • write-codex-session-manifest.mjs の symlink traversal ガード(別 Issue の対象)
  • docs/dev/test-lane-policy.md 等の CI lane ドキュメント更新(別 Issue の対象)

Acceptance Criteria

  • AC1: test_stop_event_scrubs_producer_failure_stderr で使用する producer が実際に起動されたことを、テスト内で決定論的に確認できる(producer 由来の副作用の存在確認等、実行有無を証明できるアサーションを含む)
  • AC2: producer path override の受け渡し方法が、任意の外部パスを無条件実行しない安全な形になっている(fs.realpathSync 等を用いた realpath/allowlist 検証を codex-hook-adapter.mjs に実装する)
  • AC3: 修正後の test_stop_event_scrubs_producer_failure_stderr が pytest で PASS し、機密値(/home/leak/project / sk-test-123 / producer のフルパス)が stderr に含まれないことを引き続き検証している
  • AC4: tests/session_recording/codex/test_hook_adapter.py の他の既存テストが破壊されていない(全件 PASS)

Verification Commands

# AC1
$ uv run --locked python3 -m pytest tests/session_recording/codex/test_hook_adapter.py::test_stop_event_scrubs_producer_failure_stderr -v

# AC2
$ rg -c "realpathSync" scripts/session-recording/codex-hook-adapter.mjs

# AC3
$ uv run --locked python3 -m pytest tests/session_recording/codex/test_hook_adapter.py::test_stop_event_scrubs_producer_failure_stderr -v

# AC4
$ uv run --locked python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -v

Allowed Paths

  • scripts/session-recording/codex-hook-adapter.mjs
  • tests/session_recording/codex/test_hook_adapter.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • producer path override の安全化が CODEX_HOOK_MANIFEST_ROOT パターンに準拠できず、無条件の任意パス実行を許容しないと実現できないと判明した場合

Required Skills

  • Node.js(child_process / ESM モジュール)
  • pytest subprocess ベースの結合テスト

Required Design References

  • scripts/session-recording/codex-hook-adapter.mjs(CODEX_HOOK_MANIFEST_ROOT realpath 検証パターンの参照元)
  • docs/dev/secret-policy.md

Scope Delta(該当時のみ記載)

N/A

Notes for Reviewer

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions