Skip to content

fix: route missing planner patch plans - #2732

Merged
squne121 merged 2 commits into
mainfrom
worktree-issue-2724-freeform-human-review-directive
Sep 24, 2026
Merged

squne121 merged 2 commits into
mainfrom
worktree-issue-2724-freeform-human-review-directive

Conversation

@squne121

@squne121 squne121 commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • planner authority の contract_patch_plan が absent / non-dict の場合だけ、既存 canonical consumer を通じて eligible な freeform human_review_directive を issue-editor handoff へ到達可能にします。
  • generic な empty plan は生成せず、対象外・不正な missing-plan 入力は既存の fail-closed 経路に維持します。

Checks

以下の検証は実装後の branch head に対して実行し、すべて成功しました。コマンド名と証跡の英字表記は実行対象を識別するためにそのまま記録しています。

  • uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py -q: PASS(56 passed)
  • focused runtime smoke: PASS(3 passed, 53 deselected)
  • worktree-local evidence: artifacts/issue-2724-preflight-suite.txt と artifacts/issue-2724-runtime-smoke.txt

Schema Change Applicability

この変更は内部関数が planner の欠落状態を受け取るための最小の型緩和だけです。外部利用者が読む wire format、schema、固定 artifact のキー集合や内容は変わりません。したがって schema migration や consumer 更新を必要としません。

  • decision: not_schema_change
  • reason: private consumer parameter の optionalization のみで、wire/schema/fixed artifact contract は変更していません。

Schema Consumer Inventory

  • consumer: run_preflight() と既存 canonical consumer の内部呼び出しのみです。
  • 更新有無: あり(private consumer の入力を absent/non-dict 状態として扱います)。
  • 備考: 外部 schema、wire format、固定 artifact key は不変です。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
missing plan を generic empty plan に変換しない yes - focused regression と full suite -
eligible directive は既存 SSOT で issue-editor route に到達する yes - production-entrypoint regression -
ineligible input は no_change に降格しない yes - wrong-lane、untrusted、ambiguous、invalid-binding matrix -

Notes

この PR は Issue #2724 の契約に限定した routing 修正です。structured scope reframe と非空 patch plan の既存優先順位を維持し、Issue を閉じる操作や merge は行いません。

この説明は実装と検証の要点を日本語で記録したものであり、末尾の生成者表記は repository の必須形式です。

IMPLEMENTATION_SCOPE_COVERAGE_V1:
  schema_version: "IMPLEMENTATION_SCOPE_COVERAGE_V1"
  issue_number: 2724
  issue_body_sha256: "sha256:cae3eac02ff695b47b3e0c98dfe40742e7c5f040a526fa28cdd65356c3f4f430"
  normalized_scope_manifest_sha256: "sha256:1c6969d9b46ce63206d30bef7f62a35a88f9a325eecf3e8dc27531697b788208"
  pr_head_sha: "9286d49f817438df9b8761d7b6a4425c56f706b8"
  scope_manifest: {"acceptance_criteria": ["For a freeform explicit trusted human_review_directive fixture where structured ANCHOR_SCOPE_REFRAME_V1 is absent and planner authority contract_patch_plan is absent or non-dict before a real run_preflight(), the eligible directive reaches the existing canonical consumer and emits NEXT_ACTION: issue_editor_required, explicit_trusted_human_directive_requires_issue_editor, writes: 0, and transaction calls 0. This case is mutually exclusive from AC4's structured scope-reframe case.", "Mutually exclusive precedence is explicit: (1) an existing structured ANCHOR_SCOPE_REFRAME_V1 remains owned by its existing route and retains approved_scope_requires_full_contract_rewrite; (2) only when no structured payload governs the transaction, AC1's eligible freeform explicit trusted human_review_directive fixture with planner authority contract_patch_plan absent/non-dict reaches explicit_trusted_human_directive_requires_issue_editor; (3) a non-empty contract patch plan remains on the ordinary patch route.", "Wrong-lane/untrusted, ambiguous, invalid-binding, and non-applicable missing-plan fixtures each retain their existing fail-closed blocker/reason, have writes 0, have no editor route, and never yield no_change or proven_no_change.", "[runtime: immediate][skill-invocation-runtime-smoke]  The existing runtime verification apparatus performs a focused real run_preflight() invocation and saves worktree-local evidence; only exit 77 is recorded as SKIP, while unavailable prerequisites without that policy-defined SKIP are reported as FAIL.", "run_preflight() does not synthesize generic {\"operations\": []} or an empty CONTRACT_PATCH_PLAN_V1; genuine empty-operations behavior remains owned by the existing canonical consumer and decide_rewrite_route SSOT."], "allowed_paths": [".claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py", ".claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py"], "change_kind": "code", "goal_ref": "Close only the planner contract_patch_plan absent/non-dict production reachability gap for the existing eligible #2620 freeform explicit trusted human_review_directive route, while preserving structured and genuine empty-operations semantics.", "in_scope": ["Add full run_preflight() regression fixtures and assertions in the allowed test file for a freeform explicit trusted human_review_directive fixture where structured ANCHOR_SCOPE_REFRAME_V1 is absent and planner authority contract_patch_plan is absent/non-dict before real run_preflight(), and for explicit_trusted_human_directive_requires_issue_editor, writes: 0, and transaction calls 0.", "Add negative-matrix coverage for wrong-lane/untrusted, ambiguous, and invalid-binding missing-plan inputs: each has writes 0, no editor route, no no_change or proven_no_change, and its existing fail-closed blocker/reason.", "Assert mutually exclusive precedence: (1) an existing structured ANCHOR_SCOPE_REFRAME_V1 remains owned by its existing route and retains approved_scope_requires_full_contract_rewrite; (2) only when no structured payload governs the transaction, the eligible freeform explicit trusted human_review_directive fixture with planner authority contract_patch_plan absent/non-dict reaches explicit_trusted_human_directive_requires_issue_editor; (3) a non-empty plan remains on its ordinary patch route.", "In run_preflight(), close only the planner-authority contract_patch_plan absent/non-dict production reachability gap for an eligible freeform explicit trusted human_review_directive fixture where structured ANCHOR_SCOPE_REFRAME_V1 is absent.", "Permit optionalization of a private/internal canonical-consumer parameter only if necessary to carry the absent/non-dict planner state; do not change wire, schema, or fixed artifact contracts.", "Require use of the existing canonical consumer and existing decide_rewrite_route SSOT. Do not directly call _decide_human_review_directive_editor_route() from run_preflight() and do not duplicate routing.", "Run the immediate, runtime-tagged skill-invocation-runtime-smoke through the existing apparatus with a focused real run_preflight() invocation and preserve worktree-local evidence, handling SKIP 77 and fallback FAIL exactly as specified above."], "schema_version": "IMPLEMENTATION_SCOPE_MANIFEST_V1"}

この説明は実装と検証の要点を日本語で記録したものであり、末尾の生成者表記は repository の必須形式です。
🤖 Generated with Claude Code

Route only eligible freeform directives through the canonical consumer while keeping missing-plan input fail-closed.

Co-Authored-By: Claude Code <[email protected]>
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #2732 closed).

@squne121

Copy link
Copy Markdown
Owner Author

確認した live state では、推奨アクションは PR #2732 の existing_pr_resume を第一候補として、Verification → PR Review から再開です。

現時点では main HEAD / PR base がともに 73203069a9cfc6e1d0bd84e9bdf241ca618fa6b2 で、branch-behind はありません。PR head は 9286d49f817438df9b8761d7b6a4425c56f706b8、Draft / open / mergeable=true、変更は Issue #2724 の Allowed Paths と一致する2ファイルのみです。レビュー提出・review thread はまだありません。最新の通常 CI run では test / lint / build / typecheck / python-test / e2e 等が成功しています。一方、branch protection にある validate-generated-artifact は取得できた current-head check-run 一覧には見えていないため、CI 全通過と決め打ちせず current skill の required-CI evaluator に判定させるのが適切です。deploy-pages の失敗だけを implementation defect と扱うべきでもありません。

また Issue #2724 の checkpoint #issuecomment-5780207015 では、前回の停止理由がコード不良ではなく test-runner SubAgent の API 503 により canonical terminal completion を得られなかったことと明記されています。したがって実装を最初からやり直す必要はありません。

以下をそのまま、既に auto mode で起動している Claude Code に渡すのがよいです。

あなたは既に auto mode で起動済みの対話的 Claude Code セッションです。

対象リポジトリ:
squne121/loop-protocol

対象 Issue:
https://github.com/squne121/loop-protocol/issues/2724

対象 PR:
https://github.com/squne121/loop-protocol/pull/2732

使用する skill:
.claude/skills/impl-review-loop

目的:
PR #2732 を current impl-review-loop の canonical flow で再開し、実装・検証・PR review の必要なループを人間の中間承認なしで自律実行し、merge 直前まで到達させてください。merge 自体は実行しないでください。

0. 重要: 前回作業の continuation である

これは新規 implementation dispatch ではありません。

Issue #2724 の resume checkpoint を必ず確認してください。

  • checkpoint comment:
    https://github.com/squne121/loop-protocol/issues/2724#issuecomment-5780207015
  • marker:
    OPERATOR_PAUSE_CHECKPOINT:issue-2724-2026-09-23

checkpoint は handoff evidence としてのみ使用してください。
checkpoint 内の SHA、古い contract review、古い verification result、古い routing result を execution authorization として再利用してはいけません。

最初に current repository / GitHub / skill state を fresh に取得してください。

プロンプトと current repository の skill / scripts / runbook が衝突する場合、current repository の canonical contract を優先してください。

1. 最初に fresh state を確定する

current .claude/skills/impl-review-loop/SKILL.md を読み、そこから要求される MUST_READ の steps / references / scripts も読んでください。

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

2026-09-24 の事前観測値は以下です。ただし必ず再取得してください。

  • current main HEAD:
    73203069a9cfc6e1d0bd84e9bdf241ca618fa6b2

  • PR base:
    73203069a9cfc6e1d0bd84e9bdf241ca618fa6b2

  • PR head:
    9286d49f817438df9b8761d7b6a4425c56f706b8

  • PR state:
    open / Draft

  • GitHub mergeable:
    true

  • branch:
    worktree-issue-2724-freeform-human-review-directive

  • changed files:

    • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
    • .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
  • submitted PR reviews:
    0

  • unresolved review threads:
    0

PR head の最新 ci workflow では、少なくとも以下は success が確認されています。

  • test
  • lint
  • build
  • typecheck
  • python-test
  • e2e
  • ci-verdict-summary

ただし branch protection の required check と current check-run の対応は 必ず canonical evaluator で fresh に評価してください。
特に validate-generated-artifact 等を「見当たらないから成功扱い」にしないでください。

deploy-pages failure だけを Issue #2724 の implementation defect と決めつけないでください。required / relevant かは current canonical policy で判定してください。

2. current root-owned entry transition を fresh に実行する

current impl-review-loop の root-owned synchronous entry contract に従ってください。

少なくとも:

capability preflight
→ live Issue fetch
→ current-run issue-contract-review
→ live Issue refetch
→ canonical routing
→ pre-Step-1 landing disposition

を fresh に実行してください。

古い go、古い digest、古い contract snapshot、checkpoint comment、過去 SubAgent report のいずれも、それ単独で Step 1 authorization として扱わないでください。

live/current-run evidence を使ってください。

3. pre-Step-1 landing disposition

live evidence が現在の状態と整合するなら、期待される disposition は:

existing_pr_resume

です。

PR #2732 が current scope を正しく cover している場合:

  • 新規 branch を作らない
  • 新規 PR を作らない
  • duplicate implementation を作らない
  • implementation-worker を最初から再実行しない

でください。

ただし canonical producer が fresh evidence に基づいて:

  • reconciliation_required
  • ordinary_dispatch_or_explicit_recovery
  • その他の disposition

を返すなら、自己解釈で上書きせず current skill の routing に従ってください。

4. 前回停止理由を正しく扱う

前回の genuine terminal condition は implementation/test assertion failure ではありません。

checkpoint 記録:

termination_reason: repository_environment_integrity_failure:test_runner_terminal_api_503

前回は:

  • implementation-worker: terminal completed / join 済み
  • implementation: 完了
  • commit: 完了
  • push: 完了
  • Draft PR fix: route missing planner patch plans #2732: 作成済み
  • candidate worktree 上の Verification Commands: 成功
  • canonical test-runner SubAgent: API HTTP 503 により terminal failed
  • pr-reviewer: 未起動
  • review iterations: 0
  • IMPL_REVIEW_LOOP_RESULT_V1.status: 未発行

でした。

API 503 を implementation defect として扱わないでください。

5. existing PR resume 時は Verification から進める

existing_pr_resume が成立した場合、最優先は implementation の再作成ではなく:

current PR head に bind した canonical Step 2 Verification の完成

です。

test-runner SubAgent を root/main thread から直接起動してください。

SubAgent の必須条件

SubAgent を起動するときは必ず:

こと。

最重要: 必ず completion を待つ

SubAgent の hand-back text が返っただけでは completion とみなしてはいけません。

task status が canonical terminal state になるまで必ず待ち、join してください。

running / partial / API-error / interrupted な SubAgent 出力を canonical verification evidence に昇格させてはいけません。

current head が途中で変化した場合は stale verification を破棄し、新しい current head に rebind して再検証してください。

6. Issue #2724 の Verification Commands

live Issue body で再取得してから実行してください。

現在記録されている commands は:

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

uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py -q -k "explicit_human_review_directive_reaches_next_action_production_reachable"

です。

Runtime Verification Applicability も live contract から確認し、existing apparatus を使ってください。

新規 harness は作らないでください。

exit 77 / SKIP / FAIL の分類も Issue と current runtime policy に従ってください。

7. API 503 等の SubAgent infrastructure failure

test-runner が再び API 503 等で terminal failed になった場合:

  • 即 human escalation しない
  • implementation defect と決めつけない
  • current skill が許可する bounded retry / recovery を使う
  • 無制限 retry はしない
  • fabricated completed report を作らない
  • main thread で実行した test を SubAgent completed report に偽装しない
  • stale report を current-head verification として採用しない

でください。

current skill の bounded recovery を尽くしても canonical terminal completion が取得不能な場合のみ、repository/environment integrity failure として停止してください。

その場合も全起動 SubAgent の terminal state を確認し、可能なものはすべて join してから終了してください。

8. Verification gate 通過後は PR Review

current-head Verification が canonical に non-blocking になった場合、current impl-review-loop Step 4 に従い pr-reviewer SubAgent を起動してください。

pr-reviewer も root/main thread から直接起動してください。

必須条件:

9. REQUEST_CHANGES は人間承認なしで修正ループする

pr-reviewer が REQUEST_CHANGES を返した場合、人間に中間承認を求めないでください。

current impl-review-loop の canonical routing に従って:

fix_delta
→ implementation-worker
→ Verification
→ pr-reviewer
→ judgment

を bounded max_iterations 内で自律反復してください。

implementation-worker も root/main thread から直接起動し、terminal completion を待って join してください。

修正後に head SHA が変わった場合:

  • 古い Verification は stale
  • 古い PR review は stale

として扱い、新しい current head で両方を fresh にやり直してください。

通常の:

  • test failure
  • REQUEST_CHANGES
  • stale-head rereview
  • branch behind
  • advisory artifact warning

だけを human escalation 理由にしないでください。

10. Issue #2724 の実装契約を維持する

修正ループに入っても以下を維持してください。

  • missing planner contract_patch_plan を generic {"operations": []} に変換しない
  • generic empty CONTRACT_PATCH_PLAN_V1 を合成しない
  • missing-plan と genuine empty-operations semantics を区別する
  • structured ANCHOR_SCOPE_REFRAME_V1 の既存 precedence を維持する
  • non-empty patch plan の通常 route を維持する
  • eligible freeform explicit trusted human_review_directive だけを既存 canonical consumer / routing SSOT に到達させる
  • wrong-lane input は fail-closed
  • untrusted input は fail-closed
  • ambiguous input は fail-closed
  • invalid-binding input は fail-closed
  • non-applicable missing-plan input は fail-closed
  • no_change / proven_no_change への false-green 化を防ぐ
  • run_preflight() から _decide_human_review_directive_editor_route() を直接呼ぶ duplicate routing を作らない
  • existing canonical consumer / decide_rewrite_route SSOT を利用する
  • wire contract を変えない
  • schema を変えない
  • fixed artifact contract を変えない
  • security subsystem を新設しない
  • approval mechanism を新設しない
    -新規 runtime/security harness を追加しない

Issue #2724 の current Allowed Paths 外を変更しないでください。

11. 人間の中間承認なしで進めてよい

current skill / live Issue が許可する限り、以下は承認を求めず実行してください。

  • existing PR / worktree resume
  • Allowed Paths 内の修正
  • regression test の追加・修正
  • Verification Commands
  • runtime verification
  • commit
  • push
  • PR description の必要な同期
  • review fixes
  • canonical branch update/rebase 相当
  • verification rerun
  • PR review rerun
  • stale-head rereview
  • bounded fix loop

auto mode / permission mode の設定自体は変更しないでください。

12. genuine terminal condition

通常のループ事象では止まらず、current skill / live Issue の genuine terminal condition の場合だけ停止してください。

例:

  • Allowed Paths 外の変更が不可避
  • wire/schema/fixed artifact contract 変更が不可避
  • Issue split / new Issue が不可避
  • nested SubAgent delegation が不可避
  • secret / credential が必要
  • permission escalation が必要
  • destructive / irreversible operation が必要
  • actual Git conflict かつ canonical runbook が human escalation を要求
  • reconciliation_required を canonical に解消不能
  • bounded recovery 後も repository/environment integrity failure
  • genuine semantic ambiguity
  • max_iterations 到達
  • live human comment による明示的停止指示

停止時は scope を勝手に拡張せず、evidence と人間が判断すべき最小事項だけを報告してください。

13. merge 境界

今回のゴールは merge 直前まで です。

以下は絶対に実行しないでください。

PR の Draft / Ready 状態変更については、このプロンプト独自の判断で変更せず、current impl-review-loop の canonical contract に従ってください。

current skill が merge-readiness 判定の一部として明示的な transition を要求する場合だけ、その canonical action に従ってください。

14. 完了条件

current skill の live contract に従いつつ、少なくとも:

  • current-head Verification: non-blocking
  • runtime verification: required policy を満たす
  • final pr-reviewer verdict: APPROVE
  • blockers: empty
  • reviewed_head_sha == current PR head
  • current required-CI evaluator: merge-readiness を妨げる blocker なし
  • live mergeability: current skill の approved condition を満たす

ところまで進めてください。

条件が成立したら merge せず停止し、

IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

を目標 final status としてください。

15. final report

最終報告には最低限、以下を含めてください。

最優先事項を再掲します。

実装を最初からやり直すことが目的ではありません。

まず PR #2732 の live candidate を current contract に fresh に rebindし、existing_pr_resume が成立するなら current-head test-runner を terminal completed / join まで完了 → current-head pr-reviewer を terminal completed / join まで完了させてください。

REQUEST_CHANGES があれば人間承認なしで bounded fix loop を継続し、canonical approved condition を満たした時点で mergeせず merge直前で停止してください。

この版では、前回 checkpoint を単に再掲するのではなく、現在 main が PR base と同一であること、最新 CI の成功状況、required check の未確定部分、レビュー未着手状態まで反映しています。特に「SubAgent の返答を受け取る」と「SubAgent が terminal completed になり join 済み」は別物として扱わせる点を強く固定しています。

@squne121

Copy link
Copy Markdown
Owner Author

PR Review (impl-review-loop / pr-review-judge)

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=UNSTABLE, isDraft=true (Draft stays Draft for human final-merge decision).
  • All 6 required checks SUCCESS at head 9286d49f817438df9b8761d7b6a4425c56f706b8: typecheck, lint, test, build, python-test, validate-generated-artifact.
  • deploy-pr fails but is NOT a required status check per branch protection.
  • required_approving_review_count: 0; unresolved review threads: 0.

Evidence Check

  • Allowed Paths Gate: status: ok, violations: [] — 2 changed files exactly match Issue 実装: freeform human_review_directive を production route で issue_editor_required に到達可能にする #2724 Allowed Paths.
  • Independent Step 2 Verification (separate test-runner SubAgent run, cross-checked head_sha + literal Verification Command SHA256 by the orchestrator): both literal VCs pass at exit 0.
    • uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py -q → 56 passed
    • uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py -q -k "explicit_human_review_directive_reaches_next_action_production_reachable" → 3 passed, 53 deselected
  • Code-path trace confirmed: AC1/AC4 mutually-exclusive routing, AC2 no generic empty-plan synthesis, AC3 negative-matrix fail-closed retained, no duplicate routing outside the canonical consumer, no wire/schema/fixed-artifact changes.

Blockers

(none)

Non-blockers / Warnings

verdict: APPROVE
reviewed_head_sha: "9286d49f817438df9b8761d7b6a4425c56f706b8"
blockers: []
warnings:
  - "PR body omits the literal ac-evidence-checks.md section headings; content-equivalent info exists under ## Checks and matches established repo precedent (#2717/#2720/#2723), so not blocking."
  - "AC3's 'non-applicable missing-plan' fixtures are not a separate parametrized test case; interpreted as an umbrella term already covered by the wrong_lane/untrusted/ambiguous/invalid_binding matrix based on the Issue Background section's usage, not blocking."

@squne121

Copy link
Copy Markdown
Owner Author

判定:REQUEST_CHANGES。ただし、実装の方向は維持してよいです

今回の修正は「欠落したplanを既存consumerへ渡す」という局所修正として妥当です。一方、発端となった#2715の実入力でも問題が解消することを、追加テストが確認できていません。 マージ前に優先するのは、この再現ケースの補強です。新しいセキュリティ機構やハーネスを追加する必要はありません。

レビュー対象はPR head 9286d49f817438df9b8761d7b6a4425c56f706b8、base **73203069a9cfc6e1d0bd84e9bdf241ca618fa6b2**です。変更はrun_refinement_preflight.pyとtest_preflight_run_with_anchor.pyの2ファイルです。

P0相当の新規欠陥や、明確な新規production regressionは確認していません。以下のP1は、「この修正で元の停止を解消できる」という受け入れ根拠の不足に対する指摘です。

P1:成功fixtureからplanを消すテストでは、#2715の実障害を閉じたことにならない

対象:
test_preflight_run_with_anchor.pyの_force_hrd_planner_patch_plan_missing()と、新しいmissing-plan positive test。関連する判定はrun_refinement_preflight.pyの_decide_human_review_directive_editor_route()です。

現在のテストが確認していること

追加テストは、既存の単純な成功fixtureを本物のplannerに渡し、その出力からcontract_patch_planを削除、または[]に置換しています。さらに、置換前のoriginal_planがdictだったことを明示的にassertしています。

つまり、確認できているのは次のケースです。

もともと適格で、plannerもplanを生成できる入力
  ↓
テストがplanner出力のplanだけを削除する
  ↓
consumerが同じ入力を再分類する
  ↓
再分類側では空operationsのplanを生成できる
  ↓
issue_editor_required

これは欠落値を受け渡す分岐の回帰テストとして有用です。しかし、実際にplannerがplanを生成しなかった原因まで再現したテストではありません。

production側には、もう一段の適格条件が残っています

今回の変更でconsumerはNoneを受け取れるようになりましたが、既存helperは内部でclassify_scope_delta_authority()を再実行し、再分類結果から次のように判定しています。

fresh_patch_plan = authority.get("contract_patch_plan")
fresh_operations = (
    fresh_patch_plan.get("operations")
    if isinstance(fresh_patch_plan, dict)
    else None
)
operations_empty = isinstance(fresh_operations, list) and not fresh_operations

そのうえでSSOTは、operations_empty == Trueだけでなく、route_action == "contract_update_required"も要求します。再分類側でもplanが欠落するケースや、非空operationsになるケースは、このeditor routeに入りません。

#2715の原コメントは、成功fixtureと条件が異なります

#2715の発端であるコメント5770013860には、Allowed Pathsの見出しと、変更対象パスの箇条書きが含まれています。一方、追加テストが使う_HRD_EXPLICIT_BODYは、オンボーディング文章の書き直しを求める短い文で、Allowed Pathsの境界を踏みません。

この違いは実装上、重要です。

detect_boundary_flags()は本文にAllowed Pathsがあるとexpands_allowed_pathsを立てます。その解除には、同じ抽出directive内の明示的なパス指定、または調査由来のinvestigation_derived_path_literalsが必要です。原コメントのように「見出し」と「パスだけの箇条書き」が分かれている形は、単純な成功fixtureと同じ扱いにはなりません。

調査由来パスがなく境界が解除されなければ、再分類はhuman_escalationを返し、planも生成しません。その場合、今回のmissing-plan branchに到達しても、最終的には停止します。既存テストにも、同じAllowed Paths拡張指示に対し、調査由来パスありではeditorへ、なしでは停止する対が既にあります。

また、調査由来パスを補えば必ず解決するとも断定できません。derive_contract_patch_operations()は、原コメントのパス箇条書きから非空のAllowed Paths操作を生成し得ます。非空planは通常のpatch routeに残すのが今回の契約なので、「元コメントは必ず空operationsのeditor handoffになる」という前提自体を確認する必要があります。

ここまでの後半は静的追跡です。#2715の当時の調査transport一式を使った再実行は行っていないため、現在のlive workflowでも必ず失敗するとまでは断定しません。 ただし、現在の追加テストだけで#2715の復旧を保証できないことは明確です。

推奨する修正

現在の人工的なmissing-planテストは残し、原コメント5770013860由来の再現fixtureを1ケース追加してください。新しいframeworkは不要です。

そのケースでは、plannerやclassifierを都合のよい成功結果に差し替えず、次の観測値を一緒に固定するのが重要です。

観測点 | 確認する内容 -- | -- 入力 | 原コメントの意味・箇条書き構造と、当時のhuman-context/調査transport条件 planner出力 | contract_patch_planが本当に欠落・非dictになっているか、その理由 consumer入口 | 欠落状態がgeneric empty planに変換されず渡っているか 再分類 | route.action、reason_code、planの有無、operationsの内容 最終結果 | 期待するroute identity、writes == 0、transaction呼び出し0回

この再現で追加の停止原因が見つかった場合は、#2724の狭い配送修正と、#2715に残る分類・入力条件の問題を分けて扱うべきです。今回のPRを通すために、SSOTの適格条件を無条件に緩めたり、空planを捏造したりする修正は勧めません。

P2:negative matrixは、対象分岐への到達と失敗理由を十分に固定していない

対象:
test_missing_planner_plan_ineligible_input_remains_fail_closed_production_reachable()。

negative matrixの追加自体は良いです。ただし、補助関数はplanner出力にsidecarまたはauthorityがなければ、何も置換せずそのまま返します。negative test側では、その分岐を通ったか、意図したmissing-plan状態がconsumerへ届いたかを確認していません。

また、主なassertionは次の結果確認です。

editorではない
status == failed
writes == 0
PLANNER_FAIL_CLOSEDがある
no_change / proven_no_changeではない

これは「成功扱いにならない」ことの検証としては有効です。しかし、別の早期停止でもgreenになり得るため、意図した理由で拒否していることまでは固定できません。 #2724のAC3は、既存のfail-closed blocker/reasonの維持まで要求しています。

修正は小さくて十分です。consumer入口をspyして渡されたplan状態を確認し、各ケースの期待するreasonをassertしてください。上流で止まること自体が正しいケースは、「consumer未到達」を明示的な期待値にすればよいです。非dictのnegativeも代表1ケースを足せばよく、全条件の巨大な直積テストは不要です。

このP2単独で大きな作り直しを要求する必要はありません。P1の再現fixture追加と一緒に直す程度です。

今回の変更で、維持すべき良い点

最も重要な点は、missing-planを通常の空planと区別できていることです。

consumerは欠落状態について、既存のeditor適格判定で処理できなければcontract_patch_plan_missingとして戻り、genuine empty-operationsのno_change経路には流しません。以前のレビューで懸念された「planがないので空planを作り、結果的に変更不要として成功する」という修正にはなっていません。

また、run_preflight()から既存helperを直接呼ぶ別ルートを作らず、canonical consumerを経由しています。structured scope-reframe用の既存処理も先に評価される構造を維持しています。これは#2620/PR #2623の設計に沿った変更です。

したがって、Optional[dict]をやめる、routingを作り直す、新しい承認層を追加する、といった対応は不要です。問題を直すための変更面積を小さく保てています。

外部仕様・配布物・検証状況の確認

テストのmock利用自体は問題ではありません

pytest公式は、ネットワークアクセス等を置き換えるためのmonkeypatchと、テスト終了後の自動復元を提供しています。今回の論点は「mockを使うな」ではなく、mockで作った入力が、元の障害条件を代表しているかです。既存fixtureとcallbackを使い続けて構いません。(pytestドキュメント)

uv run --lockedを使う方針も適切です。uv公式仕様では、lockfileを勝手に更新せず、プロジェクト定義と不整合ならエラーにします。このPRのために依存更新や別の実行管理を追加する理由はありません。(Astral Docs)

新しいlive GitHub harnessは不要です

リポジトリのruntime policyは、この種のskill script実行ロジック変更をimmediate/skill-invocation-runtime-smokeに分類しています。一方、#2724自身が指定する検証コマンドは、既存のreal run_preflight()を通すfocused pytestです。fixtureを使っていることだけを理由に、この方式を不合格にする必要はありません。

原コメントの再取得もGitHubの既存comment APIで行えます。新しいGitHub clientや、検証のためのIssue本文更新を導入する必要はありません。(GitHub Docs)

pluginへの機械的な同期も要求しません

Claude Code公式ではproject skillとplugin skillは配置・配布単位が区別されています。今回のheadのplugins/直下はagent-retrospectiveのみであり、今回のissue-refinement-loop修正に別のplugin同期を追加すべき根拠は確認していません。(Claude)

CI成功と、前回のAPI 503停止は分けて扱うべきです

対象headの通常ci run 35733599539はsuccessです。

一方、checkpointに記録された56 passed/focused 3 passedはworkerの検証報告です。その後、test-runner SubAgentがAPI 503でterminal failedとなり、canonical verification reportとして採用できず、review iteration 0で停止しています。これは、Pythonのテストが失敗したという記録ではありません。

こちらの環境ではリポジトリをcheckoutできず、pytestの再実行とlive #2715の再現は未実施です。上記の合格件数は独立再実行の結果ではなく、PR/checkpointの報告値です。

推奨する最小対応

  1. #2715原コメント由来の再現fixtureを追加する。 planner出力とconsumer側の再分類結果を両方観測し、「どこでplanがなくなるのか」を固定する。

  2. 既存negative matrixに、入力状態・到達点・期待reasonのassertionを足す。 大規模なテスト基盤追加はしない。

  3. 同じPRを維持して、既存の全体テストとfocused smokeを再実行する。 API 503による実行管理上の停止は既存の再試行手順で扱い、コードの作り直しや権限変更の理由にしない。

要するに、このPRの最小実装は良いです。ただし、「consumerへ到達できるようになった」と「#2715の元の指示で作業が進むようになった」は、まだ同じ事実として扱えません。 そこを原コメントの回帰テストで埋めるのが、品質を上げつつワークフローを最も妨げない修正です。

## 判定:REQUEST_CHANGES。ただし、実装の方向は維持してよいです

今回の修正は「欠落したplanを既存consumerへ渡す」という局所修正として妥当です。一方、発端となった#2715の実入力でも問題が解消することを、追加テストが確認できていません。 マージ前に優先するのは、この再現ケースの補強です。新しいセキュリティ機構やハーネスを追加する必要はありません。

レビュー対象はPR head 9286d49f817438df9b8761d7b6a4425c56f706b8、base **73203069a9cfc6e1d0bd84e9bdf241ca618fa6b2**です。変更はrun_refinement_preflight.pyとtest_preflight_run_with_anchor.pyの2ファイルです。

P0相当の新規欠陥や、明確な新規production regressionは確認していません。以下のP1は、「この修正で元の停止を解消できる」という受け入れ根拠の不足に対する指摘です。

P1:成功fixtureからplanを消すテストでは、#2715の実障害を閉じたことにならない

対象:
test_preflight_run_with_anchor.pyの_force_hrd_planner_patch_plan_missing()と、新しいmissing-plan positive test。関連する判定はrun_refinement_preflight.pyの_decide_human_review_directive_editor_route()です。

現在のテストが確認していること

追加テストは、既存の単純な成功fixtureを本物のplannerに渡し、その出力からcontract_patch_planを削除、または[]に置換しています。さらに、置換前のoriginal_planがdictだったことを明示的にassertしています。

つまり、確認できているのは次のケースです。

もともと適格で、plannerもplanを生成できる入力
  ↓
テストがplanner出力のplanだけを削除する
  ↓
consumerが同じ入力を再分類する
  ↓
再分類側では空operationsのplanを生成できる
  ↓
issue_editor_required

これは欠落値を受け渡す分岐の回帰テストとして有用です。しかし、実際にplannerがplanを生成しなかった原因まで再現したテストではありません。

production側には、もう一段の適格条件が残っています

今回の変更でconsumerはNoneを受け取れるようになりましたが、既存helperは内部でclassify_scope_delta_authority()を再実行し、再分類結果から次のように判定しています。

fresh_patch_plan = authority.get("contract_patch_plan")
fresh_operations = (
    fresh_patch_plan.get("operations")
    if isinstance(fresh_patch_plan, dict)
    else None
)
operations_empty = isinstance(fresh_operations, list) and not fresh_operations

そのうえでSSOTは、operations_empty == Trueだけでなく、route_action == "contract_update_required"も要求します。再分類側でもplanが欠落するケースや、非空operationsになるケースは、このeditor routeに入りません。

#2715の原コメントは、成功fixtureと条件が異なります

#2715の発端であるコメント5770013860には、Allowed Pathsの見出しと、変更対象パスの箇条書きが含まれています。一方、追加テストが使う_HRD_EXPLICIT_BODYは、オンボーディング文章の書き直しを求める短い文で、Allowed Pathsの境界を踏みません。

この違いは実装上、重要です。

detect_boundary_flags()は本文にAllowed Pathsがあるとexpands_allowed_pathsを立てます。その解除には、同じ抽出directive内の明示的なパス指定、または調査由来のinvestigation_derived_path_literalsが必要です。原コメントのように「見出し」と「パスだけの箇条書き」が分かれている形は、単純な成功fixtureと同じ扱いにはなりません。

調査由来パスがなく境界が解除されなければ、再分類はhuman_escalationを返し、planも生成しません。その場合、今回のmissing-plan branchに到達しても、最終的には停止します。既存テストにも、同じAllowed Paths拡張指示に対し、調査由来パスありではeditorへ、なしでは停止する対が既にあります。

また、調査由来パスを補えば必ず解決するとも断定できません。derive_contract_patch_operations()は、原コメントのパス箇条書きから非空のAllowed Paths操作を生成し得ます。非空planは通常のpatch routeに残すのが今回の契約なので、「元コメントは必ず空operationsのeditor handoffになる」という前提自体を確認する必要があります。

ここまでの後半は静的追跡です。#2715の当時の調査transport一式を使った再実行は行っていないため、現在のlive workflowでも必ず失敗するとまでは断定しません。 ただし、現在の追加テストだけで#2715の復旧を保証できないことは明確です。

推奨する修正

現在の人工的なmissing-planテストは残し、原コメント5770013860由来の再現fixtureを1ケース追加してください。新しいframeworkは不要です。

そのケースでは、plannerやclassifierを都合のよい成功結果に差し替えず、次の観測値を一緒に固定するのが重要です。

観測点 確認する内容
入力 原コメントの意味・箇条書き構造と、当時のhuman-context/調査transport条件
planner出力 contract_patch_planが本当に欠落・非dictになっているか、その理由
consumer入口 欠落状態がgeneric empty planに変換されず渡っているか
再分類 route.action、reason_code、planの有無、operationsの内容
最終結果 期待するroute identity、writes == 0、transaction呼び出し0回

この再現で追加の停止原因が見つかった場合は、#2724の狭い配送修正と、#2715に残る分類・入力条件の問題を分けて扱うべきです。今回のPRを通すために、SSOTの適格条件を無条件に緩めたり、空planを捏造したりする修正は勧めません。

P2:negative matrixは、対象分岐への到達と失敗理由を十分に固定していない

対象:
test_missing_planner_plan_ineligible_input_remains_fail_closed_production_reachable()。

negative matrixの追加自体は良いです。ただし、補助関数はplanner出力にsidecarまたはauthorityがなければ、何も置換せずそのまま返します。negative test側では、その分岐を通ったか、意図したmissing-plan状態がconsumerへ届いたかを確認していません。

また、主なassertionは次の結果確認です。

editorではない
status == failed
writes == 0
PLANNER_FAIL_CLOSEDがある
no_change / proven_no_changeではない

これは「成功扱いにならない」ことの検証としては有効です。しかし、別の早期停止でもgreenになり得るため、意図した理由で拒否していることまでは固定できません。 #2724のAC3は、既存のfail-closed blocker/reasonの維持まで要求しています。

修正は小さくて十分です。consumer入口をspyして渡されたplan状態を確認し、各ケースの期待するreasonをassertしてください。上流で止まること自体が正しいケースは、「consumer未到達」を明示的な期待値にすればよいです。非dictのnegativeも代表1ケースを足せばよく、全条件の巨大な直積テストは不要です。

このP2単独で大きな作り直しを要求する必要はありません。P1の再現fixture追加と一緒に直す程度です。

今回の変更で、維持すべき良い点

最も重要な点は、missing-planを通常の空planと区別できていることです。

consumerは欠落状態について、既存のeditor適格判定で処理できなければcontract_patch_plan_missingとして戻り、genuine empty-operationsのno_change経路には流しません。以前のレビューで懸念された「planがないので空planを作り、結果的に変更不要として成功する」という修正にはなっていません。

また、run_preflight()から既存helperを直接呼ぶ別ルートを作らず、canonical consumerを経由しています。structured scope-reframe用の既存処理も先に評価される構造を維持しています。これは#2620/PR #2623の設計に沿った変更です。

したがって、Optional[dict]をやめる、routingを作り直す、新しい承認層を追加する、といった対応は不要です。問題を直すための変更面積を小さく保てています。

外部仕様・配布物・検証状況の確認

テストのmock利用自体は問題ではありません

pytest公式は、ネットワークアクセス等を置き換えるためのmonkeypatchと、テスト終了後の自動復元を提供しています。今回の論点は「mockを使うな」ではなく、mockで作った入力が、元の障害条件を代表しているかです。既存fixtureとcallbackを使い続けて構いません。([pytestドキュメント]1)

uv run --lockedを使う方針も適切です。uv公式仕様では、lockfileを勝手に更新せず、プロジェクト定義と不整合ならエラーにします。このPRのために依存更新や別の実行管理を追加する理由はありません。([Astral Docs]2)

新しいlive GitHub harnessは不要です

リポジトリのruntime policyは、この種のskill script実行ロジック変更をimmediate/skill-invocation-runtime-smokeに分類しています。一方、#2724自身が指定する検証コマンドは、既存のreal run_preflight()を通すfocused pytestです。fixtureを使っていることだけを理由に、この方式を不合格にする必要はありません。

原コメントの再取得もGitHubの既存comment APIで行えます。新しいGitHub clientや、検証のためのIssue本文更新を導入する必要はありません。([GitHub Docs]3)

pluginへの機械的な同期も要求しません

Claude Code公式ではproject skillとplugin skillは配置・配布単位が区別されています。今回のheadのplugins/直下はagent-retrospectiveのみであり、今回のissue-refinement-loop修正に別のplugin同期を追加すべき根拠は確認していません。([Claude]4)

CI成功と、前回のAPI 503停止は分けて扱うべきです

対象headの通常ci run 35733599539はsuccessです。

一方、checkpointに記録された56 passed/focused 3 passedはworkerの検証報告です。その後、test-runner SubAgentがAPI 503でterminal failedとなり、canonical verification reportとして採用できず、review iteration 0で停止しています。これは、Pythonのテストが失敗したという記録ではありません。

こちらの環境ではリポジトリをcheckoutできず、pytestの再実行とlive #2715の再現は未実施です。上記の合格件数は独立再実行の結果ではなく、PR/checkpointの報告値です。

推奨する最小対応

  1. #2715原コメント由来の再現fixtureを追加する。 planner出力とconsumer側の再分類結果を両方観測し、「どこでplanがなくなるのか」を固定する。
  2. 既存negative matrixに、入力状態・到達点・期待reasonのassertionを足す。 大規模なテスト基盤追加はしない。
  3. 同じPRを維持して、既存の全体テストとfocused smokeを再実行する。 API 503による実行管理上の停止は既存の再試行手順で扱い、コードの作り直しや権限変更の理由にしない。

要するに、このPRの最小実装は良いです。ただし、「consumerへ到達できるようになった」と「#2715の元の指示で作業が進むようになった」は、まだ同じ事実として扱えません。 そこを原コメントの回帰テストで埋めるのが、品質を上げつつワークフローを最も妨げない修正です。

@squne121

Copy link
Copy Markdown
Owner Author

推奨アクションは、既存 PR #2732 をそのまま resume し、指定コメントを新しい fix-delta として Step 1 から再開です。前回 checkpoint では「まず current head を test-runner に通す」が妥当でしたが、今回はその後に OWNER の REQUEST_CHANGES が追加されているため、その再開点は更新されています。

指定コメントの P1/P2 は、Issue #2724 の現在の Allowed Paths 2ファイル内で処理可能です。P1 は #2715 原コメント由来の実再現 fixture、P2 は negative matrix の到達点・reason の固定で、どちらも #2724 の AC1/AC3 の証拠強化に該当します。したがって現時点では Issue reframe や新規 harness は不要です。ただし、実再現の結果「#2715 の入力は別の classifier/input-contract 問題で止まる」と判明し、それを直すには #2724 の契約外へ広げる必要がある場合だけ、scope を勝手に拡張せず genuine stop condition として扱うのが適切です。

現在確認できた状態は、PR #2732 が open/draft、head 9286d49f817438df9b8761d7b6a4425c56f706b8、変更ファイルは Allowed Paths と一致する2ファイル、通常 ci run 35733599539 は success です。ただしこれらは新しい fix 適用前の head なので、修正後は current-head binding で verification / CI / PR review をやり直す必要があります。参照: [対象コメント](https://github.com/squne121/loop-protocol/pull/2732#issuecomment-5805523804)、[[Issue #2724](https://github.com/squne121/loop-protocol/issues/2724)](https://github.com/squne121/loop-protocol/issues/2724)、[[#2715 原コメント](https://github.com/squne121/loop-protocol/issues/2715#issuecomment-5770013860)](https://github.com/squne121/loop-protocol/issues/2715#issuecomment-5770013860)、[`[impl-review-loop](https://github.com/squne121/loop-protocol/tree/main/.claude/skills/impl-review-loop)`](https://github.com/squne121/loop-protocol/tree/main/.claude/skills/impl-review-loop)。

以下を、既に auto mode で起動している Claude Code にそのまま渡してください。

PR #2732 を、current main の

https://github.com/squne121/loop-protocol/tree/main/.claude/skills/impl-review-loop

に従って、実装修正 → canonical verification → PR review → 必要なら fix loop まで自律実行してください。

目標は merge 直前の IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready までです。

既に Claude Code は auto mode で起動済みです。permission mode / auto mode の設定自体は変更しないでください。

今回の operator-selected review context / fix-delta source は次です。

#2732 (comment)

関連する live implementation contract は Issue #2724 です。

#2724

P1 の reproduction source は #2715 の OWNER comment 5770013860 です。

#2715 (comment)


1. 最初に live state と current skill を再取得する

古い checkpoint やこのプロンプトに記載した SHA を authority とせず、最初に fresh に確認してください。

最低限確認するもの:

recorded state は以下ですが、必ず live state で再検証してください。

PR: #2732
branch: worktree-issue-2724-freeform-human-review-directive
recorded head: 9286d49f817438df9b8761d7b6a4425c56f706b8
recorded base: 73203069a9cfc6e1d0bd84e9bdf241ca618fa6b2
state: open / draft

current skill の canonical preparation / intake / contract handling / pre-Step-1 landing disposition を省略しないでください。

live evidence が引き続き同じ PR を指す場合は、duplicate implementation / duplicate branch / duplicate PR を作らず existing_pr_resume を優先してください。


2. 今回は verification-only resume ではなく Step 1 fix-delta から開始する

以前の pause checkpoint 時点では、current candidate head の test-runner 再実行が次の作業でした。

しかし、その後に OWNER comment

#2732 (comment)

が REQUEST_CHANGES を追加しています。

したがって、古い checkpoint に従って head 9286d49f... をそのまま verification / review へ送るだけでは不十分です。

この OWNER comment を repository evidence と照合して root thread で technical_recommendation / fix_delta に正規化し、current impl-review-loop の Step 1 として implementation-worker に渡してください。

raw human comment 本文をそのまま child agent の command として連結しないでください。current step-1-implementation.md の context / fix_delta 規約に従ってください。

概念上の fix_delta は以下です。

fix_delta:
  blockers:
    - P1: #2715 comment 5770013860 由来の実入力を代表する reproduction fixture がなく、現在の positive test は成功fixtureから contract_patch_plan を人工的に削除したケースしか証明していない
    - P2: negative matrix が intended missing-plan branch への到達有無と既存 fail-closed reason を十分に固定していない
  pr_review_comment_url: https://github.com/squne121/loop-protocol/pull/2732#issuecomment-5805523804

iteration 番号その他の canonical fields は current LOOP_STATE に従って materialize してください。


3. implementation-worker に要求する P1 修正

現在の人工的 missing-plan positive regression は削除しないでください。

その上で、#2715 OWNER comment 5770013860 由来の reproduction fixture を1ケース追加してください。

重要なのは、単に既存の成功fixtureを使い planner output の contract_patch_plan だけを削除するテストをもう1本増やすことではありません。

fixture は少なくとも、原コメントの意味と構造上重要な特徴を保持してください。

特に:

この reproduction では、少なくとも次を観測・assert してください。

input
  原コメントを代表する semantic / list structure
  trusted human-context condition
  relevant investigation-derived path transport condition

planner output
  contract_patch_plan が dict / absent / non-dict のどれか
  missing/non-dict なら、その状態が実際の planner 結果として生じていること
  route / blocker / reason に関する必要な producer facts

canonical consumer entry
  missing state が generic {"operations": []} に変換されていないこと
  empty CONTRACT_PATCH_PLAN_V1 を捏造していないこと

fresh reclassification
  route.action
  reason_code
  contract_patch_plan の有無
  operations の内容
  relevant boundary flags / derived path facts

final result
  expected route identity
  writes == 0
  transaction call count == 0

「#2715 の原コメントなら必ず issue_editor_required になる」と事前に仮定して fixture を加工しないでください。

real classification を通して事実を確定してください。

その結果、#2724 の現在の狭い routing fix が正しく働き、AC1 の eligible missing-plan shape が explicit_trusted_human_directive_requires_issue_editor に到達できることが確認できるなら、その結果を regression として固定してください。

一方、原コメント由来の reproduction が、今回の missing-plan delivery gap とは別の classification / boundary / investigation-input 条件で停止し、これを直すには以下のいずれかが必要になる場合:

その問題を PR #2732 に便乗して修正しないでください。

SSOT の eligibility を無条件に緩めたり、空 plan を捏造して green にしないでください。

current Issue の Stop Conditions / canonical reconciliation route に従い、その residual を証拠付きで genuine blocker として扱ってください。


4. implementation-worker に要求する P2 修正

現在の

test_missing_planner_plan_ineligible_input_remains_fail_closed_production_reachable()

系 negative matrix は維持しつつ、false-green を減らしてください。

各代表ケースについて、単に

editorではない
status == failed
writes == 0
PLANNER_FAIL_CLOSED

だけを見るのではなく、意図した branch を実際に検証しているかを固定してください。

少なくとも:

  • planner output の sidecar / authority を観測する
  • intended missing-plan mutation が成立したかをassertする
  • canonical consumer が呼ばれるケースでは consumer entry を spy して渡された plan state を確認する
  • upstream で止まること自体が正しいケースでは consumer not reached を明示的な期待値としてassertする
  • 各ケースについて既存の expected blocker / reason identity をassertする
  • writes == 0
  • transaction call 0
  • no_change / proven_no_change ではないこと

を固定してください。

missing-plan absent だけでなく、代表1ケースは non-dict negative も確認してください。

巨大な直積 matrix、新しい framework、新しい harness は不要です。


5. #2724 の実装契約を維持する

今回の review fix で以下を壊さないでください。

  • missing planner contract_patch_plan と genuine empty-operations plan を区別する
  • missing-plan を generic {"operations": []} に変換しない
  • empty CONTRACT_PATCH_PLAN_V1 を合成しない
  • structured ANCHOR_SCOPE_REFRAME_V1 precedence を維持する
  • structured case の approved_scope_requires_full_contract_rewrite を維持する
  • non-empty contract patch plan は ordinary patch route に残す
  • eligible freeform explicit trusted human_review_directive だけを既存 canonical consumer / routing SSOT へ到達させる
  • wrong-lane / untrusted / ambiguous / invalid-binding / non-applicable inputs の fail-closed semantics を維持する
  • run_preflight() から _decide_human_review_directive_editor_route() を直接呼ぶ duplicate route を作らない
  • wire / schema / fixed artifact contract を変更しない
  • security subsystem を追加しない
  • approval layer を追加しない
  • 新規 runtime harness を追加しない

コメント 5805523804 自身も、現在の Optional[dict] 方針と canonical-consumer 経由の実装方向は維持してよいとしています。

production code を作り直すことを目的化しないでください。

P1/P2 の証拠強化だけで review blocker を解消できるなら、test-side の最小 delta を優先してください。


6. Allowed Paths

live Issue #2724 を再取得して authority としてください。

recorded Allowed Paths は以下の2ファイルです。

.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
.claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py

これ以外を変更しないでください。

Allowed Paths 外の変更が本当に不可避なら、勝手に scope を広げず current Stop Conditions に従ってください。


7. SubAgent policy

実装・verification・PR review は current impl-review-loop の責務分離に従い、必要な SubAgent を root/main thread から起動してください。

最低限の想定:

implementation-worker
  ↓ terminal completed / joined
test-runner
  ↓ terminal completed / joined
pr-reviewer
  ↓ terminal completed / joined

REQUEST_CHANGES 後は:

fix_delta
  ↓
implementation-worker
  ↓ terminal completed / joined
test-runner
  ↓ terminal completed / joined
pr-reviewer
  ↓ terminal completed / joined

を bounded max_iterations 内で繰り返してください。

重要:

  • nested SubAgent delegation を許可しない
  • child agent に nested Agent 起動をさせない
  • root thread が orchestration を保持する
  • 各 SubAgent に actual Issue / PR / current head / Allowed Paths を具体値で bind する
  • stale head を bind しない
  • hand-back text を受け取っただけで completed とみなさない
  • task status が terminal になるまで必ず待つ
  • terminal status を確認して join する
  • running / partial / async_launched / API error の出力を canonical result に昇格しない
  • 全 SubAgent が terminal になったことを final report で列挙する

サブエージェントを起動したら、必ずそのサブエージェントの作業完了を待ってください。

並行実行してよい処理でも、consumer phase へ進む前に required producer SubAgent の canonical terminal completion / join を確認してください。


8. implementation-worker 完了後は canonical test-runner を実行する

implementation-worker が commit / push して PR head が変わったら、古い worker test result、古い CI、head 9286d49f... の evidence を current-head verification として再利用しないでください。

current PR head を fresh に取得し、それに bind した test-runner SubAgent を起動してください。

Issue #2724 の live Verification Commands を literal authority としてください。

recorded commands は:

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

uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py -q -k "explicit_human_review_directive_reaches_next_action_production_reachable"

です。

current Issue に drift があれば live commands を優先してください。

AC5 の runtime verification policy:

  • existing apparatus を使う
  • focused real run_preflight() を通す
  • worktree-local evidence を保存する
  • exit 77 のみ policy-defined SKIP
  • prerequisite unavailable だが exit 77 でないものを PASS にしない
  • fallback PASS を捏造しない

を維持してください。


9. API 503 / infrastructure failure の扱い

過去 run では test-runner SubAgent が API HTTP 503 で terminal failed となった履歴があります。

これは Python test failure や implementation defect と同一視しないでください。

再発した場合は current skill が定める bounded retry / canonical recovery route を使ってください。

ただし:

  • 無制限 retry 禁止
  • main-thread で同じ test を通したことを SubAgent completion に偽装しない
  • stale SubAgent result を採用しない
  • fabricated TEST_RESULT を作らない
  • API error task を completed とみなさない

bounded recovery 後も canonical completion が得られない場合のみ、repository/environment integrity failure として current skill の terminal route に従ってください。


10. verification 完了後に fresh PR review を行う

current-head verification が canonical に non-blocking になった後、current impl-review-loop の Step 4 に従い pr-reviewer を起動してください。

pr-reviewer は:

に bind してください。

terminal completion まで待って join してください。

reviewed head が current PR head と違う場合、その review を current verdict として使わず stale-head rereview route に従ってください。


11. REQUEST_CHANGES は中間承認を求めず loop する

final pr-reviewer が REQUEST_CHANGES を返し、actual Git conflict や genuine stop condition がない場合、人間へ「修正してよいですか」と確認しないでください。

current route_loop_verdict_v2() の continue_loop に従い、

review blockers
→ normalized fix_delta
→ implementation-worker
→ wait/join
→ current-head test-runner
→ wait/join
→ current-head pr-reviewer
→ wait/join

を自律継続してください。

通常の:

  • test failure
  • review REQUEST_CHANGES
  • stale review head
  • branch BEHIND
  • advisory contract snapshot drift
  • non-required preview failure

だけを理由に早期 human escalation しないでください。

current skill の canonical remediation route が存在する限り、それを使用してください。


12. branch / CI / mergeability

各 push 後に live state を再取得してください。

  • current PR head
  • base SHA
  • changed files
  • required CI
  • mergeability
  • merge_state_status

を確認してください。

BEHIND の場合は current skill の route_to_update_branch / canonical update workflow に従い、その後 verification と PR review を current head でやり直してください。

actual Git conflict は current conflicting-PR runbook に従ってください。

過去 head 9286d49f... では少なくとも通常 ci run 35733599539 は success でしたが、これは新しい commit の evidence ではありません。

必ず final head の required checks を評価してください。


13. PR metadata

必要であれば PR #2732 の description を current implementation / verification evidence に合わせて更新して構いません。

ただし:

でください。

対象 comment の blocker を実装・evidence で解消してください。


14. 人間承認なしで進めてよい範囲

current skill / live Issue contract が許す限り、以下は中間承認なしで進めてください。

existing PR / worktree resume
Allowed Paths 内のコード修正
fixture / regression test 追加
review fix
commit
push
PR description update
Verification Commands
runtime verification
CI wait / readback
bounded infrastructure retry
branch update
PR review
review REQUEST_CHANGES の fix loop
stale-head rereview
mergeability recheck

permission mode / auto mode 自体は変更しないでください。


15. genuine terminal condition

停止は current skill / live Issue の genuine terminal condition に限定してください。

特に今回重要なのは、#2715-derived reproduction により別問題が見つかったケースです。

例えば:

#2724 の AC1 を成立させるには classifier semantics の変更が必要
Allowed Paths 外の変更が必要
#2715 のコード変更が必要
wire/schema/fixed artifact contract の変更が必要
new Issue / scope split が不可避
generic empty plan synthesis なしでは進めない
SSOT eligibility の意味変更が必要
new harness が必要
secret / credential が必要
permission escalation が必要
actual Git conflict が canonical に解消不能
bounded infrastructure recovery が尽きた
max_iterations 到達
live human comment に明示的な停止命令がある

この場合は scope を勝手に拡張しないでください。

特に P1 reproduction のために production contract を歪めて green にしてはいけません。

必要な evidence、どの条件で止まったか、現在の narrow PR が何を証明できて何を証明できないかを構造化して報告してください。


16. merge 境界

今回の目標は merge 直前までです。

以下は実行しないでください。

PR merge
auto-merge enable
Issue #2724 close
Issue #2715 close/update
merge後 cleanup
destructive / irreversible operation

current skill の approved condition:

  • current-head verification non-blocking
  • final pr-reviewer verdict APPROVE
  • blockers empty
  • Allowed Paths gate non-blocking
  • required CI non-blocking
  • live mergeability が approved condition を満たす

まで進めてください。

到達したら:

IMPL_REVIEW_LOOP_RESULT_V1:
  status: draft_pr_ready

を目標に終了してください。


17. final report

最低限、次を報告してください。

current main SHA
Issue #2724 live body SHA / contract identity
pre-Step-1 landing disposition
existing PR resume / その他 disposition
initial PR head
final PR head
base SHA
worktree
branch
changed files
Allowed Paths gate result

comment 5805523804 の P1:
  #2715-derived reproduction をどう構築したか
  planner contract_patch_plan actual shape
  missing/non-dict の発生点
  consumer entry plan state
  fresh reclassification route/action
  reason_code
  operations
  final route
  writes
  transaction calls

comment 5805523804 の P2:
  negative cases の reachability
  consumer reached / not reached
  expected reason/blocker
  non-dict negative coverage

Verification Commands 各結果
runtime verification classification
worktree-local evidence
final-head CI
reviewed_head_sha
review iterations
final pr-reviewer verdict
blockers
warnings
live mergeability
termination_reason

起動した全 SubAgent:
  task name
  agent type
  role
  bound head SHA
  terminal status
  joined: true/false

全 SubAgent が terminal / join 済みであること

IMPL_REVIEW_LOOP_RESULT_V1.status

merge: not executed
auto-merge: not enabled
Issue close: not executed

最優先は、既存実装を全面的に作り直すことではありません。

OWNER review comment 5805523804 の P1/P2 を最小 delta で実証的に閉じ、current head を canonical verification と fresh PR review に通し、REQUEST_CHANGES が残る限り bounded fix loop を承認なしで継続して、merge 直前まで到達することを目的にしてください。

このプロンプトでは、以前の「まず test-runner を再実行」という checkpoint よりも、今回追加された REQUEST_CHANGES を優先して Step 1 に戻すよう明示しています。ここが今回の再開方針で最も重要な差分です。

…gative matrix reachability

P1: add _HRD_2715_ORIGIN_BODY, a verbatim reproduction of #2715's origin
comment structure (Allowed Paths heading + exact path bullets), driven
through the real run_preflight() -> consume_trusted_anchor_contract_patch_plan()
-> _decide_human_review_directive_editor_route() call chain with
_force_hrd_planner_patch_plan_missing(). Observed (not assumed) outcome:
this body's own "Allowed Paths:" heading trips the expands_allowed_paths
boundary, so it stays fail-closed at human_escalation instead of reaching
issue_editor_required -- pinned as its own regression, independently
confirmed via a direct classify_scope_delta_authority() spy.

P2: extend the negative eligibility matrix
(test_missing_planner_plan_ineligible_input_remains_fail_closed_production_reachable)
to assert, per case, whether scope_signal_delta.classify_scope_delta_authority()
was reached at all and its exact route.reason_code (ai_inferred_scope_delta /
untrusted_author_association / ambiguous_human_directive / never reached for
the binding-mismatched structured case), plus a representative non-dict
planner-plan variant.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121

Copy link
Copy Markdown
Owner Author

impl-review-loop LOOP_VERDICT: APPROVE

前回 REQUEST_CHANGES (issuecomment-5805523804) の P1/P2 を fix_delta commit aba17f27 で解消。

Mergeability

  • reviewed head: aba17f2750bb8a1ca985d82de9b129d011e7386a
  • base: 73203069a9cfc6e1d0bd84e9bdf241ca618fa6b2
  • mergeable: MERGEABLE / merge_state_status: CLEAN
  • required CI: 全件 pass(python-test-core / lint / build / typecheck / test / validate-generated-artifact 他)

Evidence Check

  • P1: 実装: --enable-full-analysis のhelpテキストを--publish-authorized必須の実際の起動条件に合わせて修正する #2715 origin comment (issuecomment-5770013860) の「推奨する最小 reframe」セクション(Allowed Paths 見出し+パス箇条書き構造)を逐語的に再現した _HRD_2715_ORIGIN_BODY を用いた新規テストを追加。実際の run_preflight() → consume_trusted_anchor_contract_patch_plan() → _decide_human_review_directive_editor_route() の実チェーンを通し、classify_scope_delta_authority() の実呼び出しを observe。結果は route.reason_code == "expands_allowed_paths" により human_escalation となり next_action == "human_judgment_required"(PLANNER_FAIL_CLOSED, writes=0, apply_transaction呼び出し0回)に到達することを regression として固定。「原コメントは必ず空 operations の editor handoff になるという前提自体を確認する必要がある」という OWNER 指摘に対し、結果を事前仮定せず実際に検証し、成立しないことを証拠付きで確認。production code (run_refinement_preflight.py) の変更は 0 行(diff なし)で、classifier eligibility の緩和は一切行っていない。
  • P2: test_missing_planner_plan_ineligible_input_remains_fail_closed_production_reachable に classifier 呼び出し spy を追加し、各 ineligible ケースについて到達有無と reason_code identity を明示的に固定(wrong_lane→ai_inferred_scope_delta、untrusted→untrusted_author_association、ambiguous→ambiguous_human_directive、invalid_binding→未到達)。non-dict negative ケース untrusted_non_dict_plan を1件追加。
  • AC1 の core 要求(既存 _HRD_EXPLICIT_BODY fixture が issue_editor_required に到達)は不変のまま維持(全58テスト pass)。
  • Allowed Paths gate: status: ok(変更ファイルは記載の2ファイルのみ、production code diff は 0 行)。

Blockers

なし

Warnings

LOOP_VERDICT:
  verdict: APPROVE
  reviewed_head_sha: "aba17f2750bb8a1ca985d82de9b129d011e7386a"
  blockers: []
  warnings:
    - "新規#2715-originフィクスチャはexpands_allowed_paths境界でhuman_escalationし、issue_editor_requiredには到達しない旨をregressionとして固定しただけ。#2715自体の残存分類・入力条件問題は#2724スコープ外のまま(#2715はOPEN、#2724のhard predecessor)。"
    - "Schema Consumer Inventory / Safety Claim Matrixは前回承認済みhead(9286d49f)から内容変更なし(production code diffゼロのため)。"

@squne121
squne121 marked this pull request as ready for review September 24, 2026 01:42
@squne121
squne121 merged commit 3c176ec into main Sep 24, 2026
46 checks passed
@squne121
squne121 deleted the worktree-issue-2724-freeform-human-review-directive branch September 24, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant