Repository navigation
feat: route_canonical_step2_result() に verified failure_class ベースの operator intervention route を追加する - #2398
Conversation
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2398/ The preview will be removed when this PR is closed. |
…ようにする (#2397) reviewer_transport.py の build_compact_v2() に optional な failure_class 引数を追加し、merged_review_result.failure_class == contract_readiness_human_judgment (かつ verdict == needs-fix) の場合に NEXT_ACTION: human_judgment_required を持つ V2 compact を生成できるようにした。 validate_compact_v2() も next_action の許容値域を proceed | request_changes | human_judgment_required の3値に拡張し、 inconsistent な approve + human_judgment_required の組合せは引き続き fail-closed で拒否する。 これにより run_root_review_pipeline.route_canonical_step2_result() が 判定する step_5_human_judgment_required 分岐が実際の producer 出力から 到達可能になる (PR #2391 owner P0-1 の follow-up)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Issue #2397 の reframe により、reviewer_transport.py への failure_class 引数追加・NEXT_ACTION 三値化・test_review_compact_v2_human_judgment.py の新規追加は不要になったため撤去する。新設計は route_canonical_step2_result() 側で failure_class を判定する。
…erator intervention route を追加する (#2397) merged_review_result.failure_class == "contract_readiness_human_judgment" (env/tool/timeout/unknown 分類等、Issue 本文書き換えでは解消しない operator 起因の readiness 状態)を持つ needs-fix + request_changes の payload を、 新設の STEP_5_OPERATOR_INTERVENTION_REQUIRED route へ送る。Compact V2 wire (NEXT_ACTION の proceed | request_changes 二値契約)は変更しない。 OWNER 敵対的レビュー(P0-1/P0-2/P0-3、issues/2397#issuecomment-5461878398) の指摘に従い、前版 Issue の V2 wire 三値化案(reviewer_transport.py への failure_class 引数追加・NEXT_ACTION 三値許容化)は撤去し、root-owned route_canonical_step2_result() 側で判定する設計に作り直した。
b020790 to
52462cb
Compare
CI の PR Body Japanese Check(changed markdown 全体検査)が新設見出し 「## `canonical_step2_route: ...` の termination payload(#2397)」を prose block として検出し、日本語比率不足で fail していたため、見出し文言 に日本語を追加して修正した(意味・内容は変更なし)。
) CI の python-test-core ruff check が、Issue #2397 の Verification Commands に必須の長い test 関数名(pytest -k 選択子として exact match が要求される) に対し E501 (line too long) を報告していたため、既存コードベースの慣例 (# noqa: E501)に従い抑制した。関数名・テスト内容は変更しない。
敵対的レビュー結果判定REQUEST_CHANGES — 現状のままではマージ非推奨です。 対象は draft の PR #2398、current head は 設計の大枠には賛成です。
これらは正しい修正方向です。実際、Compact V2 producer は現在も ただし、現在の実装には以下のマージブロッカーがあります。 P0-1: operator intervention の判定元が汚染されており、本文修正可能なIssueまで終了させます新規E2Eテストは、次のコマンドをIssue本文へ入れて テスト内の説明どおり、これは以下の経路です。 新規テスト自身が、 実装側のマッピングを見ると、 しかし つまり、このE2Eテストは「operator intervention routeが本番で到達可能」と証明する一方で、本文修正可能な状態を誤ってoperator-onlyとみなす既存分類漏れを、新routeによって実際の終了動作へ昇格させています。 PR適用前は、この分類漏れがあっても Compact V2 の 必須修正最小修正は次です。 _PREFLIGHT_CATEGORY_TO_READINESS = {
...
"command_not_allowed": "needs_fix",
}ただし、より堅牢なのは そしてoperator-only集合に対してのみ、たとえば E2E fixtureも 加えて、次の回帰テストが必要です。 P1-1: producerがrouteを返すことしか検証しておらず、実際のStep 5終了結果は保証されていませんIssue #2397のAC7は、operator route到達時に以下を要求しています。 さらに既存Step 5 handlerを再利用し、scope-signal由来の 新規E2Eテストも最終的には次だけを検証しています。 assert out["canonical_step2_route"] == STEP_5_OPERATOR_INTERVENTION_REQUIREDつまり、以下は未検証です。 これは単なるテスト厳格化の話ではありません。 新しい Anthropicの公式資料上も、 さらに終了レポートpublisherは、現在「空でないMarkdown」であることしか確認せず、その本文に正しい 必須修正大規模なrenderer、ledger、hookを戻す必要はありません。趣味開発としては、次の軽量な形で十分です。
{
"canonical_step2_route": "step_5_operator_intervention_required",
"canonical_step2_disposition": {
"terminal": true,
"termination_reason": "human_escalation",
"termination_cause": "operator_intervention_required"
}
}これをpure functionで組み立てれば、複雑なハーネスは不要です。 def build_canonical_step2_disposition(result: Mapping) -> dict:
route = route_canonical_step2_result(result)
if route == STEP_5_OPERATOR_INTERVENTION_REQUIRED:
return {
"route": route,
"terminal": True,
"termination_reason": "human_escalation",
"termination_cause": "operator_intervention_required",
}
return {"route": route}テストは次の二段階で十分です。
併せてSKILL本文を、曖昧さのない独立した分岐にします。 routing table直後の「重要」要約にも、operator routeを明示する必要があります。 P1-2: 「schema changeではない」という申告とconsumer inventoryが不正確ですPR本文は次の理由で
前半は正しいですが、後半はschema/consumer contract変更そのものです。 特に またPRのSchema Consumer Inventoryは、実質的に次の二つしか列挙していません。 しかしリポジトリ内には少なくとも以下の関係資産があります。
既存検索でもこれらが 必須修正Schema Change Applicabilityを、次のように二層で記載するのが正確です。
同一リポジトリ内でatomicに変更するなら、必ずしも大げさなversion migrationは要りません。ただし「schema changeではない」としてconsumer調査を省略するのは危険です。 P2-1: 撤回済み設計の説明が実行指示・docstring・Issueタイトルに残っていますIssue #2397の本文はroot-owned route方式へreframeされていますが、現在のIssueタイトルはまだ次の旧設計です。
本文とタイトルが逆の設計を指しています。 また、
これは単なるコメント掃除ではありません。少なくともSKILL文書はランタイム指示であり、将来の実装者やClaude Codeが旧設計を再導入する根拠になります。 修正内容
評価できる点今回のPRは、前段のPR #2391にあった最重要問題には正しく対応しています。 以前はproductionで生成不能な また、以下は維持してよい設計です。
追加のsecurity gate、receipt、ledger、state store、hookは不要です。今回必要なのは防御の追加ではなく、分類を純化し、routeの最終的な意味を一度だけ明示してテストすることです。 推奨する最小修正順
この七点が反映されれば、Compact V2を不用意に拡張せず、ハーネスを増やしすぎず、しかも本文修正可能なIssueを無駄に止めない実用的な設計になります。 なお、現headのGitHub CI成功は確認しましたが、この環境でリポジトリをcheckoutしてテストを独立再実行したわけではありません。今回の判定はcurrent diff、実装資産、関連Issue・PR・コメント、current-head CI、および公式Claude Code資料の照合に基づきます。 |
… Delta を反映する (#2397) OWNER 敵対的レビュー (PR #2398, #2398 (comment)) の P0-1/P1-1/P1-2/P2-1 を反映する fix_delta。 - P0-1 (blocking): contract_readiness_check.py の _PREFLIGHT_CATEGORY_TO_READINESS に command_not_allowed -> needs_fix を 追加。body-fixable な command_not_allowed が human_judgment (延いては operator intervention route) へ誤ってフォールバックする回帰を修正。 - 新規テストファイル test_operator_intervention_route_scope_delta.py で AC9-AC12 を実 _cmd_produce() 経路で検証 (command_not_allowed -> step_4 回帰、真に operator-only な fixture -> step_5_operator_intervention_required、 canonical_step2_disposition の付与)。 - 既存 test_operator_intervention_route.py の operator-only fixture を command_not_allowed から真の operator-only 状態 (jq + 存在しないパス -> unknown 分類 -> human_judgment 直行) へ差し替え (関数名は無変更)。 - run_root_review_pipeline.py に build_canonical_step2_disposition() を 追加し、_cmd_produce() の全 stdout JSON 出力経路 (_emit_produce_result()) に canonical_step2_disposition フィールドを配線 (AC12)。 - route_canonical_step2_result() / check_issue_contract.py の docstring から、撤回済みの「compact wire 側で failure_class から NEXT_ACTION: human_judgment_required を導出する」設計記述を除去し、 現行の root-owned route 設計 (merged_review_result.failure_class を 直接参照) の説明へ更新 (P2-1)。 - issue-refinement-loop/SKILL.md の Step 2 routing table と直後の要約に step_5_operator_intervention_required を独立した5番目の分岐として 明記 (AC13)。 既知の未解決事項: .claude/skills/review-issue/tests/test_check_issue_contract.py (Allowed Paths 外) の test_human_judgment_not_collapsed_to_needs_fix が command_not_allowed フィクスチャの旧挙動 (human_judgment/blocked) を前提と しており、本修正後は status: needs_fix になるため fail する。この 契約テストの期待値更新には Allowed Paths 拡張の Scope Delta が必要。
前コミットの Step 2 routing table 要約追記で SKILL.md が 505 行になり test_skill_md_is_under_500_lines / test_skill_md_stays_within_line_budget が fail していた。review phase routing summary を圧縮し 499 行に収める (内容は変更せず改行のみ整理)。
…#2397) CI(python-test-core)で確認された既存テスト退行を修正する。 `contract_readiness_check.py` の `_PREFLIGHT_CATEGORY_TO_READINESS` に `command_not_allowed: needs_fix` を追加した(P0-1修正、意図的な挙動変更)結果、 `test_check_issue_contract.py::TestContractReadinessExecuteIntegration:: test_human_judgment_not_collapsed_to_needs_fix` が fail していた。 このテストの fixture (`_HUMAN_JUDGMENT_ISSUE_CONTENT`) は preflight の 許可コマンド一覧に無い `loop-protocol-nonexistent-tool-xyz-abc` を VC に使っており、 これは実行前に `command_not_allowed` として拒否される(body-fixable な状態、 Issue #2397 Scope Delta AC9 の意図どおり needs_fix になるべき状態)。 fixture を、Issue #2397 の新規テスト (`test_operator_intervention_route.py` / `test_operator_intervention_route_scope_delta.py`) と同じパターンである `jq '.' fixture/<存在しないパス>.json` に差し替える。`jq` は許可コマンドのため 実際に実行されるが、参照先パスが存在しないため exit code 2 で失敗し、 `classify_result()` の既知パターンに一致せず `category: unknown` に分類される。 `unknown` は `_PREFLIGHT_CATEGORY_TO_READINESS` で human_judgment のまま維持される genuine operator-only な状態であり、テスト関数名・「human_judgment に collapse されないこと」を検証するアサーションの意図は変更していない。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
推奨アクションは、PR #2398 の機能実装をこれ以上いじらず、 貼り付けログでは、旧 head また、前セッションの「非空 むしろ重要なのは PR #2385 の検証経路です。現在の runtime probe 自身が、worktree discovery 問題 #25816 を理由に 以下をそのまま Claude Code に渡すのを推奨します。 squne121/loop-protocol の Issue #2397 / PR #2398 の作業を再開してください。 今回の主目的は、PR #2398 の feature implementation を追加で変更することではありません。 現在の blocker である canonical 最重要: SubAgent の完了待ち調査・実装・検証には適切な SubAgent を使用してください。 起動したすべての SubAgentについて、必ず final result を取得し、terminal completion を確認するまで待ってください。 以下を完了扱いにしないでください。
依存する SubAgent が terminal state になる前に、その結果を前提とした次フェーズへ進まないでください。 利用可能なら、少なくとも次の役割を分離してください。
人間承認と停止条件通常の read-only 調査、Issue 編集、通常の実装、テスト、commit、push、PR 更新には人間承認を要求しないでください。 ただし以下では停止してください。
PR のマージ自体は行わないでください。 Phase 0: current live state へ再bindする過去ログの head SHA や CI 結果を authority にしないでください。 最初に live で再取得してください。
直近確認では PR #2398 は main merge 後の head に進んでいます。 したがって、必ず取得した live head を authority にしてください。 current-head CI が running / queued なら、その完了を確認してください。 current head について以下を fresh に再評価してください。
feature regression が見つかった場合のみ #2398 の feature branch を修正してください。 また PR #2398 本文と current code/test state を比較し、過去 iteration の「既知の failing test」等、既に解消済みの情報が残っていれば、current-head evidence を取得した後に本文を同期してください。 Phase A:
|
|
はい。その理解で概ね合っています。ただし、現在の live state を見ると問題はさらに一段あります。 PR #2415 では、 さらに現在の PR #2415 は CI green でもありません。 改善Issueへの批評別 Issue にする判断には賛成です。#2414 は YAML バグそのものの修正に閉じ、別 Issue は 「candidate-head で SubAgent 定義を変更したとき、その変更済み SubAgent 自身を fresh runtime で起動・完了確認し、そのまま bootstrap review に利用できる canonical recovery path」 を所有させるべきです。 特に重大なのは、今回の workflow が「現在の親セッションでは registry が stale → fresh terminal が必要 → 停止」と判断したことです。これは repository に既にある能力を使い切っていません。
ここには注意点があります。現在の repo の 推奨する順序は、まず #2415 の current CI blocker を修正し、その candidate head を 以下を Claude Code に渡すのがよいです。 squne121/loop-protocol の PR #2415 / Issue #2414、および元の PR #2398 / Issue #2397 の作業を再開してください。 今回の目的は3つです。
PR #2398 の feature diff は、PR #2415 の bootstrap problem が解決するまで変更しないでください。 SubAgent 利用の必須条件適切な SubAgent に作業を委譲してください。 起動した全 SubAgent について、必ず final result を取得し、terminal completion を確認するまで待ってください。 以下を完了扱いにしないでください。
特に 利用可能なら少なくとも以下を役割分離してください。
general-purpose / pr-reviewer-lite / main thread を canonical Phase 0: live state 再取得最初に live で確認してください。
過去の報告を authority にせず current head に bind してください。 特に PR #2415 は現在の live CI を必ず再取得してください。 直近の外部確認では PR #2415 head 失敗内容は:
で、
です。 必ず live state で再確認してください。 Phase A: PR #2415 の CI blocker を修正するまず blocker を adversarial に評価してください。 現在の test は docstring 上:
ことを守る guard ですが、実装は frontmatter を含むファイル全体の physical line count を数えています。 今回の block-style YAML 化は procedure duplication ではなく frontmatter serialization の変更です。 以下の2案を比較してください。 A. parser-safe かつ compact な YAML 表現にし、既存 例:
B. ただし B は #2414 Allowed Paths 外です。 「テストを通すためだけに閾値を 150 へ上げる」は禁止します。 architecture intent と最小変更を比較し、より正しい案を採用してください。 実装は implementation-worker に委譲し、完了を待ってください。 その後 test-runner を独立起動し、focused tests + required CI を fresh current head で確認してください。 Phase B: Issue #2414 の verification contract の不足を認識するIssue #2414 は Outcome で: fresh Claude Code process の canonical project discovery で ことを要求しています。 しかし現在の AC1〜AC3 は:
だけであり、actual Claude Code runtime discovery / Agent spawn を要求していません。 この mismatch を明示してください。 静的 YAML parse を runtime discovery の証明として扱わないでください。 PR #2415 を merge-ready にする前に、candidate head に対する genuine runtime verification を追加してください。 必要なら #2414 に Scope Delta を適用してください。 Phase C: worktree-agent-runtime-smoke による candidate-head runtime verificationPR #2415 の candidate worktree を対象に、
を canonical に使用してください。 主目的は: candidate head の までを実証することです。 第一経路: normal worktree project discovery最初は fallback を使わず、candidate worktree を cwd とする fresh interactive lane で検証してください。
prompt は main session に明示的に:
よう指示してください。 runner の既存:
等を利用し、spawnだけでなく completion まで evidence を取得してください。 単に:
で main-session persona として起動できたことだけを、この AC の PASS にしないでください。 今回は Agent tool による actual child SubAgent spawn が必要です。 また model 自己申告の SubagentStart / SubagentStop または runner が所有する既存 lifecycle evidence を authority にしてください。 Phase D:
|
|
Head is stable at Verdict: APPROVESummary of review
No blockers identified. verdict: APPROVE
reviewed_head_sha: "b1237129e7bbe797bf8bbadc7c191de19905371d"
blockers: []
warnings:
- "PR は isDraft=true / merge_state_status=BLOCKED(人間の最終承認待ち)。route_loop_verdict_v2() の fail_closed 分岐(現状維持、human escalation 自動発生なし)に従う想定。"
- "PR には過去に同一 PR 上で複数回の自己敵対的レビュー(REQUEST_CHANGES)が投稿されているが、いずれも本 review 対象の現行 head より前の head に対するものであり、指摘点(P0-1/P1-1/P1-2/P2-1)は現行 diff で解消済みであることを diff 突合で確認した。"Relevant paths reviewed (all absolute references are to the GitHub PR, not local files, since no worktree was checked out per constraints):
|
判定REQUEST_CHANGES — current head 前回の敵対的レビューで指摘した ただし、修正版にはまだ 一つの本質的な分類バグと、二つの control-plane 契約不備があります。特に一番目は、個人趣味開発で「必要のない人間停止を減らす」という目的に直接反します。 P0-1 —
|
…岐説明を修正する Issue #2397 Scope Delta iteration 3(OWNER PR #2398 敵対的レビュー、3回目、 #2398 (comment)) の P0-1/P1-1/P1-2/P1-3 を反映する fix_delta。 - P0-1 (AC14): test_operator_intervention_route_scope_delta.py の `test_genuinely_operator_only_fixture_routes_to_operator_intervention` の fixture を、`jq` を存在しない path へ向ける `unknown` catch-all 分類 トリックから、preflight の real subprocess execution boundary を PATH シムで monkeypatch し決定論的に `category: env_missing_dep` を発生させる 方式へ差し替えた。壊れやすい `fixture/e2e_produce_operator_intervention_scope_delta_unknown.json` 参照は削除。テスト関数名・アサーション内容は無変更。 - P1-1 (AC15): issue-refinement-loop/SKILL.md に、Step 5 operator intervention route の終了処理が `canonical_step2_disposition` の `termination_reason` / `termination_cause` をそのまま使用し独自に 再導出しないことを明記した。 - P1-2 (AC16): issue-refinement-loop/SKILL.md の `step_5_human_judgment_required` の説明を、現行 Compact V2 producer からは生成されない defensive/legacy route である旨に修正した。 - P1-3 (AC17): run_root_review_pipeline.py の `FAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT` に、route-critical な 既知 failure_class 値の single source of truth であることを明示する コメントを追加した。 Closes #2397
…nt-next-action' into worktree-issue-2397-human-judgment-next-action
Verdict: APPROVELinked Issue confirmationPR #2398 body contains CI confirmationcanonical required-CI evaluator( AC coverage — 独立再実行(self-reportを信用せず)PR headを隔離worktreeでcheckoutし、全Verification Commandsを再実行:
AC14 独立検証
P1-1/P1-2/P1-3 検証
Allowed Paths gate
Schema / Safety gatesSchema Change Applicabilityは二層開示済み(Compact V2 wire不変、 Blockersなし verdict: APPROVE
reviewed_head_sha: "7d368dff25507a56c39e0f2d3e6e24d3cbdfa108"
blockers: []
warnings:
- "PR is currently Draft(skill policy上はblockerではない、人間の最終マージ判断に委ねる)"
- "mergeStateStatus=UNSTABLE / deploy-pr checkがfailしているが、deploy-prはwait_ci_checks.pyが評価するrequired checks setに含まれない" |
Summary
Issue #2397 は issue-refinement-loop の敵対的レビュー(OWNER, https://github.com/squne121/loop-protocol/issues/2397#issuecomment-5461878398)で reframe され、旧設計(V2 wire の
NEXT_ACTION三値化)は REQUEST_CHANGES(P0-1/P0-2/P0-3)判定を受けて撤回された。本 PR は旧実装をすべて撤去し、新しい Issue contract に基づいて作り直したものである。採用する設計: Compact V2 wire(
build_compact_v2()/validate_compact_v2()/NEXT_ACTION: proceed | request_changesの二値契約)は一切変更せず、root-ownedrun_root_review_pipeline.route_canonical_step2_result()が、同一 payload に含まれる verifiedmerged_review_result.failure_classを直接判定に使う。status: ok+verdict: needs-fix+next_action: request_changesかつmerged_review_result.failure_class == "contract_readiness_human_judgment"の場合に限り、新設のSTEP_5_OPERATOR_INTERVENTION_REQUIREDroute へ送り、既存の Step 5 handler を再利用してtermination_cause: operator_intervention_requiredとして区別して停止する。failure_classが欠落・Noneの場合は従来どおりSTEP_4を維持し、未知の非空failure_classや型不正なmerged_review_resultは従来どおりFAIL_CLOSED_ENVIRONMENT_OR_INTEGRITY_FAILUREを維持する。contract_readiness_human_judgmentはcontract_readiness_check.pyがenv_missing_dep/timeout/ unknown 分類 / regression gate failure /package_manager_no_tty_prompt/ validator timeout・internal error・JSON decode error / body retrieval failure などを exit code 2 として分類する既存の readiness 状態であり、Issue 本文の書き換えでは解消しない operator 起因の状態である。genuine semantic / owner ambiguity 用の既存step_5_human_judgment_requiredroute とは明確に分離する。旧実装の撤去
前版 Issue 本文に基づく旧実装(
reviewer_transport.pyへのfailure_class引数追加、FAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT定数、NEXT_ACTION三値許容ロジック、test_review_compact_v2_human_judgment.pyの新規追加、test_canonical_step2_route_wiring.pyへのコメント追記)はすべて撤去し、対象ファイルを main と byte-identical に戻した(git diff origin/main -- <対象ファイル>が空であることを確認済み)。Scope Delta(OWNER PR #2398 敵対的レビュー、#2398 (comment) 反映、fix_delta)
初版実装(上記設計)に対する OWNER の追加指摘(REQUEST_CHANGES)を反映した fix_delta。
contract_readiness_check.pyの_PREFLIGHT_CATEGORY_TO_READINESSにcommand_not_allowedカテゴリのマッピングが存在せず、未登録カテゴリはデフォルトでhuman_judgmentにフォールバックしていた。しかしcommand_not_allowed(VC が preflight allowlist 外のコマンド形を使っている)は body 書き換えで解消可能な body-fixable な状態であり、env_missing_dep等の真の operator-only 状態とは異なる。初版の E2E テストがcommand_not_allowedを operator-only fixture として使っており、body-fixable な Issue を誤って Step 5 で停止させる回帰を生んでいた。→_PREFLIGHT_CATEGORY_TO_READINESS["command_not_allowed"] = "needs_fix"を追加し、既存test_operator_intervention_route.pyの operator-only fixture を真の operator-only 状態(jqを存在しないパスへ実行しunknown分類 /decision: human_judgmentに直行させるもの。関数名は無変更)へ差し替えた。新規test_operator_intervention_route_scope_delta.pyでcommand_not_allowed -> step_4(AC9/AC10)と真の operator-only fixture-> step_5_operator_intervention_required(AC11)の両方を実_cmd_produce()経路で回帰確認する。canonical_step2_routeを返すことしか検証しておらず、実際にtermination_reason: human_escalation/termination_cause: operator_intervention_requiredまで出力されるかは未検証だった。→route_canonical_step2_result()の戻り値から純粋関数で disposition を導出するbuild_canonical_step2_disposition()を追加し、_cmd_produce()の全 stdout JSON 出力経路(_emit_produce_result())にcanonical_step2_dispositionフィールドとして配線した。operator route の場合のみ{"route", "terminal": true, "termination_reason": "human_escalation", "termination_cause": "operator_intervention_required"}、それ以外は{"route": route}のみ。AC12 で実_cmd_produce()経路から検証する。canonical_step2_routeは_cmd_produce()の stdout JSON の一部であり、その閉じた値集合への追加は additive な producer/consumer contract 変更である。→ 下記「Schema Change Applicability」を二層記載に修正した。run_root_review_pipeline.py/check_issue_contract.pyの docstring に、撤回済み設計(compact wire 側でfailure_classからNEXT_ACTION: human_judgment_requiredを導出する、という旧経路)の説明が残っていた。→ 両ファイルの該当 docstring を、現行の root-owned route 設計(merged_review_result.failure_classを直接参照する)の説明へ更新した。Scope Delta iteration 3(OWNER PR #2398 敵対的レビュー、3回目、#2398 (comment) 反映、fix_delta)
3回目の OWNER 敵対的レビューで指摘された P0-1(本質的)/P1-1/P1-2/P1-3 を反映した fix_delta。
test_operator_intervention_route_scope_delta.pyのtest_genuinely_operator_only_fixture_routes_to_operator_intervention(AC11)の fixture が、jq '.' fixture/e2e_produce_operator_intervention_scope_delta_unknown.json(存在しないパス)を使いcategory: unknownの catch-all 分類をトリガーして「genuinely operator-only」と定義していた。しかしunknownは分類器が認識できなかっただけの failure を含む catch-all であり、typo・stale VC・classifier gap のような body-fixable な状態を排除できていなかった。→ 真に operator-only な既知カテゴリ(env_missing_dep)を、preflight の real subprocess execution boundary(jqの実行ファイル解決)をPATHシムで monkeypatch して決定論的に発生させる方式へ差し替えた(_write_forced_env_missing_dep_command()を新設)。fixture/e2e_produce_operator_intervention_scope_delta_unknown.jsonという壊れやすい fixture 名/参照は削除した。テスト関数名・アサーション内容(failure_class == "contract_readiness_human_judgment"かつcanonical_step2_route == STEP_5_OPERATOR_INTERVENTION_REQUIRED)は無変更(AC14)。canonical_step2_dispositionは producer 側に実装済みだったが、issue-refinement-loop/SKILL.mdがこれを Step 5 終了処理が consume するという実行指示を明記していなかった。→ SKILL.md のstep_5_operator_intervention_requiredrouting table 項目に、終了処理がcanonical_step2_dispositionのtermination_reason/termination_causeをそのまま使用し独自に再導出しないことを明記した(AC15)。issue-refinement-loop/SKILL.mdのstep_5_human_judgment_requiredの説明が、「既存 compact schema で有効な組」という記述のままであり、現行 Compact V2 producer(build_compact_v2())からは生成されない defensive/legacy route である現状と矛盾していた。→ 現行 producer からはnext_action: human_judgment_requiredが生成されない defensive/legacy route であり、genuine semantic / owner ambiguity の実経路は Step 2.5 semantic design review が別途所有する、という現状説明へ修正した(AC16)。failure_classの route-critical な既知値集合が、shared な定義箇所を明示していなかった。→run_root_review_pipeline.pyのFAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT定数定義に、これが route-critical な既知failure_class値の single source of truth であることを明示するコメントを追加した(AC17)。PR Body Japanese Checkfailure(## Runtime Verification Evidence見出しの日本語比率不足)を本文修正で解消した。Changes(変更内容)
.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py:route_canonical_step2_result()にSTEP_5_OPERATOR_INTERVENTION_REQUIRED定数とFAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT定数を追加し、needs-fix+request_changesの triple 内でmerged_review_result.failure_classを追加判定する分岐を実装。新規build_canonical_step2_disposition()を追加し_emit_produce_result()に配線(Scope Delta AC12)。docstring から撤回済み設計記述を除去(Scope Delta P2-1).claude/skills/issue-contract-review/scripts/contract_readiness_check.py(Scope Delta):_PREFLIGHT_CATEGORY_TO_READINESSに"command_not_allowed": "needs_fix"を追加(Scope Delta P0-1 / AC9).claude/skills/review-issue/scripts/check_issue_contract.py(Scope Delta):readiness_errors_to_structured_blockers()/readiness_status_to_failure_class()の docstring から撤回済み設計記述を除去し、現行の root-owned route 設計の説明へ更新(Scope Delta P2-1).claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.py: AC1〜AC3 に対応するテスト(unit レベルのroute_canonical_step2_result()直接呼び出しに加え、実_cmd_produce()を使った genuine end-to-end reachability テストを含む)。operator-only fixture をcommand_not_allowedから真の operator-only 状態(jq+ 存在しないパス)へ差し替え(Scope Delta。関数名・シグネチャは無変更).claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py(Scope Delta・新規): AC9〜AC12 に対応するテスト.claude/skills/issue-refinement-loop/SKILL.md: Step 2 routing table にstep_5_operator_intervention_requiredの説明を独立した項目として追記し、table 直後の要約(approve→Step2.5 / needs-fix→Step4 / human_judgment_required→Step5 / inconsistent→fail closed の4分岐)にstep_5_operator_intervention_requiredを独立した5番目の分岐として明記(Scope Delta AC13).claude/skills/issue-refinement-loop/references/termination-policy.md:operator_intervention_requiredの termination cause 定義、既存 Step 5 handler の再利用、step_5_human_judgment_requiredとの区別、および scope_signal_guard の termination_cause 正規化ルールとは独立であることを追記.claude/skills/review-issue/SKILL.md: 「reviewer_transport.pyがfailure_classを読んでNEXT_ACTION: human_judgment_requiredに変換する」という未実装記述を、root-owned canonical route がmerged_review_result.failure_classを直接参照するという現状の設計説明に修正.claude/skills/review-issue/tests/test_check_issue_contract.py(Scope Delta iteration 2):TestContractReadinessExecuteIntegration::test_human_judgment_not_collapsed_to_needs_fixの fixture(_HUMAN_JUDGMENT_ISSUE_CONTENT)を、AC9 のcommand_not_allowed -> needs_fix変更後も真に operator-only(human_judgment)であり続ける状態に差し替え。旧 VCloop-protocol-nonexistent-tool-xyz-abc(allowlist 外のためcommand_not_allowedに分類され、AC9 適用後はneeds_fixになってしまい本テストの前提が崩れる)を、jqを存在しないパスへ実行しcategory: unknown→human_judgmentに到達する VC へ差し替えた(jqは preflight allowlist 内のため実際に実行される)。関連する Issue 本文フィクスチャ・docstring・コメントも同様に更新.claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.py(Scope Delta iteration 3, P0-1 / AC14):_write_forced_env_missing_dep_command()を新設し、AC11/AC12 が使う_GENUINELY_OPERATOR_ONLY_BODYfixture を、unknowncatch-all 分類(jq+ 存在しないパス)から、jqの real subprocess execution boundary をPATHシムで monkeypatch して決定論的にcategory: env_missing_depを発生させる方式へ差し替え。テスト関数名・アサーション内容は無変更.claude/skills/issue-refinement-loop/SKILL.md(Scope Delta iteration 3, P1-1 / AC15、P1-2 / AC16):step_5_operator_intervention_required項目に、終了処理がcanonical_step2_dispositionのtermination_reason/termination_causeをそのまま使用し独自に再導出しないことを追記。step_5_human_judgment_requiredの説明を、現行 Compact V2 producer からは生成されない defensive/legacy route である旨に修正.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py(Scope Delta iteration 3, P1-3 / AC17):FAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT定数に、route-critical な既知failure_class値の single source of truth であることを明示するコメントを追加受け入れ条件の達成状況
Issue #2397 の Acceptance Criteria(AC1〜AC17)はすべて達成済み。以下は 2026-08-30 に本 worktree(head
7d368dff25507a56c39e0f2d3e6e24d3cbdfa108)で実際に再実行して得た結果に基づく。_cmd_produce()形状の payload をroute_canonical_step2_result()に渡すとstep_5_operator_intervention_requiredが返る(test_route_canonical_step2_result_needs_fix_request_changes_with_contract_readiness_human_judgment_routes_to_operator_intervention+test_given_real_produce_needs_fix_body_with_contract_readiness_human_judgment_when_run_then_routes_to_operator_intervention2 passed)failure_classが欠落/Noneの場合は既存どおりstep_4を返す(test_route_canonical_step2_result_needs_fix_request_changes_without_failure_class_routes_to_step_41 passed)failure_class/Mappingでないmerged_review_resultはfail_closed_environment_or_integrity_failureを返す(test_route_canonical_step2_result_needs_fix_request_changes_with_unknown_failure_class_fails_closed5 parametrize cases 5 passed)step_2_5へ到達する回帰、(b)input_or_runtime_error/ 矛盾組合せは従来どおり fail-closed を維持する回帰(test_canonical_step2_route_wiring.pyフルスイート 19 passed)build_compact_v2()/validate_compact_v2()は変更されておらず、既存テストが変更前と同じ内容で PASS する(test_review_compact_v2.py+test_reviewer_transport_e2e.py25 passed)review-issue/SKILL.mdの未実装記述が削除され、root-owned canonical route の現状説明に置き換わっている(rgマッチ 1 件確認)termination-policy.mdにoperator_intervention_requiredの termination cause・既存 Step 5 handler 再利用・step_5_human_judgment_requiredとの独立性が明記されている(rg複数マッチ確認)run_root_review_pipeline.pyにimport requests/import socket/import urllibが無いことをrgで確認、no match = 期待どおり exit 1)_PREFLIGHT_CATEGORY_TO_READINESSにcommand_not_allowed: "needs_fix"が追加されている(test_command_not_allowed_category_maps_to_needs_fix_not_human_judgment1 passed)command_not_allowed(failure_classなし)はstep_4に到達しstep_5_operator_intervention_requiredには到達しない(test_command_not_allowed_readiness_routes_to_step_4_not_operator_intervention1 passed)command_not_allowed以外)を用いた E2E テストがstep_5_operator_intervention_requiredに到達する(test_genuinely_operator_only_fixture_routes_to_operator_intervention1 passed)_cmd_produce()の成功 payload にcanonical_step2_dispositionが含まれ、operator route のみterminal: true/termination_reason: "human_escalation"/termination_cause: "operator_intervention_required"を持つ(test_cmd_produce_includes_canonical_step2_disposition_for_operator_route+test_cmd_produce_disposition_is_route_only_for_non_operator_routes2 passed)issue-refinement-loop/SKILL.mdの Step 2 routing table 直後の要約にstep_5_operator_intervention_requiredが独立した5番目の分岐として明記されている(rg複数マッチ確認)unknowncatch-all 分類ではなく、決定論的に生成される既知の operator-only カテゴリ(env_missing_dep)を使用しており、AC11 のテストは変更後の fixture でも引き続き PASS する(test_genuinely_operator_only_fixture_routes_to_operator_intervention1 passed)issue-refinement-loop/SKILL.mdに、Step 5 operator intervention route の終了処理がcanonical_step2_dispositionのtermination_reason/termination_causeをそのまま使用し再導出しないことが明記されている(rgマッチ確認)issue-refinement-loop/SKILL.mdのstep_5_human_judgment_requiredの説明が、現行 Compact V2 producer からは生成されない defensive/legacy route である旨に修正されている(rgマッチ確認)run_root_review_pipeline.pyのFAILURE_CLASS_CONTRACT_READINESS_HUMAN_JUDGMENT定数に、route-critical な既知failure_class値の single source of truth であることを明示するコメントが付与されている(rgマッチ確認)検証コマンド結果
以下は 2026-08-30 に本 worktree(
git checkout 7d368dff25507a56c39e0f2d3e6e24d3cbdfa108)で、Issue #2397 の Verification Commands セクションに記載された各コマンドを実際に再実行して得た生の出力である。さらに、回帰確認として以下も再実行し全 PASS を確認した(2026-08-30 時点):
.claude/skills/issue-refinement-loop/tests/test_operator_intervention_route.pyフルスイート(8 passed).claude/skills/issue-refinement-loop/tests/test_operator_intervention_route_scope_delta.pyフルスイート(6 passed — Scope Delta iteration 3 の fixture 差し替え後も AC9〜AC12 含め全 PASS).claude/skills/issue-refinement-loop/tests/test_canonical_step2_route_wiring.pyフルスイート(19 passed).claude/skills/review-issue/tests/フルスイート(270 passed, 0 failed — Blocker 2 参照。旧「既知の未解決事項」で報告していた 1 failed は本 Scope Delta iteration 2 で解消済み。詳細は下記「既知の未解決事項の解消」参照).claude/skills/review-issue/tests/test_check_issue_contract.py::TestContractReadinessExecuteIntegration::test_human_judgment_not_collapsed_to_needs_fix(単独実行 1 passed)uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ .claude/skills/issue-contract-review/tests/ .claude/skills/review-issue/tests/ -q(2707 passed, 3 failed)。3 件の failure はtest_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch(uv_version_mismatch系)であり、本 Issue の Allowed Paths外・変更なしのファイルで、本 PR の変更前(git stashで本コミットの差分を退避した状態)でも同一の 3 failed が再現することを確認済みの既存事象(本 fix_delta が原因ではない)Allowed Paths 遵守
git diff --name-only origin/main...HEAD(head7d368dff25507a56c39e0f2d3e6e24d3cbdfa108)で確認した変更ファイルは以下の9個であり、Issue #2397 の Allowed Paths(Scope Delta iteration 1・2・3 を含む)に完全に一致する(過不足なし。Scope Delta iteration 3 は既存の 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のフィクスチャ差し替えのみ)Allowed Paths 外のファイル変更はゼロ。
Runtime Verification Evidence(実行時検証証跡)
Issue #2397 の
Runtime Verification Applicabilityはdecision: immediate、applicable_acs: [AC1, AC2, AC3, AC4, AC5, AC9, AC10, AC11, AC12](artifact_requirements: focused production-shaped pytest output)。以下は該当 AC の実_cmd_produce()/ production-shaped pytest 実行結果を、2026-08-30 に本 worktree(head7d368dff25507a56c39e0f2d3e6e24d3cbdfa108)で実際に再実行して直接埋め込んだものである(SKIP・fallback 経路は使用していない)。AC11 は Scope Delta iteration 3(P0-1)の fixture 差し替え後の再実行結果であり、AC14 は同一テストの再掲(fixture が決定論的なenv_missing_depへ差し替わったことの確認)である。いずれの production-shaped pytest 実行も、hermetic subprocess(
uv run --locked pytest)内で実_cmd_produce()/route_canonical_step2_result()を呼び出すテストを含み、実 Claude CLI・外部認証・ネットワークは使用していない(AC8 の import 静的検査で追加依存が無いことも確認済み)。SKIP exit 77 やフォールバック成功を PASS として扱う経路は存在しない。AC15〜AC17 は静的なrggrep 検証(テキスト明記の確認)であり、Issue #2397 のRuntime Verification Applicability.applicable_acsには含まれない(rgの実行結果は上記「検証コマンド結果」節に記載済み)。Schema Change Applicability
ISSUE_REVIEW_RESULT_COMPACT_V2/build_compact_v2()/validate_compact_v2()/NEXT_ACTIONの二値契約は一切変更していない。_cmd_produce()の stdout JSON: additive contract change。canonical_step2_routeの戻り値集合に新しい値(step_5_operator_intervention_required)を1つ追加し、新規フィールドcanonical_step2_dispositionを追加した。いずれも既存フィールドの意味・型を変更しない加算的変更であり、未知の値/フィールドを無視する既存 consumer には非破壊。Schema Consumer Inventory
.claude/skills/review-issue/SKILL.md(本 PR でroute_canonical_step2_result()がmerged_review_result.failure_classを直接参照するという現状設計の説明へ更新済み).claude/skills/issue-refinement-loop/scripts/command_registry.py(canonical_step2_route/canonical_step2_dispositionの値集合を消費しないため変更不要。参考として確認済み — このファイルは_cmd_produce()の出力を直接パースしない).claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py(本 PR で routing 分岐とbuild_canonical_step2_disposition()を実装した producer 本体).claude/skills/issue-refinement-loop/tests/test_canonical_step2_route_wiring.py(既存canonical_step2_routeフィールドの回帰確認テスト。本 PR による新値追加後も AC4 として全 PASS を確認済み。同ファイル自体は変更していない).claude/skills/issue-refinement-loop/SKILL.md(本 PR で routing table と直後の要約を更新済み).claude/skills/issue-refinement-loop/references/termination-policy.md(本 PR で termination cause 定義を追記済み)既知の未解決事項の解消(旧 Blocker 2 対応)
以前の本 PR 本文は、
.claude/skills/review-issue/tests/test_check_issue_contract.py::TestContractReadinessExecuteIntegration::test_human_judgment_not_collapsed_to_needs_fixを「本 Issue の Allowed Paths 外」「未解決」と記載していたが、これは stale な記述である。live Issue #2397 本文の Scope Delta(iteration 2、https://github.com/squne121/loop-protocol/issues/2397#issuecomment-5461878398系のフォローアップとして OWNER が承認)は、この点をすでに解消しており、以下がすべて確認済みである。## Allowed Pathsは既に.claude/skills/review-issue/tests/test_check_issue_contract.py(Scope Delta iteration 2:test_human_judgment_not_collapsed_to_needs_fixがcommand_not_allowedfixture に依存しており AC9 の意図的な挙動変更で fail するため、fixture を真の operator-only 状態へ差し替えるのみ)を含んでいる。同 Issue の## Scope Delta(任意)ブロック(status: approved_by_trusted_anchor,anchor_author_association: OWNER)にも同ファイルがallowed_path_deltasとして明記されている。git diff origin/main...HEAD -- .claude/skills/review-issue/tests/test_check_issue_contract.py)は、_HUMAN_JUDGMENT_ISSUE_CONTENTフィクスチャの VC を、allowlist 外のためcommand_not_allowed(AC9 適用後はneeds_fix)に分類されてしまうloop-protocol-nonexistent-tool-xyz-abcから、jqを存在しないパスへ実行しcategory: unknown→human_judgmentに到達する VC へ実際に差し替え済みである(コメント・docstring・Issue 本文フィクスチャも同時に更新)。.claude/skills/review-issue/tests/フルスイートは 270 passed, 0 failed(旧本文で報告していた「270 件中 269 passed, 1 failed」は本 Scope Delta iteration 2 のフィクスチャ差し替えで解消済み)。Allowed Paths 外の変更・follow-up Issue の起票はいずれも不要になった。Safety Claim Matrix
contract_readiness_human_judgmentfailure_class を持つ needs-fix+request_changes payload はstep_5_operator_intervention_requiredへ route される_cmd_produce()E2E)PASSfailure_class欠落/Noneの場合は既存どおりstep_4へ route される(回帰なし)failure_class/ 型不正なmerged_review_resultは fail-closed のままtest_canonical_step2_route_wiring.py19 tests)PASSNEXT_ACTION二値契約)は不変test_review_compact_v2.py/test_reviewer_transport_e2e.py25 tests)PASSgit diff origin/main --statで確認できる差分は.claude/skills/**の Python/Markdown のみcommand_not_allowedはneeds_fix(body-fixable)に分類され、operator-only route へ誤送されないcommand_not_allowed以外)は引き続きstep_5_operator_intervention_requiredへ route される_cmd_produce()の stdout JSON にcanonical_step2_dispositionが正しく付与される(operator route のみ terminal、それ以外は route のみ)review-issue/tests/test_check_issue_contract.pyのフィクスチャ差し替え後、対象テストは PASS する(旧 Blocker 2 は解消済み)unknowncatch-all ではなく既知のenv_missing_depカテゴリで決定論的に operator-only を証明するtest_genuinely_operator_only_fixture_routes_to_operator_intervention同一テストの fixture 差し替え後の再実行)canonical_step2_dispositionを再導出せずそのまま使用する、と SKILL.md に明記されているrgマッチ確認)step_5_human_judgment_requiredの説明が現行 Compact V2 producer の実態(defensive/legacy route)と一致しているrgマッチ確認)failure_classの route-critical な既知値集合の single source of truth が明示されているrgマッチ確認)Notes
worktree-issue-2397-human-judgment-next-action)を in-place 更新したものであり、新規 branch・新規 PR は作成していない。旧設計の実装コミットは revert コミットで完全に撤去し、その上に新設計の実装コミット、Scope Delta の fix_delta コミット、さらに本 Scope Delta iteration 3 の fix_delta コミットを積んでいるimmediate(Issue 本文のRuntime Verification Applicability参照。AC1〜AC5、AC9〜AC12 の実_cmd_produce()E2E テストで production-shaped payload の到達性を証明。上記「Runtime Verification Evidence」節に実行結果を埋め込み済み。AC14 は AC11 と同一テストの fixture 差し替え確認、AC15〜AC17 は静的rggrep 検証).claude/skills/**の Python/Markdown のみ)に影響しないことをgit status --porcelainで確認済み(対象外)PR Body Japanese Checkfailure(## Runtime Verification Evidence見出しの日本語比率不足)の解消である