Repository navigation
Description
Parent Issue
なし(単独改善。#1830 の post-merge follow-up)
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: null
goal_ref: "#1830"
change_kind: fixParent Goal Ref
#1830 は「Codex enforcing harness(artifact hard gate 等)を隔離し、snapshot/go artifact が無くても live Issue と worktree から通常実装に着手できるようにする」ことが目的だった。PR #1849 がこの Issue を Close した。
Current Validated Scope
PR #1849 の post-merge 監査により、以下 3 箇所で snapshot/go を実装着手・PR publication の必須条件として扱う実体(コードとしての hard gate)が変更されずに残っていることを、以下のファイル内容の直接確認で検証済み。
.codex/agents/implementation-worker.tomlL10-11:INPUT_CONTRACTがissue_numberとcontract_snapshot_urlを必須とし、「どちらかが欠ける、または issue-contract-review の go 判定が確認できない場合は fail closed で差し戻す」と明記。PR fix: Codex enforcing harnessをP0 quarantine #1849 の変更ファイル一覧に本ファイルは含まれておらず無修正。.claude/skills/impl-review-loop/steps/preparation.mdL1-17 に Issue 実装: Codex enforcing harness を quarantine し、advisory session recorder のみ維持して標準 sandbox / approval workflow に戻す #1830 由来の precedence(artifact を telemetry として扱い、legacy gate より優先する旨)が追加されているが、直後の L19(0-a. Intake capsule-first)・L76(0. Intake Gate — CONTRACT_REVIEW_RESULT_V1 status: go 必須検査)以降は無修正のまま残り、ensure_contract_snapshotへの自動 routing・missing_contract_go判定・status: go必須検査のロジックがそのまま存在する。.claude/skills/open-pr/scripts/open_pr.py(PR fix: Codex enforcing harnessをP0 quarantine #1849 の変更ファイル一覧に不在=無修正): L65FORCE_OVERLAP_PREFLIGHT_LABEL = "phase/implementation"を起点に、L1637-1647 のforced_by_label判定とoverlap_gate_active分岐により、phase/implementationlabel が付いた Issue に紐づく PR は overlap preflight artifact の取得・検証を強制され、失敗すると複数箇所(L1547, L1551, L1558, L1562, L1570, L1586, L1601, L1663, L1701, L1710, L1714 等)のreturn 2でgh pr createに到達せず PR publication が停止する。
これに対し .claude/agents/implementation-worker.md L29-30 は既に contract_snapshot_url を任意 telemetry として扱う記述に緩和済みであり、Claude 側の記述と Codex 側 / 実行スクリプトの実体が乖離している。
Remaining Parent Gaps
本 Issue の完了後も、.claude/skills/implement-issue/SKILL.md 側で snapshot/go 確認記述が残っている場合の要否確認、および #1830 の目的達成を CI で保証する end-to-end テスト(artifact なしで custom agent → 実装 → PR publication まで進む経路の検証)は Out of Scope とし、別 Issue で扱う。
Scope Delta(PR #1854 レビュー起因、2026-07-30)
PR #1854 に対する REQUEST_CHANGES(comment)で、以下 2 点が独立に検証・確認された。
- 実際のルーティング producer が未変更:
impl-review-loopの Step 1 到達可否を決めているのはpreparation.mdの説明文ではなく.claude/skills/impl-review-loop/scripts/build_intake_capsule.pyの_next_action_route()であり、この関数は本 Issue の Allowed Paths 外のため無修正のまま残っていた。normalized_status == "missing_go"は現在もensure_contract_snapshot/run_contract_blocker_triageへ route し、proceed_to_step_1を返さない。これは本 Issue の Outcome(contract snapshot 欠落でも実装着手を止めない)が実際には達成されていないことを意味する。 - canonical repository 解決失敗が fail-open 化されている: PR fix: implementation-worker.toml と open_pr.py の legacy artifact hard gate を除去 #1854 の
open_pr.pyはresolve_canonical_repository()がNoneを返した場合にemit_warning後 rawrepoへフォールバックして処理を継続する。これは overlap preflight artifact(stored/fresh evidence)の advisory 化とは別種の変更であり、Issue 実装: open-pr の overlap_preflight evidence consumer に repository 一致検証を追加する #1470 が導入した「PR mutation target の canonical repository 解決失敗時は必ず停止する」という repository-identity 安全境界を弱体化させている。同様に、stored evidence のrepositoryフィールドが解決済み target と一致しない cross-repo ケースのテスト(test_cross_repo_same_issue_number_is_rejected)も、名前・docstring が「reject(PR作成しない)」を主張したまま assertion だけcreate_called is Trueに反転されている。
これを受け、以下のとおり Allowed Paths と Acceptance Criteria を拡張する(Stop Condition 「Allowed Paths 外の変更が必要と判明した場合」に該当するが、対象ファイルは本 Issue と同一 skill 内かつ Outcome 達成に不可欠なため、別 Issue 分割ではなく Scope Delta で対応する)。
Outcome
.codex/agents/implementation-worker.toml の INPUT_CONTRACT、.claude/skills/impl-review-loop/ の intake routing(preparation.md の説明文と build_intake_capsule.py の実 routing producer の両方)、.claude/skills/open-pr/scripts/open_pr.py の overlap gate の各箇所を、contract_snapshot_url / CONTRACT_REVIEW_RESULT_V1 status: go / overlap preflight evidence(stored/fresh の妥当性検証)のいずれも任意 telemetry として扱う(欠落・stale・invalid・runtime_error でも実装着手および PR publication を止めない)よう変更する。ただし、以下 2 点は本 Issue のスコープ外・意図的に fail-closed のまま維持する安全境界として明示的に除外する:
contract_blocker_triageのlatest_blocked(trusted author による明示 blocked/request_changes)の human veto 境界- PR mutation target の canonical repository 解決失敗、および stored evidence の
repositoryフィールドが解決済み target と不一致の cross-repo ケース(Issue 実装: open-pr の overlap_preflight evidence consumer に repository 一致検証を追加する #1470 の repository-identity binding)
overlap preflight evidence が warning-only化される場合も、In Scope で規定した「stderr / PR コメントへの記録は残す」を実際に満たす(stdout の WARNING= KEY=VALUE だけでは不十分)。
git grep で旧 fail-closed 文言・return 2 gate 分岐・missing_go を stopping route として扱う分岐が対象箇所から検出されなくなり、かつ新規の behavioral test が該当箇所の実際の挙動(advisory 化された箇所は proceed、fail-closed のまま維持する箇所は block)を検証している状態を完了とする。
In Scope
.codex/agents/implementation-worker.tomlのINPUT_CONTRACTを、必須項目をissue_number・live Issue 取得成功に限定し、contract_snapshot_urlを任意 telemetry に降格する.claude/skills/impl-review-loop/steps/preparation.mdの0-a. Intake capsule-firstおよび0. Intake Gateセクションを、precedence(L1-17)と整合するよう書き換える(status: go未確認・contract_snapshot_url欠落を理由にした停止ロジックを削除し、live Issue contract のみで次ステップへ進める)。見出し「0. Intake Gate — CONTRACT_REVIEW_RESULT_V1 status: go 必須検査」等、advisory 方針と矛盾する「必須」表現も整合させる.claude/skills/impl-review-loop/scripts/build_intake_capsule.pyの_next_action_route()を、issue_ready_status == "pass"かつnormalized_statusがmissing_go/stale/runtime_errorのいずれかの場合に"proceed_to_step_1"を返すよう変更する(latest_blockedは既存どおり human veto 境界として維持し変更しない).claude/skills/impl-review-loop/SKILL.mdの Guardrails 節にあるmissing_contract_go routing(ensure_contract_snapshotへの無条件 route を規定する記述)を、ファイル冒頭の advisory artifact policy と整合するよう書き換える.claude/skills/open-pr/scripts/open_pr.pyの overlap preflight gate(forced_by_label/overlap_gate_active判定と関連return 2分岐)を、evidence(stored/fresh の妥当性検証結果)が invalid/missing/stale/drift の場合に PR 作成を止めない warning-only 挙動へ変更する。ただし以下は変更後も fail-closed のまま維持する:- canonical repository 解決(
resolve_canonical_repository()がNoneを返す場合はoverlap_gate_activeの値に関わらずEXIT_BLOCKEDで停止し、rawrepoへフォールバックしない) - stored evidence の
repositoryフィールドが解決済みtarget_repoと不一致の cross-repo ケース - warning は stdout の
WARNING=/WARNING_DETAIL=に加え、stderr にも出力し、gh pr create成功後に固定 HTML marker(<!-- loop-protocol:overlap-preflight-warnings-v1 -->)付きの PR コメントとして最低 1 件永続化する
- canonical repository 解決(
.claude/skills/open-pr/SKILL.mdの4.5. Overlap Preflight Hard Gateセクション見出しと本文を、evidence 検証は advisory・canonical repository 解決と cross-repo evidence 不一致は fail-closed のまま、という区分を反映するよう更新するdocs/dev/agent-skill-boundaries.mdのopen-pr consumer行(既存 hard gate 全維持を要求する記述)を、上記の advisory/fail-closed 区分と整合するよう更新する
Out of Scope
.claude/skills/implement-issue/SKILL.md側の記述整合確認(別 Issue)- artifact なしの end-to-end CI テスト追加(
build_intake_capsule -> preparation routing -> implementation delegationの結合テストは本 Issue の新規 behavioral test で最小限カバーするが、フルスコープの E2E は別 Issue) .codex/rules/default.rulesの rtk push/branch ルール(runtime guard による実 enforcement を確認済みのため対象外).codex/hooks.jsonの hook command パス解決(既に git root 絶対パス解決済みのため対象外)contract_blocker_triage.status == latest_blockedの human veto 境界の再設計- overlap preflight evidence 検証以外の canonical repository binding(Issue 実装: open-pr の overlap_preflight evidence consumer に repository 一致検証を追加する #1470 の repository-identity 安全境界)の変更
Acceptance Criteria
- AC1:
.codex/agents/implementation-worker.tomlのINPUT_CONTRACT節に「contract_snapshot_urlを必須とする」「fail closed で差し戻す」の文言が存在しない - AC2:
.claude/skills/impl-review-loop/steps/preparation.mdにmissing_contract_goを理由とした停止ロジックの記述が存在しない - AC3:
.claude/skills/open-pr/scripts/open_pr.pyに overlap preflight evidence 検証失敗を理由にgh pr create前でreturn 2/EXIT_BLOCKEDする分岐が存在しない(canonical repository 解決失敗・cross-repo evidence 不一致によるEXIT_BLOCKEDは維持する。AC6/AC7 参照) - AC4: 既存 pytest(
.claude/skills/open-pr/配下および.claude/skills/impl-review-loop/配下)が変更後も pass する - AC5:
build_intake_capsule.pyの_next_action_route()がissue_ready_status == "pass"かつnormalized_statusがmissing_go/stale/runtime_errorのいずれかのとき"proceed_to_step_1"を返すことを検証する新規テストファイル.claude/skills/impl-review-loop/tests/test_build_intake_capsule_advisory_routing.pyが存在し pass する - AC6:
open_pr.pyのmain()がresolve_canonical_repository()の戻り値Noneを理由にEXIT_BLOCKEDで停止しgh pr createを呼ばないことを検証する新規テストファイル.claude/skills/open-pr/scripts/tests/test_open_pr_canonical_repo_fail_closed.pyが存在し pass する(overlap_gate_activeの値に関わらず) - AC7: stored evidence の
repositoryが解決済みtarget_repoと不一致の場合にgh pr createを呼ばないことを検証するテストが、名前・docstring・assertion のいずれも「reject(create されない)」の意味で一致した状態で pass する - AC8: overlap evidence 由来の warning が発生した場合、
gh pr create成功後に固定 HTML marker<!-- loop-protocol:overlap-preflight-warnings-v1 -->を含む PR コメントが投稿されることを検証する新規テストファイル.claude/skills/open-pr/scripts/tests/test_open_pr_overlap_warning_persistence.pyが存在し pass する - AC9:
.claude/skills/impl-review-loop/SKILL.mdの Guardrails 節に、status: go不在時の無条件ensure_contract_snapshotroute を規定するmissing_contract_go routing文言が存在しない
Verification Commands
# AC1
# baseline-expect: pass
$ grep -n "contract_snapshot_url.*必須" .codex/agents/implementation-worker.toml# AC2
# baseline-expect: pass
$ grep -c "missing_contract_go" .claude/skills/impl-review-loop/steps/preparation.md# AC3
# baseline-expect: pass
$ grep -c "return 2" .claude/skills/open-pr/scripts/open_pr.py# AC4
$ uv run --locked pytest .claude/skills/open-pr/ .claude/skills/impl-review-loop/ -q# AC5
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_build_intake_capsule_advisory_routing.py -q# AC6
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_canonical_repo_fail_closed.py -q# AC7
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_overlap_gate.py::test_cross_repo_same_issue_number_is_rejected -q# AC8
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_overlap_warning_persistence.py -q# AC9
# baseline-expect: pass
$ grep -c "missing_contract_go routing" .claude/skills/impl-review-loop/SKILL.mdAllowed Paths
.codex/agents/implementation-worker.toml.claude/skills/impl-review-loop/steps/preparation.md.claude/skills/impl-review-loop/scripts/build_intake_capsule.py.claude/skills/impl-review-loop/SKILL.md.claude/skills/open-pr/scripts/open_pr.py.claude/skills/open-pr/SKILL.md.claude/skills/open-pr/scripts/tests/(既存テストの期待値更新・新規テスト追加).claude/skills/impl-review-loop/tests/(既存テストの期待値更新・新規テスト追加)docs/dev/agent-skill-boundaries.md(open-pr consumer行の記述整合のみ)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
docs/dev/agent-skill-boundaries.md(orchestrator / control-plane 設計原則、Allowed Paths・停止条件の判断基準).claude/agents/implementation-worker.md(contract_snapshot_urlを任意 telemetry として扱う緩和済み記述の参照先。本 Issue はこの記述と.codex/agents/implementation-worker.toml/open_pr.pyの実体を整合させる)
Notes for Reviewer
- 元の分析対象レポートには「
.codex/rules/default.rulesのrtk git push/rtk git branchallow ルールが runtime hook 撤去により無防備になった」という P0 Security 主張が含まれていたが、scripts/agent-guards/worktree_scope_guard.py(PreToolUse hook として.codex/hooks.jsonに現存)とscripts/agent-guards/git_mutation_command_policy.py(force/delete/mirror/tag push および branch force-delete を deny するロジックが現存)を実際に読み検証した結果、この主張は誤りと判明したため本 Issue には含めていない。 - 同レポートの「hook command が cwd 相対パスで壊れる」という P1 主張も、
.codex/hooks.jsonの全コマンドが$(git rev-parse --show-toplevel)経由の絶対パス解決になっていることを確認し、誤りと判明したため対象外とした。
Activity
squne121 commentedon Jul 29, 2026
Contract Review Result
squne121 commentedon Jul 29, 2026
implement-issue: 実装完了 (2026-07-29T22:19:23Z)
.claude/worktrees/issue-1851-legacy-artifact-hard-gate-removalworktree-issue-1851-legacy-artifact-hard-gate-removalsqune121 commentedon Jul 30, 2026
Contract Review Result
fix: OWNER REQUEST_CHANGES 反映 -- routing advisory化と repository bindin…
fix: test_ac8_japanese_pass_allows_gh_pr_create の resolve_canonical_r…
squne121 commentedon Jul 30, 2026
impl-review-loop: 完了 (2026-07-30T12:04:42Z)
iteration 2/3 は人間レビュアーによる REQUEST_CHANGES(comment)を受け、Issue 本文を Scope Delta で拡張(Allowed Paths 拡張、AC5-AC9 新設)した上で対応した。
実装: semantic planning・overlap・contract artifactのblocking authorityを撤去…