Skip to content

実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "baseline_vc_preflight の通常実行・canonical VC plan・static-only が同一の shared VC command grammar を消費し、説明用 bash fence 内の非 $ 行を実コマンド候補へ昇格させない"
change_kind: fix

Parent Issue

none

Parent Goal Ref

  • Goal: baseline_vc_preflight の通常実行・canonical VC plan・static-only が同一の shared VC command grammar authority を消費し、説明用の非 $ 行を実コマンド候補へ昇格させない状態にする
  • Desired Destination: standalone issue(parent issue なし)のため、本 Issue の Outcome がそのまま到達点

Current Validated Scope

  • baseline_vc_preflight.py の command extraction を shared VC parser authority へ統一する
  • vc_contract_syntax.py へ quote-aware compound detection primitive を追加する
  • 上記の regression test を追加する

Remaining Parent Gaps

なし

Source

Background

PR #2786 の OWNER review で、Verification Commands 内の bash コードフェンスに含まれる説明用の非 $ 行が実コマンド候補として扱われ得る既存制約が再現された。

現行 .claude/skills/issue-contract-review/scripts/vc_contract_syntax.py::parse_verification_commands_section() は canonical VC grammar として「bash fence 内の command は $ で始まる」ことを要求し、非空・非コメントの non-$ 行を non_dollar_command error として扱う。

一方、.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py では:

  • --static-only は shared parse_verification_commands_section() を使う
  • 通常実行は legacy extract_fenced_bash_blocks() + parse_commands_from_block() を使う
  • compute_canonical_vc_plan() も同じ legacy command extraction を使う
  • legacy parse_commands_from_block() は $ がない非空・非コメント行も command として取り込む

という authority drift が残っている。

このため、同じ Issue body が static-only では non-canonical と判定される一方、通常実行 / canonical plan では説明行が command / timeout-budget candidate に昇格し得る。

#993 は shared parser を追加し baseline_vc_preflight.py --static-only をそこへ寄せたが、通常実行と canonical plan の command source 統一までは扱っていないため、本 Issue はその残存 gap を bounded に閉じる。

上記の敵対的レビュー(OWNER, 2026-09-26)により、legacy parser を shared parser へ単純置換するだけでは次の既存正常系が壊れることが判明した。(1) vc_contract_syntax.py の _COMPOUND_SHELL_RE は command 全体に正規表現を適用し quote-aware でないため、rg -n "foo|bar" PATH のような quoted regex alternation を誤って compound_shell と判定する(#589 の既存回帰契約に反する)。(2) shared VcCommandEntry は vc-regex-intent と annotation_source(line/raw)provenance を保持しておらず、#589 の literal-pipe-ok annotation と #889 AC11 の result JSON 契約が失われる。(3) grouped AC(ac_refs)から normal execution の scalar ac representation への写像が未定義で、雑な adapter は command 実行回数を変える恐れがある。(4) compute_canonical_vc_plan() の直接 caller(contract_readiness_check.py / run_contract_review_once.py / run_root_review_pipeline.py)は Allowed Paths 外にあり、新しい例外型を導入すると未処理 exception で workflow を落とすリスクがある。(5) _distinct_command_texts_from_body() は docstring で compute_canonical_vc_plan() と同じ command population を宣言しているが、現状は独立に legacy parser を使っており、本 Issue 後もそこだけ legacy のままだと宣言が偽になる。本 Issue の contract は以下でこれらを踏まえて拡張した。

Outcome

baseline_vc_preflight.py の static-only・通常実行・compute_canonical_vc_plan() が同一の canonical VC command grammar authority を消費し、説明用の non-$ 行を subprocess 実行候補または command budget candidate にしない状態にする。

新しい独自 parser は追加せず、既存 vc_contract_syntax.parse_verification_commands_section() / VcParseResult を authority として再利用する。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 静的検証のみで完結するため

In Scope

  • baseline_vc_preflight.py 通常実行の command extraction を shared VC parser の command entries に統一する
  • compute_canonical_vc_plan() の command source を通常実行と同じ shared VC parser authority に統一する
  • shared parser が返す non-canonical parse errors を、subprocess 起動前に deterministic に blocked / extraction error として扱う
  • canonical $ command、AC marker、grouped AC marker、inline AC suffix、preflight-scope、baseline-expect、vc-role の既存 shared semantics を維持する
  • 説明用 non-$ 行を含む bash fence と canonical $ command の regression fixture/test を追加し、static-only / canonical plan / normal execution の3経路が同じ command set / reject semantics を持つことを固定する
  • legacy parser helper を即時削除するかは、実 consumer が残る場合は別途判断する。ただし本 Issue の3経路が legacy grammar を authority として使い続けないことは必須
  • vc_contract_syntax.py の _COMPOUND_SHELL_RE ベースの compound 判定を、shlex ベースの quote-aware primitive へ委譲する形に統一し、baseline_vc_preflight.detect_compound_command() と同一の判定ロジックを共有する(新しい独立 regex 判定を追加しない)
  • shared VcCommandEntry に vc-regex-intent の値、および annotation_source(line/raw)provenance を追加し、既存 実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589 / 実装: baseline-expect VC annotation と deterministic repair pass で issue-refinement-loop 反復失敗を防ぐ #889 semantics を losslessly 保持する
  • grouped AC(ac_refs)は additive な representation として保持し、既存 scalar ac representation との backward-compat を deterministic に定義する。1 source command = 1 canonical plan occurrence = 1 subprocess launch を崩さない
  • _distinct_command_texts_from_body()(history snapshot command population)を、上記で統一した command source と一致させる
  • compute_canonical_vc_plan() の non-canonical parse-error rejection は、既存 direct caller(contract_readiness_check.py / run_contract_review_once.py / run_root_review_pipeline.py)に未処理 exception を伝播させない設計とする。可能な限り、body を shared parser で一度 parse し、parse error がある場合は plan producer 自体を呼ばない構造を優先し、Allowed Paths の拡張を避ける

Out of Scope

Acceptance Criteria

  • AC1: baseline_vc_preflight.py の通常実行が vc_contract_syntax.parse_verification_commands_section() または同じ VcParseResult.commands を source of truth とする薄い shared adapter から runnable command を取得し、legacy parse_commands_from_block() 独自 grammar で command set を決めない
  • AC2: compute_canonical_vc_plan() が AC1 と同一の command source を使用し、normal execution と command occurrence / budget candidate の集合が drift しない
  • AC3: bash fence 内の説明用 non-$ 行を含む fixture で、static-only / canonical plan / normal execution のいずれもその行を runnable command として扱わず、subprocess 起動前に non-canonical input として一貫して拒否する
  • AC4: canonical $ command fixture では従来どおり command が抽出され、plan count と通常実行対象が一致する
  • AC5: bare # ACN、grouped marker、inline AC suffix、preflight-scope、baseline-expect、vc-role、vc-regex-intent: literal-pipe-ok、および result JSON の annotation_source.line / annotation_source.raw provenance の既存 shared parser semantics を回帰させない
  • AC6: 同一 body に対する static-only / canonical plan / normal execution の parser authority 一致を pytest で固定する
  • AC7: baseline_vc_preflight.py に新しい第三の command grammar parser を追加しない
  • AC8: 既存 baseline VC preflight / VC syntax regression suite が PASS する
  • AC9: rg -n "foo|bar" PATH のような quoted regex alternation を含む VC command が、vc_contract_syntax.py / baseline_vc_preflight.detect_compound_command() のいずれでも compound_shell / compound_command_disallowed として誤判定されない(quote-aware primitive への統一により、独立した新しい regex ベース判定を追加しない)
  • AC10: rg -n "foo\|bar" PATH は annotation なしの場合 regex_literal_pipe_suspected として従来どおり扱われ、# vc-regex-intent: literal-pipe-ok annotation 付きの場合は shared-parser 統一後の normal execution でも実行可能である
  • AC11: grouped AC(# AC2, AC3 等)は1つの source command に対して1つの canonical plan occurrence / 1回の subprocess launch のみを生成し、AC association を理由に同じ command を複数回実行しない。ac_refs representation は set の iteration order に依存しない deterministic な形式である
  • AC12: _distinct_command_texts_from_body()(history snapshot command population)が、AC1/AC2 で統一した command source と一致する command set を返す
  • AC13: compute_canonical_vc_plan() の non-canonical parse-error rejection は、既存 direct caller(contract_readiness_check.py / run_contract_review_once.py / run_root_review_pipeline.py)に未処理 Python exception を伝播させない。Allowed Paths を変更せずに実現できない場合は、その旨と必要な Allowed Paths 拡張を PR で明示する

Verification Commands

# AC1
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC2
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC3
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC4
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC5
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/ -q
# AC6
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC7
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC8
# preflight-scope: pr_review_only
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -q
# AC9
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC10
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC11
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC12
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q
# AC13
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py -q

Allowed Paths

  • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
  • .claude/skills/issue-contract-review/scripts/vc_contract_syntax.py
  • .claude/skills/issue-contract-review/scripts/tests/
  • .claude/skills/issue-contract-review/tests/
  • tests/fixtures/issue-body/

Stop Conditions

Required Skills

  • Python 3
  • pytest
  • 既存 VC parser(vc_contract_syntax.py / baseline_vc_preflight.py)の内部構造理解

Required Design References

  • .claude/skills/issue-contract-review/scripts/vc_contract_syntax.py(既存 shared VC command grammar authority の実体。AC5/AC9-AC13 の preserved semantics 判断根拠)
  • docs/dev/workflow.md(必須検証節。VC 実行契約の repo-wide 位置づけ)

Notes for Reviewer

本 Issue は PR #2786 の non-blocking follow-up。#2786 では OWNER review が推奨した test hygiene の局所改善のみを行い、本 command grammar 問題を同 PR へ混ぜない。

本 Issue 本文は、OWNER の敵対的レビュー(Source 参照)を反映して issue-refinement-loop により更新された。反映内容: (1) quote-aware compound shell 判定の regression 固定(AC9)、(2) vc-regex-intent: literal-pipe-ok semantics の保持(AC5/AC10)、(3) annotation provenance(annotation_source.line/raw)の保持(AC5)、(4) grouped AC の subprocess launch 数不変 invariant(AC11)、(5) history snapshot command population の parity(AC12)、(6) compute_canonical_vc_plan() の parse-error caller-facing contract(AC13)。Allowed Paths は変更していない(AC13 の推奨設計は既存 caller への変更を避ける方向のため)。

Activity

  1. squne121 commented on Sep 26, 2026

    @squne121
    OwnerAuthor

    Issue #2788、関連する [PR #2786](https://github.com/squne121/loop-protocol/pull/2786)、その OWNER review、[Issue #993](#993) / [PR #1002](https://github.com/squne121/loop-protocol/pull/1002)、[[#589](https://github.com/squne121/loop-protocol/issues/589)](https://github.com/squne121/loop-protocol/issues/589)、[[#814](https://github.com/squne121/loop-protocol/issues/814)](https://github.com/squne121/loop-protocol/issues/814)、[[#889](https://github.com/squne121/loop-protocol/issues/889)](https://github.com/squne121/loop-protocol/issues/889)、[[#2784](https://github.com/squne121/loop-protocol/issues/2784)](https://github.com/squne121/loop-protocol/issues/2784)、および current main の実装・テストを突き合わせました。

    結論は、#2788 の問題設定自体は正しく、優先して直す価値があります。ただし現在の Issue 契約のまま実装に入るのは危険です。少なくとも2件の blocker と、2件の contract gap を先に明文化すべきです。 特に「legacy parser を shared parser に置換するだけ」は #589 の既存正常系を壊します。

    敵対的レビュー

    1. BLOCKER — shared parser 自体が 実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589 の quoted regex alternation を誤って compound_shell にします。

      current vc_contract_syntax.py は _COMPOUND_SHELL_RE = re.compile(r"[;&|]|>+|<+") を command 全体へ適用しています。このため、正当な VC である

      $ rg -n "foo|bar" .claude/

      にも | が含まれるだけで compound_shell parse error が付きます。

      一方、通常実行側には既に detect_compound_command() があり、shlex.shlex(..., posix=True, punctuation_chars=True) で quote-aware に判定しています。実際にリポジトリの test_vc_quality_guards.py / test_vc_regex_pipe_semantics.py では「quoted foo|bar は compound ではない」が回帰契約になっています。これは [#589](実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589) の明示要件です。

      外部仕様とも一致します。Python の shlex は punctuation_chars=True で ();<>|& を shell-like に token 化する用途を提供しており、現在の detect_compound_command() の方向が適切です。:chatgpt-content-reference{index="0"} Rust regex の syntax でも x|y は alternation で、escape はメタ文字を literal 化します。:chatgpt-content-reference{index="1"} ripgrep も通常は regex pattern を扱い、-F で初めて fixed-string に切り替わります。:chatgpt-content-reference{index="2"}

      修正方針: vc_contract_syntax.py に新しい regex ベース判定を増やさず、quote-aware な compound detection primitive を shared 側へ移し、baseline_vc_preflight.detect_compound_command() もそれへ delegate するのが最小です。これなら harness は増えず、むしろ重複が減ります。

    2. BLOCKER — VcCommandEntry に vc-regex-intent がなく、単純移行すると既存 annotation semantics が消えます。

      legacy parse_commands_from_block() は各 command について

      ac_label
      command
      line_number
      preflight_scope
      vc_regex_intent
      baseline_expect
      vc_role
      annotation_line_no
      annotation_raw
      

      を返しています。

      通常実行では vc_regex_intent == "literal-pipe-ok" のとき regex_literal_pipe_suspected block を解除する実処理があります。ところが shared VcCommandEntry は現在、

      ac_refs
      command
      line_number
      preflight_scope
      baseline_expect
      vc_role
      

      だけです。実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 AC5 も bare/grouped/inline AC、preflight-scope、baseline-expect、vc-role しか列挙しておらず、[#589](実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589) の # vc-regex-intent: literal-pipe-ok reason="..." が抜けています。

      したがって AC5 を満たしたつもりでも、既存の正当な literal-pipe VC が blocked になります。

      Issue 本文で vc-regex-intent を明示的な preserved semantic に追加すべきです。 これは hardening ではなく既存互換性の維持です。

    3. MAJOR — grouped AC を shared parser から通常実行へどう写像するか未定義です。

      shared parser の VcCommandEntry.ac_refs は set なので # AC2, AC3 は {"AC2", "AC3"} を表現できます。これは [#814](実装: issue-refinement-loop の checker approve が max_rewrite_attempts を超えて human_escalation される問題を修正する #814) / PR fix(agent-ops): Issue VC grammar を vc_contract_syntax に単一化し、C4/C5 と LP010/LP011 の矛盾を解消する #1002 由来の既存契約です。

      しかし通常実行 result は現在、

      "ac": ac_label or "AC_UNKNOWN"

      という scalar です。

      ここで adapter を雑に作ると、「AC2だけ選ぶ」「set の next(iter(...)) で非決定的に選ぶ」「AC2/AC3 の2 jobに展開して同じ command を2回実行する」のいずれかになります。最後の案は command_occurrence_count や budget/dedup semantics まで変えます。

      推奨は、1 source command = 1 plan occurrence = 1 execution を維持することです。その上で result に additive な ac_refs: ["AC2", "AC3"] を持たせ、旧 ac は単一 AC なら従来値、grouped の backward-compatible fallback は deterministic に定義します。少なくとも「grouped AC は subprocess 数を増やさない」を AC に入れるべきです。

    4. MAJOR — compute_canonical_vc_plan() の「reject」の API が決まっておらず、Allowed Paths と衝突します。

      実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 AC3 は non-canonical input を canonical plan でも reject する方向ですが、現在 compute_canonical_vc_plan() の caller は複数あります。少なくとも contract_readiness_check.py、run_contract_review_once.py、run_root_review_pipeline.py が直接呼んでいます。

      現行 callers が明示的に処理しているのは主に timeout/budget 系 typed exception です。新しく例えば VcParseContractError を raise すると、run_root_review_pipeline.py の exception tuple に入っておらず、run_contract_review_once.py も Step 5 の plan 計算を直接行っています。つまり「きれいに needs_fix/block する」つもりが Python exception で review workflow 自体を落とす可能性があります。

      しかもこれら caller は 実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 の Allowed Paths に含まれていません。

      ここは Issue 契約で先に決めるべきです。個人開発として余計な schema/harness を増やさないなら、body → shared parse result を上位で1回取得し、parse error がある body に対してそもそも plan producer を呼ばない構造が扱いやすいです。どうしても plan 自身を total function にしたければ、schema変更ではなく小さい typed exception と全 direct caller の catch 更新が必要なので、その場合は Allowed Paths を広げるべきです。

    5. MAJOR/P2 — 「3経路の authority 統一」だけでは同ファイル内に legacy command-population authority が残ります。

      baseline_vc_preflight.py では通常実行と compute_canonical_vc_plan() 以外にも、

      _distinct_command_texts_from_body()
      compute_duplicate_diagnostic_report()

      が extract_fenced_bash_blocks() + parse_commands_from_block() を直接使用しています。

      特に _distinct_command_texts_from_body() は history snapshot 用で、docstring 自身が「compute_canonical_vc_plan() と同じ command population」と宣言しています。実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 後にそこだけ legacy のままだと宣言が偽になります。

      duplicate diagnostic は status authority ではないので残す選択も可能ですが、history population は同じ shared commands に寄せるべきです。新しい抽象化を何層も作る必要はなく、VcParseResult.commands を受け取る小さな helper 1つで十分です。

    追加で気になる compatibility

    shared parser の line_number は Verification Commands section 内の行番号ですが、legacy parser の line_number は bash block 内の行番号です。また legacy は annotation_line_no / annotation_raw を保持し、result JSON の annotation_source.line/raw に出しています。shared VcCommandEntry はこの provenance を持っていません。

    [#889](#889) では result JSON の annotation_source.line が AC11 として明示されています。そのため、adapter を作る際に値だけ (baseline_expect, vc_role) 保存して provenance を落とすのは回帰です。

    これは blocker までは上げませんが、AC5 を「annotation value semantics」だけでなく existing result provenance semantics まで含めるよう修正した方がよいです。

    外部仕様から見たスコープ判断

    ここで一般的な Markdown parser を導入する必要はありません。GFM そのものでは fenced code block は3個以上の backtick/tilde、最大3スペースの indentation、info string などを許容します。:chatgpt-content-reference{index="3"} 一方 LOOP_PROTOCOL の ```bash + $ command は GFM grammar ではなくプロジェクト固有の実行契約です。

    したがって [#2784](#2784) のような repo-wide Markdown parser 統合へ広げず、#2788 は VC execution grammar の収束だけに留めるのが妥当です。これは [PR #2786 の OWNER review](#2786 (comment)) の「大きい Markdown parser 問題をこの修正へ持ち込まない」という方向とも整合します。

    実行についても、Python は subprocess に args sequence を渡す方式を一般に推奨し、デフォルトの shell=False なら shell meta character が暗黙に shell 解釈されません。:chatgpt-content-reference{index="4"} なので今回、セキュリティ理由でさらに command sandbox/harness を増やす必要はありません。既存の shlex + argv execution 方針を維持し、parser の semantic drift を減らす方が有用です。

    Issue #2788 に入れるべき修正

    現行 AC を全面的に作り直す必要はありません。最低限、次を追加・修正すれば実装可能な契約になります。

    AC5 を拡張:
    - bare AC / grouped AC / inline suffix
    - preflight-scope
    - baseline-expect
    - vc-role
    - vc-regex-intent: literal-pipe-ok
    - annotation_source provenance
    を既存 semantics のまま保持する。
    
    新 AC:
    - quoted regex alternation (`rg -n "foo|bar" PATH`) は
      compound_shell / compound_command_disallowed と誤判定されない。
    - `rg -n "foo\|bar" PATH` は annotation 無しなら従来どおり
      regex_literal_pipe_suspected、literal-pipe-ok 付きなら実行可能。
    - grouped AC は一つの source command / plan occurrence /
      subprocess launch として扱い、AC association のために command を複製しない。
    - history snapshot 用 command population も shared parsed commands と一致する。
    - parse-error rejection の caller-facing contract を固定し、
      direct canonical-plan callers を未処理 exception で落とさない。
    

    テスト matrix には最低でも non-$ explanation, canonical $, grouped AC, inline suffix, quoted foo|bar, foo\|bar annotated/unannotated, baseline-expect, preflight-scope, annotation source の各ケースを置くべきです。大きな E2E harness は不要で、shared parser unit test + plan unit test + subprocess launch monkeypatch/counter で「実行されない/1回だけ」を証明すれば十分です。

    判定

    REQUEST_CHANGES 相当です。

    #2788 の中心命題――「通常実行と canonical plan が legacy parser を command authority にしているため non-$ 説明行を実行候補化する」――は current main で再現可能で、修正価値があります。[PR #1002](#1002) が shared parser を導入した後に残った実際の gap です。

    ただし、現状の契約で実装すると #589 の regex semantics 消失、vc-regex-intent 消失、grouped AC の lossless adapter 不在、canonical-plan caller の例外契約未定義が残ります。特に最初の2点は実装後の正常系破壊につながるため、着手前に Issue 本文へ固定した方がよいです。

    また、PR #1002 の初回レビューでも shared parser の stricter 化が edit-issue の既存 autofix を9件壊した実績があります。今回も「parser を統一したから正しい」で終わらせず、既存 semantic consumer の全フィールドを inventory してから置換するのが再発防止として最も効きます。セキュリティ層や新しい harness を追加するより、この consumer parity をテストで固定する方を優先すべきです。

  2. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    推奨は、#2788 をまだ実装へ渡さず、対象 OWNER comment を operator_asserted_human_context として issue-refinement-loop に投入し、契約を再精緻化してから refinement_approved まで回すことです。

    current main を確認すると、対象コメントの主要指摘は実装と一致しています。vc_contract_syntax.py の shared parser は quote-aware ではない _COMPOUND_SHELL_RE を持つ一方、baseline_vc_preflight.py 側には quote-aware な detect_compound_command() が残っています。また VcCommandEntry には vc_regex_intent と annotation provenance がなく、_distinct_command_texts_from_body() も legacy parse_commands_from_block() を使っています。したがって単純な parser 差し替えでは #589/#889 系の既存 semantics を壊す可能性があります。

    再発防止については、現時点では別Issueを先に作るより、#2788 自体に consumer parity の回帰条件を組み込む方が重複が少ないと判断します。検索上も vc-regex-intent の shared-parser 移行を直接扱う既存Issueは #2788 です。ClaudeCode の調査で「#2788 に収めると別PRになる独立した再発性問題」が判明した場合だけ、dedupe 後に follow-up を起票させるのが適切です。

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

    squne121/loop-protocol の Issue #2788 を、現在の repository の .claude/skills/issue-refinement-loop/SKILL.md を正本として、人間の追加承認なしで refinement 完了まで進めてください。

    対象:

    このコメントは今回のユーザーが明示的に選択した human context です。
    unlabeled with_anchor や agent-report lane として扱わず、current issue-refinement-loop が定義する preflight.run.with_human_context / 必要時の contract_update.run.with_human_context 経路を使用してください。

    コマンドの argv をこのプロンプトから手書きで再構成せず、current main の ISSUE_REFINEMENT_COMMAND_REGISTRY_V1 / command_registry.py と SKILL.md を読み、現在登録されている canonical command profile をそのまま使用してください。

    目的

    対象 OWNER comment のレビュー結果を repository の実状態と照合し、Issue #2788 の contract を実装可能な状態へ精緻化してください。

    今回は issue-refinement-loop の実行だけが依頼されています。

    • Issue 本文の refinement
    • 必要な調査
    • contract review
    • rewrite/review loop
    • follow-up materialization
    • termination report

    までは自律的に実施してください。

    一方で、refinement が approved / refinement_approved になっても、この invocation から impl-review-loop、implementation-worker、実装用 worktree、production code 修正、commit、push、PR 作成へ進んではいけません。

    Issue #2740 以降の current skill contract に従い、refinement 完了後は正常終了してください。

    人間承認

    通常の needs-fix、Issue 本文 rewrite、AC/VC修正、Allowed Paths の整合化、review iteration のたびにユーザーへ承認を求めないでください。

    current skill の loop_iteration_approval_gate.default_required: false に従って bounded loop を自律継続してください。

    対象 comment が要求している refinement を、単に「scope/AC が変わる」という理由だけで人間へ差し戻さないでください。

    operator-selected human-context 用の current canonical route、
    references/anchor-comment-handling.md の
    Operator-Selected Human-Context 継続と Accepted Trust Model
    を使用してください。

    特に exact Allowed Paths の追加候補が comment 本文だけでは確定しない場合は、人間へ path を聞く前に current skill が規定する read-only codebase-investigator を使用して repository-relative exact paths を導出してください。

    新しい独自 bypass や approval mechanism は作らないでください。

    必須の SubAgent 利用

    root/main thread だけで調査から rewrite まで済ませないでください。

    まず current planner/preflight を実行し、その結果が investigation を要求する場合は、必ず codebase-investigator SubAgent を起動してください。

    今回については対象コメントが current-main の複数 consumer / parser field の inventory を要求しているため、少なくとも以下を read-only 調査対象としてください。

    • .claude/skills/issue-contract-review/scripts/vc_contract_syntax.py
    • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    • compute_canonical_vc_plan() の全 direct caller
    • _distinct_command_texts_from_body()
    • compute_duplicate_diagnostic_report()
    • VcCommandEntry
    • legacy parse_commands_from_block()
    • detect_compound_command()
    • vc-regex-intent
    • annotation_source
    • grouped AC の downstream consumer
    • command occurrence / timeout budget / history snapshot consumer
    • 関連 regression tests

    関連 Issue / PR も確認してください。

    最低限:

    SubAgent を spawn したら、必ず completion を待ってください。

    completion 前に調査済みとみなしたり、Issue rewrite / final classification へ進んだりしないでください。

    planner が Web research を required と判定した場合は web-researcher も current skill に従って使用してください。
    codebase-investigator と並列化してよいですが、両者が required の場合は両方の completion を join してから Step 2 へ進んでください。

    Issue rewrite が必要になり issue-editor SubAgent を起動した場合も、その completion を待ち、GitHub 上の live Issue body を readback してから次の review iteration へ進んでください。

    対象コメントから検証すべき technical points

    コメントの結論を無条件に採用せず、current main の実装と regression contract で fact-check してください。

    ただし少なくとも次の論点は明示的に検証してください。

    1. quote-aware compound shell semantics

    current shared parser の compound-shell 判定と、
    baseline_vc_preflight.detect_compound_command() の quote-aware 判定を比較してください。

    既存 #589 の契約:

    • rg -n "foo|bar" PATH の quoted regex alternation は shell pipe ではない
    • quote 外の actual shell pipe は compound command
    • rg -n "foo\|bar" PATH は literal-pipe semantics として別判定

    を壊さないことを Issue contract に固定してください。

    実装方針を contract に過剰指定する必要はありませんが、shared authority へ寄せる結果として quoted regex alternation が compound_shell / compound_command_disallowed に誤分類されないことを testable AC にしてください。

    2. vc-regex-intent parity

    legacy parser が保持している
    vc-regex-intent: literal-pipe-ok
    と shared VcCommandEntry の field set を比較してください。

    shared parser migration 後も #589 の annotation semantics が lossless に維持されることを AC / tests に明記してください。

    annotation を落として normal execution が regression する contract は approve しないでください。

    3. annotation provenance parity

    #889 と current result JSON consumer/test を確認し、

    • annotation value
    • annotation_source.line
    • annotation_source.raw

    等、既存 externally-observable semantics を inventory してください。

    単に baseline_expect / vc_role の値だけ残して provenance を消す rewrite は避けてください。

    どの provenance が current contract 上で必須かは repository evidence から決定してください。

    4. grouped AC mapping

    shared VcCommandEntry.ac_refs と normal execution 側の scalar ac representation の差を確認してください。

    最低限、Issue contract に以下の invariant を固定してください。

    1 source command = 1 canonical plan occurrence = 1 subprocess launch

    grouped AC association を理由に同じ command を複数回実行してはいけません。

    必要なら additive ac_refs 等の representation を検討してください。ただし backward-compatible scalar representation の具体形は、current consumer inventory を行った上で deterministic に決めてください。

    set の iteration order に依存する非決定的 mappingは禁止です。

    5. canonical-plan parse-error contract

    compute_canonical_vc_plan() の direct caller を current main から全数確認してください。

    少なくとも対象コメントが挙げる:

    • contract_readiness_check.py
    • run_contract_review_once.py
    • run_root_review_pipeline.py

    を検証してください。

    non-canonical VC parse error を canonical plan でも拒否する場合に、未処理 Python exception で workflow 全体が落ちない caller-facing contract を Issue に定義してください。

    可能なら、個人開発向けに余計な schema/harness を増やさない最小設計を優先してください。

    body を shared parser で一度 parse し、error 時に plan producer 自体を呼ばない構造で現在の Allowed Paths 内に収まるならそれを優先候補にしてください。

    一方、typed exception と direct caller 更新が本当に必要と repository evidence が示すなら、必要な exact path を調査して Issue の Allowed Paths を整合させてください。

    「Allowed Paths に無いから人間へ聞く」で停止せず、今回の operator-selected human-context route と read-only investigation により current skill が許す範囲で contract を更新してください。

    6. history / diagnostic command population

    _distinct_command_texts_from_body() と compute_duplicate_diagnostic_report() が現在どの parser authority を使うか確認してください。

    特に history snapshot が compute_canonical_vc_plan() と「same command population」を契約しているなら、#2788 後もその invariant が真になるよう Issue scope / AC を修正してください。

    duplicate diagnostic が diagnostic-only であり migration scope に入れる必要がない場合は、その理由を明示してください。
    「同じファイルに legacy parser がある」という理由だけで無条件に全部変更しないでください。

    Issue #2788 の refinement 方針

    対象 OWNER comment の提案を repository evidence が支持する場合、少なくとも以下を Issue contract に反映してください。

    • AC5 の preserved semantics を拡張
      • bare AC
      • grouped AC
      • inline AC suffix
      • preflight-scope
      • baseline-expect
      • vc-role
      • vc-regex-intent: literal-pipe-ok
      • current contract が要求する annotation provenance
    • quoted foo|bar が compound shell と誤判定されない regression
    • foo\|bar annotated / unannotated の既存 実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589 semantics
    • grouped AC が subprocess launch 数を増やさない invariant
    • normal execution / canonical plan / static-only の command population / rejection semantics parity
    • history snapshot の command population parity が実際の consumer contract なら、その parity
    • non-canonical parse error の caller-facing behavior
    • direct caller を未処理 exception でクラッシュさせないこと
    • legacy parser から shared parser へ移行する全 semantic field の consumer inventory

    テスト matrix は repository evidence を踏まえて、最低でも次を検討してください。

    • non-$ explanation
    • canonical $ command
    • grouped AC
    • inline suffix
    • quoted "foo|bar"
    • "foo\|bar" without annotation
    • "foo\|bar" with literal-pipe-ok
    • baseline-expect
    • preflight-scope
    • vc-role
    • annotation provenance
    • canonical plan / normal execution / static-only parity
    • one source grouped command -> one subprocess launch

    大規模 E2E harness、新しい Markdown parser、新規 security layer はこの目的だけのために追加しないでください。
    unit / focused regression test と subprocess launch monkeypatch/counter 等で十分証明できるならそちらを優先してください。

    #2784 の section-boundary 問題や repo-wide Markdown parser 刷新を #2788 に吸収しないでください。

    Review / rewrite loop

    current issue-refinement-loop の Step 2 を正本としてください。

    canonical Step 2 では legacy issue-reviewer SubAgent を新たに起動せず、current run_root_review_pipeline.py produce / canonical_step2_route 経路を使ってください。

    Step 2 が background execution を要求する current contract なら:

    1. background で起動
    2. task completion notification を join
    3. 実際の completed JSON を取得
    4. その後にだけ routing

    の順を守ってください。

    background launch 時点を completion とみなさないでください。

    review が needs-fix / request_changes なら current skill の bounded loop に従って issue-editor rewrite → completion wait → live readback → fresh review を自律的に繰り返してください。

    通常の修正可能な review finding ごとにユーザーへ確認を求めないでください。

    再発防止 follow-up

    今回すでに確認されている

    「shared parser へ authority を統一する際、legacy consumer が依存する semantic field / provenance を inventory せず移行すると既存正常系を壊す」

    という問題については、まず #2788 の AC / regression test として直接固定できるか判断してください。

    #2788 自体に consumer parity regression を入れれば十分なものを、重複する generic follow-up Issue に分離しないでください。

    ただし調査中に、#2788 の bounded implementation scopeとは独立した、具体的な再現証拠付きの再発性問題が見つかった場合は、Step 4.5 の current follow-up materialization contract に従って GitHub Issue 化してください。

    その場合:

    1. open / closed Issue を検索する
    2. title 類似だけでなく semantic overlap と dedupe key で重複確認する
    3. open duplicate があれば再利用し、新規作成しない
    4. closed issue は自動 reopen しない
    5. 実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 の実装 scope に無理に押し込まない
    6. 新規 Issue は小さく bounded にする
    7. 新 framework / ledger / security harness を再発防止という名目だけで追加しない

    この target comment 由来で独立 follow-up が本当に必要になった場合の dedupe key 候補は:

    follow-up:squne121/loop-protocol:issues/2788#issuecomment-5848560731:vc-parser-consumer-parity

    です。

    ただし #2788 の修正そのものと重複するなら 作成しない でください。

    Stop conditions

    通常の contract refinement、review finding、testable AC の追加、既存 semantics 保存、今回コメントに基づく Allowed Paths 調整だけでは停止しないでください。

    以下は current skill の hard boundary に従って停止してください。

    • destructive / non-idempotent repository operation が必要
    • secret / credential の取得・出力・露出が必要
    • permission boundary の変更が必要
    • external service boundary の変更が必要
    • current skill が明示的に fail-closed とする integrity / capability failure が bounded retry 後も解消不能
    • GitHub mutation が安全に readback / verify できない
    • 今回の human-context directive でも authorize されない genuinely separate issue split が必要

    停止する場合も、単に「人間判断が必要」とだけ返さず、current skill の reason code / blocker evidence を残してください。

    完了条件

    以下を満たすまで終了しないでください。

    最後に root/main thread から一度だけ簡潔に報告してください。

    報告には最低限:

    • final refinement status
    • Issue 実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 の最終 URL
    • 最終 body SHA / current skill が提供する equivalent identity
    • 対象 OWNER comment から反映した主要 contract changes
    • codebase-investigator を spawn し completion を待ったこと
    • web-researcher の実行有無と、実行したなら completion を待ったこと
    • issue-editor の実行有無と、実行したなら completion を待ったこと
    • review iteration 数
    • final review verdict / blockers
    • Allowed Paths を変更したか、その理由
    • consumer parity と grouped AC / vc-regex-intent / annotation provenance / parse-error caller contract の最終 disposition
    • follow-up Issue の created / reused / skipped 結果
    • impl-review-loop / implementation / commit / PR 作成を開始していないこと

    を含めてください。

    この形なら、今回のコメントを単なる advisory review として読み飛ばさず、明示的な human-context authority → 調査 → Issue rewrite → fresh review の正規ルートに載せられます。また、現行 skill では refinement 完了が実装開始の認可ではないため、ここで impl-review-loop まで連結しないのが重要です。

  3. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    Termination: approved

    対象 OWNER コメント(Operator-Selected Human-Context): #2788 (comment)

    実施内容

    1. Step 0f preflight: 初回は STATUS: blocked(missing_required_section: .github/ISSUE_TEMPLATE/implementation.yml が要求する6セクション欠落)。issue-editor による structured 補完(Parent Issue / Parent Goal Ref / Current Validated Scope / Remaining Parent Gaps / Runtime Verification Applicability / Required Skills の6セクション追加)を経て STATUS: pass に解消。
    2. Step 1 investigation: codebase-investigator SubAgent を起動し completion を待機。対象 OWNER コメントが指摘した VC parser consumer parity(vc_contract_syntax.py の _COMPOUND_SHELL_RE、legacy parse_commands_from_block() の field 差分、compute_canonical_vc_plan() の direct caller 3件、_distinct_command_texts_from_body() 等)を current main の実装・テストと照合し、OWNER コメントの技術的主張が全て正しいことを確認。
    3. Issue 本文 rewrite(issue-editor 経由、3回、いずれも completion 待機 + live body readback で確認):
      • 6セクション追加 + Background内の孤立backtick修正(guard誤検知の原因を特定・修正)
      • OWNER レビュー反映の大幅拡張(AC5拡張 + AC9-AC13 新規、In Scope/Out of Scope拡張、VC section再構成)
      • AC8 VC コマンドへ # preflight-scope: pr_review_only 追加(既存の低速な regression suite が Step 2 の per-command timeout を超過したための既存サポート済み annotation 適用)
    4. Step 2 canonical review(run_root_review_pipeline.py produce、background実行 + completion join、2回): 最終的に verdict: approve / next_action: proceed(blocking findings なし)。
    5. Step 2.5 semantic design review(issue-design-reviewer SubAgent、completion待機): effective_verdict: approve。low-severity の non-blocking clarity finding 2件を記録(rewrite不要、warningとして残存)。
    6. Step 4.5 follow-up materialization: 作業中に発見した独立の再発性バグ(guard-issue-body.py::_strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングする不具合。#2788の実装scopeとは無関係)について、重複確認(既存Issue検索で重複なし)の上、新規 Issue 実装: guard-issue-body.py の _strip_fenced_code_blocks() が prose 内の孤立backtick列を実fenceと誤ペアリングし template_guard を false-positive にする不具合を修正する #2794 を起票。

    Consumer Parity / 技術論点の最終 disposition

    • quote-aware compound shell 判定: AC9 で regression 固定(新規AC)
    • vc-regex-intent: literal-pipe-ok: AC5 拡張で保持を明記
    • annotation provenance(annotation_source.line/raw): AC5 拡張で保持を明記
    • grouped AC の subprocess launch 数不変 invariant: AC11 で明記
    • history snapshot command population parity: AC12 で明記
    • compute_canonical_vc_plan() の parse-error caller-facing contract: AC13 で明記(Allowed Paths 拡張を避ける設計を優先候補として明記)

    Allowed Paths

    変更なし。AC13 の設計方針(既存 direct caller への変更を避け、shared parser で一度 parse してから plan producer を呼ぶかどうかを判断する構造を優先する)により、contract_readiness_check.py 等への Allowed Paths 拡張は不要と判断。

    Follow-up

    実装フェーズへの移行について

    本 invocation は issue-refinement-loop の実行のみを依頼されたものであり、impl-review-loop / implementation-worker / 実装用 worktree / production code 修正 / commit / push / PR 作成のいずれも開始していない。

    LOOP_HANDOFF_RESULT_V1:
      status: refinement_approved
      routing_action: none
      checked_body_sha256: f0542e403cdcc7126b3fcdd233b9871771843f85ece3f1ae3454da9a58cde64d
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
      blockers: []
      generated_at: "2026-09-27T03:44:36Z"
  4. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    推奨は、#2788 をそのまま impl-review-loop に投入して実装フェーズへ移行です。Issue はすでに refinement_approved まで到達しており、現行 main(確認時 f8fa7428ab006ccf04d0d8e3ae624f2d2b17de81)でも、normal execution / canonical plan / history population の legacy parser 利用、shared parser の quote-unaware compound 判定、vc-regex-intent / annotation provenance 欠落が残っています。つまり no-op ではありません。

    再発防止については、refinement 中に発見された独立問題がすでに #2794 として起票されています。今回の調査では、それとは別に今すぐ追加Issue化すべき独立問題は見つかっていません。実装中に新たな再発性問題が判明した場合のみ、重複検索して follow-up を起票するのが適切です。PR #2786 はすでに merge 済みで、検索上 baseline_vc_preflight / vc_contract_syntax を対象にした open PR も見つかりませんでした。ただし impl-review-loop の pre-Step-1 landing disposition で live 状態を再確認させるべきです。

    以下を、そのまま auto mode の ClaudeCode に渡せます。

    squne121/loop-protocol の Issue #2788 を対象に、current repository の

    .claude/skills/impl-review-loop/SKILL.md

    を正本として、実装・テスト・PR作成・レビュー修正ループを マージ直前の merge-ready 状態まで、人間の追加承認なしで 自律実行してください。

    対象:

    このプロンプト作成時点では Issue #2788 は refinement_approved 済みであり、implementation phase へ進める状態です。

    分析時点の main HEAD は

    f8fa7428ab006ccf04d0d8e3ae624f2d2b17de81

    でしたが、これを固定値として信用せず、開始時に必ず live main、Issue body、Issue comments、関連 PR、CI、repository state を再取得してください。

    最終目標

    Issue #2788 の live contract、Acceptance Criteria、Verification Commands、Allowed Paths を満たす実装を行い、

    1. implementation-worker による実装
    2. focused tests / Issue VC / repository-required tests
    3. Draft PR 作成
    4. Closes #2788 の設定
    5. pr-reviewer によるレビュー
    6. blocker / REQUEST_CHANGES に対する fix_delta
    7. 再テスト
    8. 再レビュー
    9. current-head required CI の確認
    10. unresolved review thread / blocker の解消

    を bounded loop で繰り返し、current impl-review-loop が定義する merge-ready 条件まで到達してください。

    PR の merge 自体は実行しないでください。
    auto-merge も有効化しないでください。

    merge 可能な直前状態で終了し、最終報告を出してください。

    人間承認について

    通常の実装判断・needs-fix・テスト失敗修正・レビュー指摘対応・再push・review iteration ごとに人間へ確認を求めないでください。

    current impl-review-loop の loop policy と routing を使用し、通常の continue_loop / fix_delta は自律継続してください。

    以下は承認待ち理由にしないでください。

    • implementation-worker の通常の設計判断
    • focused test failure
    • reviewer の REQUEST_CHANGES
    • lint / typecheck / test failureの修正
    • PR description の更新
    • review thread への対応
    • iteration continuation
    • advisory な contract snapshot / product-spec warning
    • mergeability UNKNOWN の bounded retry
    • current-head CI の再確認

    ただし、live Issue #2788 の hard Stop Conditions や current impl-review-loop が定義する actual conflict / hard escalation boundary を無視してはいけません。

    特に以下は勝手に突破しないでください。

    • Issue の Allowed Paths 外の production change が本当に必要
    • Issue の固定 contract 自体の変更が不可避
    • actual Git conflict
    • destructive operation
    • secret / credential の取得・表示・変更
    • current skill が明示的 hard-stop とする条件

    これらが発生した場合は、可能な非破壊的調査・再発防止 Issue materialization まで行ったうえで、その理由と evidence を最終報告してください。

    pre-Step-1: duplicate / landing disposition

    implementation-worker を起動する前に、current impl-review-loop の Evidence-Based Landing Disposition を必ず実施してください。

    Issue #2788 を満たす:

    • merged PR
    • open PR
    • draft PR
    • current main 上の landed implementation
    • durable implementation scope marker

    が存在しないか live evidence で確認してください。

    検索結果を自己解釈して新規PRを即作成せず、current skill の canonical disposition producer を利用してください。

    routing は current skill に従い:

    • implementation_already_landed
    • existing_pr_resume
    • already_satisfied
    • ordinary_dispatch_or_explicit_recovery
    • reconciliation_required

    をそのまま扱ってください。

    既存PRが見つかれば duplicate PR を作らず resume してください。

    分析時点では #2788 を閉じる implementation PR は確認できていませんが、この情報は stale になり得るため必ず live re-check してください。

    必須 SubAgent 利用

    root/main thread 自身だけで実装・テスト・レビューを完結させないでください。

    current impl-review-loop が規定する SubAgent を使用してください。

    最低限:

    • implementation-worker
    • test-runner
    • pr-reviewer

    を適切な Step で使用してください。

    追加調査が必要なら codebase-investigator 等、current skill が許可する read-only SubAgent を使用してください。

    completion / join の絶対条件

    SubAgent を spawn した場合、必ずその SubAgent の completion を待ってください。

    特に:

    • implementation-worker が完了する前に実装完了扱いしない
    • test-runner が完了する前に tests PASS 扱いしない
    • pr-reviewer が完了する前に review verdict を推測しない
    • 複数 SubAgent を並列起動した場合、routing に必要な全 SubAgent を join してから次 Step へ進む
    • SubAgent の散文要約を root thread が勝手に別の verdict に読み替えない
    • current skill が要求する structured result を保持する

    こと。

    SubAgent の未完了状態を理由に root thread が同じ仕事を横取りして完了扱いすることは禁止します。

    Issue #2788 で特に確認すべき実装ポイント

    Issue body を正本としつつ、以下は実装レビューで明示的に確認してください。

    1. parser authority の一本化

    現在の baseline_vc_preflight.py では少なくとも normal execution が legacy

    extract_fenced_bash_blocks() + parse_commands_from_block()

    を使用しています。

    compute_canonical_vc_plan() も同じ legacy parser population を使用しています。

    _distinct_command_texts_from_body() も legacy parser を使用しています。

    これらを Issue #2788 の AC1 / AC2 / AC6 / AC12 に従い、既存

    vc_contract_syntax.parse_verification_commands_section()

    またはその VcParseResult.commands を source of truth とする薄い shared adapter へ統一してください。

    新しい第三の VC grammar parser を作らないでください。

    2. quote-aware compound detection

    current vc_contract_syntax.py の _COMPOUND_SHELL_RE による command 全体への regex 判定は、

    rg -n "foo|bar" PATH

    の quoted regex alternation を shell pipe と誤認し得ます。

    一方 baseline_vc_preflight.detect_compound_command() には shlex ベースの quote-aware 判定があります。

    Issue AC9 に従い、compound-shell 判定 primitive を shared authority に一本化してください。

    少なくとも以下を regression test で固定してください。

    • quoted "foo|bar" は shell pipe ではない
    • quote 外の |, &&, ;, redirect 等は compound shell
    • malformed shell tokenization は現在の fail-closed semantics を維持
    • 独立した第二・第三の regex-based compound detector を追加しない

    3. vc-regex-intent を lossless に保持

    legacy parser が持つ

    # vc-regex-intent: literal-pipe-ok

    の semantics を shared parser migration で消さないでください。

    特に:

    rg -n "foo\|bar" PATH

    が regex_literal_pipe_suspected に分類される既存挙動と、

    # vc-regex-intent: literal-pipe-ok

    が付いた場合に normal execution が許可される既存挙動を両方固定してください。

    単に annotation 行を parser が「コメントとして無視する」だけでは不十分です。

    値を downstream execution まで保持してください。

    4. annotation provenance

    Issue #889 由来の externally-observable result semantics を維持してください。

    最低限 current consumers/tests を inventory し、

    • annotation value
    • annotation_source.line
    • annotation_source.raw

    を shared parser migration 後も lossless に扱ってください。

    既存 result JSON から provenance が消える変更は regression として扱ってください。

    5. grouped AC

    shared parser の VcCommandEntry.ac_refs と normal execution の scalar ac の差を明示的に処理してください。

    必須 invariant:

    1 source command = 1 canonical plan occurrence = 1 subprocess launch

    です。

    # AC2, AC3 のような grouped marker を AC association ごとに複製して、同じ subprocess を2回以上実行してはいけません。

    ac_refs の representation が必要なら additive / deterministic にしてください。

    set iteration order に依存して scalar ac を決める実装は禁止します。

    backward-compatible scalar ac が current consumer に必要なら、consumer inventory に基づいて deterministic rule を定義・testしてください。

    6. canonical plan parse-error contract

    non-canonical VC inputを canonical plan / normal execution の subprocess candidate にしてはいけません。

    特に説明用 non-$ 行が bash fence 内に存在する場合は、subprocess 起動前に deterministic に拒否してください。

    一方、compute_canonical_vc_plan() の direct caller に新しい未処理 Python exception を漏らして workflow 自体を crash させてはいけません。

    current main の direct callers を再確認してください。

    少なくとも refinement 時点では:

    • contract_readiness_check.py
    • run_contract_review_once.py
    • run_root_review_pipeline.py

    が確認されています。

    Issue #2788 はこれらを Allowed Paths に含めていません。

    そのため AC13 に従い、まず Allowed Paths 内で parse result を一度確定し、parse error がある場合は unsafe な plan/execution pathへ進まない最小設計 を検討してください。

    もし AC13 を正しく満たすために本当に Allowed Paths 外の production code 修正が不可避だと repository evidence が示した場合、無理な workaround を入れないでください。

    Issue の hard Stop Condition として扱い、必要なら独立 follow-up Issue を起票して evidence を報告してください。

    7. history population

    _distinct_command_texts_from_body() が docstring どおり canonical plan と同じ command population を使用することを AC12 の test で固定してください。

    8. duplicate diagnostic

    compute_duplicate_diagnostic_report() 自体の diagnostic 表示再設計は Issue の Out of Scope です。

    ACを満たすために不要なら scope creep させないでください。

    legacy population を残す場合は、なぜ status authority ではなく diagnostic-only として許容されるのか PR に明記してください。

    テスト

    Issue body の Verification Commands を正本として実行してください。

    特に新設予定の focused regression:

    .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight_shared_command_parser.py

    で AC1-AC4 / AC6-AC7 / AC9-AC13 を明確に固定してください。

    既存 suites:

    .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py

    .claude/skills/issue-contract-review/tests/

    も Issue の VC / current workflow contract に従って実行してください。

    AC8 の pr_review_only annotation は尊重し、baseline phase と PR-review phase の execution scope を勝手に混同しないでください。

    focused tests が通っただけで merge-ready にしないでください。

    current repository の branch protection / required CI を live 取得し、PR current head に対する required checks を確認してください。

    分析時点では main branch の required checks として少なくとも:

    • typecheck
    • lint
    • test
    • build
    • python-test
    • validate-generated-artifact

    が設定されていました。

    これも live state を正本として再確認してください。

    PR

    新規 implementation が必要なら current skill / implement-issue / open-pr の canonical workflow に従い dedicated worktree を使用してください。

    PR はまず Draft とし、Issue #2788 を閉じる relation を明示してください。

    PR body に:

    Closes #2788

    を含めてください。

    Issue の current scope/AC/Allowed Paths と PR diff の対応を明確にし、可能なら current workflow が要求する implementation scope coverage marker / evidence を生成してください。

    Issue body の Allowed Paths 外へ diff を広げないでください。

    PR作成後はそこで終了せず、そのPRを対象として同じ impl-review-loop のレビュー・fix_delta loop を継続してください。

    review loop

    pr-reviewer の verdict を current skill の canonical routing へそのまま入力してください。

    REQUEST_CHANGES / blockers があれば implementation-worker に fix_delta として返し、修正完了を待ってください。

    修正後:

    • test-runner
    • push
    • current-head CI
    • pr-reviewer

    を必要に応じて再実行してください。

    review thread を修正した場合、修正内容を確認したうえで current skill が許可する場合のみ resolve してください。

    単に「対応しました」とコメントしただけで blocker 解消扱いしないでください。

    merge-ready 判定

    verdict: APPROVE だけでは終了しないでください。

    current impl-review-loop の merge-ready 条件を正本としてください。

    少なくとも:

    • live mergeability が current skill 上 acceptable
    • blockers == []
    • current-head required CI が成功
    • Allowed Paths gate が通る
    • unresolved blocking review thread がない
    • PR が target Issue の current contract を満たす
    • PR head がレビュー・CI対象 head と一致している

    ことを確認してください。

    mergeability / CI が stale なら再取得してください。

    PR head 更新前の成功結果を流用しないでください。

    再発防止 Issue

    実装・テスト・レビュー中に、#2788 の局所修正だけでは再発しそうな 独立した問題 を発見した場合は、GitHub Issue を起票してください。

    ただし必ず先に open / closed Issue を検索して重複確認してください。

    以下の分類をしてください。

    #2788 scope 内の問題

    #2788 の AC を正しく満たすために必要で、Allowed Paths 内で修正できる問題なら、原則として current PR で修正してください。

    別Issueへ逃がして #2788 を false-green にしないでください。

    独立した non-blocking recurring problem

    #2788 の AC 達成には不要だが同じ failure pattern が今後再発し得る場合:

    を記載した follow-up Issue を起票してください。

    起票後も #2788 と独立で non-blocking なら current loop を継続してください。

    blocking / out-of-scope recurring problem

    #2788 を正しく完了するために必要だが Allowed Paths 外変更等の hard Stop Condition に当たる場合:

    1. 重複確認
    2. 必要な follow-up Issue 起票
    3. evidence を保存
    4. 実装: baseline_vc_preflight の通常実行を shared VC parser に統一し説明用 bash 行の誤実行候補化を防ぐ #2788 loop は current skill / live Issue Stop Condition に従って停止

    としてください。

    Issue contract を黙って逸脱して突破してはいけません。

    既存 #2794

    refinement 中に発見された

    guard-issue-body.py::_strip_fenced_code_blocks() の orphan backtick / fence pairing 問題

    はすでに Issue #2794 として起票済みです。

    同じ問題を新しいIssueとして重複起票しないでください。

    #2794 は #2788 implementation の blocker ではありません。

    禁止事項

    最終報告

    終了時は少なくとも以下を構造化して報告してください。

    merge-ready の場合、人間が行う次の操作は PR の最終確認と merge のみにしてください。

    このプロンプトでは、通常の修正ループは止めず、Issue 自体の hard Stop Condition だけは突破しないよう分離しています。特に #2788 は AC13 が Allowed Paths 境界に接しているため、そこを無理に自動突破させないのが重要です。

  5. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-27T04:51:27Z)

  6. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-27T05:15:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2796"
      head_sha: "e8d6b279565f16826794f43b3a34d2b46d859bd9"
      issue_number: 2788
      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: []
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions