Repository navigation
fix: root-owned review pipeline を分離し issue-reviewer の read-only 権限矛盾を解消する - #2135
Conversation
…解消する (#2049) `.codex/agents/issue-reviewer.toml` は read-only permission profile (`loop-protocol-readonly`) を宣言しながら、developer_instructions では live body fetch・temp file 保存・full artifact 保存という producer I/O を 要求しており、権限契約として自己矛盾していた。 producer I/O(live body fetch・body SHA 固定・check_issue_contract / contract_readiness_check / merge_readiness の実行・canonical artifact directory への保存)を新規の root-owned pipeline `run_root_review_pipeline.py` に集約し、issue-reviewer agent は merged review result を読んで advisory verdict を返すだけの役割に限定した。 child stdout が 0 byte のケースは validate_review_compact_output.py が `empty_input` を `reviewer_transport_failure` として分類し、root producer を一度だけ再実行、再度失敗した場合は human_judgment_required へ倒す。 final review は remote body update / artifact readback(regular file・ no symlink・strict JSON・body SHA・verdict identity)が成功した場合にのみ 実行するガードを追加した。 static contract test(test_issue_reviewer_contract_static.py)で、 read-only agent の instructions に workspace write requirement が 残っていないことを継続的に検証する。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #2135 closed). |
PR Review Verdict (impl-review-loop iteration 0)CI Evidence(独立に再確認済み)
Blockers
verdict: REQUEST_CHANGES
reviewed_head_sha: "7134e8ff8265ae25b3d28fcbf5a18c7f3c9484cd"
blockers:
- "Required check ci/python-test (python-test-core) FAILING at reviewed head: ruff E501 (124>120) at .claude/skills/issue-refinement-loop/tests/test_issue_reviewer_contract_static.py:73:106 — must be reformatted to satisfy 120-char line-length limit before merge."
warnings: [] |
PR #2135 review iteration 0 REQUEST_CHANGES: ci/python-test (python-test-core) failing on ruff E501 (124>120) at line 73. Wraps the AC9 negative-fixture Japanese-language OUTPUT_CONTRACT string literal across multiple lines within the triple-quoted fixture without altering its semantic content (check_agent_is_read_only_advisory folds newlines to spaces before sentence splitting, so the fixture's detection behavior is unaffected). Issue #2049
|
fix_delta iteration 1 対応: ruff E501( AC9 negative-fixture の Japanese OUTPUT_CONTRACT 文字列を triple-quoted fixture 内で複数行に分割(意味内容は変更なし)。 再検証:
new head: bf2950f |
PR Review Verdict (impl-review-loop iteration 1)検証内容(独立に再確認済み)
Blockersなし Warnings(non-blocking)
verdict: APPROVE
reviewed_head_sha: "bf2950fc774d87e8e137a14c948e63832f5ace33"
blockers: []
warnings:
- "PR body omits the literal '## 受け入れ条件の達成状況' heading (uses narrative Checks/Notes instead); consistent with recent merged PR convention (#2097, #2103), not treated as blocking."
- "merge_state_status=BEHIND at review time; expected to be resolved via control-plane update_branch routing, not a reviewer-level blocker." |
PR Review Verdict (impl-review-loop iteration 2)確認内容
Blockersなし verdict: APPROVE
reviewed_head_sha: "1d4354c02d7c2cb5624dc43809ff9161783599eb"
blockers: []
warnings:
- "非必須 CI job visual-impact-policy-trusted が失敗しているが、Allowed Paths 外の既知 pre-existing infra flake(Issue #2076 tracking)であり本 PR の変更に起因しない。merge-blocking としない。" |
判定REQUEST_CHANGES です。既存の
最小修正方針このPRを肥大化させず直すなら、root-owned adapter を唯一の producer にするのが最も整合します。root が fetch → pin → checker/readiness/merge → invocation-private artifact persistence は既存 したがって、現 HEAD に対する判定は |
…・strict JSON 検証を canonical validator に統一する PR #2135 human REQUEST_CHANGES (iteration 3, comment #2135 (comment)) が指摘した production-wiring gap を修正する。 - P0-1: run_root_review_pipeline.py の produce コマンドが compact_review_result.py の純粋関数 + hardened _atomic_write() を直接呼び、 ISSUE_REVIEW_RESULT_COMPACT_V1 の生成・永続化まで単一 producer として完結 させる。issue-reviewer agent は compact_result.stdout_lines を read-only input として受け取り、そのまま relay するだけになり、 compact_review_result.py を自ら実行しなくなった。 - P0-2: classify_child_stdout() が validate_review_compact_output.py の canonical validator に委譲する単一実行経路になり、非空だが malformed な child stdout も reviewer_transport_failure として一度だけ再試行される (以前は非空なら無条件で "ok" 扱いだった)。 - P1-3: persist_to_canonical_artifact_directory() が run-unique (pid+uuid4) filename component を持ち、compact_review_result._atomic_write() の hardened primitive (mkstemp+0600+symlink recheck) を再利用する。 - P1-4: run_root_review_pipeline.py のモジュール docstring に #1875 からの architecture delta (何を追加し、誰が consume し、なぜ #2049 のスコープに 閉じているか) を明記した。 - P1-5: readback_persisted_artifact() が compact_review_result._strict_json_loads() を再利用し、NaN/Infinity をパーサレベルで拒否する。raw substring search ("Infinity handling" のような正当な文字列を誤検知していたバグ) を削除した。 - P2-6: _cmd_produce() が invocation-private intermediate files を tempfile.TemporaryDirectory() のスコープに置き、呼び出し完了時に自動削除 する。 test_issue_reviewer_contract_static.py に P0-2/P1-5/P1-3/P0-1/P2-6 の regression テストを追加 (20 tests)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Iteration 3 対応完了人間 REQUEST_CHANGES コメント(squne121, HEAD
検証: |
PR Review Verdict (impl-review-loop iteration 3 — 人間の敵対的レビュー対応後)6点の独立再検証結果(コードを実際に読んで確認、自己申告は信用せず)
その他
Blockersなし verdict: APPROVE
reviewed_head_sha: "5884c115efff68d5b4aad7604682602048f80f00"
blockers: []
warnings:
- "compact_review_result.py's own persisted-artifact filename remains second-precision timestamp only (no run-unique component); collision risk under same-second same-issue concurrent sessions is pre-existing and out of this PR's P1-3 scope per the module docstring, not newly introduced, but worth a future follow-up if multi-session collision hardening is later extended to this artifact too." |
前コミットで `.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]>
…erdict を artifact に暗号学的束縛する (#2142) * 実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を 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]> * fix: PR #2142 実CI red の2件を修正 (Ruff stale per-file-ignore / PR Body Japanese 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]> * fix: python-test-core の実CI ruff check 失敗 (E501/E701/E702/F401) を解消する 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]> * fix: .claude/agents/issue-reviewer.md を Claude/Codex parity 契約に戻す 実 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]> * fix: issue-reviewer.md revert に伴い無効化された自己参照テストを削除する 前コミットで `.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]> * fix: issue-reviewer agent 定義を V1/V2 partial deployment から atomic V2 へ同期する 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]> * fix: 実 reviewer transport の production 配線と wire<->artifact 暗号学的束縛を実装する (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]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
.codex/agents/issue-reviewer.tomlは read-only permission profile(default_permissions = "loop-protocol-readonly")を宣言しながら、developer_instructionsでは live body fetch・temp file 保存・full artifact 保存という producer I/O を要求しており、権限契約として自己矛盾していた(Issue #2049)。本 PR では producer I/O(live body fetch・body SHA 固定・
check_issue_contract/contract_readiness_check/merge_readinessの実行・canonical artifact directory への保存)を新規の root-owned pipeline.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.pyに集約し、issue-revieweragent は root-owned pipeline が既に fetch・pin・checker 実行を終えた merged review result を読み、advisory verdict を返すだけの役割に限定した。child stdout が 0 byte のケースは
validate_review_compact_output.pyがempty_inputviolation にclassification: reviewer_transport_failureを付与し、orchestrator は root producer(issue-reviewer呼び出し)を一度だけ再実行する。再実行後も empty のままであればreviewer_transport_failureとして human_judgment_required へ倒す(無制限リトライやサイレント承認にはしない)。final review(この body revision に対する terminal VERDICT を決める review pass)は、remote body update readback(既存の
BODY_HASHgate)に加えて、run_root_review_pipeline.pyの artifact readback(regular file・no symlink・strict JSON・body_sha256一致・verdict一致 =verdict_identity)が成功した場合にのみ実行するガードを追加した。static contract test(
test_issue_reviewer_contract_static.py)が、read-only agent の instructions に workspace write requirement が再度混入していないかを継続的に検証する(負のフィクスチャで checker がバイパス不能であることも確認)。Iteration 3(人間 REQUEST_CHANGES 対応、コメント)
current HEAD (
1d4354c02d7c2cb5624dc43809ff9161783599eb) は敵対的に production path を追跡した結果、P0 2件 / P1 3件 / P2 1件の未解決 gap が指摘された。以下ですべて解消した(詳細は各コミットの docstring/コメントを参照)。run_root_review_pipeline.pyのproduceコマンドがcompact_review_result.pyの純粋関数compact_review_result()+ hardened_atomic_write()を直接呼び出し、ISSUE_REVIEW_RESULT_COMPACT_V1の生成・永続化まで単一 producer(root-owned pipeline)として完結させた(produce_compact_result())。issue-reviewer.tomlの INPUT_CONTRACT / OUTPUT_CONTRACT を、root が既に render したcompact_result.stdout_linesを read-only input として受け取り、そのまま relay するだけの契約に書き換え、compact_review_result.pyを child が自ら実行する記述を削除した。review-issue/SKILL.mdに Procedure ステップ単位の所有権表(invoked_as_loop: true/falseで何を root が実行し何を skip するか)を追加した。run_root_review_pipeline.classify_child_stdout()をvalidate_review_compact_output.validate_review_compact_output()に委譲する実装へ置き換えた(別実装の簡易 classifier を削除)。これにより非空だが malformed な child stdout もreviewer_transport_failureとして分類され、無条件で"ok"扱いにならない。test_issue_reviewer_contract_static.pyに 0-byte / malformed 双方について「一度だけ retry → 二度目失敗でreviewer_transport_failure停止」を検証する回帰テストを追加した。persist_to_canonical_artifact_directory()にpid+uuid4の run-unique component を追加し、compact_review_result._atomic_write()(mkstemp+ 0600 + symlink recheck、PR fix(issue-refinement-loop): compact artifact wire pathをrepo-relativeにする #1907 で追加済みの hardened primitive)を再利用する実装へ置き換えた。run_root_review_pipeline.pyのモジュール docstring に「Architecture delta relative to 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1875」節を追加し、何を新設し(ROOT_REVIEW_PIPELINE_RESULT_V1/ compact artifact 永続化)、誰が consume し(issue-refinement-loopSKILL.md Step 2 orchestrator と read-onlyissue-reviewerchild のみ)、なぜ 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1875 の minimal-harness 方針からの deliberate な narrow exception として妥当か(すべて同一produce呼び出し内で生成・消費され、stale な長寿命 receipt を持ち越さない)を明記した。Issue 実装: read-only issue-reviewer の producer I/O を root-owned に分離し、0-byte stdout も validator-first で分類する #2049 の AC7/AC10 の文言自体を変更する必要はなかった。readback_persisted_artifact()の NaN/Infinity 検出を raw substring search からcompact_review_result._strict_json_loads()(json.loads(..., parse_constant=...)によるパーサレベルの拒否)へ置き換えた。"message": "Infinity handling"のような正当な文字列が誤って reject されていたバグを解消した。_cmd_produce()の body/review/readiness/merged 各中間ファイルをtempfile.TemporaryDirectory()のスコープに置き、呼び出し完了時に自動削除されるようにした。Checks
pnpm typecheckpnpm lintpnpm test(1872 passed)pnpm builduv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py(24 passed)uv run --locked pytest .claude/skills/issue-refinement-loop/tests/(1636 passed)uv run --locked pytest .claude/skills/review-issue/tests/(260 passed)uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_command_registry.py .claude/skills/issue-refinement-loop/tests/test_command_registry_security.py(78 passed)uv run --locked pytest tests/test_agent_parity.py(53 passed)uv run --locked ruff check .claude/scripts scripts schemas .claude/skillsvalidate_japanese_content.py --file .claude/skills/review-issue/SKILL.md/--file .claude/skills/issue-refinement-loop/SKILL.md(両方 PASS)Schema Change Applicability
schemas/配下の JSON schema ファイルは変更していない。変更対象は agent config(TOML)・skill 手順(Markdown)・スクリプト(Python)のみで、既存の compact envelope フィールド集合(ISSUE_REVIEW_RESULT_COMPACT_V1/REVIEW_ISSUE_RESULT_V1)は変更していない。ROOT_REVIEW_PIPELINE_RESULT_V1(run_root_review_pipeline.pyの stdout JSON)は Issue 実装: read-only issue-reviewer の producer I/O を root-owned に分離し、0-byte stdout も validator-first で分類する #2049 のスコープに閉じた新規 machine-readable interface であり、上記「Iteration 3」節の P1-4 で 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1875 との architecture delta を明示した。Schema Consumer Inventory
ROOT_REVIEW_PIPELINE_RESULT_V1の consumer はissue-refinement-loopSKILL.md Step 2(orchestrator)と読み取り専用issue-reviewerchild(compact_result.stdout_linesの read-only input としてのみ)に限定される。他の skill / orchestrator step はこの schema に依存しない。Safety Claim Matrix
.codex/agents//.claude/skills/を変更しているため safety-sensitive PR として扱う。issue-revieweragent は本 PR 後 body fetch / temp file 書き込み / artifact 保存 /compact_review_result.py実行を一切行わない.codex/agents/issue-reviewer.tomldeveloper_instructions(iteration 3 で compact_review_result.py 実行の記述も削除)、test_issue_reviewer_contract_static.py::test_real_issue_reviewer_toml_has_no_workspace_write_requirementで継続検証run_root_review_pipeline.pyのfetch_and_pin_live_body/run_check_issue_contract/run_contract_readiness_check/run_merge_readiness/persist_to_canonical_artifact_directory/produce_compact_resultclassify_child_stdout()がvalidate_review_compact_output.validate_review_compact_output()を直接呼ぶ単一実行経路、test_issue_reviewer_contract_static.pyの P0-2 regression テスト群readback_persisted_artifact()がcompact_review_result._strict_json_loads()を再利用、test_issue_reviewer_contract_static.pyの P1-5 regression テスト群default_permissions = "loop-protocol-readonly"の実際の enforcement(Codex runtime 側の permission profile 適用)自体loop-protocol-readonlyprofile 定義・runtime 適用は本 PR で変更していないNotes
not_applicable(全 VC は grep/rg・test -f・pytest によるユニットテスト実行のみで完結し、プロセス起動・IPC・外部サービス通信を要求しない)。.codex/agents/issue-reviewer.toml/.claude/skills/review-issue/SKILL.md/.claude/skills/issue-refinement-loop/SKILL.md/.claude/skills/issue-refinement-loop/scripts/*/.claude/skills/issue-refinement-loop/tests/test_issue_reviewer_contract_static.py/.claude/skills/review-issue/tests/(iteration 3 でcompact_review_result.py(docstring 追記のみ、挙動は不変)も Allowed Paths 内で編集した)。test_compact_review_result.py/test_readiness_forwarding_contract.pyは Allowed Paths 内だが、既存挙動を変更する必要がなかったため未編集(test_readiness_forwarding_contract.pyは AC10 の regression gate として green のまま維持)。