Skip to content

実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "guard-issue-body.py の template_guard を false-positive にする fence 誤ペアリング不具合を修正する"
change_kind: code

Parent Issue

none

Parent Goal Ref

  • Goal: guard-issue-body.py の _strip_fenced_code_blocks() が Issue 本文の実 Markdown fence 境界を正しく識別し、template_guard 等のガードが false-positive を出さない状態にする
  • Desired Destination: なし(単独改善)

Current Validated Scope

  • .claude/skills/edit-issue/scripts/guard-issue-body.py の _FENCED_CODE_BLOCK_RE を削除し、_strip_fenced_code_blocks() は既存 .claude/skills/create-issue/scripts/prose_boundary_policy.py::iter_markdown_blocks() の BLOCK_KIND_CODE_FENCE だけを除外する薄い consumer に変更する(既存 sibling-skill import pattern を使用)。共有 parser は変更しない。
  • .claude/skills/edit-issue/tests/test_guard_issue_body.py に guard_template() consumer 経由の回帰テストを追加する。Allowed Paths はこの2ファイルに固定する。

Remaining Parent Gaps

なし

Outcome

guard_template() が共有 Markdown block parser に委譲して code fence 内の見出しのみを除外し、prose 内の不揃いな backtick 列と後続の実 VC fence を誤ペアリングせず、実在する必須見出しを検出できる状態。独自 fence regex/scanner を残さず、既存テストと追加の consumer-level 回帰テストが PASS する。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 静的なテキスト処理ロジック(正規表現/文字列解析)の修正であり、pytest による静的検証のみで完結するため

Background

Issue #2788 の本文編集時、guard-issue-body.py の _strip_fenced_code_blocks() の独自 _FENCED_CODE_BLOCK_RE(現在の HEAD でも非行指向の non-greedy regex と .sub('', text) が残る)が prose の backtick 列と後続の実 VC bash fence を誤ペアリングし、template_guard.missing_sections が実在する見出しを false-positive で列挙して transaction を妨げた。

元の #2794 Background は #2788 に「バックティック3文字 + bash + バックティック1文字」という不揃いな表現があったと記録している。ただし #2788 の当時の raw 行の原本は現時点で取得・検証できていない(現行 #2788 本文は修正済みで、取得できた timeline API / 保存本文にも旧 raw 行はない)。テストでは #2794 の既存記録に基づく形を literal fixture にし、当時の実 raw bytes と同一だったと断定しない。原本が取得できた場合だけ比較して差異を評価する。

fence 境界の既存 SSOT は .claude/skills/create-issue/scripts/prose_boundary_policy.py::iter_markdown_blocks()(#659 / PR #669)。GFM の opener/closer は先頭 0–3 spaces、同種かつ適切な長さの delimiter、backtick opener の info string に backtick を含めない等を既に処理する。別 consumer の委譲 precedent は PR #1717。anchor-comment 専用 scanner の 0–8 spaces / blockquote 処理は本 guard の Markdown 見出し検出に転用しない。共有 parser の golden grammar corpus は既存 test_prose_boundary_policy.py が担う。

In Scope

  • _FENCED_CODE_BLOCK_RE を削除し、_strip_fenced_code_blocks() を prose_boundary_policy.iter_markdown_blocks() が返す block のうち BLOCK_KIND_CODE_FENCE のみ除外して非 fence block を連結する薄い adapter にする。import wiring は repo の既存 sibling-skill pattern に合わせる。guard_template() の見出し判定自体は維持する。
  • guard_template() に対し、孤立 backtick の行頭/inline・空白位置・info string 内 backtick、後続の正しい bash fence と見出し、4-backtick 中の3-backtick、tilde fence、4-space indented non-fence、EOF 未閉 fence、正常 fenced heading の除外と後続実見出しの保持を代表ケースとしてテストする。共有 parser の全 golden corpus はコピーしない。
  • guard test で共有 parser への委譲と独自 regex 撤去も固定する。

Out of Scope

Acceptance Criteria

  • AC1: 既存 実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 Background の記録(U+0060 3文字 + bash + U+0060 1文字の不揃い表現)に基づく literal fixture をテストファイル内に生 Markdown として固定する。行頭と inline、先頭の空白数、info string 内の末尾 backtick の位置を fixture 文字列そのものと assertion で検証し、直後に置いた正しい VC bash fence と実在する ## Outcome / ## In Scope 等の見出しを guard_template() が missing と誤判定しない。実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 の旧 raw 行が取得できた場合だけ原本との一致/差異を検証し、未取得のまま歴史的 bytes の一致を主張しない。
  • AC2: guard_template() 経由の代表ケースで、4-backtick fence 中の3-backtick、tilde fence、4-space-indented non-fence、EOF 未閉 fence、正常な fence 内の偽見出しを除外し、その後にある実見出しは維持する。行頭 0–3 spaces と 4 spaces の差、backtick opener の info string 内 backtick 禁止、closer の種類/長さは共有 parser の意味論を継承し、独自 0–8 spaces scanner を導入しない。
  • AC3: _FENCED_CODE_BLOCK_RE の定義/使用が削除され、_strip_fenced_code_blocks() が _pbp.iter_markdown_blocks() の BLOCK_KIND_CODE_FENCE だけを除外する薄い consumer であることを新規 guard test assertion で確認する。既存 guard test 全件と共有 parser の focused fence tests が PASS する(共有 parser の golden corpus は複製しない)。

Verification Commands

# AC1
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_orphan_backtick_shared_parser_adapter -q
# AC2
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_shared_parser_fence_boundary_cases -q
# AC3
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_shared_parser_delegation_without_regex -q
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py -q
$ uv run --locked pytest .claude/skills/create-issue/scripts/tests/test_prose_boundary_policy.py -k fence -q

Allowed Paths

  • .claude/skills/edit-issue/scripts/guard-issue-body.py
  • .claude/skills/edit-issue/tests/test_guard_issue_body.py

Stop Conditions

Required Skills

なし

Required Design References

  • docs/dev/workflow.md
  • .claude/skills/create-issue/scripts/prose_boundary_policy.py(既存 Markdown block SSOT、閲覧のみ)
  • .claude/skills/create-issue/scripts/tests/test_prose_boundary_policy.py(既存 grammar tests、閲覧/実行のみ)

Delivery Rule

  • 1 Issue = 1 PR とする
  • 作業は専用 worktree で行う
  • Draft PR を既定とする

Notes for Reviewer

Activity

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

    @squne121
    OwnerAuthor

    敵対的レビュー結果

    現状の #2794 は、目的自体は妥当ですが、実装契約を修正してから着手すべきです。 最大の問題は、既に repository 内に fence segmentation の SSOT が存在するのに、Issue が別の line-oriented scanner を新設する方向へ実装者を誘導していることです。

    確認時点の main では、対象コードはまだ re.compile(r'```.*?```', re.DOTALL) のままで、報告された failure class は残っています。[guard-issue-body.py on main](https://github.com/squne121/loop-protocol/blob/main/.claude/skills/edit-issue/scripts/guard-issue-body.py?utm_source=chatgpt.com)

    1. P1 / Blocker — 新しい fence scanner を作る契約が、既存 SSOT と衝突しています。
      実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 は _strip_fenced_code_blocks() を独自の line-oriented scanner に置き換え、_anchor_scope_reframe_fence_present() を参考実装にするよう指定しています。ところが repository には既に .claude/skills/create-issue/scripts/prose_boundary_policy.py::iter_markdown_blocks() があり、これはまさに「独自 non-greedy fence regex による parser drift をなくす」ために 実装: split_markdown_blocks の GFM 準拠セグメンテーションを prose_boundary_policy SSOT へ委譲 #659 / PR feat(#659): prose_boundary_policy に GFM 準拠 iter_markdown_blocks SSOT を追加し split_markdown_blocks を委譲 #669 で導入された共有 authority です。[Issue #659](https://github.com/squne121/loop-protocol/issues/659?utm_source=chatgpt.com) [PR #669](https://github.com/squne121/loop-protocol/pull/669?utm_source=chatgpt.com)
      さらに PR fix: validate_issue_body.py の LP010 が AC/VC 番号不一致を検出できない偽陰性を修正する #1717 でも、別 consumer が独自 fence scanner を持ったことに対するレビュー finding として、prose_boundary_policy.iter_markdown_blocks() への委譲が要求され、最終的にその形で着地しています。[PR #1717](https://github.com/squne121/loop-protocol/pull/1717?utm_source=chatgpt.com)
      影響: 実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 を現契約のまま実装すると、今回の1ケースは直っても、同じ Markdown semantics を2箇所で再実装することになり、将来また opener/closer、tilde、長さ、indent の drift が発生します。
      最小修正: _FENCED_CODE_BLOCK_RE は置換ではなく削除し、_strip_fenced_code_blocks() を iter_markdown_blocks() の薄い consumer にしてください。Allowed Paths は現在の2ファイルのままで実現できます。prose_boundary_policy.py 自体を変更する必要はありません。

    2. P1 — Issue に記載された「0–8 space indent」は GFM の fence semantics ではありません。
      実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 が参考にしている anchor-comment 用 scanner は、reference 上「0–8 spaces」「nested blockquote」などを扱う用途固有の scanner です。一方、GitHub Flavored Markdown の fenced code block は opener/closer とも 最大3 spaces の indent が許容され、4 spaces 以上は通常の fenced opener として扱われません。また backtick opener の info string に backtick 自体を含めることは禁止されています。:chatgpt-content-reference{index="4"}
      今回問題になった「 ```bash にさらに孤立 backtick が付く」形では、この info string 内 backtick 禁止 が重要です。既存 prose_boundary_policy はこの条件も既に実装しています。
      影響: 0–8 space をそのまま持ち込むと、4-space indented code 中の backtick 列を fence として誤認し、新しい template_guard false-positive を作れます。
      最小修正: anchor scanner のコピーをやめ、GFM semantics は共有 parser から継承する、と契約を固定してください。blockquote 専用の複雑さも不要です。guard_template() が探すのは column-0 相当の ## 見出しなので、通常の > ## Outcome はそもそも実見出しとしてマッチしません。

    3. P1 — AC1〜AC3 は happy-path が狭すぎ、間違った独自実装でも green になれます。
      現 AC1 は「孤立 backtick + 後続 bash fence」、AC2 は「正常 fence を引き続き除去」、AC3 はテスト存在、という構成です。これでは r'^\s*```' のような単純 toggle scanner でも通過できます。実装: split_markdown_blocks の GFM 準拠セグメンテーションを prose_boundary_policy SSOT へ委譲 #659 では既に 4-backtick 内の 3-backtick、tilde/backtick mismatch、short closer、unclosed fence、3-space/4-space indent、closer の trailing text 等が failure matrix として固定されています。
      実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 側でその全 golden corpus をコピーする必要はありません。むしろ SSOT へ委譲したことを直接固定する adapter-level regression にするべきです。最低限、実際の 実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 由来 orphan fixture、4-backtick 内 3-backtick、tilde fence、4-space-indented non-fence、unclosed fence を guard_template() 経由で確認すれば十分です。共有 parser 自体の grammar は既存テストへ任せる方が重複がありません。

    4. P2 — 再現 fixture が「似た文字列」ではなく、実 failure の raw layout を固定していません。
      実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 の AC1 は「3連backtickの直後にbash・直後にbacktick1文字」のように自然言語で説明していますが、Markdown では 行頭か inline か、何 spaces indent か、info string に backtick が入るか で意味が変わります。
      影響: 実際の 実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 とは異なる fixture を作ってテストだけ green にする false-green が可能です。
      最小修正: regression test に 実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 で実際に guard を壊した raw line sequence を literal fixture として固定し、その直後に本物の VC fenceと ## Outcome 等を配置してください。fixture の意図をコメントだけで説明するのではなく、生の Markdown 構造を assertion 対象にします。

    5. P2 — Stop Condition が、人間判断を不必要に増やします。
      現在は「_anchor_scope_reframe_fence_present() と完全に同一実装になる場合、共通化すべきか判断を仰ぐ」とあります。しかし current repository では共通 authority が既に prose_boundary_policy として存在します。ここは実装中に人間へ戻す問題ではありません。
      最小修正: 「独自 fence parser を追加しない。既存 prose_boundary_policy.iter_markdown_blocks() を使用する」に事前決定してください。共有 SSOT に不足が実証された場合だけ、その時点で scope extension / follow-up を検討すれば足ります。個人開発のワークフローとしてもこちらの方が停止が少なく、保守コストも低いです。

    推奨する契約修正

    Current Validated Scope / In Scope の中心は、概ね次の形に変更するのが適切です。

    - guard-issue-body.py::_strip_fenced_code_blocks() から
      独自 `_FENCED_CODE_BLOCK_RE` を撤去する。
    - fence boundary の authority は既存
      create-issue/scripts/prose_boundary_policy.py::iter_markdown_blocks()
      とし、BLOCK_KIND_CODE_FENCE の block のみ除外する薄い adapter にする。
    - 新しい fence regex / toggle / line-oriented parser は追加しない。
    - #2788 由来の実 orphan-backtick fixture を guard_template() 経由で固定する。
    - shared parser 自体の GFM grammar を複製テストせず、
      guard_template consumer として重要な代表 edge case の parity のみ固定する。
    

    実装イメージもこの程度で足ります。

    def _strip_fenced_code_blocks(text: str) -> str:
        return "".join(
            block_text
            for block_text, block_kind in _pbp.iter_markdown_blocks(text)
            if block_kind != _pbp.BLOCK_KIND_CODE_FENCE
        )

    実際の import wiring は既存 repository の sibling-skill import patternに合わせるべきで、新ライブラリ、新 wrapper、新 security gate は不要です。

    Verification Commands の改善

    現在の target test 2本に加えて、共有 semantics の既存 regression を focused に1本通す程度が妥当です。たとえば test_guard_issue_body.py の全件に加え、test_prose_boundary_policy.py -k fence を実行し、さらに rg で _FENCED_CODE_BLOCK_RE が消え、iter_markdown_blocks を consume していることを確認する構成です。repo-wide test を #2794 の固有 VC として毎回要求する必要はありません。

    関連 Issue の整理では、#2784 はまさに parser drift の横断 inventory ですが research-only かつ blocker ではないため、#2794 を待たせる必要はありません。[Issue #2784](https://github.com/squne121/loop-protocol/issues/2784?utm_source=chatgpt.com) #1719 は同じ guard-issue-body.py を触るものの AC/VC alignment の別 concern なので、実装開始時に live PR/HEAD の衝突だけ確認すれば十分です。#2796 は #2794 を既知の別 Issue として明示的に scope out しており、本不具合を解消していません。[PR #2796](https://github.com/squne121/loop-protocol/pull/2796?utm_source=chatgpt.com)

    結論: #2794 は「regex → 独自 line scanner」ではなく、**「残存している独自 fence regex consumer を既存 prose_boundary_policy SSOT へ収束させる Issue」**として精緻化するのが最小かつ再発しにくい修正です。現状のまま実装すると、#659 と PR #1717 で既に排除した parser duplication を再導入します。

  3. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    確認した限り、推奨ルートは #2794 を実装へ進めず、OWNER の対象コメントを trusted human context として issue-refinement-loop で契約修正する ことです。current main は確認時点で 8fac56af67e9f8da89092e880b5c9a1ab3c8d2f6、#2794 は open のままで、対象の独自 fence 処理も残っています。

    対象コメントの技術指摘も妥当です。GFM の fenced code block は opener/closer とも最大3 spacesのindentで、backtick fence の info string には backtick を含められません。したがって Issue 本文の「0–8 spaces の独自scannerを参考にする」方向より、repository既存の prose_boundary_policy.iter_markdown_blocks() に収束させる方が整合します。:chatgpt-content-reference{index="0"}

    current issue-refinement-loop では iterationごとの承認は既定で不要です。一方、Step 2 は現在 issue-reviewer SubAgentではなく root-owned run_root_review_pipeline.py が正規経路です。SubAgent は Step 1 の codebase-investigator、必要時の web-researcher、rewrite時の issue-editor を使わせ、各結果を待ってから後続へ進ませるのが現在の契約に合います。

    そのまま、既に auto mode で起動している Claude-GPT / Native Claude Code のどちらにも貼れる共通プロンプトです。

    repo: squne121/loop-protocol

    対象:

    • Issue: #2794
    • trusted human context / anchor comment:
      https://github.com/squne121/loop-protocol/issues/2794#issuecomment-5859799739
    • 実行する canonical Skill:
      .claude/skills/issue-refinement-loop/SKILL.md

    この既存の対話セッションをそのまま継続し、Issue #2794 に対して current repository の issue-refinement-loop を最後まで実行してください。

    このセッションは既に auto mode で起動済みです。iteration ごとの人間承認は求めず、repository の loop policy が許す範囲で自律継続してください。

    Claude-GPT セッションの場合は repository-owned Claude-GPT launcher/profile/backend mapping をそのまま維持してください。再起動、別frameworkへの切替、model alias の固定推測、permission mode の変更は不要です。Native Claude Code の場合も同じ Claude Code harness 契約に従ってください。

    最初に必ず fresh state を取得する

    過去の会話・過去のSHA・古いSkill仕様を正本にしないでください。

    開始時に current state を fresh 取得し、少なくとも以下を確認してください。

    prompt作成時点では main=8fac56af67e9f8da89092e880b5c9a1ab3c8d2f6 だったが、これを固定値として使わず実行開始時の fresh main を authority にしてください。

    anchor comment の扱い

    対象コメントは Issue OWNER による明示的な adversarial review / contract correction directive です。

    したがって、URLだけの unlabeled anchor や agent-report lane として扱わず、current Skill の canonical direct human context lane を使用してください。

    current contract が変わっていなければ、canonical root/main control-plane から:

    preflight.run.with_human_context

    を用い、対象 anchor URL と Issue #2794 を binding してください。

    run_refinement_preflight.py を production entrypoint として直接叩いたり、独自にplanner判定を再実装したりしないでください。command registry / canonical executor を authority にしてください。

    preflight が trusted contract patch / contract update を要求した場合は current Skill の Step 0g に従い、

    contract_update.run.with_human_context

    を main/root control-plane から実行してください。

    NEXT_ACTION: issue_editor_required が返った場合は同じ contract-update を無意味に再試行せず、current Skill の canonical Step 4 rewrite routeへ進めてください。

    今回の refinement で解消すべき中心 finding

    anchor comment の指示を単なる参考情報ではなく、trusted human context として current repository evidence と照合してください。

    特に次を精緻化対象とします。

    1. 実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 の現在の「独自 line-oriented fence scanner を新設する」という方向を再検討する。

    2. current repository に既存の fence segmentation authority
      .claude/skills/create-issue/scripts/prose_boundary_policy.py::iter_markdown_blocks()
      が存在し、current main でも有効なSSOTであることを確認する。

    3. repository evidence が anchor comment を支持する場合、Issue契約を概ね次へ収束させる。

      • guard-issue-body.py::_strip_fenced_code_blocks() の独自 _FENCED_CODE_BLOCK_RE を撤去する。
      • 新しい独自 regex / toggle scanner / line-oriented Markdown parser を追加しない。
      • fence boundary semantics は既存 prose_boundary_policy.iter_markdown_blocks() に委譲する。
      • _strip_fenced_code_blocks() は BLOCK_KIND_CODE_FENCE を除外する薄い consumer / adapter とする。
      • prose_boundary_policy.py 自体は、current evidenceで不足が実証されない限り変更対象へ広げない。
      • sibling-skill import wiring は repository内の既存canonical patternに従う。
      • 新ライブラリ、新wrapper、新schema、新security gate、新approval layerを追加しない。
    4. Issue本文にある anchor-comment専用 scanner の「0–8 spaces」等のsemanticsを、GFM fence grammarとしてコピーしない。
      external semantics が refinement decision に materially 必要なら、後述する web-researcher で GitHub Flavored Markdown / CommonMark の一次仕様を検証する。

    5. Acceptance Criteria / Verification Commands を false-green しにくい形へ修正する。
      最低限検討するもの:

      ただし shared parser 自体の golden corpus を 実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 側へ大量コピーしないでください。
      shared parser のgrammarは既存テストをauthorityとし、#2794では consumer/adapter-level parity を中心に固定してください。

    6. Verification Commands には current pathsを確認した上で、少なくとも以下の意図を反映してください。

      • test_guard_issue_body.py の新regressionをfocused実行
      • test_guard_issue_body.py 全件
      • shared test_prose_boundary_policy.py の fence 関連focused regression
      • _FENCED_CODE_BLOCK_RE の撤去確認
      • iter_markdown_blocks を consumer が利用することの確認
    7. 現Issueにある
      「anchor scanner と同一実装になる場合は共通化すべきか人間判断」
      のような不要な停止条件は、既存SSOTへの委譲が repository evidence で確定するなら除去・置換してください。
      独自 parser を追加しないことを契約上事前決定し、通常の実装時に不要なhuman stopを発生させない形を優先してください。

    関連stateの確認

    少なくとも以下を fresh 確認し、scope collision / dependencyを current事実から評価してください。

    既存の follow-up / dedupe がある場合、新しい重複Issueを作らないでください。

    SubAgent の使用

    Step 1: codebase-investigator

    current Skill が Step 1 investigation を要求する場合、custom SubAgent codebase-investigator を使用してください。

    dispatch時には親会話の暗黙contextに依存させず、少なくとも以下を明示してください。

    SubAgent をdispatchしただけで完了扱いしないでください。必ず最終resultが返るまで待ち、そのresultを取得・検証してから downstream Stepへ進んでください。

    Step 1b: web-researcher

    planner / current Skill が critical external claim の検証を要求する場合だけ web-researcher を起動してください。

    今回の候補claimは主に:

    • GFM fenced code block opener/closer のindent規則
    • backtick fence の info string 制約
    • opener/closer character/length semantics
    • unclosed fence semantics

    GitHub Flavored Markdown / CommonMark の一次資料を優先してください。

    repository evidenceだけで disposition が確定でき、external claim が dispositive でない場合は、不必要なweb researchをhard blockerにしないでください。

    起動した場合は、web-researcher の最終resultを待ち、citation/source contentを確認してから downstreamへ進んでください。

    Step 2: Review

    current issue-refinement-loop の canonical Step 2 に従ってください。

    現行contractが維持されている限り、issue-reviewer SubAgentを起動しないでください。
    Step 2 は root-owned run_root_review_pipeline.py produce の結果を直接consumeする経路です。

    legacy issue-reviewer SubAgent / legacy relay を canonical routing に持ち込まないでください。

    Step 4: Rewrite

    review / contract-update routing が rewrite を要求した場合は current issue-editor SubAgent を使ってください。

    • reviewer feedback として canonical anchor URLを使うべきrouteではURLをそのまま渡す
    • raw snapshotを不用意に再包装しない
    • edit-issue の controlled transaction routeを使用する
    • raw gh issue edit でcanonical transactionを迂回しない
    • issue-editor はnested Agentを持たないため、必要な別SubAgent処理はroot/main threadが順序制御する

    issue-editor をdispatchした後も必ずterminal resultを待ち、readbackを取得してから fresh reviewへ進んでください。

    自律継続

    current Skill の既定 max_iterations / routing authorityに従ってください。特段の理由がなければcurrent defaultを使用してください。

    以下は人間承認を挟まず自動継続してください。

    • needs-fix → 上限内の rewrite iteration
    • deterministic safe repair
    • deterministic structural repair
    • trusted human context に基づく canonical contract update
    • issue_editor_required → canonical issue-editor rewrite
    • rewrite後の body/title readback
    • fresh preflight
    • fresh Step 2 review
    • fresh readiness
    • 通常の一時的/修正可能なchecker failure

    人間承認不要という指示を Claude Code の permission bypass と混同しないでください。

    以下を要求・変更しないでください。

    • bypassPermissions
    • --dangerously-skip-permissions
    • permission modeの緩和
    • hooksを使った承認迂回

    不要な停止を避ける

    以下だけを理由に停止しないでください。

    • triage-required 等のpresentation labelだけ
    • 同じfileを触るrelated Issueが存在するだけ
    • deterministicに解消できるcontract problem
    • 通常のreview needs-fix
    • 修正後に再実行可能なchecker/test failure
    • repository内に既にauthorityが存在し、機械的に解決可能な parser design choice

    canonical planner / reviewer / deterministic checker の判断を自然言語で上書きしないでください。

    一方、current repository authority が最終的に human_judgment_required と判定する非決定的なscope conflict、evidence integrity failure、irreconcilable contract conflict、loop上限到達などは、その正規termination routeに従ってください。

    この invocation の到達点

    今回は Issue refinement のみ が依頼されています。

    したがって refinement が approved になっても、この invocation から以下を開始しないでください。

    • production code実装
    • implementation worktreeでの実装開始
    • impl-review-loop
    • commit / push
    • implementation PR作成
    • merge / auto-merge

    current Skill が LOOP_HANDOFF_RESULT_V1 / termination report を要求する場合は正規手順で出力・投稿し、そこで終了してください。

    approved を implementation authorization とみなさないでください。

    follow-up

    refinement中に新しい独立した recurrent defect が見つかった場合は、まず current open/closed Issues を dedupeしてください。

    既に #2784 / #1719 等が同じ問題を十分coverしているなら新規Issueを作らないでください。

    current issue-refinement-loop の follow-up materialization authority が新規Issueを要求する場合のみ、そのcanonical routeに従ってください。タイトル類似だけで重複判定しないでください。

    停止境界

    通常のrefinement作業では人間承認を求めないでください。

    ただし以下は停止/escalation可能です。

    • destructive operation
    • secret / credential の取得・変更・公開
    • force push / history rewrite
    • repository contract が明示する human_judgment_required
    • irreconcilable scope conflict
    • authority外変更が不可避
    • policy / permission bypass が必要
    • evidence integrityを維持できない
    • canonical loop上限到達

    他Issueのdirty worktree、foreign branch、別taskの未commit変更を勝手に変更・削除しないでください。

    最終報告

    terminal state に到達したら、簡潔に次を報告してください。

    1. 実行開始時の fresh main SHA
    2. 実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 / anchor comment の binding と authority classification
    3. 使用した current Skill / relevant references
    4. 起動した SubAgent 一覧
      • 各SubAgentについて dispatch済みではなく completion result取得済み であること
    5. Issue本文に実際に反映した主要なcontract変更
    6. _FENCED_CODE_BLOCK_RE → 独自scanner ではなく shared prose_boundary_policy SSOT へ収束したか
    7. AC / VC / Allowed Paths / Stop Conditions / verification の変更概要
    8. fresh final review / readiness 結果
    9. termination reason
    10. 残blockerがあればそのcanonical reason code
    11. refinement approvedの場合は、次の独立 invocation として impl-review-loop #2794 が実行可能かどうか

    成功・approvedを推測で報告せず、GitHub readbackとcurrent canonical artifactsで確認してから終了してください。

    このケースでは、人間承認不要を強めるために独自コマンド列を増やすより、current Skill の with_human_context → contract_update / issue-editor → fresh review をそのまま最後まで走らせるのが適切です。特に今回は対象コメント自体が十分具体的なので、手書きの追加 ANCHOR_SCOPE_REFRAME_V1 をユーザーへ要求させない方針にしています。

  4. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-09-27T22:13:51Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/2794
      body_sha256: "sha256:d8e0a035d2dd42c7aabd2d19950572022fad42af55f42fa4a22341712dc933dc"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:d8e0a035d2dd42c7aabd2d19950572022fad42af55f42fa4a22341712dc933dc","source_provenance":{"source_type":"body_file","body_file":"/tmp/contract_review_once_body_3ayphh5i.md"}}
        vc_preflight:
          decision: pass
          classifications: '[{"ac":"AC1","line":3,"raw_command":"uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_orphan_backtick_shared_parser_adapter -q","command_hash":"sha256:94f939a6c11dde43bce73c7a2246cbacd3f3ec59f5f116c633d693f7b1bc4a65","execution_key_hash":"sha256:0ce1fa23c1cdbd1865bc96590ce7ac3eeace0ca43043d7f1568947a0bf41edf7","runner":"exec","exit_code":4,"classification":"expected_fail","category":"existing_file_missing_node_id_declared_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"low","stdout_head":["no tests ran in 0.03s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: not found: /home/squne/projects/LOOP_PROTOCOL/.claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_orphan_backtick_shared_parser_adapter","(no match in any of [<Class TestGuardTemplate>])"],"stderr_truncated":false,"stderr_original_line_count":4,"runner_env_delta":{},"duration_ms":206,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":2,"raw":"# baseline-expect: fail"},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:f5de31d140fd19e0eb0c1fac3fe1ddd070addae147dc074ccb755c2c92fa864f"}},{"ac":"AC2","line":6,"raw_command":"uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_shared_parser_fence_boundary_cases -q","command_hash":"sha256:f54aa325bc8539d0345afc17c79396b3ff223979e3fb6320d6ebe35ace45c4db","execution_key_hash":"sha256:3fbf6f9621233f769cfa3671deb85e665f9b00ca9b33dbb1676cadd062dfb787","runner":"exec","exit_code":4,"classification":"expected_fail","category":"existing_file_missing_node_id_declared_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"low","stdout_head":["no tests ran in 0.02s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: not found: /home/squne/projects/LOOP_PROTOCOL/.claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_shared_parser_fence_boundary_cases","(no match in any of [<Class TestGuardTemplate>])"],"stderr_truncated":false,"stderr_original_line_count":4,"runner_env_delta":{},"duration_ms":220,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":5,"raw":"# baseline-expect: fail"},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:396f154a81cbff91e800dca4b482ee7161321145a45c7dd882a1f3448c439e4b"}},{"ac":"AC3","line":9,"raw_command":"uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_shared_parser_delegation_without_regex -q","command_hash":"sha256:6779dd0af6078d94f351fc1cf401a589ca5613b535bb0e3187855f262aa851d3","execution_key_hash":"sha256:11a8c5e5698f93ee67333c4e13a35f222569d9f8b025ba6d315e2c032e7ecebc","runner":"exec","exit_code":4,"classification":"expected_fail","category":"existing_file_missing_node_id_declared_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"low","stdout_head":["no tests ran in 0.03s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: not found: /home/squne/projects/LOOP_PROTOCOL/.claude/skills/edit-issue/tests/test_guard_issue_body.py::TestGuardTemplate::test_shared_parser_delegation_without_regex","(no match in any of [<Class TestGuardTemplate>])"],"stderr_truncated":false,"stderr_original_line_count":4,"runner_env_delta":{},"duration_ms":200,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":8,"raw":"# baseline-expect: fail"},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:1efa8e3afb715e5281edac8156b849f227d656f9d9950be322edd1df25e93923"}},{"ac":"AC_UNKNOWN","line":10,"raw_command":"uv run --locked pytest .claude/skills/edit-issue/tests/test_guard_issue_body.py -q","command_hash":"sha256:6fd863bbb9481ce1a1c4dd390d7a721d5631160a1e10e349c1f52f166d151281","execution_key_hash":"sha256:182dee94cb207c9a1e4f82ec7ce845d2b455848c443b21c5fa28a421a0694bb1","runner":"exec","exit_code":0,"classification":"expected_pass","category":"regression_gate","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":["...................................................................      [100%]","67 passed in 0.62s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":891,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:14979946c2b6584f9c4f03bed9d2146183464ad2855cd0a5d04c8b10e2351bb7"}},{"ac":"AC_UNKNOWN","line":11,"raw_command":"uv run --locked pytest .claude/skills/create-issue/scripts/tests/test_prose_boundary_policy.py -k fence -q","command_hash":"sha256:2767002da84ec40959e82b2fed0b3fa7942558333a2f8953b20429a4f5531059","execution_key_hash":"sha256:d04a0cde4d1f1bf34cec2a15db89f3e8639e4c6879f95ca50c21bfb4598e2f4a","runner":"exec","exit_code":0,"classification":"expected_pass","category":"regression_gate","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":[".............................                                            [100%]","29 passed, 63 deselected in 0.04s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":247,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:4b137295b08bf0e87a579fd94c2a8b1b6deff79bc8cf5fd4eb6271e4a9ac704f"}}]'
          classifications_transport: {"schema":"vc_preflight_classifications_transport/v1","classification_count":5,"original_payload_sha256":"sha256:6a7b4520872f5d1d11d9969e5ef8c6cc148b1aae152d697e844b8f22f0a23e27","compact":false,"truncated":false}
        declared_path_overlap: '{"schema":"declared_path_overlap/v1","advisory":true,"blocking":false,"decision":"advisory_only","disjoint":true,"overlapping_prs":[],"inventory":{"schema":"OPEN_PR_INVENTORY_V1","repo":"squne121/loop-protocol","state":"open","base_ref":"main","base_sha":"077919b431d2dc4ded1762dc851c14fe578d2a02","draft_policy":"include_drafts","prs":[{"number":2813,"title":"実装: PR body authoring validator と pr-review-judge の evidence/safety contract drift を解消する","base_ref_name":"main","head_ref_name":"worktree-issue-2808-evidence-safety-contract-parity","head_ref_oid":"5ce33b57775eccc72252dfb821dbd97db98d6a40","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2813","changed_files_count_graphql":13},{"number":2814,"title":"fix: scope_signal_delta の _BULLET_LINE_RE / extract_directive_items を Markdown 順序付きリスト検出に対応させる","base_ref_name":"main","head_ref_name":"worktree-issue-2812-ordered-list-bullet-detection","head_ref_oid":"877ceef014c9b2d64cb25d60decfecf0e33938ee","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2814","changed_files_count_graphql":3}],"fetched_count":2,"totalCount":2,"has_next_page":false,"complete":true,"saturated":false,"limit":200,"page_count":1,"inventory_digest":"sha256:b220457b11ddc1b655011615c7966d5ce175ee8ddd2a4c1997842aa4294bdd97","errors":[]},"inventory_digest_extended":"sha256:d1a91b8a3e6e5e5bd28dfbddf47a5f57e2378b181fb7aa06961065dd6a6f99ce","errors":[],"note":"changed-file 名の単純な重なりのみを証明する advisory check。3-way merge・hunk 競合・rename/delete 競合は評価しない(実 Git merge 競合の判定は Issue #1792 の PAIRWISE_MERGE_OBSERVATION_V1 producer の責務)。単独では blocking にしない。disjoint は tri-state(true/false/null)— 観測が不完全な場合は null。"}'
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: '{"issue_number":2794,"contract_source_kind":"issue_comment","contract_source_id":"5860320598","contract_body_sha256":"sha256:d8e0a035d2dd42c7aabd2d19950572022fad42af55f42fa4a22341712dc933dc","allowed_paths_normalized_sha256":"963cb62a5fb7b92584372f9b867d0500b1a3bd3ac03717fc2f77a762c918fa5c","base_ref":"main","base_sha_at_snapshot":"077919b431d2dc4ded1762dc851c14fe578d2a02"}'
  5. squne121 commented on Sep 28, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []
    LOOP_HANDOFF_RESULT_V1:
      status: refinement_approved
      routing_action: none
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: https://github.com/squne121/loop-protocol/issues/2794#issuecomment-5860320598
        generated_at: "2026-09-27T22:13:51Z"
        body_sha256: "sha256:d8e0a035d2dd42c7aabd2d19950572022fad42af55f42fa4a22341712dc933dc"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "label changes not requested; presentation metadata is non-authoritative"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-27T22:22:58Z"
      checked_body_sha256: "sha256:d8e0a035d2dd42c7aabd2d19950572022fad42af55f42fa4a22341712dc933dc"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  6. squne121 commented on Sep 28, 2026

    @squne121
    OwnerAuthor

    確認した live state では、#2794 は実装へ進める状態です。Issue は open、refinement は approved、current main 077919b431d2dc4ded1762dc851c14fe578d2a02 には問題の _FENCED_CODE_BLOCK_RE = re.compile(r'```.*?```', re.DOTALL) がまだ残っています。契約で追加予定の3つの regression test も current main には存在しません。

    また、#1719 は現在も open Issue ですが、確認範囲では対応する open PR は見つかっていません。#2794 自身も「同一ファイルを扱うだけでは停止せず、実際の衝突または scope extension がある場合のみ調整」としています。PR #2796 は既に merged で、#2794 の Allowed Paths には触れていません。

    したがって推奨は、current impl-review-loop の Root-Owned Synchronous Entry Transition → Evidence-Based Landing Disposition を通し、通常実装へ進めることです。既存 PR が fresh discovery で見つかった場合だけ resume し、重複 PR は作らせません。

    以下を、そのまま既に auto mode で起動している Claude-GPT に貼れます。

    repo: squne121/loop-protocol

    対象:

    • Issue: https://github.com/squne121/loop-protocol/issues/2794
    • canonical Skill: .claude/skills/impl-review-loop/SKILL.md

    この既存の対話的 Claude-GPT セッションをそのまま継続し、Issue #2794 に対して current repository の impl-review-loop を実行してください。

    目的は、Issue #2794 の実装、検証、Draft PR 作成、PR review、必要な修正と再検証を自律反復し、人間が merge 判断できる直前の状態まで到達させることです。

    iteration ごとの人間承認は要求しないでください。通常の test failure、CI failure、REQUEST_CHANGES、stale review、BEHIND、修正可能な PR hygiene 問題は停止理由にせず、current impl-review-loop の canonical routing に従って自動修復・再検証してください。

    ただし実 merge / auto-merge は行わないでください。

    Claude-GPT セッションの扱い

    このセッションは既に auto mode で起動済みです。

    • repository-owned Claude-GPT launcher/profile/backend mapping をそのまま維持する
    • Claude Code harness の Skill / SubAgent / hooks / permissions semantics を維持する
    • セッションを不用意に再起動しない
    • backend model alias / proxy versionを過去情報から固定推測しない
    • permission mode を変更しない
    • --dangerously-skip-permissions / bypassPermissions 等を要求しない
    • auto mode と permission bypass を混同しない

    0. 必ず fresh state から開始する

    この prompt 内の SHA や状態は参考情報であり authority ではありません。

    開始時に live state を fresh 取得し、少なくとも以下を確認してください。

    prompt 作成時点の観測値は以下ですが、必ず fresh read で再確認してください。

    このユーザー指示自体を、refinement 完了後の 独立した明示的 implementation request として扱ってください。

    1. current impl-review-loop の entry contract を厳守する

    過去の contract snapshot comment や handoff comment を Step 1 authorization token として再利用しないでください。

    current impl-review-loop が要求する Root-Owned Synchronous Entry Transition を root/main thread 自身が current run で実行してください。

    すなわち同一の継続 invocation の中で:

    1. capability preflight
    2. live Issue fetch
    3. current-run issue-contract-review
    4. 直後の live Issue 再取得
    5. canonical routing decision
    6. 条件成立時のみ Step 1 を直接起動

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

    旧 invocation token、古い snapshot、GitHub comment、artifact、digest 等を単独の authorization として扱わないでください。

    current Skill の deterministic router / script が authority の判断を持つ場合は、それを prose で再実装しないでください。

    2. Step 1 前の duplicate / already-landed 判定

    worker dispatch、worktree 作成、新規 PR 作成より前に、current preparation.md の Evidence-Based Landing Disposition を canonical producer / router 経由で評価してください。

    結果に従い:

    • implementation_already_landed
      • 新規 worktree / worker / PR を開始しない
    • existing_pr_resume
      • 既存 PR / branch / worktree を再利用する
      • duplicate PR を作らない
    • already_satisfied
      • canonical recommendation を返して終了する
    • ordinary_dispatch_or_explicit_recovery
      • 通常の Step 1 へ進む
    • reconciliation_required
      • canonical reconciliation を行い、推測で新規 PR を作らない

    GitHub search の単純な title / branch 名だけで candidate identity を判断しないでください。

    3. Issue #2794 の live contract を implementation authority とする

    実装内容は必ず current live Issue body の Outcome / In Scope / Out of Scope / AC / Verification Commands / Allowed Paths / Stop Conditions を正本にしてください。

    現時点の意図は次のとおりですが、fresh body を優先してください。

    Allowed Paths

    変更可能なのは次の2ファイルだけです。

    • .claude/skills/edit-issue/scripts/guard-issue-body.py
    • .claude/skills/edit-issue/tests/test_guard_issue_body.py

    閲覧・テスト実行のために以下を参照してよいですが、#2794 では変更しないでください。

    • .claude/skills/create-issue/scripts/prose_boundary_policy.py
    • .claude/skills/create-issue/scripts/tests/test_prose_boundary_policy.py
    • docs/dev/workflow.md

    実装方針

    guard-issue-body.py で独自 fence parser を新設しないでください。

    • _FENCED_CODE_BLOCK_RE を削除する
    • _strip_fenced_code_blocks() を既存
      prose_boundary_policy.iter_markdown_blocks()
      の薄い consumer にする
    • BLOCK_KIND_CODE_FENCE の block だけを除外する
    • repository 内の既存 sibling-skill import pattern を使う
    • prose_boundary_policy.py 自体は変更しない
    • 新規 regex / toggle scanner / line-oriented parser を追加しない
    • anchor-comment 用 0–8 spaces scanner の semantics を流用しない

    current main に旧 _FENCED_CODE_BLOCK_RE = re.compile(r'```.*?```', re.DOTALL) がまだ存在することは prompt 作成時点で確認済みですが、実装前に fresh HEAD でも確認してください。

    Regression tests

    Issue の AC が指定する consumer-level regression を追加してください。

    特に current contract の以下3 node-id:

    • test_orphan_backtick_shared_parser_adapter
    • test_shared_parser_fence_boundary_cases
    • test_shared_parser_delegation_without_regex

    prompt 作成時点の main にはまだ存在しません。

    baseline-expect が fail の VC について、実装前の missing node-id / expected failure と、実装後の PASS を明確に区別してください。

    共有 parser 自体の golden grammar corpus を guard tests にコピーしないでください。

    AC2 の EOF 未閉 fence の解釈

    refinement final comment の semantic warning を必ず確認してください。

    EOF 未閉 fence は opener 以降 EOF まで code fence content です。その中に現れる ## ... を「後続の実見出し」として保持するような誤った regression test を作らないでください。

    「fence 後の実見出しを保持する」ケースと「EOF 未閉 fence 内の見出し風文字列を除外する」ケースを semantics 上区別してください。

    4. #1719 collision は actual evidence で判断する

    Issue #1719 は同じ guard-issue-body.py を扱う別 concern です。

    単に同じファイルを扱うだけで停止しないでください。

    fresh state で:

    を確認してください。

    実際の conflict または #2794 Allowed Paths / scope を越える変更が必要と実証された場合のみ、current Issue Stop Conditions に従って停止してください。

    5. SubAgent を canonical role で使う

    root/main thread は control-plane に徹し、current impl-review-loop が指定する canonical SubAgents を使用してください。

    最低限:

    Step 1

    implementation-worker

    渡す context:

    Step 2

    test-runner

    渡す context:

    Step 4

    pr-reviewer

    渡す context:

    • exact PR number
    • exact current PR HEAD SHA
    • live Issue binding
    • current review inputs required by pr-review-judge

    SubAgent に root conversation の暗黙 context を推測させないでください。

    SubAgent 自身に不要な nested delegation をさせないでください。Issue #2794 の live Stop Conditions が nested delegation を停止条件として維持している場合は、それを尊重してください。

    6. SubAgent の作業完了を必ず待つ

    SubAgent dispatch だけで完了扱いしてはいけません。

    current impl-review-loop の Common Completion Protocol を厳密に守ってください。

    各 dispatch について必ず:

    1. spawn_agent の戻り値から canonical task_name を保存する
    2. wait_agent は mailbox activity を待つ用途だけに使う
    3. timeout / steer / intermediate mailbox update を成功扱いしない
    4. 対象 SubAgent の final result を取得・消費する
    5. その後 list_agents で同じ canonical task_name の terminal state が completed であることを確認する
    6. final result と terminal completed の両方が揃ってから downstream step へ進む

    以下は成功扱いしない:

    • errored
    • interrupted
    • shutdown
    • not_found

    これらを観測した場合、result を捏造して次 Step へ進まず current Skill の fail-closed / recovery contract に従ってください。

    特に:

    • implementation-worker を dispatch しただけで test-runner を開始しない
    • test-runner の final result と terminal completion を確認する前に PR review へ進まない
    • pr-reviewer の final verdict と terminal completion を確認する前に Step 5 を評価しない

    7. 実装 → 検証 → PR → review/fix loop

    current canonical procedure に従って:

    inspect → implement → test → Draft PR作成/更新 → CI → PR review → fix → re-test → fresh re-review

    を実行してください。

    Issue #2794 の Verification Commands をすべて current contract から取得して実行してください。

    現時点では少なくとも以下が含まれていますが、live body を authority としてください。

    • orphan-backtick adapter regression
    • shared parser fence boundary cases
    • shared parser delegation / regex removal
    • edit-issue guard test file 全体
    • shared prose_boundary_policy fence-focused tests

    実装後は narrow VC だけでなく、current workflow が要求する relevant regression / repository checks も実行してください。

    8. PR

    1 Issue = 1 PR を維持してください。

    新規 PR が必要な場合:

    • dedicated worktree を使う
    • current open-pr Skill を使う
    • Draft PR を既定とする
    • Closes #2794 を正しく設定する
    • PR body の required sections / Safety Claim Matrix / schema applicability 等は current open-pr contract に従う
    • Allowed Paths から逸脱しない
    • existing branch / PR が fresh discovery で見つかった場合は再利用し、duplicate を作らない

    9. REQUEST_CHANGES / CI failure は自動修復する

    pr-reviewer が REQUEST_CHANGES を返した場合、actual conflict や current canonical hard stop でない限り止まらないでください。

    blockers を exact fix_delta として次 iteration の implementation-worker に渡し:

    1. 修正
    2. test
    3. push / PR update
    4. current-head CI
    5. fresh PR review

    を行ってください。

    stale review は fresh HEAD で再レビューしてください。

    BEHIND は current route_loop_verdict_v2() が route_to_update_branch を返す場合、その action を canonical worker に委譲し、更新後に verification と PR review を再実行してください。

    mergeability UNKNOWN 等は current bounded retry contract に従ってください。

    10. 終了条件

    終了は current route_loop_verdict_v2() を authority としてください。

    目標状態は:

    • pr-reviewer verdict = APPROVE
    • blockers == []
    • reviewed_head_sha == current PR head
    • required CI / verification が current head に binding されて PASS
    • live mergeability が current Skill の approved 条件を満たす
    • Allowed Paths gate が問題なし
    • unresolved review finding がない

    ここまで到達したら draft_pr_ready 相当として終了し、merge はしないでください。

    max iteration は current Skill の policy に従ってください(現在の既定は 3)。上限に達するまでは通常の修正可能 finding ごとに人間承認を要求しないでください。

    11. 停止境界

    以下の場合だけ current canonical contract に従って停止 / escalate してください。

    scope-rollup / contract snapshot / launch ledger 等の advisory artifact の missing/stale だけを理由に停止しないでください。

    今回の変更は repository-internal な static Markdown processing 修正なので、外部調査は原則不要です。external_research_skip_basis にその根拠を記録してください。Issue Stop Conditions に反して外部サービスを勝手に利用しないでください。

    12. 最終報告

    最終的に以下を簡潔かつ具体的に報告してください。

    実 merge / auto-merge / irreversible cleanup は行わず、merge 判断直前で停止してください。

    特に重要なのは、今回は refinement 済みなので単純に worker を起動するのではなく、current-run entry transition と pre-Step-1 landing disposition を通したうえで implementation-worker → test-runner → pr-reviewer を回す点です。また、各 SubAgent は final result と list_agents の terminal completed の両方を確認するまで次へ進ませない構成にしています。

  7. squne121 commented on Sep 28, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-28T12:44:37Z)

    • PR: fix: guard_template の fence 判定を共有 parser に委譲する #2818 (Draft)
    • Worktree: .claude/worktrees/issue-2794-guard-fence-parser
    • Branch: worktree-issue-2794-guard-fence-parser
    • Verification: Issue VC 5/5 PASS、guard 70 passed、共有 parser fence 29 passed、typecheck/lint/test/build 4/4 PASS、routing pytest 24 passed
    • Allowed Paths: 2 件のみ変更、逸脱なし
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  8. squne121 commented on Sep 30, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了(2026-09-30T11:51:55Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2818"
      head_sha: "cd753f2d3731ef7283dfffbd258701e7e22d7127"
      issue_number: 2794
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "issue-2794-pr-body-advisory-scope-marker-old-head"
          source_url: "https://github.com/squne121/loop-protocol/pull/2818#issuecomment-5910562925"
          source_note_id: "5910562925"
          summary: "PR body advisory scope coverage marker uses an earlier head; excluded from current-head approval evidence."
    
    ISSUE_SCOPE_ROLLUP_DECISION_V2:
      schema_version: 2
      recorded_at: "2026-09-30T11:51:55Z"
      rollup_plan_ref: null
      decision: skipped
      executed_actions: []
      skipped_reason: "no scope-rollup preflight executed during existing PR resume"
      candidates_reviewed: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions