Repository navigation
実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を artifact に暗号学的束縛する - #2142
Conversation
…erdict を artifact に暗号学的束縛する (#2054) parent-owned reviewer_transport.py が V2 契約 SSOT として、transport status (spawn/timeout/signal/empty/malformed/artifact 整合性失敗) と semantic verdict (approve/needs-fix) を型として分離する。transport failure は常に STATUS: environment_failure / semantic_verdict: null に収束し、 human_judgment_required と混同しない。 success-only compact V2 envelope(SCHEMA/STATUS/VERDICT/SUMMARY/BLOCKERS/ NEXT_ACTION/MUST_READ/REVIEWED_BODY_SHA256/ATTEMPT_ID/ARTIFACT/ARTIFACT_SHA256 の exact 11-line grammar)へ V1 から atomic cutover した。V1 producer (compact_review_result.py の compact 生成関数) は retired であり、 downgrade fallback はない。 parent 側 artifact 検証は trusted artifact root FD を起点に O_DIRECTORY|O_NOFOLLOW による component-wise open、fstat 確認、同一 FD からの bounded raw read、その同じ raw bytes に対する SHA-256 と strict JSON parse (duplicate key 拒否) を実装する。resolve()→stat()→別 open() という分離パターン は使わない。 Issue 起票後に main で merge された #2049/PR #2135 (root-owned review pipeline) との scope 衝突が判明したため、Issue 本文を改訂 (Allowed Paths に run_root_review_pipeline.py を追加、Scope Delta 訂正)。同ファイルの classify_child_stdout() / retry_once_on_transport_failure() / readback_persisted_artifact() の内部実装を reviewer_transport.py へ委譲する 形でリファクタリングし、外部 CLI 契約 (produce/classify-child-stdout/ readback/gate-final-review) は変更していない。これにより run_root_review_ pipeline.py は #2054 が新設する競合 producer pipeline ではなく、単一 V2 契約 実装へ統合された (AC8)。 fault injection E2E (spawn/timeout/signal/malformed/artifact missing/late/non-regular-file/symlink swap/wrong binding/schema mismatch/ same-session and fresh-session retry/all-attempts-failed) を test_reviewer_transport_e2e.py に実装。 Closes #2054 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2142/ The preview will be removed when this PR is closed. |
…panese Check)
CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 2054
pr_number: 2142
decision_scope: ci_change
changed_paths:
- pyproject.toml
lane_classification:
fast_static:
applicable: true
evidence:
- "scripts/ci/verify_ruff_configuration.py --root . が per-file-ignores の isolated E402 probe を実行する fast_static レーン"
required_commands:
- "uv run --locked python3 scripts/ci/verify_ruff_configuration.py --root ."
python_unit: {applicable: false, evidence: [], required_commands: []}
contract_artifact: {applicable: false, evidence: [], required_commands: []}
integration: {applicable: false, evidence: [], required_commands: []}
baseline_inputs:
ci_runtime_baseline_v1_available: false
run_count: 0
p50_p95_ready: false
artifact_consistency:
ci_test_selection_v1_checked: false
missing_pytest_args: []
risk_flags: []
reviewer_gate:
approve_allowed: true
required_evidence: [CI_CHECK_RUN_SCOPED]
follow_up_required: []
1. `pyproject.toml` の `[tool.ruff.lint.per-file-ignores]` から
`test_artifact_security.py` / `test_compact_review_result.py` の stale な
`E402` エントリを削除した。#2054 の import 構造変更(compact_review_result.py
の retire、reviewer_transport.py への import 集約)によりこの2ファイルは
もう E402 を発生させないため、`scripts/ci/verify_ruff_configuration.py` の
isolated E402 probe が stale entry として reject していた。他の
per-file-ignore / ruff 設定は変更していない。
2. `.claude/agents/issue-reviewer.md` の PR Body Japanese Check 失敗
(aggregate_ratio=0.267 だが per-block で4ブロックが threshold 0.1 未達)
を修正した。frontmatter description と3つの英語見出し
(## contract readiness / ## stdout contract / ## domain judgment) に
日本語グロスを追記し、全 prose block が閾値を満たすようにした。
Verification:
uv run --locked python3 scripts/ci/verify_ruff_configuration.py --root . => PASS
uv run --locked python3 .claude/skills/create-issue/scripts/validate_japanese_content.py \
--file .claude/agents/issue-reviewer.md --threshold 0.1 => exit 0
Issue #2054
Co-Authored-By: Claude Sonnet 5 <[email protected]>
PR #2142 の実 CI ログ (gh run view --log-failed) を確認したところ、 `python-test-core` の "Verify Ruff configuration authority" ステップより前の `uv run --locked ruff check .claude/scripts scripts schemas .claude/skills` が 57 件の lint 違反 (主に reviewer_transport.py の dense one-liner による E501 line-too-long / E701/E702 multiple-statements、一部テストの F401 未使用 import) で fail していた。ローカル検証では `scripts/ci/verify_ruff_configuration.py` のみ実行しており、実際の `ruff check` 自体を実行していなかったため見落としていた。 `uv run --locked ruff check --fix` で F401 を自動修正し、 `uv run --locked ruff format` で reviewer_transport.py と関連する4テスト ファイルを再フォーマットして E501/E701/E702 を解消した。ロジック変更なし (pure formatting)。 Verification: uv run --locked ruff check .claude/scripts scripts schemas .claude/skills => All checks passed! uv run --locked python3 scripts/ci/verify_ruff_configuration.py --root . => PASS uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ .claude/skills/issue-refinement-loop/scripts/tests/ -q => 1330 passed(既知の worktree 環境固有 flake 2件を除く、詳細は PR 本文参照) Issue #2054 Co-Authored-By: Claude Sonnet 5 <[email protected]>
実 CI (python-test-core) で発見: `.claude/agents/issue-reviewer.md` の出力 契約を raw REVIEW_ISSUE_RESULT_V1 semantic JSON へ変更したことで、 `scripts/check_claude_codex_agent_parity.py`(SCHEMA_PARITY_001)が Claude 側 (.claude/agents/issue-reviewer.md) と Codex 側 (.codex/agents/issue-reviewer.toml) の final_output_schema 不一致を検出し、 tests/test_agent_parity.py / tests/test_codex_agent_bridge_contract.py / tests/codex/test_codex_permission_profile_config.py が fail していた。 `.codex/agents/issue-reviewer.toml` は Issue #2054 の Allowed Paths 外であり 変更できない(引き続き ISSUE_REVIEW_RESULT_COMPACT_V1 を宣言し、 run_root_review_pipeline.py が root-owned pipeline として compact envelope を生成・relay させる既存アーキテクチャを維持する)。この Codex 側の契約に Claude 側を一致させる必要があるため、`.claude/agents/issue-reviewer.md` を main (6b93dbc) の内容へ完全に revert した(AC1-12 の Verification Command はいずれもこのファイルの内容に依存しないため、revert は安全)。 Verification: uv run --locked pytest tests/test_agent_parity.py \ tests/test_codex_agent_bridge_contract.py \ tests/codex/test_codex_permission_profile_config.py \ tests/test_post_merge_cleanup_boundary.py -q => 153 passed uv run --locked pytest tests/ -q => 1892 passed, 3 skipped, 1 failed (test_artifact_head_sha_matches_git_head は CI=true で明示的に skip される local-dev-only fixture staleness テストであり CI blocking では ない) Issue #2054 Co-Authored-By: Claude Sonnet 5 <[email protected]>
前コミットで `.claude/agents/issue-reviewer.md` を main 相当へ revert した ため、`test_given_issue_reviewer_contract_when_read_then_only_raw_semantic_json_is_produced` (このファイルが "raw REVIEW_ISSUE_RESULT_V1 semantic JSON" のみを返すことを 主張していたテスト)の前提が無効になった。`.claude/agents/issue-reviewer.md` は #2049/#2135 の root-owned pipeline 契約(`.codex/agents/issue-reviewer.toml` との parity ロック、Allowed Paths 外のため変更不可)に従うべきファイルであり、 reviewer_transport.py の V2 契約はこのファイルの出力スキーマを規定しない。 Verification: uv run --locked ruff check .claude/scripts scripts schemas .claude/skills => All checks passed! uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_reviewer_transport_e2e.py -q => 9 passed uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ .claude/skills/issue-refinement-loop/scripts/tests/ -q => 1329 passed, 2 failed (既知の worktree 環境固有 flake、PR 本文参照) Issue #2054 Co-Authored-By: Claude Sonnet 5 <[email protected]>
…同期する iteration 2 で `.claude/agents/issue-reviewer.md` を main 相当へ revert したこと により、AC5 が明示的に禁止する「V1/V2 の partial deployment」状態になっていた: `run_root_review_pipeline.py`(内部で reviewer_transport.py V2 契約に委譲済み) は V2 envelope を生成するのに、Claude 側 agent 定義は依然として V1 envelope (9 フィールド、EVIDENCE / compact_review_result_v1= 形式)を記述したままだった。 Issue #2054 の改訂により `.codex/agents/issue-reviewer.toml` が Allowed Paths に追加されたため、同一 commit で両ファイルの envelope 記述を V2 grammar (SCHEMA/STATUS/VERDICT/SUMMARY/BLOCKERS/NEXT_ACTION/MUST_READ/ REVIEWED_BODY_SHA256/ATTEMPT_ID/ARTIFACT/ARTIFACT_SHA256)へ同期更新した。 permission (default_permissions / permissionMode)・delegation・model 設定は 変更していない。 .claude/agents/issue-reviewer.md: - frontmatter description / 出力契約見出し / stdout grammar / needs-fix 節 / OUTPUT_BUDGET_V1 節 / ORCHESTRATOR_IO_BOUNDARY_V1 節を V2 へ更新 - retired compact_review_result.py CLI を呼ぶ実行例を削除し、 reviewer_transport.py(V2 契約 SSOT)への relay である旨を明記 .codex/agents/issue-reviewer.toml: - developer_instructions の ROLE/INPUT_CONTRACT/OUTPUT_CONTRACT を V2 へ更新 - `scripts/check-codex-agents.mjs` が要求する "structured output" / "context budget" 等の必須フレーズは維持 Verification: uv run --locked python3 scripts/check_claude_codex_agent_parity.py => exit 0, no SCHEMA_PARITY drift uv run --locked pytest tests/test_agent_parity.py tests/test_codex_agent_bridge_contract.py \ tests/codex/test_codex_permission_profile_config.py tests/test_post_merge_cleanup_boundary.py -q => 153 passed uv run --locked pytest tests/ -q => 1892 passed, 3 skipped, 1 failed (test_artifact_head_sha_matches_git_head は CI=true で skip される local-dev-only fixture staleness テスト、CI blocking ではない) uv run --locked ruff check .claude/scripts scripts schemas .claude/skills => All checks passed! uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ \ .claude/skills/issue-refinement-loop/scripts/tests/ -q => 1329 passed, 2 failed (既知の worktree 環境固有 flake、iteration 2 で実 CI green を確認済み) AC1-AC12 の Verification Command 個別実行 => 全て pass Issue #2054 Co-Authored-By: Claude Sonnet 5 <[email protected]>
pr-review-judge: APPROVEMergeability
Evidence Check
Blockersなし verdict: APPROVE
reviewed_head_sha: "e9b3f92ef8c53224c1ae385792c648337ff38d65"
blockers: []
warnings:
- "merge_state_status: UNSTABLE は visual-impact-policy-trusted という non-required check の pre-existing failure による(#2145/#2093 で既存トラック)。required checks は全て green" |
判定REQUEST_CHANGES です。現行 HEAD 依存 PR #2068 は現在 merge 済みなので dependency 自体は解消しています。#2135 で導入された root-owned review pipeline を #2054 が拡張する、という前提も妥当です。 Blocker findings
CI と関連 Issue の評価現 HEAD では 問題は、green CI が上記 P0 を検出できないテスト構造になっていることです。特に したがって、現状の評価は P0 ×4 / P1 ×3、merge block です。最優先は「production Step 2 を本当に |
…る (owner REQUEST_CHANGES P0x4/P1x3) repository owner の PR #2142 REQUEST_CHANGES (comment 5273165231) が指摘した 4 P0 + 3 P1 blocker を修正する。 1. [P0] production reviewer launcher が run_reviewer_transport() 未接続: - run_root_review_pipeline.py に内部専用 `run-checker-attempt` サブコマンド (`_cmd_run_checker_attempt` / `run_checker_pipeline_once`) を追加し、 `_cmd_produce()` が checker pipeline の実行そのものを `reviewer_transport.run_reviewer_transport(base_argv=..., backend="deterministic", ...)` 経由でスポーンするよう配線した。attempt manifest・closed retry matrix・ process-group reap・artifact binding が実 production 経路で機能する。 - `reviewer_transport.run_reviewer_transport()` は固定 `command` ではなく `base_argv` を受け取り、`build_backend_command()`(新規、claude/codex/ deterministic/fixture backend adapter)で毎 attempt ごとに session_id を実際の argv へ materialize する(同一 command を全 attempt で使い回さない)。 - `retry_once_on_transport_failure()` は分類ロジックを `classify_child_stdout()`(= reviewer_transport SSOT)に委譲し、 `integrity_failure` を retry しない専用ステータスとして扱う。 2. [P0] wire<->artifact 暗号学的束縛の欠落: - `reviewer_transport.project_compact_v2_from_artifact()` / `verify_wire_matches_artifact()`(新規)が検証済み artifact の `semantic_result` から wire を再導出し、child が relay した wire と byte 単位で比較する。ARTIFACT/ARTIFACT_SHA256 を保持したまま VERDICT/BLOCKERS/NEXT_ACTION だけを自己整合的に書き換えた wire は `integrity_failure` として reject される。 - `run_reviewer_transport()` 自身も内部で self-check する(defense in depth)。 - `run_root_review_pipeline.classify_child_stdout()` が `artifact_root`/`repo`/`expected_body_sha256` 指定時にこの cross-check を実行するよう拡張(CLI: `classify-child-stdout --artifact-root ... `)。 - negative test: `test_given_tampered_wire_when_cross_checked_against_artifact_then_mismatch_detected`, `test_classify_child_stdout_with_artifact_context_rejects_tampered_relay`, `test_retry_once_on_transport_failure_never_retries_integrity_failure`。 3. [P0] V2 artifact が full REVIEW_ISSUE_RESULT_V1 を保持していない: - `run-checker-attempt` の stdout(`run_checker_pipeline_once()` の戻り値) は merge_readiness が生成した merged REVIEW_ISSUE_RESULT_V1 全体であり、 `write_semantic_artifact(semantic_result=<この全体>)` がそのまま losslessly 永続化する(旧 `{"verdict":..., "blocking_issues":...}` の 2 フィールド射影を撤去)。 - negative test: `test_given_lossless_semantic_result_when_persisted_then_full_review_fields_survive`。 4. [P0] `.claude/skills/review-issue/SKILL.md` の V1 direct-invocation path 破壊: - Issue #2054 の Allowed Paths 拡張により、`invoked_as_loop` ownership 表・ INPUT_CONTRACT・failure_class routing 記述を V1(9-line)→V2(11-line) へ 更新した。`invoked_as_loop: false` は compact envelope を生成せず `REVIEW_ISSUE_RESULT_V1` をそのまま返す(compact envelope 生成は loop 専用の producer 配線であり、`compact_review_result.py` は retired)。 5. [P1] deadline / process-group reap が fail-closed でない: - `process.wait()` timeout 後だけでなく、正常返却後も `time.monotonic() - started > total_deadline` を再チェックし late-result を reject する。 - `descendants_reaped` は `timed_out` の単純代入をやめ、 `_confirm_process_group_reaped()`(waitpid(WNOHANG) + killpg(0) probe) による実観測値(bool | None)にした。 - reader thread は `daemon=True` + bounded `join()` にし、escaped grandchild が inherited stdout/stderr pipe を保持しても無期限に ブロックしない。 - negative test: `test_given_escaped_grandchild_holding_stdout_when_timeout_then_join_is_bounded`。 6. [P1] `os.supports_dir_fd` capability 判定の誤り: - `not os.supports_dir_fd`(set の truthiness)を `os.open in os.supports_dir_fd`(正確な関数 membership、Python 公式 ドキュメント準拠)へ修正。読み書き両方の capability gate (`_has_secure_open_capability()`) に統一。 - negative test: `test_given_dir_fd_set_missing_os_open_when_gated_then_rejected_even_if_nonempty`, `test_given_unsupported_dir_fd_capability_when_writing_then_fails_closed`, `test_given_unsupported_dir_fd_capability_when_reading_then_integrity_failure`。 7. [P1] artifact producer の write path が symlinked intermediate directory を追従しうる: - `_atomic_create()` を dir-fd-anchored, component-wise no-follow の `_mkdir_no_follow()` + `O_CREAT|O_EXCL|O_NOFOLLOW` leaf create に 全面書き換え。`Path.mkdir(parents=True)` + 別 `os.open()` という resolve-then-open 相当の producer 側パターンを撤去した。 - negative test: `test_given_symlinked_intermediate_directory_when_producer_writes_then_no_follow_rejects`。 Verification: uv run --locked ruff check .claude/scripts scripts schemas .claude/skills => All checks passed! uv run --locked python3 scripts/ci/verify_ruff_configuration.py --root . => PASS uv run --locked python3 scripts/check_claude_codex_agent_parity.py => exit 0 uv run --locked pytest tests/test_agent_parity.py tests/test_codex_agent_bridge_contract.py \ tests/codex/test_codex_permission_profile_config.py tests/test_post_merge_cleanup_boundary.py -q => 153 passed uv run --locked pytest tests/ -q (context_mode head-sha local-only test deselected) => 1895 passed, 3 skipped uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ \ .claude/skills/issue-refinement-loop/scripts/tests/ -q => 1348 passed, 2 failed (既知の worktree 環境固有 flake、実CI では green 確認済み) AC1-AC12 の Verification Command 個別実行 => 全て pass Issue #2054 Co-Authored-By: Claude Sonnet 5 <[email protected]>
pr-review-judge: APPROVE(owner REQUEST_CHANGES 対応後の再レビュー)Mergeability
owner REQUEST_CHANGES(コメント)P0×4 / P1×3 の対応確認control-plane・test-runner・pr-reviewer それぞれが独立にコードを読み、以下7項目全ての実装と対応する negative test の存在・PASS を確認しました。
Evidence Check
Blockersなし verdict: APPROVE
reviewed_head_sha: "0289570200121fb075b6d7ef886f2d700bef6873"
blockers: []
warnings:
- "visual-impact-policy-trusted は non-required の pre-existing repo全体 infra issue(#2145/#2093 既存トラック)として blocking扱いしなかった" |
#2246) * fix: root review pipeline readback を reviewer_transport V2 SSOT へ再接続する (#2242) readback_persisted_artifact() は V1 時代の平坦 top-level キー (payload.get("body_sha256") / payload.get("verdict"))を直接参照していたが、 canonical V2 writer(reviewer_transport.write_semantic_artifact())は reviewed_body_sha256(top-level)と semantic_result.verdict(nested)で 永続化するため、fresh producer artifact に対して常に None を読み、 gate-final-review が恒常的に body_sha256_mismatch / verdict_mismatch を 返していた(#2231 issuecomment-5315427655 / issuecomment-5316915493)。 reviewer_transport.py に check_artifact_binding() / extract_binding_context() / semantic_verdict_and_count() の共有アクセサを追加し(verify_artifact() 自身も これらへ委譲するようリファクタ)、readback_persisted_artifact() はこれらを 経由して V2 payload を検証するよう修正した。run_root_review_pipeline.py は semantic_result の内部 key layout を独自に再実装しない(#2054/PR #2142 SSOT 契約の維持、AC7/AC8)。 test_issue_reviewer_contract_static.py の readback 向け4テストを production writer 出力(V2 shape)へ更新し、新規 test_root_review_pipeline_readback_v2_ssot.py で producer→readback→gate_final_review の実 roundtrip(CLI E2E 含む)を追加した。 pre-fix コードに対して該当テストが fail することを確認済み(regression proof)。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: root review pipeline readback の OWNER adversarial review 4 blocker を解消する (#2242) Issue #2242 / PR #2246 の OWNER adversarial review (#2246 (comment)) が指摘した P0×2 / P1×2 の Blocker を修正する。 Blocker 1 [P0] artifact-type 混同: `produce` が返す `artifact_path` (REVIEW_ISSUE_RESULT_V1 フル成果物)と `compact_result.artifact_path` (REVIEWER_COMPACT_ARTIFACT_V2 ラッパー)のどちらが gate-final-review の canonical input かを明示する `full_review_artifact` / `verified_transport_artifact` の型付きフィールドを追加し、SKILL.md に canonical 契約を明記した。 `write_semantic_artifact()` を直接呼ぶだけでなく実際の `produce` CLI を 呼び出す genuine E2E テストを追加し、その実 artifact_path を readback/gate-final-review に渡して成功することを証明した。 Blocker 2 [P0] AC4 binding 検証の自己参照(トートロジー): `readback_persisted_artifact()` が artifact 自身から repo/issue/invocation_id/attempt を読み取って 「期待値」として自分自身と比較していた。呼び出し側が独立に供給する expected_repo/expected_issue/expected_invocation_id/expected_attempt/ expected_artifact_sha256 を必須にし、`gate-final-review` CLI にも同名の 引数を追加。各 binding フィールドを個別に誤らせても fail-closed になる ことを実際の CLI 経由でテストする。 Blocker 3 [P1] 独自の脆弱な symlink-following open: `readback_persisted_artifact()` が独自の `os.open(path, O_NOFOLLOW)` + 10 MiB cap + 読み込みループを 実装しており、leaf のみ no-follow で中間ディレクトリの symlink を防げな かった。これを削除し `reviewer_transport.verify_artifact()`(dir-fd anchored, 全コンポーネント no-follow, 1 MiB cap, SHA-256 検証)へ完全委譲。 中間ディレクトリ symlink・root escape・FIFO・ディレクトリ代替・oversize・ raw-byte 改ざん・artifact-path 差し替えの否定テストを追加。FIFO を O_NONBLOCK なしで open すると無期限ハングする実バグも同時に修正した。 Blocker 4 [P1] bool が int として通る / 空文字列・非正値が未検証: `extract_binding_context()` を `isinstance(x, int)` から exact `type(x) is int` + 正値制約 + 正規表現(owner/repo は `command_registry._OWNER_REPO_RE` を再利用、invocation_id は既存の `_ATTEMPT` を再利用、body_sha256 は既存の `_SHA` を再利用)へ強化。 `check_artifact_binding()` 自体も比較レイヤーで bool 型 issue_number/attempt を拒否するよう修正(`True != 1` が False になる Python の bool/int 互換の 盲点)。`semantic_result` を `check_issue_contract._validate_review_issue_result_payload()` 経由で REVIEW_ISSUE_RESULT_V1 の完全な jsonschema に対して検証する `validate_semantic_result_schema()` を追加。 Allowed Paths: `.claude/skills/issue-refinement-loop/scripts/**`, `.claude/skills/issue-refinement-loop/tests/**`, `.claude/skills/issue-refinement-loop/SKILL.md` のみ。 検証: `.claude/skills/issue-refinement-loop/tests/` 配下 pytest 全 1594 件 pass(live gh canary 含む)。ruff check クリーン。 Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
Issue #2054 の実装。deterministic parent wrapper(
reviewer_transport.py)が reviewer attempt の起動から終了までを所有し、transport status(spawn/timeout/signal/empty/malformed/artifact 整合性失敗)と semantic verdict(approve/needs-fix)を型として分離する。transport failure は常にSTATUS: environment_failure/semantic_verdict: nullに収束し、human_judgment_requiredと混同しない。success-only compact V2 envelope(
SCHEMA/STATUS/VERDICT/SUMMARY/BLOCKERS/NEXT_ACTION/MUST_READ/REVIEWED_BODY_SHA256/ATTEMPT_ID/ARTIFACT/ARTIFACT_SHA256の exact 11-line grammar)へ V1 から同一 commit で atomic cutover した。V1 producer(compact_review_result.pyの compact 生成関数)は retired であり、downgrade fallback はない。parent 側 artifact 検証は trusted artifact root FD を起点に
O_DIRECTORY|O_NOFOLLOWによる component-wise open、fstat()確認、同一 FD からの bounded raw read、その同じ raw bytes に対する SHA-256 と strict JSON parse(duplicate key 拒否)を実装する。resolve()→stat()→ 別open()という resolve/stat と open を分離した security fallback パターンは使わない。Scope Delta(Issue 起票後の main 変化への対応): Issue #2054 起票後、main で #2049 / merged PR #2135(root-owned review pipeline、
run_root_review_pipeline.py)がマージ済みになったため、Issue 本文を段階的に改訂しながら実装を継続した(run_root_review_pipeline.py/.codex/agents/issue-reviewer.toml/.claude/skills/review-issue/SKILL.mdを順次 Allowed Paths に追加)。Iteration 履歴(実 CI 検証と owner REQUEST_CHANGES 対応)
python-test-core/PR Body Japanese Check)が red と判明。(1)pyproject.tomlの stale Ruffper-file-ignores2件削除、(2).claude/agents/issue-reviewer.mdの Japanese Check 不足4ブロック修正、(3) 未実行だったruff checkがreviewer_transport.pyの dense one-liner に対し57件のE501/E701/E702/F401を検出したためruff formatで解消、(4).claude/agents/issue-reviewer.mdの raw semantic JSON 契約変更が.codex/agents/issue-reviewer.tomlとのcheck_claude_codex_agent_parity.pyparity を破壊したため revert。.codex/agents/issue-reviewer.tomlを Allowed Paths に追加し、両 agent 定義ファイルを同一 commit で V2 envelope へ同期、check_claude_codex_agent_parity.pydrift なしを確認。現在
python-test-core/python-test/ci-verdict-summary/e2e/PR Body Japanese Checkを含む全 required check が green であることをgh pr checks 2142で確認済み(visual-impact-policy-trustedを除く。詳細は下記)。owner REQUEST_CHANGES 対応(repository owner による直接指摘への修正、iteration 4、P0 ×4 / P1 ×3)
_cmd_produce()がrun_reviewer_transport()に一切接続されておらず、AC1-AC3 の attempt manifest / closed retry matrix / process-group reap が production 経路に配線されていなかったrun_root_review_pipeline.pyに内部専用run-checker-attemptサブコマンド(_cmd_run_checker_attempt/run_checker_pipeline_once)を追加し、_cmd_produce()が checker pipeline 実行そのものをreviewer_transport.run_reviewer_transport(base_argv=..., backend="deterministic", ...)経由でスポーンするよう配線。run_reviewer_transport()は固定commandではなくbase_argvを受け取り、新規build_backend_command()(claude/codex/deterministic/fixture backend adapter)が毎 attempt ごとに session_id を実際の argv へ materialize する。retry_once_on_transport_failure()はclassify_child_stdout()(reviewer_transport SSOT)へ分類ロジックを委譲し、integrity_failureを非 retry の専用ステータスとして扱うtest_cmd_produce_cleans_up_intermediate_files_and_persists_canonical_artifacts(実 subprocess 経由で E2E 動作を確認)reviewer_transport.project_compact_v2_from_artifact()/verify_wire_matches_artifact()(新規)が検証済み artifact のsemantic_resultから wire を再導出し、child が relay した wire と byte 単位で比較。run_reviewer_transport()自身も内部で self-check する。run_root_review_pipeline.classify_child_stdout()が--artifact-root/--repo/--expected-body-sha256指定時にこの cross-check を実行test_given_tampered_wire_when_cross_checked_against_artifact_then_mismatch_detected,test_classify_child_stdout_with_artifact_context_rejects_tampered_relay,test_retry_once_on_transport_failure_never_retries_integrity_failuresemantic_resultが{"verdict":..., "blocking_issues":...}の2フィールドのみでfindings[]/checker_evidence/structured_blockers等を lossless に保持していなかったrun-checker-attemptの stdout(run_checker_pipeline_once()の戻り値、merge_readiness が生成した mergedREVIEW_ISSUE_RESULT_V1全体)をそのままwrite_semantic_artifact(semantic_result=<全体>)へ渡すよう変更test_given_lossless_semantic_result_when_persisted_then_full_review_fields_survive.claude/skills/review-issue/SKILL.mdがinvoked_as_loop: falseで retired 済みcompact_review_result.pyCLI 実行を規定したまま、ownership 表も V1 9-line のままだったinvoked_as_loopownership 表・INPUT_CONTRACT・failure_class routing 記述を V2(11-line) へ更新。invoked_as_loop: falseは compact envelope を生成せずREVIEW_ISSUE_RESULT_V1を直接返す設計に変更(compact envelope は loop 専用の producer 配線)validate_japanese_content.py通過確認 + 既存 review-issue テストprocess.wait()timeout の外側で total deadline の再チェックがなく late-result を accept し得た。reader thread の無期限join()が escaped grandchild でハングし得た。descendants_reapedが実観測でなくtimed_outの単純代入だったwait()正常返却後もtime.monotonic() - started > total_deadlineを再チェック。descendants_reapedは_confirm_process_group_reaped()(waitpid(WNOHANG) + killpg(0) probe)による実観測(bool | None)に変更。reader thread をdaemon=True+ boundedjoin()に変更test_given_escaped_grandchild_holding_stdout_when_timeout_then_join_is_bounded_open_no_follow()の capability 判定がnot os.supports_dir_fd(set の truthiness のみ)で、Python 公式仕様が要求するos.open in os.supports_dir_fd(正確な関数 membership)になっていなかった_has_secure_open_capability()に統一し、読み書き両方の capability gate でos.open in os.supports_dir_fd/os.mkdir in os.supports_dir_fdを明示チェックtest_given_dir_fd_set_missing_os_open_when_gated_then_rejected_even_if_nonempty,test_given_unsupported_dir_fd_capability_when_writing_then_fails_closed,test_given_unsupported_dir_fd_capability_when_reading_then_integrity_failure_atomic_create())がPath.mkdir(parents=True)+ 別os.open()という resolve-then-open 相当のパターンで、symlinked intermediate directory を追従し得た_atomic_create()を dir-fd-anchored, component-wise no-follow の_mkdir_no_follow()+O_CREAT|O_EXCL|O_NOFOLLOWleaf create へ全面書き換えtest_given_symlinked_intermediate_directory_when_producer_writes_then_no_follow_rejectsChecks
test_reviewer_transport_e2e.py -qtest_reviewer_transport_e2e.py -k telemetry -qtest_reviewer_transport_e2e.py -k retry -qenvironment_failure/nullに収束、integrity_failure区別test_review_compact_v2.py -qtest_review_compact_v2.py -qtest_artifact_consumer_security.py -qtest_artifact_consumer_security.py -k immutable -qtest_command_registry.py test_decide_next_loop_action.py -qtests/ scripts/tests/ -qpython-test-coreは greentest_reviewer_transport_e2e.py -k resume -qtest_reviewer_transport_e2e.py -k telemetry -qtest_command_registry.py -q以下は追加で実行した検証コマンドとその結果である:
uv run --locked python3 scripts/check_claude_codex_agent_parity.py=> exit 0(SCHEMA_PARITY_001 の乖離なし)uv run --locked pytest tests/test_agent_parity.py tests/test_codex_agent_bridge_contract.py tests/codex/test_codex_permission_profile_config.py tests/test_post_merge_cleanup_boundary.py -q=> 153 件成功uv run --locked pytest tests/ -q(repository root 全体のテスト) => 1895 件成功、3 件スキップuv run --locked ruff check .claude/scripts scripts schemas .claude/skills=> 全チェック合格AC9 について(pre-existing 環境依存 flake、実 CI で確定)
test_repair_issue_contract.py::test_new_allowed_path_baseline_failと::test_rg_exit2_new_fileの2件が実装 worktree 環境でのみ失敗する(baseline_vc_preflight.pysubprocess の stdout が空になる)。iteration 2 以降、実 CIpython-test-corejob(clean checkout)は一貫して green であり、この2テストを含む全 pytest が実 CI 上で PASS することを確認済み(iteration 4 でも python-test-core green を再確認)。PR #2142 の変更と無関係の nested worktree 環境固有 flake であることが実 CI で裏付けられている。visual-impact-policy-trusted について(pre-existing repo 全体の infra issue、非 blocking)
visual-impact-policy-trustedは本 PR の diff と無関係に repo 全体で恒常的に失敗している(producer_artifact_verification_rejected/stale workflow_run does not match current PR head)。直近の merge 済み PR(#2135, #2118)の head commit でも同一 failure をgh api repos/squne121/loop-protocol/commits/<sha>/check-runsで確認済み。#2076 で既存 tracking。Allowed Paths 外(.github/workflows/**)のため本 PR では修正しない。Schema Change Applicability
ISSUE_REVIEW_RESULT_COMPACT_V1(9-line,EVIDENCEfield,compact_review_result_v1=prefix)からISSUE_REVIEW_RESULT_COMPACT_V2(11-line,ATTEMPT_ID/ARTIFACT_SHA256追加,compact_review_result_v2=prefix)へ同一 commit で atomic cutover した(downgrade fallback なし)。producer スクリプト・Claude/Codex 両 agent 定義・review-issue/SKILL.mdの direct invocation path まで含めて同一 cutover 対象とした(owner REQUEST_CHANGES P0-4)。Schema Consumer Inventory
# before状態(変更前、ISSUE_REVIEW_RESULT_COMPACT_V1、9 行)はSTATUS/VERDICT/SUMMARY/BLOCKERS/NEXT_ACTION/MUST_READ/REVIEWED_BODY_SHA256/EVIDENCE/ARTIFACT(compact_review_result_v1=<path>)というフィールド構成だった。# after状態(変更後、ISSUE_REVIEW_RESULT_COMPACT_V2、11 行)はSCHEMA/STATUS/VERDICT/SUMMARY/BLOCKERS/NEXT_ACTION/MUST_READ/REVIEWED_BODY_SHA256/ATTEMPT_ID/ARTIFACT(compact_review_result_v2=<path>)/ARTIFACT_SHA256というフィールド構成に変更した。.claude/skills/issue-refinement-loop/scripts/reviewer_transport.pyrun_reviewer_transport(base_argv=...)、build_backend_command()、verify_wire_matches_artifact()、dir-fd-anchored producer write.claude/skills/issue-refinement-loop/scripts/compact_review_result.py_atomic_write()のみ残置.claude/skills/issue-refinement-loop/scripts/validate_review_compact_output.pyreviewer_transport.validate_compact_v2()へ委譲.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.pyrun-checker-attemptサブコマンド追加、既存4サブコマンドの外部 CLI 契約は不変)_cmd_produce()がrun_reviewer_transport()経由に、classify_child_stdout()が wire<->artifact cross-check 対応に.claude/skills/issue-refinement-loop/scripts/decide_next_loop_action.py--reviewer-transport-result-fileオプション引数を追加(既存引数は不変).claude/skills/issue-refinement-loop/SKILL.md.claude/skills/issue-refinement-loop/references/loop-state.mdlast_verdict参照を V2 に更新.claude/agents/issue-reviewer.md.codex/agents/issue-reviewer.tomlと同一 commit で V2 同期.codex/agents/issue-reviewer.tomlcheck_claude_codex_agent_parity.pydrift なし.claude/skills/review-issue/SKILL.md.claude/skills/issue-refinement-loop/scripts/command_registry.pypyproject.toml[tool.ruff.lint.per-file-ignores]の stale エントリ2件削除のみ)Safety Claim Matrix
test_review_compact_v2.py,reviewer_transport._attempt_result()test_artifact_consumer_security.py,test_given_symlinked_intermediate_directory_when_producer_writes_then_no_follow_rejectstest_given_tampered_wire_when_cross_checked_against_artifact_then_mismatch_detected他2件test_given_lossless_semantic_result_when_persisted_then_full_review_fields_surviverun_reviewer_transport()経由で attempt manifest・retry matrix・reap を持つtest_cmd_produce_cleans_up_intermediate_files_and_persists_canonical_artifacts(実 subprocess)test_given_escaped_grandchild_holding_stdout_when_timeout_then_join_is_boundedtests/test_agent_parity.py等(153 passed)native_backend_canary: deferredgh api .../check-runsNotes
Closes #2054(本 Issue を解決する)
既知の残課題(follow-up 候補、本 PR のスコープ外):
command_registry.pyにreviewer_transport.py --validate用の追加エントリを新設する余地はあるが、既存テストが要求しておらず AC8 はrun_root_review_pipeline.pyの内部委譲で満たしているため、本 PR ではスコープを最小に保った。visual-impact-policy-trustedの repo 全体 infra issue は 実装: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する #2076 で tracking 済みだが症状が再発している。本 PR のスコープ外。backend="deterministic"の checker pipeline attempt には session resume の概念がない(決定論的で idempotent なため)。実 Claude/Codex backend による reviewer 起動自体へのrun_reviewer_transport()適用は、native backend canary(Out of Scope)と合わせた follow-up の対象。