Skip to content

実装: route_canonical_step2_result() に verified failure_class ベースの operator intervention route を追加する #2397

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "verified merged_review_result.failure_class(genuinely operator-only な readiness 状態)を root-owned route_canonical_step2_result() で検査し、本文修正不能な readiness 状態のみを通常の Issue rewrite loop(Step 4)ではなく operator intervention route(Step 5)へ接続する。body-fixable な readiness 状態(command_not_allowed 等)は誤って operator-only に分類されない"
change_kind: code

Title を以下に変更する(P2-1): 実装: route_canonical_step2_result() に verified failure_class ベースの operator intervention route を追加する

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: なし(単独改善)
  • Desired Destination: なし(単独改善)

Current Validated Scope

  • .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py の route_canonical_step2_result() を修正し、status: ok + verdict: needs-fix + next_action: request_changes の場合に限り、同じ payload に含まれる merged_review_result.failure_class を追加で検査する
  • merged_review_result.failure_class == "contract_readiness_human_judgment" の場合のみ、新設する STEP_5_OPERATOR_INTERVENTION_REQUIRED route へ送る(既存 Step 5 handler を再利用し、termination_cause: operator_intervention_required として区別する)
  • 未知の非空 failure_class、型不正、矛盾した組合せは既存どおり FAIL_CLOSED_ENVIRONMENT_OR_INTEGRITY_FAILURE のままとする
  • ISSUE_REVIEW_RESULT_COMPACT_V2 の wire format(build_compact_v2() / validate_compact_v2())・NEXT_ACTION の二値契約(proceed | request_changes)・artifact projection・transport failure 分類は一切変更しない
  • review-issue/SKILL.md の「reviewer_transport.py が failure_class を読んで human_judgment_required wire に変換する」という未実装記述を、「root-owned canonical route(route_canonical_step2_result())が verified merged_review_result.failure_class を直接参照する」という現状に合わせて修正する
  • issue-refinement-loop/references/termination-policy.md に operator_intervention_required の停止条件・termination summary への反映方法を追記する

Remaining Parent Gaps

なし

Outcome

contract_readiness_human_judgment(環境・tool・timeout・unknown classification 等、Issue 本文の書き換えでは解消しない operator 起因の readiness 状態)を持つ verified merged_review_result は、通常の Issue rewrite loop(Step 4)に誤配送されず、route_canonical_step2_result() が新設する step_5_operator_intervention_required route を通じて既存 Step 5 handler へ到達し、termination_cause: operator_intervention_required として区別された状態で停止する。genuine semantic / owner ambiguity(step_5_human_judgment_required)と operator intervention は明確に分離される。Compact V2 wire(NEXT_ACTION: proceed | request_changes の二値契約)・artifact schema・transport failure 分類は変更しない。

Runtime Verification Applicability

decision: immediate
applicable_acs:
  - AC1
  - AC2
  - AC3
  - AC4
  - AC5
  - AC9
  - AC10
  - AC11
  - AC12
skip_conditions:
  - "local repository checkout が存在しない場合は SKIP ではなく environment blocked として扱う"
execution_environment:
  cli_tools: [python3, uv]
  auth_required: false
  network_required: false
fallback_policy:
  fallback_success_is_pass: false
artifact_requirements:
  - focused production-shaped pytest output
  • reason: 変更対象は production output(_cmd_produce() の payload)と canonical routing(route_canonical_step2_result())の分岐到達性であり、grep と direct unit test だけでは production 経路の収束を証明できない(P1-2 反映)。実 Claude CLI・外部認証・ネットワークは不要で、hermetic subprocess test で完結する。

Background

本 Issue は PR #2391(Closes #2389、マージ済み)の敵対的レビュー(OWNER, #2391 (comment), P0-1)で指摘された「route_canonical_step2_result() の step_5_human_judgment_required 分岐が実 producer からは到達不能」という問題への対応として起票された。

前バージョンの本 Issue(初版)は、この問題を「V2 wire の NEXT_ACTION を proceed | request_changes | human_judgment_required の三値に拡張し、build_compact_v2()/validate_compact_v2() に failure_class を渡す」という設計で解決しようとしていた。この初版は issue-refinement-loop で一度 approve され、対応する実装が PR #2398 として作成された。

しかし、その後の OWNER 敵対的レビュー(anchor comment, https://github.com/squne121/loop-protocol/issues/2397#issuecomment-5461878398)により、この設計は REQUEST_CHANGES(reframe_in_place)と判定された。指摘は以下の3点(P0-1/P0-2/P0-3)。

P0-1: Acceptance Criteria が「実 producer からの到達」を証明していない

production 経路は merged REVIEW_ISSUE_RESULT_V1 → check_issue_contract.merge_readiness_into_review_result() → run_reviewer_transport() → build_compact_v2() → validate_compact_v2() → project_compact_v2_from_artifact() → verify_wire_matches_artifact() → run_root_review_pipeline._cmd_produce() → route_canonical_step2_result() という複数箇所を経由する。初版 PR #2398 は build_compact_v2()/validate_compact_v2() の直接単体テストのみを追加しており、run_reviewer_transport() が failure_class を渡すか、artifact 再投影と wire が一致するか、outer re-render(_cmd_produce() 内の再呼び出し)が split-brain を起こさないか、を証明していない。false-green が成立し得る。

現行 main のコード確認により、この指摘は現在も有効であることを確認済み(run_root_review_pipeline.py:1282-1288 の route_canonical_step2_result() は現在 compact_result.next_action の二値のみを判定しており、merged_review_result.failure_class を全く参照していない)。

P0-2: contract_readiness_human_judgment は仕様判断ではなく operator intervention

contract_readiness_check.py の human_judgment(exit code 2)は env_missing_dep / timeout / unknown classification / regression gate failure / package_manager_no_tty_prompt / validator timeout・internal error・JSON decode error / body retrieval failure など、環境・tool・runtime 起因の状態を含む(モジュール自身が exit 2 を "env/tool/runtime issues needing human attention" と定義している)。これを一律 step_5_human_judgment_required(genuine semantic / owner ambiguity 用の route)に変換すると、依存パッケージ不足や一時的 timeout を「仕様・意味・owner 判断が必要」と誤分類し、終了レポート上で運用障害と本物の設計判断の区別が消える。

現行 main のコード確認(check_issue_contract.py:554-682 の readiness_status_to_failure_class() / merge_readiness_into_review_result())により、merged["failure_class"] = "contract_readiness_human_judgment" が既に merged_review_result(_cmd_produce() の payload に含まれ route_canonical_step2_result() へそのまま渡る)に設定されていることを確認済み。つまり wire を拡張しなくても、route_canonical_step2_result() は verified merged_review_result.failure_class を直接参照できる。

P0-3: NEXT_ACTION の三値化は Issue #2054 が確立した V2 wire 契約の変更

Issue #2054 は ISSUE_REVIEW_RESULT_COMPACT_V2 を exact 11-line grammar として定義し、NEXT_ACTION を proceed | request_changes の二値に固定した(V1→V2 は atomic cutover、downgrade fallback なし、producer・validator・artifact projection・consumer・agent 定義を同時更新する契約)。現行 main には依然としてこの二値契約を明記する配布資産(.claude/agents/issue-reviewer.md の NEXT_ACTION: proceed | request_changes 記述等)が存在し、初版 PR #2398 はこれらの consumer inventory を更新せずに validate_compact_v2() の許容値だけを三値に広げていた。これは atomic cutover が閉じていない状態でのスキーマ変更である。

現行 main のコード確認(.claude/agents/issue-reviewer.md 内 NEXT_ACTION: proceed | request_changes の記述、および reviewer_transport.py の build_compact_v2()/validate_compact_v2() が現在も二値のみを扱っていること)により、この指摘は現在も有効であることを確認済み。

採用する設計(P0-1/P0-2/P0-3 の解決方針)

anchor comment の推奨に従い、Compact V2 wire は変更せず、root-owned route_canonical_step2_result() 側で verified merged_review_result.failure_class を判定に使う設計を採用する。

architecture_decision:
  preserve:
    - "#2054 の success-only compact V2 exact 11-line grammar"
    - "NEXT_ACTION: proceed | request_changes の二値契約"
    - "transport/integrity failure と semantic result の分離"
    - "artifact verification / retry / permission の現行実装"
  supersedes:
    - target: "#2389 の triple-only route 判定(status/verdict/next_actionの3値のみで判定するroute_canonical_step2_result())"
      extent: >
        status=ok、verdict=needs-fix、next_action=request_changesの場合に限り、
        同一payload内のverified merged_review_result.failure_classを追加判定へ使用する。
        他のroute分岐(approve+proceed、input_or_runtime_error等)は変更しない。
  new_route:
    name: step_5_operator_intervention_required
    physical_handler: existing_step_5
    termination_cause: operator_intervention_required

これにより、V2 wire・artifact schema・transport failure 分類には一切触れずに、既存の merged_review_result.failure_class を参照するだけで operator intervention route を実現できる。

Scope Delta(PR #2398 への OWNER 敵対的レビュー、2026-08-30、#2398 (comment) 反映)

上記設計に基づく実装(PR #2398)に対し、OWNER が以下の追加指摘(REQUEST_CHANGES)を行った。

  • P0-1(blocking): contract_readiness_check.py の _PREFLIGHT_CATEGORY_TO_READINESS に command_not_allowed カテゴリのマッピングが存在せず、未登録カテゴリはデフォルトで human_judgment にフォールバックする。しかし command_not_allowed(VC が許可されていないコマンド形を使っている)は、通常は Issue 本文の VC を許可形へ書き換えれば解消する body-fixable な状態であり、env_missing_dep 等の真の operator-only 状態とは異なる。本 Issue の新規 E2E テスト・Verification Commands は command_not_allowed を fixture に使っており、これは「operator route が到達可能」を証明する一方で、本来 Step 4(rewrite)へ進むべき body-fixable な Issue を誤って Step 5(operator intervention)で停止させる回帰を生む。
  • P1-1: producer が canonical_step2_route を返すことしか検証しておらず、実際に orchestrator が Step 5 へ正しく遷移し termination_reason: human_escalation / termination_cause: operator_intervention_required を出力するところまでは検証されていない。
  • P1-2: PR 本文が「schema change ではない」としているが、canonical_step2_route は _cmd_produce() の stdout JSON の一部であり、その閉じた値集合への追加は additive な producer/consumer contract 変更である。failure_class も REVIEW_ISSUE_RESULT_V1 の schema に型定義されていない未型付けフィールドを routing authority に転用している。
  • P2-1: Issue タイトルが旧設計(V2 wire 三値化)のままであり、run_root_review_pipeline.py / check_issue_contract.py の docstring にも撤回済み設計の説明が残っている。

これらのうち P0-1 の修正には .claude/skills/issue-contract-review/scripts/contract_readiness_check.py の変更が必要であり、これは本 Issue の当初 Out of Scope(「contract_readiness_check.py の readiness 判定ロジック自体の変更」)に抵触する。OWNER の本レビューコメント自体を Scope Delta の承認根拠とし、以下のとおり Allowed Paths / Out of Scope / Acceptance Criteria を拡張する。

Scope Delta iteration 3(PR #2398 への OWNER 敵対的レビュー、2026-08-30、#2398 (comment) 反映)

3回目の PR #2398 レビューで、以下が指摘された。

  • P0-1(本質的): AC11 の「genuinely operator-only fixture」が、jq '.' <存在しないパス> を使い category: unknown の catch-all 分類をトリガーして「genuinely operator-only」と定義していた。しかし unknown は分類器が認識できなかっただけの failure を含む catch-all であり、本文修正可能な状態(typo・stale VC・classifier gap)を排除できていない。真に operator-only な既知カテゴリ(env_missing_dep 等)で決定論的に発生させるべきである。
  • P1-1: canonical_step2_disposition は producer 側に実装されたが、issue-refinement-loop/SKILL.md はこれを Step 5 終了処理が consume するという実行指示を明記していない。
  • P1-2: issue-refinement-loop/SKILL.md の step_5_human_judgment_required の説明が、「既存 compact schema で有効な組」という記述のままであり、実際には現行 Compact V2 producer からは生成されない defensive/legacy route であるという(今回修正済みの docstring 等の)現状と矛盾している。
  • P1-3: failure_class の route-critical な既知値集合が、shared な定義箇所を明示していない。

これらに対応する AC14〜AC17 を追加する。P0-1 が最優先(個人開発の運用上、分類器が理解できない failure で不要に人間停止させないという目的に直接反するため)。

前版 Issue 本文・PR #2398 との関係

前版 Issue 本文(build_compact_v2()/validate_compact_v2() の三値化)と対応する PR #2398 の実装は、本 Issue が確定する設計と不整合であるため、本 Issue の実装着手前に PR #2398 の変更(reviewer_transport.py への failure_class 引数追加、NEXT_ACTION 三値許容化、test_review_compact_v2_human_judgment.py の新規追加、および test_canonical_step2_route_wiring.py に加えられた docstring/コメントのみの追記)はすべて撤去し、対象ファイルを変更前の main と byte-identical に戻した上で、本 Issue の Allowed Paths に従って作り直す。

In Scope

  • .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py の route_canonical_step2_result() に、status: ok + verdict: needs-fix + next_action: request_changes かつ merged_review_result.failure_class == "contract_readiness_human_judgment" の場合に STEP_5_OPERATOR_INTERVENTION_REQUIRED(新設定数)を返す分岐を追加する
  • 同条件で failure_class が欠落・null の場合は既存どおり STEP_4 を返すことを維持する
  • 未知の非空 failure_class、型不正な merged_review_result、矛盾した組合せは既存どおり FAIL_CLOSED_ENVIRONMENT_OR_INTEGRITY_FAILURE を返すことを維持する
  • input_or_runtime_error / reviewer transport failure / artifact readback failure の既存 fail-closed 経路は変更しない
  • issue-refinement-loop/SKILL.md の Step 2 routing table に step_5_operator_intervention_required の説明を追記する
  • issue-refinement-loop/references/termination-policy.md に operator_intervention_required の termination cause 定義・summary 記述方法を追記する
  • review-issue/SKILL.md の Producer I/O ownership 節にある「reviewer_transport.py が failure_class を読んで NEXT_ACTION: human_judgment_required に変換する」という未実装記述を、「route_canonical_step2_result() が verified merged_review_result.failure_class を直接参照する」という現状の設計に修正する
  • 対応するテストを新規ファイル .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py に追加する(既存ファイルへの新規関数追加という非canonical VC形状〈Issue 実装: VC baseline-fail 用 pytest command を canonical form に正規化して contract-review 往復を削減する #1285/feat: VC baseline-fail pytest command を canonical form に正規化する compiler を追加 #1305〉を避けるため)。既存 test_canonical_step2_route_wiring.py(フル実行での回帰確認)・test_review_compact_v2.py / test_reviewer_transport_e2e.py(V2 wire 不変の回帰確認)は変更しない
  • (Scope Delta iteration 3, P0-1) test_genuinely_operator_only_fixture_routes_to_operator_intervention(AC11)の fixture を、unknown catch-all 分類(jq を存在しないパスへ実行するトリック)から、決定論的に生成される既知の operator-only カテゴリ(env_missing_dep 等。preflight の subprocess 実行境界を monkeypatch して既知の分類結果を返す)へ差し替える。テスト関数名・アサーション内容(failure_class == "contract_readiness_human_judgment" かつ canonical_step2_route == STEP_5_OPERATOR_INTERVENTION_REQUIRED)は変更しない
  • (Scope Delta iteration 3, P1-1) issue-refinement-loop/SKILL.md に、Step 5 operator intervention route の終了処理が canonical_step2_disposition の termination_reason / termination_cause フィールドをそのまま使用し、独自に再導出しないことを明記する一文を追加する
  • (Scope Delta iteration 3, P1-2) issue-refinement-loop/SKILL.md の step_5_human_judgment_required の説明を、現行 Compact V2 producer からは生成されない defensive/legacy route であり、genuine semantic / owner ambiguity の実経路は Step 2.5 semantic design review が別途所有する、という現状に合わせて修正する
  • (Scope Delta iteration 3, P1-3) run_root_review_pipeline.py の FAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT 定数定義に、これが route-critical な既知 failure_class 値の single source of truth であることを明示するコメントを追加する
  • (Scope Delta) .claude/skills/issue-contract-review/scripts/contract_readiness_check.py の _PREFLIGHT_CATEGORY_TO_READINESS に "command_not_allowed": "needs_fix" を追加し、body-fixable な command_not_allowed が human_judgment(延いては operator intervention route)へ誤ってフォールバックしないようにする
  • (Scope Delta) E2E テスト(test_operator_intervention_route.py)の operator-only fixture を、command_not_allowed ではなく真に本文修正では解消しない状態(例: 許可コマンド一覧に無い実行不能バイナリを要求する env_missing_dep 相当、または preflight タイムアウト)に差し替える
  • (Scope Delta) command_not_allowed → readiness_status: needs_fix → failure_class なし → canonical_step2_route: step_4 の回帰テストを追加する
  • (Scope Delta) _cmd_produce() の成功 payload に、canonical_step2_route と並べて canonical_step2_disposition(route / terminal / termination_reason / termination_cause の pure な導出結果。route が step_5_operator_intervention_required の場合のみ terminal: true / termination_reason: "human_escalation" / termination_cause: "operator_intervention_required"、それ以外は {"route": route} のみ)を追加する
  • (Scope Delta) issue-refinement-loop/SKILL.md の Step 2 routing table 直後の要約(approve → Step 2.5 / needs-fix → Step 4 / human_judgment_required → Step 5 / inconsistent → fail closed の4分岐)に step_5_operator_intervention_required を独立した5番目の分岐として明記する
  • (Scope Delta) PR 本文の Schema Change Applicability を、「Compact V2 wire: no schema change」「_cmd_produce() の stdout JSON canonical_step2_route enum への値追加、および canonical_step2_disposition フィールド追加: additive contract change」の二層で記載し、consumer inventory に review-issue/SKILL.md / command_registry.py / run_root_review_pipeline.py / test_canonical_step2_route_wiring.py を明記する
  • (Scope Delta) Issue タイトルを旧設計から現行設計の名称へ更新する
  • (Scope Delta) .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py の route_canonical_step2_result() docstring、および .claude/skills/review-issue/scripts/check_issue_contract.py の docstring に残る撤回済み設計(compact wire 側で failure_class から NEXT_ACTION: human_judgment_required を導出する、という旧経路の説明)を、現行の root-owned route 設計の説明へ更新する

Out of Scope

  • ISSUE_REVIEW_RESULT_COMPACT_V2 の wire format 変更(build_compact_v2() / validate_compact_v2() / NEXT_ACTION の値域は二値のまま維持し、一切変更しない)
  • merged_review_result.failure_class 以外の新規フィールド追加(ただし canonical_step2_disposition は本 Scope Delta で明示的に許可する。これは failure_class を含む既存 payload から pure に導出される追加フィールドであり、新しい入力フィールドではない)
  • 新規 receipt / ledger / persistent state / security harness の追加
  • contract_readiness_check.py の readiness_status_to_failure_class() 自体の変更(この関数は現状のまま利用する。本 Scope Delta で変更するのは _PREFLIGHT_CATEGORY_TO_READINESS のカテゴリ分類のみ)
  • step_5_human_judgment_required(genuine semantic / owner ambiguity 用)route 自体の判定ロジック変更
  • command_not_allowed 以外の既存 _PREFLIGHT_CATEGORY_TO_READINESS エントリの再分類(env_missing_dep / timeout / package_manager_no_tty_prompt / unknown 等は operator-only のまま維持する)

Acceptance Criteria

  • AC1: 実 _cmd_produce() 形状の payload(status: ok、compact_result.verdict: needs-fix、compact_result.next_action: request_changes、merged_review_result.failure_class: "contract_readiness_human_judgment")を route_canonical_step2_result() に渡すと step_5_operator_intervention_required が返る
  • AC2: 同じ needs-fix + request_changes の payload で merged_review_result.failure_class が欠落または None の場合、route_canonical_step2_result() は既存どおり step_4 を返す
  • AC3: merged_review_result.failure_class が未知の非空文字列、または merged_review_result 自体が Mapping でない場合、route_canonical_step2_result() は fail_closed_environment_or_integrity_failure を返す
  • AC4: (a) status: ok + verdict: approve + next_action: proceed は本 Issue の変更後も従来どおり step_2_5 に到達する(回帰)。(b) status: input_or_runtime_error(既知/未知の error_code を問わず)、および approve + human_judgment_required のような矛盾組合せは本 Issue の変更後も従来どおり fail_closed_environment_or_integrity_failure を維持する(既存回帰)
  • AC5: ISSUE_REVIEW_RESULT_COMPACT_V2 の build_compact_v2() / validate_compact_v2() は本 Issue によって一切変更されず、既存の test_review_compact_v2.py / test_reviewer_transport_e2e.py が変更前と同じ内容で PASS する(NEXT_ACTION の二値契約が維持されていることの回帰確認)
  • AC6: review-issue/SKILL.md の Producer I/O ownership 節から「reviewer_transport.py が failure_class を読んで NEXT_ACTION: human_judgment_required に変換する」という未実装記述が削除され、root-owned canonical route が merged_review_result.failure_class を参照するという現状説明に置き換わっている
  • AC7: issue-refinement-loop/references/termination-policy.md に operator_intervention_required の termination cause が追記されており、step_5_operator_intervention_required route に到達した場合の終了処理が既存 Step 5 handler の再利用であること、termination_reason: human_escalation / termination_cause: operator_intervention_required として区別されること、および本ルールが既存の「scope_signal_guard 停止時は termination_cause を常に human_judgment_required に正規化する」ルール(別トリガー経路)とは独立であり、route_canonical_step2_result() 起因の本 route はこの正規化の対象外であることが明記されている
  • AC8: 本 Issue の変更はネットワーク・実 Claude runtime・外部認証・新規 receipt/ledger/state store のいずれも追加しない
  • AC9(Scope Delta): _PREFLIGHT_CATEGORY_TO_READINESS に command_not_allowed: "needs_fix" が追加されており、command_not_allowed カテゴリの readiness result は readiness_status: needs_fix になる(human_judgment にならない)
  • AC10(Scope Delta): command_not_allowed な readiness(failure_class なし)を持つ verified merged_review_result は canonical_step2_route: step_4 に到達する(step_5_operator_intervention_required には到達しない)
  • AC11(Scope Delta): 真に本文修正不能な operator-only fixture(command_not_allowed 以外)を用いた E2E テストが、canonical_step2_route: step_5_operator_intervention_required に到達することを検証する
  • AC12(Scope Delta): _cmd_produce() の成功 payload に canonical_step2_disposition フィールドが含まれ、route が step_5_operator_intervention_required の場合のみ terminal: true / termination_reason: "human_escalation" / termination_cause: "operator_intervention_required" を持つ。それ以外の route では {"route": route} のみを持つ
  • AC13(Scope Delta): issue-refinement-loop/SKILL.md の Step 2 routing table 直後の要約に step_5_operator_intervention_required が独立した分岐として明記されている
  • AC14(Scope Delta iteration 3): AC11 の E2E fixture が unknown catch-all 分類ではなく、決定論的に生成される既知の operator-only カテゴリ(env_missing_dep 等)を使用しており、AC11 のテストは変更後の fixture でも引き続き PASS する
  • AC15(Scope Delta iteration 3): issue-refinement-loop/SKILL.md に、Step 5 operator intervention route の終了処理が canonical_step2_disposition の termination_reason / termination_cause をそのまま使用し再導出しないことが明記されている
  • AC16(Scope Delta iteration 3): issue-refinement-loop/SKILL.md の step_5_human_judgment_required の説明が、現行 Compact V2 producer からは生成されない defensive/legacy route である旨に修正されている
  • AC17(Scope Delta iteration 3): run_root_review_pipeline.py の FAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT 定数に、route-critical な既知 failure_class 値の single source of truth であることを明示するコメントが付与されている

Verification Commands

AC1〜AC3 のテストは、既存ファイルへの新規関数追加ではなく新規テストファイル .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py(現時点では未作成)に追加する。

# AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py::test_route_canonical_step2_result_needs_fix_request_changes_with_contract_readiness_human_judgment_routes_to_operator_intervention .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py::test_given_real_produce_needs_fix_body_with_contract_readiness_human_judgment_when_run_then_routes_to_operator_intervention -v

# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py::test_route_canonical_step2_result_needs_fix_request_changes_without_failure_class_routes_to_step_4 -v

# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py::test_route_canonical_step2_result_needs_fix_request_changes_with_unknown_failure_class_fails_closed -v

# AC4
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_canonical_step2_route_wiring.py -v

# AC5
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_review_compact_v2.py .claude/skills/issue-refinement-loop/tests/test_reviewer_transport_e2e.py -q

# AC6
$ rg -n "root-owned canonical route.*merged_review_result.failure_class" .claude/skills/review-issue/SKILL.md

# AC7
$ rg -n "operator_intervention_required" .claude/skills/issue-refinement-loop/references/termination-policy.md

# AC8
$ rg -n -e "^import requests" -e "^import socket" -e "^import urllib" .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py

# AC9
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py::test_command_not_allowed_category_maps_to_needs_fix_not_human_judgment -v

# AC10
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py::test_command_not_allowed_readiness_routes_to_step_4_not_operator_intervention -v

# AC11
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py::test_genuinely_operator_only_fixture_routes_to_operator_intervention -v

# AC12
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py::test_cmd_produce_includes_canonical_step2_disposition_for_operator_route .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py::test_cmd_produce_disposition_is_route_only_for_non_operator_routes -v

# AC13
$ rg -n "step_5_operator_intervention_required" .claude/skills/issue-refinement-loop/SKILL.md

# AC14
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py::test_genuinely_operator_only_fixture_routes_to_operator_intervention -v

# AC15
$ rg -n "canonical_step2_disposition.*再導出しない" .claude/skills/issue-refinement-loop/SKILL.md

# AC16
$ rg -n "defensive.legacy route" .claude/skills/issue-refinement-loop/SKILL.md

# AC17
$ rg -n "single source of truth" .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py
  • .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py
  • .claude/skills/issue-refinement-loop/SKILL.md
  • .claude/skills/issue-refinement-loop/references/termination-policy.md
  • .claude/skills/review-issue/SKILL.md
  • .claude/skills/issue-contract-review/scripts/contract_readiness_check.py(Scope Delta: _PREFLIGHT_CATEGORY_TO_READINESS の command_not_allowed エントリ追加のみ)
  • .claude/skills/review-issue/scripts/check_issue_contract.py(Scope Delta: docstring 修正のみ)
  • .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py(Scope Delta: 新規ファイル)
  • .claude/skills/review-issue/tests/test_check_issue_contract.py(Scope Delta iteration 2: TestContractReadinessExecuteIntegration::test_human_judgment_not_collapsed_to_needs_fix が command_not_allowed fixture に依存しており AC9 の意図的な挙動変更で fail する。fixture を真の operator-only 状態〈env_missing_dep 相当等〉へ差し替えるのみ)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合(特に reviewer_transport.py / compact V2 wire への変更が必要と判明した場合。本 Issue はこれを明示的に Out of Scope とする設計判断のため、必要になった場合は設計そのものの再検討が必要)
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Required Design References

  • .claude/skills/review-issue/SKILL.md
  • .claude/skills/issue-refinement-loop/references/termination-policy.md
  • docs/dev/agent-skill-boundaries.md

Scope Delta(任意)

scope_delta:
  status: approved_by_trusted_anchor
  anchor_comment_url: "https://github.com/squne121/loop-protocol/pull/2398#issuecomment-5465119493"
  anchor_author_association: OWNER
  allowed_path_deltas:
    - .claude/skills/issue-contract-review/scripts/contract_readiness_check.py
    - .claude/skills/review-issue/scripts/check_issue_contract.py
    - .claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py
    - .claude/skills/review-issue/tests/test_check_issue_contract.py
  reason: "PR #2398 への OWNER 敵対的レビュー(P0-1)が、command_not_allowed の誤分類回帰を指摘し、contract_readiness_check.py の修正を要求したため。この修正により command_not_allowed → human_judgment を前提にしていた既存テスト test_human_judgment_not_collapsed_to_needs_fix が fail するため、fixture 差し替えのみ Allowed Paths に追加する(iteration 2, CI red で判明)"

Notes for Reviewer

Activity

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

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES — reframe_in_place を推奨します。

    Issue #2397 は、contract_readiness_human_judgment が通常の request_changes に落ち、Issue 本文を書き換えても直らない状態が Step 4 の rewrite loop に誤配送されるという不具合を正しく捉えています。

    ただし、現在の Issue は本質を「V2 wire の NEXT_ACTION を三値化すること」と定義しており、修正レイヤーを一段間違えています。このまま実装すると、直接ユニットテストだけ成功し、本番 producer・artifact 再投影・legacy wire が互いに矛盾する可能性があります。

    2026年8月29日時点で Issue #2397 自体にはコメントがありません。設計上の重要な判断材料は、起票元である PR #2391 の OWNER 敵対的レビューと、その後の修正コメントにあります。


    主要な指摘

    P0-1: Acceptance Criteria が「実 producer からの到達」を証明していません

    現在の production 経路には、少なくとも次の判定箇所があります。

    merged REVIEW_ISSUE_RESULT_V1
        ↓
    _semantic_verdict_and_count()
        ↓
    run_reviewer_transport()
        ↓
    build_compact_v2()
        ↓
    validate_compact_v2()
        ↓
    project_compact_v2_from_artifact()
        ↓
    verify_wire_matches_artifact()
        ↓
    run_root_review_pipeline._cmd_produce()
        ↓
    再度 build_compact_v2()
        ↓
    compact_result / canonical_step2_route

    Issue #2397 の In Scope は build_compact_v2() と validate_compact_v2() を中心にしていますが、現実には以下も同じ判断規則を共有しなければなりません。

    • _semantic_verdict_and_count() は現在、verdict と blocking_issues 件数しか返さず、failure_class を捨てています。

    • project_compact_v2_from_artifact() は verified artifact から同じ二値規則で wire を再生成します。

    • verify_wire_matches_artifact() はその再生成結果と実 wire をバイト単位で比較します。

    • run_reviewer_transport() は現在、failure_class を渡さずに builder を呼びます。

    そのため、AC1〜AC3の直接関数テストだけでは、次の false-green が成立します。

    1. builder と validator だけ三値化する
      → run_reviewer_transport() が failure_class を渡さないので production 出力は二値のまま。

    2. run_reviewer_transport() まで修正するが artifact projection を修正しない
      → wire は human_judgment_required、artifact 再投影は request_changes となり、wire_artifact_semantic_mismatch で自己検証に失敗。

    3. reviewer_transport.py 内をすべて修正する
      → run_root_review_pipeline._cmd_produce() が最後にもう一度 build_compact_v2() を呼びますが、ここでは failure_class を渡していません。その結果、compact_result.next_action は inner compact の human_judgment_required、compact_result.stdout_lines は outer renderer の request_changes という同一 producer 内の split-brainが起こります。

    つまり、Issue の Outcome にある「実際の producer 出力から到達可能になる」は、現在の Allowed Paths と AC では閉じていません。Issue #2054/PR #2142 でも、production wiring と artifact 再投影が必要だと判明した段階で run_root_review_pipeline.py や agent 定義まで Allowed Paths を広げ、全経路を原子的に更新しています。今回だけ builder 単体に閉じる合理的な理由はありません。


    P0-2: contract_readiness_human_judgment は「仕様判断」ではなく、ほぼ operator intervention です

    contract_readiness_check.py における human_judgment は、純粋な意味判断や owner の方針決定を表していません。実装上、次のような状態を含みます。

    • env_missing_dep

    • timeout

    • unknown classification

    • regression gate failure

    • package_manager_no_tty_prompt

    • validator timeout

    • validator internal error

    • validator JSON decode error

    • body retrieval failure

    モジュール自身も、exit 2 を「env/tool/runtime issues needing human attention」と定義しています。

    したがって、

    contract_readiness_human_judgment
        ↓
    NEXT_ACTION: human_judgment_required
        ↓
    step_5_human_judgment_required
        ↓
    human_review_required

    と一律変換すると、rewrite loop への誤配送は防げても、今度は依存パッケージ不足や一時的 timeout を「仕様・意味・owner 判断が必要」と誤分類します。

    さらに現在の termination policy は、「人間レビューが必要な任意の状態」を human_escalation にまとめ、cause 未指定時には human_judgment_required を補います。このまま既存 Step 5 へ送ると、運用障害と本物の設計判断の区別は終了レポートでも消えます。

    起票元の OWNER レビューは、まさにこの点を指摘し、次の分離を推奨していました。

    genuine semantic / owner ambiguity
        → step_5_human_judgment_required
    

    known environment / tool condition
    → step_5_operator_intervention_required

    malformed / unknown contract state
    → fail_closed_environment_or_integrity_failure

    同レビューは、V2 wire を拡張するより、verified merged_review_result.failure_class を root-owned producer の route 計算で使う方が軽量だとも明記しています。Issue #2397 は、この推奨ではなく、明示的に避けるよう提案された wire 拡張案を採用しています。

    個人趣味開発の運用では、意味判断でもない状態で owner escalation を増やすより、「環境を直して再実行する」ことが分かる operator route にした方が明らかに実用的です。


    P0-3: これは「引数追加」ではなく V2 wire 契約変更です

    Issue #2054 は ISSUE_REVIEW_RESULT_COMPACT_V2 を exact 11-line grammar として定義し、NEXT_ACTION を次の二値に固定しています。

    NEXT_ACTION: proceed | request_changes

    さらに、V1→V2 は atomic cutover、downgrade fallback なし、producer・validator・artifact projection・consumer・agent 定義を同時更新する契約でした。

    現在の repository には、依然として二値契約を明記する配布資産があります。

    • .claude/agents/issue-reviewer.md

    • validate_review_compact_output.py の CLI 契約説明

    • artifact からの canonical projection

    • root pipeline の再 renderer

    .claude/skills/**/SKILL.md や .claude/agents/*.md は、単なる補助文書ではなく、Claude Code が project scope で読み込む skill/subagent の実行指示資産です。出力 grammar が stale なままなら、ドキュメント上の軽微な不一致ではなく、配布される実行契約の不一致です。(Claude)

    V3 化が必須とまでは言えません。repository 内だけで原子的に更新できるなら、V2 の値域拡張として扱う選択肢もあります。ただし、固定 enum の値集合を増やすことは明確な契約変更であり、旧 validator は実際に新値を拒否します。少なくとも次を宣言すべきです。

    schema_change:
    decision: value_domain_extension
    compatibility: atomic_repo_wide_cutover
    mixed_version_support: forbidden
    supersedes:
    - "#2054 AC5 の NEXT_ACTION 値域に限定"

    一般にも、enum は許容値集合を閉じる仕組みであり、公開 API の非互換変更には明示的なバージョニング判断が必要です。(JSON Schema)


    P1-1: failure_class: Optional[str] をそのまま routing authority にする設計が弱いです

    REVIEW_ISSUE_RESULT_V1 の JSON Schema は、現在 failure_class を properties に定義していません。しかも additionalProperties: true なので、任意の値・任意の型が schema validation を通り得ます。

    その状態で builder に裸の Optional[str] を足し、

    failure_class == "contract_readiness_human_judgment"

    だけで制御フローを変えると、次の挙動が未規定です。

    • approve + contract_readiness_human_judgment

    • needs-fix + blockers == 0 + contract_readiness_human_judgment

    • typo を含む未知 failure_class

    • HJ wire だが artifact 内の failure_class は欠落

    • failure_class が文字列以外

    • artifact は HJ、outer renderer は通常 needs-fix

    特に AC2 は「未知値なら従来動作」としており、contract_readiness_human_judgement のような typo が通常の rewrite loop に静かに戻る設計です。

    wire 拡張を維持するなら、renderer に policy を埋め込むのではなく、verified semantic artifact 全体から次を一度だけ導出する SSOT が必要です。

    project_semantic_disposition(
    semantic_result: Mapping[str, object],
    ) -> CompactDisposition

    最低限の閉じた真理値表は次です。

    verdict blockers failure_class disposition
    approve 0 absent/null proceed
    needs-fix 1以上 absent/null request_changes
    needs-fix 1以上 exact known operational class operator intervention
    任意 任意 未知の非空値 fail-closed
    その他の不整合 — — invalid

    実装箇所は route_canonical_step2_result() です。この関数には _cmd_produce() の全 payload が渡され、成功時 payload の merged_review_result は verified transport artifact から取り出されたものです。したがって、wire を拡張しなくても信頼済みの failure_class を参照できます。

    step_5_operator_intervention_required は新しい画面や state machine を必要としません。既存 Step 5 の表示・終了処理を再利用しつつ、終了原因だけを以下のように区別すれば足ります。

    termination_reason: human_escalation
    termination_cause: operator_intervention_required

    これにより、現在の human_judgment_required への無条件正規化を避けられます。

    この案では、次の既存ハーネスには触れません。

    • artifact hash/binding

    • no-follow traversal

    • immutable attempt artifact

    • retry matrix

    • transport failure separation

    • V2 wire validator

    • agent permission

    つまり、品質上必要な routing 修正だけを行い、セキュリティ機構や schema を増やしません。


    Issue #2397 の推奨リフレーム案

    推奨タイトル

    実装: verified readiness の本文修正不能状態を canonical operator-intervention route へ接続する

    Architecture Decision

    architecture_decision:
      preserve:
        - "#2054 の success-only compact V2 exact 11-line grammar"
        - "NEXT_ACTION: proceed | request_changes の二値契約"
        - "transport/integrity failure と semantic result の分離"
        - "artifact verification / retry / permission の現行実装"
    

    supersedes:
    - target: "#2389 の triple-only route 判定"
    extent: >
    status=ok、verdict=needs-fix、next_action=request_changes の場合に限り、
    verified merged_review_result.failure_class を追加判定へ使用する。

    new_route:
    name: step_5_operator_intervention_required
    physical_handler: existing_step_5
    termination_cause: operator_intervention_required

    Outcome

    contract_readiness_human_judgment を持つ verified merged review result は
    通常の Issue rewrite loop に入らず、operator intervention として Step 5 に停止する。

    compact V2 wire、artifact schema、transport failure 分類は変更しない。

    Acceptance Criteria

    • AC1: 実 producer 形状の status: ok、verdict: needs-fix、next_action: request_changes、merged_review_result.failure_class: contract_readiness_human_judgment が step_5_operator_intervention_required に到達する。

    • AC2: 同じ needs-fix + request_changes でも failure_class が欠落または null の場合は、既存どおり step_4 に到達する。

    • AC3: 未知の非空 failure_class、型不正、矛盾した verdict/action は fail-closed となる。

    • AC4: input_or_runtime_error、reviewer transport failure、artifact readback failure は operator route や human-judgment route に昇格せず、既存どおり fail-closed となる。

    • AC5: ISSUE_REVIEW_RESULT_COMPACT_V2 の builder/validator/artifact projection は一切変更されず、NEXT_ACTION の二値契約を維持する。

    • AC6: review-issue/SKILL.md にある「reviewer_transport.py が failure_class を読んで HJ wire に変換する」という未実装説明を削除し、root-owned canonical route が verified merged result を参照する説明へ直す。

    • AC7: operator route は既存 Step 5 handler を再利用するが、termination cause を human_judgment_required に正規化せず operator_intervention_required として保持する。

    • AC8: ネットワーク、実 Claude runtime、外部認証、新規 receipt/ledger/state store を追加しない。

    Runtime Verification Applicability

    decision: immediate
    execution_environment:
    cli_tools: [python3, uv]
    auth_required: false
    network_required: false
    fallback_policy:
    fallback_success_is_pass: false
    artifact_requirements:

    • focused production-shaped pytest output

    推奨 Verification Commands

    uv run --locked pytest 
    .claude/skills/issue-refinement-loop/tests/test_canonical_step2_route_wiring.py
    -k "operator_intervention or contract_readiness_human_judgment" -v

    uv run --locked pytest
    .claude/skills/issue-refinement-loop/tests/test_root_review_canonical_delivery.py -q

    V2 wire が変わっていないこと

    uv run --locked pytest
    .claude/skills/issue-refinement-loop/tests/test_review_compact_v2.py
    .claude/skills/issue-refinement-loop/tests/test_reviewer_transport_e2e.py -q

    推奨 Allowed Paths

    .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py
    .claude/skills/issue-refinement-loop/tests/test_canonical_step2_route_wiring.py
    .claude/skills/issue-refinement-loop/tests/test_root_review_canonical_delivery.py
    .claude/skills/issue-refinement-loop/SKILL.md
    .claude/skills/issue-refinement-loop/references/termination-policy.md
    .claude/skills/review-issue/SKILL.md

    現案の wire 三値化を維持する場合の最低条件

    V2 wire を本当に拡張するなら、現在の Allowed Paths では不足です。少なくとも次を同一 PR で更新する必要があります。

    1. reviewer_transport.py

      • canonical semantic disposition helper

      • builder

      • validator

      • run_reviewer_transport

      • artifact projection

      • wire-artifact cross-check

    2. run_root_review_pipeline.py

      • outer re-render の撤去、または同一 disposition の引き継ぎ

      • compact_result.stdout_lines と compact_result.next_action の一致検証

    3. 配布・consumer 資産

      • validate_review_compact_output.py

      • .claude/agents/issue-reviewer.md

      • agent parity が要求する場合は .codex/agents/issue-reviewer.toml

      • review-issue/SKILL.md

      • issue-refinement-loop/SKILL.md

    4. テスト

      • artifact に HJ class がある正例

      • artifact に HJ class がないのに wire だけ HJ の負例

      • outer producer の stdout_lines/next_action/canonical route の一致

      • mixed old/new consumer rejection

      • exact truth table

    こちらは実装量と契約面積が大きく、今回の目的に対して有用性が低いため、推奨しません。


    verdict: REQUEST_CHANGES
    recommended_disposition: reframe_in_place

    blocking_findings:

    • id: P0-1
      summary: >
      builder/validator の直接テストだけでは production producer、
      artifact re-projection、outer re-render の収束を証明できない。
    • id: P0-2
      summary: >
      contract_readiness_human_judgment は環境・tool・timeout 系を含み、
      semantic human judgment への一律変換は誤分類と不要な中断を生む。
    • id: P0-3
      summary: >
      NEXT_ACTION の三値化は #2054 の exact V2 wire 契約変更だが、
      consumer inventory、atomic cutover、配布資産更新が欠落している。

    recommended_implementation:
    compact_v2_change: false
    artifact_hardening_change: false
    new_harness: false
    routing_change:
    source: verified_merged_review_result.failure_class
    destination: step_5_operator_intervention_required
    handler_reuse: existing_step_5

    なお、本レビューでは current main のコード、Issue/PR/コメント、公式仕様を照合しましたが、ローカル checkout 上で pytest 自体は実行していません。PR に記録された既存テスト結果は参照していますが、Issue #2397 の提案実装はまだ存在しないため、上記の production-shaped regression test が実装時の最終確認になります。

    # 判定

    REQUEST_CHANGES — reframe_in_place を推奨します。

    Issue #2397 は、contract_readiness_human_judgment が通常の request_changes に落ち、Issue 本文を書き換えても直らない状態が Step 4 の rewrite loop に誤配送されるという不具合を正しく捉えています。

    ただし、現在の Issue は本質を「V2 wire の NEXT_ACTION を三値化すること」と定義しており、修正レイヤーを一段間違えています。このまま実装すると、直接ユニットテストだけ成功し、本番 producer・artifact 再投影・legacy wire が互いに矛盾する可能性があります。

    2026年8月29日時点で Issue #2397 自体にはコメントがありません。設計上の重要な判断材料は、起票元である PR #2391 の OWNER 敵対的レビューと、その後の修正コメントにあります。


    主要な指摘

    P0-1: Acceptance Criteria が「実 producer からの到達」を証明していません

    現在の production 経路には、少なくとも次の判定箇所があります。

    merged REVIEW_ISSUE_RESULT_V1
        ↓
    _semantic_verdict_and_count()
        ↓
    run_reviewer_transport()
        ↓
    build_compact_v2()
        ↓
    validate_compact_v2()
        ↓
    project_compact_v2_from_artifact()
        ↓
    verify_wire_matches_artifact()
        ↓
    run_root_review_pipeline._cmd_produce()
        ↓
    再度 build_compact_v2()
        ↓
    compact_result / canonical_step2_route
    

    Issue #2397 の In Scope は build_compact_v2() と validate_compact_v2() を中心にしていますが、現実には以下も同じ判断規則を共有しなければなりません。

    • _semantic_verdict_and_count() は現在、verdict と blocking_issues 件数しか返さず、failure_class を捨てています。
    • project_compact_v2_from_artifact() は verified artifact から同じ二値規則で wire を再生成します。
    • verify_wire_matches_artifact() はその再生成結果と実 wire をバイト単位で比較します。
    • run_reviewer_transport() は現在、failure_class を渡さずに builder を呼びます。

    そのため、AC1〜AC3の直接関数テストだけでは、次の false-green が成立します。

    1. builder と validator だけ三値化する
      → run_reviewer_transport() が failure_class を渡さないので production 出力は二値のまま。

    2. run_reviewer_transport() まで修正するが artifact projection を修正しない
      → wire は human_judgment_required、artifact 再投影は request_changes となり、wire_artifact_semantic_mismatch で自己検証に失敗。

    3. reviewer_transport.py 内をすべて修正する
      → run_root_review_pipeline._cmd_produce() が最後にもう一度 build_compact_v2() を呼びますが、ここでは failure_class を渡していません。その結果、compact_result.next_action は inner compact の human_judgment_required、compact_result.stdout_lines は outer renderer の request_changes という同一 producer 内の split-brainが起こります。

    つまり、Issue の Outcome にある「実際の producer 出力から到達可能になる」は、現在の Allowed Paths と AC では閉じていません。Issue #2054/PR #2142 でも、production wiring と artifact 再投影が必要だと判明した段階で run_root_review_pipeline.py や agent 定義まで Allowed Paths を広げ、全経路を原子的に更新しています。今回だけ builder 単体に閉じる合理的な理由はありません。


    P0-2: contract_readiness_human_judgment は「仕様判断」ではなく、ほぼ operator intervention です

    contract_readiness_check.py における human_judgment は、純粋な意味判断や owner の方針決定を表していません。実装上、次のような状態を含みます。

    • env_missing_dep
    • timeout
    • unknown classification
    • regression gate failure
    • package_manager_no_tty_prompt
    • validator timeout
    • validator internal error
    • validator JSON decode error
    • body retrieval failure

    モジュール自身も、exit 2 を「env/tool/runtime issues needing human attention」と定義しています。

    したがって、

    contract_readiness_human_judgment
        ↓
    NEXT_ACTION: human_judgment_required
        ↓
    step_5_human_judgment_required
        ↓
    human_review_required
    

    と一律変換すると、rewrite loop への誤配送は防げても、今度は依存パッケージ不足や一時的 timeout を「仕様・意味・owner 判断が必要」と誤分類します。

    さらに現在の termination policy は、「人間レビューが必要な任意の状態」を human_escalation にまとめ、cause 未指定時には human_judgment_required を補います。このまま既存 Step 5 へ送ると、運用障害と本物の設計判断の区別は終了レポートでも消えます。

    起票元の OWNER レビューは、まさにこの点を指摘し、次の分離を推奨していました。

    genuine semantic / owner ambiguity
        → step_5_human_judgment_required
    
    known environment / tool condition
        → step_5_operator_intervention_required
    
    malformed / unknown contract state
        → fail_closed_environment_or_integrity_failure
    

    同レビューは、V2 wire を拡張するより、verified merged_review_result.failure_class を root-owned producer の route 計算で使う方が軽量だとも明記しています。Issue #2397 は、この推奨ではなく、明示的に避けるよう提案された wire 拡張案を採用しています。

    個人趣味開発の運用では、意味判断でもない状態で owner escalation を増やすより、「環境を直して再実行する」ことが分かる operator route にした方が明らかに実用的です。


    P0-3: これは「引数追加」ではなく V2 wire 契約変更です

    Issue #2054 は ISSUE_REVIEW_RESULT_COMPACT_V2 を exact 11-line grammar として定義し、NEXT_ACTION を次の二値に固定しています。

    NEXT_ACTION: proceed | request_changes
    

    さらに、V1→V2 は atomic cutover、downgrade fallback なし、producer・validator・artifact projection・consumer・agent 定義を同時更新する契約でした。

    現在の repository には、依然として二値契約を明記する配布資産があります。

    • .claude/agents/issue-reviewer.md

    • validate_review_compact_output.py の CLI 契約説明

    • artifact からの canonical projection

    • root pipeline の再 renderer

    .claude/skills/**/SKILL.md や .claude/agents/*.md は、単なる補助文書ではなく、Claude Code が project scope で読み込む skill/subagent の実行指示資産です。出力 grammar が stale なままなら、ドキュメント上の軽微な不一致ではなく、配布される実行契約の不一致です。(Claude)

    V3 化が必須とまでは言えません。repository 内だけで原子的に更新できるなら、V2 の値域拡張として扱う選択肢もあります。ただし、固定 enum の値集合を増やすことは明確な契約変更であり、旧 validator は実際に新値を拒否します。少なくとも次を宣言すべきです。

    schema_change:
      decision: value_domain_extension
      compatibility: atomic_repo_wide_cutover
      mixed_version_support: forbidden
      supersedes:
        - "#2054 AC5 の NEXT_ACTION 値域に限定"

    一般にも、enum は許容値集合を閉じる仕組みであり、公開 API の非互換変更には明示的なバージョニング判断が必要です。([JSON Schema]2)


    P1-1: failure_class: Optional[str] をそのまま routing authority にする設計が弱いです

    REVIEW_ISSUE_RESULT_V1 の JSON Schema は、現在 failure_class を properties に定義していません。しかも additionalProperties: true なので、任意の値・任意の型が schema validation を通り得ます。

    その状態で builder に裸の Optional[str] を足し、

    failure_class == "contract_readiness_human_judgment"

    だけで制御フローを変えると、次の挙動が未規定です。

    • approve + contract_readiness_human_judgment
    • needs-fix + blockers == 0 + contract_readiness_human_judgment
    • typo を含む未知 failure_class
    • HJ wire だが artifact 内の failure_class は欠落
    • failure_class が文字列以外
    • artifact は HJ、outer renderer は通常 needs-fix

    特に AC2 は「未知値なら従来動作」としており、contract_readiness_human_judgement のような typo が通常の rewrite loop に静かに戻る設計です。

    wire 拡張を維持するなら、renderer に policy を埋め込むのではなく、verified semantic artifact 全体から次を一度だけ導出する SSOT が必要です。

    project_semantic_disposition(
        semantic_result: Mapping[str, object],
    ) -> CompactDisposition

    最低限の閉じた真理値表は次です。

    verdict blockers failure_class disposition
    approve 0 absent/null proceed
    needs-fix 1以上 absent/null request_changes
    needs-fix 1以上 exact known operational class operator intervention
    任意 任意 未知の非空値 fail-closed
    その他の不整合 — — invalid

    builder はその disposition を文字列化するだけにし、run_reviewer_transport() と project_compact_v2_from_artifact() の両方が同じ helper を使うべきです。


    P1-2: Runtime Verification Applicability が誤っています

    Issue #2397 は decision: not_applicable としていますが、変更対象は production output と canonical routing の分岐到達性です。grep と direct unit test だけで完結する変更ではありません。

    PR #2391 自体は route wiring を immediate な runtime verification として扱い、production-shaped pytest で _cmd_produce() の出力を確認しています。今回も同じ水準が必要です。

    ただし、実 Claude CLI、外部認証、ネットワーク canary、新しい harness は不要です。次の一件の hermetic subprocess test で十分です。

    schema-valid REVIEW_ISSUE_RESULT_V1
      failure_class = contract_readiness_human_judgment
            ↓
    real reviewer_transport path
            ↓
    verified artifact readback
            ↓
    real _cmd_produce()-shaped result
            ↓
    expected canonical route
    

    併せて、artifact に failure class がない状態で手作り HJ wire を渡した場合に、cross-binding が拒否する negative test が必要です。


    P2: Scope Collision Record が実際の重複を正確に表していません

    Issue #2397 は #2393 と #2153 を一般的な path overlap としていますが、実態は異なります。

    .claude/skills/issue-refinement-loop/tests/ 全体を Allowed Paths にするのではなく、変更する test file を列挙した方が、不要な scope collision と並行作業停止を減らせます。


    推奨する修正方針

    V2 wire は変更せず、root-owned route で operational failure を扱う

    本件で本当に直すべきなのは、

    failure_class が compact wire に載らないこと

    ではなく、

    verified semantic result にある「本文修正不能」という情報が canonical route に反映されないこと

    です。

    推奨 route は次です。

    verified producer state route
    approve + proceed、failure class なし step_2_5
    needs-fix + request_changes、failure class なし step_4
    needs-fix + request_changes + contract_readiness_human_judgment step_5_operator_intervention_required
    未知の非空 failure_class fail_closed_environment_or_integrity_failure
    input_or_runtime_error、transport failure、artifact failure 既存どおり fail_closed_environment_or_integrity_failure
    型不正・組合せ不整合 既存どおり fail-closed

    実装箇所は route_canonical_step2_result() です。この関数には _cmd_produce() の全 payload が渡され、成功時 payload の merged_review_result は verified transport artifact から取り出されたものです。したがって、wire を拡張しなくても信頼済みの failure_class を参照できます。

    step_5_operator_intervention_required は新しい画面や state machine を必要としません。既存 Step 5 の表示・終了処理を再利用しつつ、終了原因だけを以下のように区別すれば足ります。

    termination_reason: human_escalation
    termination_cause: operator_intervention_required
    

    これにより、現在の human_judgment_required への無条件正規化を避けられます。

    この案では、次の既存ハーネスには触れません。

    • artifact hash/binding
    • no-follow traversal
    • immutable attempt artifact
    • retry matrix
    • transport failure separation
    • V2 wire validator
    • agent permission

    つまり、品質上必要な routing 修正だけを行い、セキュリティ機構や schema を増やしません。


    Issue #2397 の推奨リフレーム案

    推奨タイトル

    実装: verified readiness の本文修正不能状態を canonical operator-intervention route へ接続する

    Architecture Decision

    architecture_decision:
      preserve:
        - "#2054 の success-only compact V2 exact 11-line grammar"
        - "NEXT_ACTION: proceed | request_changes の二値契約"
        - "transport/integrity failure と semantic result の分離"
        - "artifact verification / retry / permission の現行実装"
    
      supersedes:
        - target: "#2389 の triple-only route 判定"
          extent: >
            status=ok、verdict=needs-fix、next_action=request_changes の場合に限り、
            verified merged_review_result.failure_class を追加判定へ使用する。
    
      new_route:
        name: step_5_operator_intervention_required
        physical_handler: existing_step_5
        termination_cause: operator_intervention_required

    Outcome

    contract_readiness_human_judgment を持つ verified merged review result は
    通常の Issue rewrite loop に入らず、operator intervention として Step 5 に停止する。
    
    compact V2 wire、artifact schema、transport failure 分類は変更しない。
    

    Acceptance Criteria

    • AC1: 実 producer 形状の status: ok、verdict: needs-fix、next_action: request_changes、merged_review_result.failure_class: contract_readiness_human_judgment が step_5_operator_intervention_required に到達する。
    • AC2: 同じ needs-fix + request_changes でも failure_class が欠落または null の場合は、既存どおり step_4 に到達する。
    • AC3: 未知の非空 failure_class、型不正、矛盾した verdict/action は fail-closed となる。
    • AC4: input_or_runtime_error、reviewer transport failure、artifact readback failure は operator route や human-judgment route に昇格せず、既存どおり fail-closed となる。
    • AC5: ISSUE_REVIEW_RESULT_COMPACT_V2 の builder/validator/artifact projection は一切変更されず、NEXT_ACTION の二値契約を維持する。
    • AC6: review-issue/SKILL.md にある「reviewer_transport.py が failure_class を読んで HJ wire に変換する」という未実装説明を削除し、root-owned canonical route が verified merged result を参照する説明へ直す。
    • AC7: operator route は既存 Step 5 handler を再利用するが、termination cause を human_judgment_required に正規化せず operator_intervention_required として保持する。
    • AC8: ネットワーク、実 Claude runtime、外部認証、新規 receipt/ledger/state store を追加しない。

    Runtime Verification Applicability

    decision: immediate
    execution_environment:
      cli_tools: [python3, uv]
      auth_required: false
      network_required: false
    fallback_policy:
      fallback_success_is_pass: false
    artifact_requirements:
      - focused production-shaped pytest output

    推奨 Verification Commands

    uv run --locked pytest \
      .claude/skills/issue-refinement-loop/tests/test_canonical_step2_route_wiring.py \
      -k "operator_intervention or contract_readiness_human_judgment" -v
    
    uv run --locked pytest \
      .claude/skills/issue-refinement-loop/tests/test_root_review_canonical_delivery.py -q
    
    # V2 wire が変わっていないこと
    uv run --locked pytest \
      .claude/skills/issue-refinement-loop/tests/test_review_compact_v2.py \
      .claude/skills/issue-refinement-loop/tests/test_reviewer_transport_e2e.py -q

    推奨 Allowed Paths

    .claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py
    .claude/skills/issue-refinement-loop/tests/test_canonical_step2_route_wiring.py
    .claude/skills/issue-refinement-loop/tests/test_root_review_canonical_delivery.py
    .claude/skills/issue-refinement-loop/SKILL.md
    .claude/skills/issue-refinement-loop/references/termination-policy.md
    .claude/skills/review-issue/SKILL.md
    

    現案の wire 三値化を維持する場合の最低条件

    V2 wire を本当に拡張するなら、現在の Allowed Paths では不足です。少なくとも次を同一 PR で更新する必要があります。

    1. reviewer_transport.py

      • canonical semantic disposition helper
      • builder
      • validator
      • run_reviewer_transport
      • artifact projection
      • wire-artifact cross-check
    2. run_root_review_pipeline.py

      • outer re-render の撤去、または同一 disposition の引き継ぎ
      • compact_result.stdout_lines と compact_result.next_action の一致検証
    3. 配布・consumer 資産

      • validate_review_compact_output.py
      • .claude/agents/issue-reviewer.md
      • agent parity が要求する場合は .codex/agents/issue-reviewer.toml
      • review-issue/SKILL.md
      • issue-refinement-loop/SKILL.md
    4. テスト

      • artifact に HJ class がある正例
      • artifact に HJ class がないのに wire だけ HJ の負例
      • outer producer の stdout_lines/next_action/canonical route の一致
      • mixed old/new consumer rejection
      • exact truth table

    こちらは実装量と契約面積が大きく、今回の目的に対して有用性が低いため、推奨しません。


    verdict: REQUEST_CHANGES
    recommended_disposition: reframe_in_place
    
    blocking_findings:
      - id: P0-1
        summary: >
          builder/validator の直接テストだけでは production producer、
          artifact re-projection、outer re-render の収束を証明できない。
      - id: P0-2
        summary: >
          contract_readiness_human_judgment は環境・tool・timeout 系を含み、
          semantic human judgment への一律変換は誤分類と不要な中断を生む。
      - id: P0-3
        summary: >
          NEXT_ACTION の三値化は #2054 の exact V2 wire 契約変更だが、
          consumer inventory、atomic cutover、配布資産更新が欠落している。
    
    recommended_implementation:
      compact_v2_change: false
      artifact_hardening_change: false
      new_harness: false
      routing_change:
        source: verified_merged_review_result.failure_class
        destination: step_5_operator_intervention_required
        handler_reuse: existing_step_5

    なお、本レビューでは current main のコード、Issue/PR/コメント、公式仕様を照合しましたが、ローカル checkout 上で pytest 自体は実行していません。PR に記録された既存テスト結果は参照していますが、Issue #2397 の提案実装はまだ存在しないため、上記の production-shaped regression test が実装時の最終確認になります。

  3. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  4. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    • termination_reason: approved
    • Final Gate: 成功(status: go、root_entry_router.py の現行 issue-contract-review 実行で確認)
    • iteration: 1(1回の needs-fix → rewrite → approve で収束)

    経緯

    1. 対象コメント(https://github.com/squne121/loop-protocol/issues/2397#issuecomment-5461878398)を anchor として preflight・investigation を実行し、Issue 本文が実装可能かつ自己完結であることを確認した。
    2. Step 2 review(run_root_review_pipeline.py produce)で needs-fix を検出:
      • AC1 の VC が git read-only allowlist 外の git grep を使用していた
      • AC2/AC3 の VC が -k フィルタで 0 tests collected(pytest exit 5、hard block)になる非 canonical shape だった
      • AC4 の VC がディレクトリ全体を対象にしており、実測 353 秒で per-command timeout(150秒)を超過し、かつスコープ外の pre-existing failure(test_command_registry.py 内 3 件)に汚染されていた
      • Current Validated Scope と In Scope の語彙 jaccard が低い(0.269 < 0.3、non-blocking advisory)
    3. issue-editor へ rewrite を委譲し、AC1 の VC を rg に、AC2/AC3 の VC を新規テストファイルへの node-id 参照に、AC4 の VC を関連3ファイル明示指定に修正。CVS/In Scope の語彙も整合させた。
    4. fresh Step 2 review で verdict: approve / canonical_step2_route: step_2_5 を確認。
    5. Step 2.5 semantic review applicability 判定は全シグナル false のため semantic_review_applicable: false → Step 4.5(follow-up materialization)へ直行、follow-up 候補なし。
    6. root_entry_router.py --issue-number 2397 を実行し、route: invoke_impl_review_loop(reason: fresh_review_go_live_equality)を確認。
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: null
        generated_at: "2026-08-29T00:00:00Z"
        body_sha256: "sha256:54aa0f0266ed9ba6f545d64d09c0053e02b96f1eceb8474ee6bd1c64dfa1e25f"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label transition required"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-08-29T00:00:00Z"
      checked_body_sha256: "sha256:54aa0f0266ed9ba6f545d64d09c0053e02b96f1eceb8474ee6bd1c64dfa1e25f"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  5. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-29T11:16:30Z)

  6. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    推奨は、同じ Claude Code セッションで Step 4 だけ再開しないことです。Claude Code を完全終了して新規プロセスを起動し、まず Issue #2397 の refinement から再収束させるのがよいです。

    理由は3点あります。

    1. anchor コメント #5461878398 は明示的に REQUEST_CHANGES / reframe_in_place で、P0-1「builder 単体では production producer への到達を証明できない」、P0-2「human judgment ではなく operator intervention と分離すべき」、P0-3「NEXT_ACTION 三値化は V2 wire 契約変更」という本質的な指摘でした。
    2. ところが終了レポートを見ると、その anchor を入力したにもかかわらず、実際に直したのは git grep、pytest exit 5、timeout など Verification Commands 周辺だけで、その後 approve にしています。つまり anchor の主要設計指摘が解決された証拠がありません。
    3. live Issue 実装: route_canonical_step2_result() に verified failure_class ベースの operator intervention route を追加する #2397 は現在も build_compact_v2() に human_judgment_required を生成させる設計で、PR feat: route_canonical_step2_result() に verified failure_class ベースの operator intervention route を追加する #2398 もその設計を実装しています。PR 本文自身が producer 呼び出しフローを Out of Scope としています。したがって、このまま Step 4 を再開すると「誤って収束した契約を正しく実装した PR」をレビューする構造になります。

    pr-reviewer 不可については二次的な問題です。current main には .claude/agents/pr-reviewer.md が存在しています。 Claude Code の現行仕様でも project subagent は .claude/agents/ からロードされ、agent ファイル変更も通常は監視されます。frontmatter hooks と handler 単位の if も現行仕様です。([Claude]1) したがって、まず /clear ではなくプロセス自体を再起動して agent registry を作り直すのが最小の復旧策です。

    新しい Claude Code プロセスで、以下をそのまま使うのを推奨します。

    squne121/loop-protocol の Issue #2397 / PR #2398 の作業を再開してください。

    サブエージェントを使用し、起動したすべてのサブエージェントについて final result を取得したうえで terminal completion を確認するまで待ってください。background 起動しただけ、timeout、途中通知だけを完了扱いにしないでください。

    人間承認は通常の調査・Issue 編集・実装・テスト・commit・push・PR 更新・レビュー対応では不要です。リポジトリの canonical skill / workflow の fail-closed 条件には従ってください。秘密情報の開示、不可逆・破壊的操作、canonical workflow 自体が human judgment を要求する場合だけ停止してください。

    重要: 再開点

    前セッションは PR #2398 の impl-review-loop Step 4 直前で pr-reviewer agent type が no longer available になり停止しました。

    ただし、単純に Step 4 から再開しないでください。

    Issue #2397 の human-context anchor comment ID 5461878398 と、その後の issue-refinement-loop termination report、現在の live Issue body、PR #2398 の diff を再取得し、まず契約が正しく収束しているかを再監査してください。

    前回の issue-refinement-loop では anchor comment を入力したにもかかわらず、実際の rewrite は主として Verification Commands の以下の問題だけを修正して approve に進んでいます。

    • git read-only allowlist 外 command
    • pytest -k 0 match / exit 5
    • AC4 の過大 test scope / timeout
    • Current Validated Scope と In Scope の軽微な語彙 drift

    一方、anchor comment の主要な REQUEST_CHANGES は以下でした。

    • P0-1: build_compact_v2() / validate_compact_v2() の直接テストだけでは production producer、artifact re-projection、outer re-render の整合性を証明できない
    • P0-2: contract_readiness_human_judgment は environment / tool / timeout 系を含むため、semantic human_judgment_required へ一律変換せず operator intervention と分離すべき
    • P0-3: NEXT_ACTION の三値化は既存 Compact V2 wire の値域契約変更であり、現在の限定 Allowed Paths / consumer inventory では atomic cutover が閉じない
    • 推奨案: verified merged_review_result.failure_class を root-owned canonical routing で判定し、step_5_operator_intervention_required に送る。Compact V2 wire は二値のまま維持する

    現在の live Issue #2397 と PR #2398 がこれらを本当に解消しているか、anchor を単なる参考情報として流さず、1件ずつ明示的に reconcile してください。

    Phase A: live-state / anchor reconciliation

    最初に以下を live で確認してください。

    codebase-investigator 等の適切な SubAgent に調査を委譲し、完了を待ってください。

    anchor の P0-1 / P0-2 / P0-3 について、それぞれ:

    1. current code 上でも valid
    2. current code の後続変更により obsolete
    3. anchor 自体に技術的誤りがある

    のどれかを evidence 付きで確定してください。

    「前回 issue-refinement-loop が approve した」という事実自体を、anchor が解決済みである根拠には使わないでください。

    Phase B: Issue #2397 の再 refinement

    P0 のいずれかが未解決なら、Issue #2397 を再度 issue-refinement-loop に通してください。

    human context として comment ID 5461878398 を明示的に使用してください。

    今回は、anchor の各 P0 finding が以下のどちらかになるまで refinement を終了しないでください。

    • Issue body / architecture / AC / Allowed Paths / Verification Commands に具体的に反映された
    • codebase evidence に基づく明示的な rebuttal が成立し、その理由が review result に残った

    単に Verification Commands が executable になっただけで approve にしないでください。

    anchor の指摘が現在も valid なら、推奨方向は以下です。

    • Compact V2 NEXT_ACTION は proceed | request_changes の二値契約を維持
    • contract_readiness_human_judgment 等の verified semantic failure class は root-owned canonical route で評価
    • genuine semantic / owner ambiguity と operator intervention を分離
    • known environment/tool/runtime condition は step_5_operator_intervention_required
    • malformed / unknown non-empty failure class は fail-closed
    • existing Step 5 physical handler は可能なら再利用
    • termination cause は operator_intervention_required として保持
    • unnecessary receipt / ledger / persistent state / security harness は追加しない
    • production-shaped test で producer → canonical route まで証明する

    ただし、current code を調査した結果、より小さく正しい設計が確認できた場合は evidence を優先してください。

    fresh review が approve / canonical implementation route になるまで SubAgent の完了を待って refinement を収束させてください。

    Phase C: PR #2398 の扱い

    refined contract と現在の PR #2398 を比較してください。

    現在の PR #2398 の実装が refined contract と一致しない場合、既存 PR をそのままレビュー工程へ送らないでください。

    可能なら PR #2398 / 既存 branch を in-place で修正し、不要になった旧実装を撤去して refined contract に合わせてください。

    既存 PR を再利用すると履歴や workflow contract が不健全になると canonical workflow が判断した場合だけ、replacement PR を選択してください。不要な duplicate PR は作らないでください。

    実装が必要なら implementation-worker に委譲し、完了を待ってください。

    Issue の Allowed Paths、AC、Verification Commands を authoritative contract としてください。

    実装後は test-runner を独立起動し、完了を待ち、current PR head に対する fresh verification を取得してください。

    Phase D: impl-review-loop

    contract と実装が再収束した後、impl-review-loop を merge 直前まで継続してください。

    Step 2 の current-head VC adjudication を fresh live Issue body / literal Verification Commands / current PR head に再bindしてください。

    その後 Step 4 の起動直前 gate を再評価してください。

    pr-reviewer

    Step 4 は必ず canonical pr-reviewer SubAgent を使ってください。

    pr-reviewer が利用可能なら起動し、final result を取得し、agent が terminal completed になるまで待ってください。

    main thread による代替レビュー、general-purpose agent、別 reviewer、レビュー省略によって fail-closed 規約を迂回しないでください。

    PR review が REQUEST_CHANGES の場合は blockers を fix_delta として implementation-worker に戻し、

    implementation
    → verification
    → fresh current-head gate
    → pr-reviewer

    を APPROVE まで反復してください。

    head が変わった場合、stale review は利用せず fresh review を行ってください。

    pr-reviewer が再び unavailable の場合

    このセッションは新規 Claude Code process であることを前提とします。

    それでも runtime-provided agent listing から pr-reviewer が消える場合は、feature implementation の問題と混同しないでください。

    最低限以下を確認してください。

    • .claude/agents/pr-reviewer.md が current project scope に存在する
    • frontmatter が current Claude Code で parse 可能
    • duplicate name: pr-reviewer がない
    • project/user/managed settings で Agent(pr-reviewer) が deny されていない
    • Agent tool 自体が利用可能
    • cwd / project root discovery が正しい
    • Claude Code version
    • agent listing から消えたタイミングと、その直前の ConfigChange / file change
    • relevant debug / doctor diagnostics が取得可能なら確認

    repo の agent 定義が valid で、fresh process でも agent type が消失することが再現する場合は runtime capability defect として扱ってください。

    その場合は pr-reviewer を他の agent や main thread で代替せず、現在の feature PRを汚染する workaround も入れず、再現条件・diagnostics・current state をまとめて停止してください。

    終了条件

    最終的に以下まで進めてください。

    マージ自体は行わず、マージ直前で停止してください。

    最後に、実施した refinement delta、実装 delta、test/CI、review verdict、PR head SHA、mergeability、残 warning、マージ可能かどうかを簡潔に報告してください。

    このプロンプトのポイントは、agent 不可の復旧だけでなく、前回 refinement が anchor を取りこぼした問題まで巻き戻すことです。PR #2398 のレビューを先に進めるより、この順序の方が手戻りを減らせます。

  7. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    termination_reason: approved

    前回の issue-refinement-loop は approve したが、その後 OWNER 敵対的レビュー(anchor comment #issuecomment-5461878398)が REQUEST_CHANGES(reframe_in_place) と判定した。今回はこの anchor を human context として再投入し、指摘された P0-1/P0-2/P0-3 を codebase evidence で reconcile した。

    P0 reconciliation(前回ループが見落としていた点)

    • P0-1(builder/validator 直接テストだけでは production 経路の収束が証明できない): 現行 main の route_canonical_step2_result()(run_root_review_pipeline.py:1279-1288)は現在 compact_result.next_action の二値のみを判定しており、merged_review_result.failure_class を全く参照していないことをコード確認。この関数を修正対象に据える reframe を行った。
    • P0-2(contract_readiness_human_judgment は operator intervention であり genuine semantic judgment と分離すべき): check_issue_contract.py:554-682 の readiness_status_to_failure_class() / merge_readiness_into_review_result() が既に merged["failure_class"] = "contract_readiness_human_judgment" を設定し、_cmd_produce() の payload(merged_review_result)にそのまま乗っていることをコード確認。V2 wire を拡張せずとも route_canonical_step2_result() がこの値を直接参照できることが判明したため、Compact V2 wire は変更しない設計に転換した。
    • P0-3(NEXT_ACTION の三値化は implement: recover reviewer transport failures and cryptographically bind compact verdicts to artifacts #2054 の V2 wire 契約変更であり atomic cutover が欠落): .claude/agents/issue-reviewer.md が依然として二値契約を明記していることを確認。reframe 後は NEXT_ACTION を二値のまま維持し、wire 契約変更を回避する設計にした。

    前版 Issue 本文(V2 wire 三値化案)に対応する PR #2398 の実装は、この reframe と不整合であるため、実装フェーズで撤去・作り直す方針を Background に明記した。

    検証

    • Step 2 (deterministic): run_root_review_pipeline.py produce → VERDICT: approve / NEXT_ACTION: proceed / canonical_step2_route: step_2_5(body_sha256: 5a2fb3c3edc799cd0dfa884bc82a34b04f86a7041c694d68bc4e12d0c4ff4c63)
    • Step 2.5 (semantic, issue-design-reviewer SubAgent): 1周目は low-severity finding 3件(AC4文言曖昧・Background revert対象漏れ・AC7とtermination-policy.md既存ルールの関係不明確)→ 反映。2周目は assessment: clear(P0-1/P0-2/P0-3 の reconciliation を独立に current main コードで再検証した上で、追加の gap なしと確認)。join_review_results.py → effective_verdict: approve
    • Final Gate (run_contract_review_once.py --evidence-mode baseline --mode execute): status: go(readiness_status: go, vc_preflight_status: pass)。AC1/AC2/AC3/AC6/AC7/AC8 は baseline で expected_fail(実装未着手のため想定通り)、AC4/AC5 は既存回帰テストとして既に expected_pass。
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: ""
        generated_at: "2026-08-29T12:20:00Z"
        body_sha256: "sha256:5a2fb3c3edc799cd0dfa884bc82a34b04f86a7041c694d68bc4e12d0c4ff4c63"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label mutation performed in this loop iteration"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-08-29T12:20:00Z"
      checked_body_sha256: "sha256:5a2fb3c3edc799cd0dfa884bc82a34b04f86a7041c694d68bc4e12d0c4ff4c63"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  8. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  9. self-assigned this
    on Aug 29, 2026
  10. changed the title [-]実装: reviewer_transport.py の build_compact_v2 が human_judgment_required next_action を生成できるようにする[/-] [+]実装: route_canonical_step2_result() に verified failure_class ベースの operator intervention route を追加する[/+] on Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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