Skip to content

実装: test_hook_adapter.py の共有 MANIFEST_ROOT を xdist 並列実行から分離する #1420

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "tests/session_recording/codex/test_hook_adapter.py の共有マニフェストパスをテスト間で分離し、Node-backed hook tests を並列 pytest 実行下でも決定論的に PASS させる"
change_kind: code

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: N/A(単独改善のため親 Issue なし)
  • Desired Destination: N/A

Current Validated Scope

  • scripts/session-recording/write-codex-session-manifest.mjs の writeCodexSessionManifest にマニフェスト書き込み先ディレクトリの override 経路を追加する
  • scripts/session-recording/codex-hook-adapter.mjs の runManifestFlow が環境変数からマニフェストルートの override を読み取り writeCodexSessionManifest に渡す
  • tests/session_recording/codex/test_hook_adapter.py が各テストで pytest の tmp_path を使い、上記 override 経由でテスト固有のマニフェストディレクトリを adapter サブプロセスに渡す
  • .github/workflows/ci.yml の node-backed-hook-tests job に tests/session_recording/codex/test_hook_adapter.py を実行する専用 step を追加し、.github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes にそのカバレッジ提供元を登録して、CI の ci_test_selection/v1 G1 gate(uncovered changed test file 検出)を満たす

Remaining Parent Gaps

なし

Outcome

scripts/session-recording/write-codex-session-manifest.mjs と scripts/session-recording/codex-hook-adapter.mjs にマニフェスト書き込み先の override 経路が追加され、tests/session_recording/codex/test_hook_adapter.py の各テストがリポジトリ共有の tmp/session-manifests/codex/ ではなくテスト固有の一時ディレクトリを使うよう更新され、python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -n4 を含む並列 pytest 実行でも 36 件全てが安定して PASS し、かつ .github/workflows/ci.yml の node-backed-hook-tests job(pnpm install 済みで Node 実行環境を持つ job)で tests/session_recording/codex/test_hook_adapter.py が実行され、CI の python-test / node-backed-hook-tests 両 job の ci_test_selection/v1 G1 gate(uncovered changed test file 検出)が実行証跡(collect-only の実 nodeid)で通り、manifestRoot override が realpath 検証済みで symlink・許可外パスへの書き込みを拒否し、evidence_ref が実際の書き込み先を反映し、CI が xdist 並列実行で元の競合を回帰検査し、環境変数未設定時のフォールバック挙動もテストされている状態。

In Scope

  • write-codex-session-manifest.mjs の writeCodexSessionManifest に manifestRoot(または同等の)オプション引数を追加し、指定時はそのディレクトリ配下に書き込む
  • codex-hook-adapter.mjs の runManifestFlow / produceManifest 呼び出し経路で、環境変数(例: CODEX_HOOK_MANIFEST_ROOT)が設定されている場合にそれを writeCodexSessionManifest の override として渡す。未設定時は既存の repoRoot ベースの既定パスを維持し、本番の hook 実行経路の挙動を変えない
  • tests/session_recording/codex/test_hook_adapter.py の setup_function によるグローバル MANIFEST_ROOT(REPO_ROOT/tmp/session-manifests/codex)への shutil.rmtree を削除し、各テストが tmp_path fixture 由来のテスト固有ディレクトリを run_adapter の env 引数(既存の env=None パラメータ)経由で adapter サブプロセスに渡すよう更新する
  • 上記変更後、test_positive_fixture_writes_private_manifest_and_returns_continue_true 等マニフェストファイル件数を検査するテストが、他テストの並行書き込み・削除と無関係に自テスト専用ディレクトリのみを検査するようにする
  • .github/workflows/ci.yml の node-backed-hook-tests job に、既存の pytest node-backed hook tests step とは独立した新規 step(tests/session_recording/codex/test_hook_adapter.py -p no:xdist を実行)を追加する。既存の固定 2 nodeid(.claude/hooks/tests/test_generate_session_manifest_from_hook.py の 2 テスト)の disjointness / exact-match invariant には触れない
  • .github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes に provider_job: node-backed-hook-tests / paths: ["tests/session_recording/codex/test_hook_adapter.py"] の新規エントリを追加し、generate_ci_test_selection_artifact.py の G1 gate(uncovered_changed_test_files)でこの PR の変更差分が uncovered と判定されないようにする(targets 配列には追加しない。python-test job は pnpm install を実行しないため、この Node-backed hook test を targets に入れると node_modules 欠如で壊れる)
  • .github/workflows/ci.yml の node-backed hook selection artifact 生成 step(--collect-only を実行する箇所)が tests/session_recording/codex/test_hook_adapter.py の実 nodeid も収集するよう対象を拡張し、secondary_coverage.dedicated_lanes の宣言だけに依存せず実行証跡(collected nodeids)で uncovered 判定を回避する。これに伴い、既存の「固定 2 nodeid のみ」という invariant アサーションは、その 2 nodeid のサブセットに対してのみ適用されるよう限定し、job 全体の不変条件としては扱わない
  • write-codex-session-manifest.mjs に manifestRoot override の検証(realpathSync を用いた symlink 拒否・許可パス外拒否)を追加する
  • codex-hook-adapter.mjs の evidence_ref を、書き込み前に固定生成した文字列ではなく writeCodexSessionManifest の戻り値(実際の書き込み先)から構築するよう修正する
  • .github/workflows/ci.yml の node-backed-hook-tests job に tests/session_recording/codex/test_hook_adapter.py を -n 4 --dist load で実行する step を追加する(既存の -p no:xdist シリアル step は維持してよい)
  • test_hook_adapter.py に環境変数未設定時の既定パスへの書き込みを検証するテストを追加する

Out of Scope

  • scripts/agent-guards/git_mutation_command_policy.py や publish lane 関連の変更(Issue 実装: PreToolUse remote_write_requires_approval を publish lane 証跡で通過可能にする #1408 のスコープ)
  • tests/session_recording/codex/test_metrics_and_secret_scan.py を CI 実行対象へ追加すること(本 Issue で変更しないファイルのため)
  • .github/ci/python-test-plan.json の targets 配列への追加(python-test job には node 実行環境が無いため不採用)
  • docs/dev/test-lane-policy.md の Node-backed hook tests 定義そのものの見直し(follow-up Issue で対応)
  • manifest の内容・schema(schemas/agent-session-manifest 相当)の変更
  • runManifestFlow / writeCodexSessionManifest の依存性注入(DI)への全面リファクタリング(CODEX_HOOK_MANIFEST_ROOT 環境変数を廃止し producer/writer を注入可能にする設計変更)。本 Issue では env var を維持しつつ realpath 検証で安全化する最小修正を採用する
  • test_stop_event_scrubs_producer_failure_stderr の producer path fallback ロジック見直し(実際の失敗 producer を起動させる修正、follow-up Issue で対応)

Acceptance Criteria

  • AC1: writeCodexSessionManifest が override 引数を受け取った場合、そのディレクトリ配下(<override>/<eventName>/)にマニフェストを書き込む
  • AC2: codex-hook-adapter.mjs が環境変数 CODEX_HOOK_MANIFEST_ROOT 未設定時は既存の repoRoot ベースの tmp/session-manifests/codex/<event>/ に書き込む(後方互換維持)
  • AC3: test_hook_adapter.py の各テストが tmp_path 由来のテスト固有ディレクトリを使い、setup_function のグローバル MANIFEST_ROOT への shutil.rmtree 呼び出しが削除されている
  • AC4: python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -n4 が 36 件全て PASS する
  • AC5: python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -p no:xdist が 36 件全て PASS する(既存のシリアル実行の回帰なし)
  • AC6: .github/workflows/ci.yml の node-backed-hook-tests job で tests/session_recording/codex/test_hook_adapter.py を実行する step が存在する
  • AC7: .github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes に provider_job: node-backed-hook-tests のエントリが追加され、tests/session_recording/codex/test_hook_adapter.py がその paths に含まれる(targets 配列への追加ではない)
  • AC8: .github/workflows/ci.yml の「node-backed hook selection artifact」生成 step(--collect-only)が tests/session_recording/codex/test_hook_adapter.py の実 nodeid を収集対象に含み、宣言(secondary_coverage.dedicated_lanes)だけに依存せず実行証跡で uncovered 判定を回避する
  • AC9: write-codex-session-manifest.mjs が manifestRoot override を realpathSync 等で検証し、symlink 経由や許可外ディレクトリへの書き込みを拒否する
  • AC10: codex-hook-adapter.mjs が writeCodexSessionManifest の戻り値を manifestWriteResult という変数名で受け取り、manifest.secret_policy.runtime_boundary.evidence_ref を manifestWriteResult.relativePath(実際の書き込み先)から再構築する。書き込み前に固定生成された evidenceSourceRef 文字列をそのまま evidence_ref に使わない
  • AC11: .github/workflows/ci.yml の node-backed-hook-tests job が tests/session_recording/codex/test_hook_adapter.py を --dist load を用いた xdist 並列実行で回帰検査する(-p no:xdist のシリアル実行のみに依存しない)
  • AC12: test_hook_adapter.py に、CODEX_HOOK_MANIFEST_ROOT 環境変数が未設定の場合にマニフェストが既定パス(<repoRoot>/tmp/session-manifests/codex/<event>/)へ書き込まれることを検証するテスト(test_manifest_written_to_default_root_when_env_unset)が存在する

Verification Commands

# baseline-expect: fail
$ rg -n "manifestRoot" scripts/session-recording/write-codex-session-manifest.mjs # AC1
# baseline-expect: fail
$ rg -n "CODEX_HOOK_MANIFEST_ROOT" scripts/session-recording/codex-hook-adapter.mjs # AC2
# baseline-expect: pass
$ rg -c "shutil.rmtree\(MANIFEST_ROOT" tests/session_recording/codex/test_hook_adapter.py # AC3
# baseline-expect: deferred
$ python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -n4 # AC4
# baseline-expect: pass
$ python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -p no:xdist # AC5
# baseline-expect: fail
$ rg -n "tests/session_recording/codex/test_hook_adapter.py" .github/workflows/ci.yml # AC6
# baseline-expect: fail
$ rg -n "\"provider_job\": \"node-backed-hook-tests\"" .github/ci/python-test-plan.json # AC7
# baseline-expect: deferred
$ rg -U "collect-only.{0,400}test_hook_adapter" .github/workflows/ci.yml # AC8
# baseline-expect: fail
$ rg -n "realpathSync" scripts/session-recording/write-codex-session-manifest.mjs # AC9
# baseline-expect: fail
$ rg -n "manifestWriteResult.relativePath" scripts/session-recording/codex-hook-adapter.mjs # AC10
# baseline-expect: fail
$ rg -n "dist load" .github/workflows/ci.yml # AC11
# baseline-expect: fail
$ rg -n "test_manifest_written_to_default_root_when_env_unset" tests/session_recording/codex/test_hook_adapter.py # AC12

Allowed Paths

  • scripts/session-recording/write-codex-session-manifest.mjs
  • scripts/session-recording/codex-hook-adapter.mjs
  • tests/session_recording/codex/test_hook_adapter.py
  • .github/ci/python-test-plan.json
  • .github/workflows/ci.yml

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Node.js(node:fs / node:path を使うマニフェスト書き込みロジック)
  • Python / pytest(tmp_path fixture、subprocess.run の env 引数)

Required Design References

  • docs/dev/test-lane-policy.md(Node-backed hook tests のレーン定義)
  • .claude/skills/ci-test-performance/SKILL.md(xdist worker 間の fixture scope / 非決定性に関する注意)

Delivery Rule

  • 1 Issue = 1 PR
  • Dedicated worktree を作成して実装する
  • Draft PR 既定

Scope Delta(任意)

項目 内容
発見経緯(1回目) PR #1421 の pr-review-judge レビューで、CI 必須チェック python-test / node-backed-hook-tests が generate_ci_test_selection_artifact.py の G1 gate(uncovered_changed_test_files)で fail することが判明した
発見経緯(2回目) 1回目の Scope Delta で .github/ci/python-test-plan.json の targets に登録して G1 gate 自体は通ったが、再検証で python-test job 側の pytest 実行が 5 件 fail(ajv and ajv-formats must be installed as devDependencies 等)。原因調査の結果、python-test job は pnpm install を実行しない Python 専用レーンであり、Node の子プロセスを起動する Node-backed hook test をそこに加えると node_modules 欠如で壊れることが判明した
変更 .github/ci/python-test-plan.json の targets 登録を撤回し、代わりに (1) .github/workflows/ci.yml の node-backed-hook-tests job(pnpm install 済み)に実行 step を追加、(2) .github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes に provider_job: node-backed-hook-tests としてカバレッジ登録、の2点に修正した。AC6/AC7 として反映し、Allowed Paths に .github/workflows/ci.yml を追加した
影響範囲 .github/workflows/ci.yml の node-backed-hook-tests job に新規 step 1つを追加(既存の固定 2 nodeid の disjointness/exact-match invariant には触れない)。.github/ci/python-test-plan.json は secondary_coverage.dedicated_lanes への 1 エントリ追加のみ
注意 .github/workflows/ci.yml の編集は .github/CLAUDE.md により PR レビューで人間承認必須。マージ判断は人間が行う
発見経緯(3回目) PR #1421 に対する人間経由の外部アドバーサリアルレビュー(issuecomment-4940413442)で、2件の P1 blocker が指摘された: (1) secondary_coverage.dedicated_lanes の宣言のみで実行証跡が伴わず、node-backed-hook-tests job の新規 step が削除・rename・skip されても G1 gate が検出できない false-green リスク、(2) CODEX_HOOK_MANIFEST_ROOT が本番 adapter 経路で無検証の ambient environment 変数として機能し、任意パスへの書き込み・監査証跡(evidence_ref)と実書き込み先の不一致を許してしまう安全性の欠陥。加えて P2 として、CI の xdist 回帰検査が -p no:xdist(xdist 無効化)のみで元の競合を再現していないこと、環境変数未設定時のフォールバック挙動が動作テストされていないことが指摘された
変更(3回目) AC8-AC12 を追加。CI selection artifact の実行証跡化、manifestRoot の realpath 検証、evidence_ref の実書き込み先反映、xdist 並列 CI 回帰検査の追加、フォールバックパステストの追加を行う。P2(stderr redaction テストの実効性)と P3(docs/dev/test-lane-policy.md 等のドキュメント同期)は本 PR のブロッカーとせず、別途 follow-up Issue で対応する(レビューコメントもこの扱いを許容している)

Notes for Reviewer

  • 本 Issue は Issue 実装: PreToolUse remote_write_requires_approval を publish lane 証跡で通過可能にする #1408 の baseline VC preflight(ensure_contract_snapshot.py / baseline_vc_preflight.py)が tests/session_recording/codex/test_hook_adapter.py を並列実行環境下でフレーキーに human_judgment 判定させたため、そのブロッカー解消として起票された。-n2 での再現実験で MANIFEST_ROOT(REPO_ROOT/tmp/session-manifests/codex)の共有と setup_function の shutil.rmtree がテスト間競合の原因であることを確認済み。
  • AC6 の追加は PR fix: MANIFEST_ROOT を xdist 並列実行から分離する #1421 の pr-review-judge REQUEST_CHANGES を受けた Scope Delta である。
  • AC8-AC12 は fix: MANIFEST_ROOT を xdist 並列実行から分離する #1421 (comment) の P1/P2 blocker を受けた Scope Delta である。AC8 の検証は .github/workflows/ci.yml の静的な marker 検査に加え、実際に生成された CI 実行後の ci_test_selection_v1.json / ci_test_selection_summary_v1.json artifact(node-backed-hook-tests job の run から取得可能)で collected_test_files に tests/session_recording/codex/test_hook_adapter.py の nodeid が含まれ、cross_job_covered_test_files が空であることを pr-review-judge が確認すること。
  • レビューコメントが挙げた P2「stderr redaction テストが実際の失敗 producer を起動していない」(test_stop_event_scrubs_producer_failure_stderr)と P3「docs/dev/test-lane-policy.md / ci-test-performance/SKILL.md の記述が現行 workflow と乖離」は、本 Issue の Allowed Paths 外または追加調査を要するため、本 PR では対応せず follow-up Issue を別途起票する。

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jul 10, 2026
  2. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-10T12:17:28Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1420
      body_sha256: "sha256:3eccab3737ea74a4290c275666bd69eb2d1a6391c10f00c86355a7b4c4b82041"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      source: ensure_contract_snapshot_auto
  3. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-07-10)

    • PR: fix: MANIFEST_ROOT を xdist 並列実行から分離する #1421
    • Worktree: .claude/worktrees/issue-1420-codex-manifest-root-xdist
    • Branch: worktree-issue-1420-codex-manifest-root-xdist
    • Verification: AC1-AC5 全て PASS(-n4 を 4 回連続実行して 36 件全て安定 PASS を確認、-n2 でも別途確認)
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  4. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    Contract Review Result (Scope Delta AC6 追加後の再検証)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-10T12:50:00Z"
      generated_by: impl-review-loop-orchestrator
      issue_url: https://github.com/squne121/loop-protocol/issues/1420
      body_sha256: "sha256:5763f4ddd9d2c3c9b46c600617f0c45ea72ef411fd73c6a8b9edef72a2b0fed0"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      notes: >-
        AC1-AC5 は前回 go 判定(issuecomment-4935165753, body_sha 3eccab37...)から内容変更なし。
        AC6(.github/ci/python-test-plan.json への targets 登録)を Scope Delta として追加し、
        baseline VC(rg -n "tests/session_recording/codex/test_hook_adapter.py" .github/ci/python-test-plan.json)
        が exit 1(未登録・baseline-expect: fail 通り)であることを手動確認済み。
      source: manual_supersede_after_scope_delta
  5. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    Contract Review Result (Scope Delta 2回目: AC6/AC7 CI レーン修正後の再検証)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-10T19:05:00Z"
      generated_by: impl-review-loop-orchestrator
      issue_url: https://github.com/squne121/loop-protocol/issues/1420
      body_sha256: "sha256:b7d13e817d3373112485f8a235d7de0614ceb8e02fd829c2ae76f0fd280ab6b5"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      notes: >-
        1回目 Scope Delta(AC6: python-test-plan.json targets 登録)は node 環境の無い
        python-test job に Node-backed hook test を混入させ CI を壊したため撤回。
        2回目 Scope Delta で AC6/AC7 を .github/workflows/ci.yml の node-backed-hook-tests
        job への実行追加 + secondary_coverage.dedicated_lanes 登録に置き換えた。
        baseline VC(rg ベース AC1/AC2/AC6/AC7、rg -c AC3、pytest AC5)は全て手動確認済み。
        AC4 は baseline-expect: deferred のため preflight 未実行(pr-review-judge へ委譲)。
      source: manual_supersede_after_scope_delta_2
  6. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    Contract Review Result (Scope Delta 3回目: AC8-AC12 外部レビュー対応後の再検証)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-10T23:50:00Z"
      generated_by: impl-review-loop-orchestrator
      issue_url: https://github.com/squne121/loop-protocol/issues/1420
      body_sha256: "sha256:df2bd3d386b64855b1824545d6819371e3f8688196f450bee1b80c2f3ffd381c"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      notes: >-
        AC1-AC7 は前回 go 判定から内容変更なし。
        https://github.com/squne121/loop-protocol/pull/1421#issuecomment-4940413442 の外部
        アドバーサリアルレビュー(P1 x2, P2 x3, P3 x1)を受け AC8-AC12 を Scope Delta として
        追加した。baseline VC(AC9/AC10/AC11/AC12 の rg 存在確認、AC8 の regex 構文確認)を
        手動確認済み。全て root main 上で未実装(exit 1)を確認、baseline-expect: fail と整合。
        AC4/AC8 は baseline-expect: deferred のため preflight では未実行。
      source: manual_supersede_after_scope_delta_3
  7. added a commit that references this issue on Jul 11, 2026
  8. squne121 commented on Jul 11, 2026

    @squne121
    OwnerAuthor

    fix_delta 3 完了報告(AC8-AC12, 外部アドバーサリアルレビュー対応)

    外部レビュー(#1421 (comment) )の P1 blocker 2件・P2 3件(内1件対応)を Scope Delta 3(AC8-AC12)として実装しました。commit: 759f495a

    対応内容

    • AC8: node-backed-hook-tests job の collect-only 対象に tests/session_recording/codex/test_hook_adapter.py(37 nodeid)を追加し、G1 gate(uncovered_changed_test_files)が declared secondary_coverage だけでなく実行証跡を独立に確認できるようにした。既存の固定2 nodeid の disjointness / exact-match invariant は fixed_hook_wrapper_nodeids として分離集計し維持。
    • AC9: CODEX_HOOK_MANIFEST_ROOT override 時、書き込み先ディレクトリの realpathSync が OS tmpdir() の realpath 配下であることを検証し、symlink 経由の任意パス書き込みを fail-closed で拒否するようにした(mkdirSync 後に realpathSync する順序でディレクトリ置換 symlink も検出)。
    • AC10: codex-hook-adapter.mjs の runManifestFlow が resolveManifestWriteTarget() を produceManifest() 呼び出し前に実行し、実際の書き込み先を反映した relativePath を evidence_ref に使うよう修正。manifestRoot が repoRoot 外(テスト isolation の tmp_path)の場合は <event>/<file> 形式にフォールバックし、generate-session-manifest.mjs の secret-leak guard(Secret pattern detected: absolute path detected)誤検知を回避した。
    • AC11: node-backed-hook-tests job に -n 4 --dist load の xdist 並列実行 step を追加(既存の -p no:xdist step はそのまま維持)。
    • AC12: CODEX_HOOK_MANIFEST_ROOT 未設定時に本番既定パス(<repoRoot>/tmp/session-manifests/codex/stop/)へ書き込まれることを確認する回帰テスト test_manifest_written_to_default_root_when_env_unset を追加。

    検証結果

    $ uv run --locked pytest -q tests/session_recording/codex/test_hook_adapter.py -n4
    37 passed in 0.89s / 0.93s / 0.83s(複数回実行で安定)
    
    $ uv run --locked pytest -q tests/session_recording/codex/test_hook_adapter.py -p no:xdist
    37 passed in 1.97s
    
    $ rg -U "collect-only.{0,400}test_hook_adapter" .github/workflows/ci.yml  → exit 0
    $ rg -n "realpathSync" scripts/session-recording/write-codex-session-manifest.mjs  → exit 0
    $ rg -n "manifestWriteResult.relativePath" scripts/session-recording/codex-hook-adapter.mjs  → exit 0
    $ rg -n "dist load" .github/workflows/ci.yml  → exit 0
    $ rg -n "test_manifest_written_to_default_root_when_env_unset" tests/session_recording/codex/test_hook_adapter.py  → exit 0
    

    ESLint(変更2ファイル): エラーなし。node --check(変更2ファイル): エラーなし。.github/workflows/ci.yml の YAML パース: OK。

    CI_TEST_PERFORMANCE_DECISION_V1

    .claude/skills/ci-test-performance/SKILL.md を確認の上、PR #1421 にコメントとして投稿しました: #1421 (comment)

    実装過程で見つけた追加の設計調整(AC10 の派生対応)

    resolveManifestWriteTarget() の relativePath を素朴に relative(repoRoot, absolutePath) にすると、テストの manifestRoot(tmp_path 経由、repoRoot 外)override 時に ../../../.../tmp/... という traversal 文字列が生成され、generate-session-manifest.mjs の secret-leak guard に Error: Secret pattern detected: absolute path detected. として拒否され、4テストが stderr 非空で fail していました。manifestRoot が指定されている場合は <event>/<file> 形式(repoRoot 非依存)にフォールバックすることで解消しています(本番の manifestRoot 未指定パスは既存の tmp/session-manifests/codex/<event>/<file> 形式のまま変更なし)。

    Refs #1420
    PR: #1421

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/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions