Repository navigation
Open
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
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: codeParent Issue
none(単独改善)
Parent Goal Ref
- Goal: PR fix: MANIFEST_ROOT を xdist 並列実行から分離する #1421 の外部アドバーサリアルレビューで指摘された stderr redaction テストの実効性欠如を解消する
- Desired Destination: N/A(単独 follow-up のため parent なし)
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 -vAllowed 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
- 本 Issue は PR fix: MANIFEST_ROOT を xdist 並列実行から分離する #1421(Closes 実装: test_hook_adapter.py の共有 MANIFEST_ROOT を xdist 並列実行から分離する #1420)マージ後の post-merge-cleanup で発見された follow-up 候補です。由来: PR fix: MANIFEST_ROOT を xdist 並列実行から分離する #1421 外部アドバーサリアルレビュー P2 Issue駆動実装 skill と workflow 文書を整備する #4(https://github.com/squne121/loop-protocol/pull/1421#issuecomment-4940413442)。
- dedupe_key: follow-up:squne121/loop-protocol:pr/1421:stderr-redaction-test
- 重複チェック(gh issue list --search)は起票前に control-plane 側で実施済みで、重複 OPEN Issue は確認されていません。
- 本 Issue と別 follow-up(symlink negative test / relativePath 統一)はいずれも tests/session_recording/codex/test_hook_adapter.py を Allowed Paths に含む。マージコンフリクト回避のため、両 Issue の実装 PR は同時並行で進めず、直列(順次マージ)で処理することを推奨する。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity