Skip to content

fix(#1013-followup): loop-state.md の散文誤記修正 — review phase の hard_stop_eligible を false に修正 #1040

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
subkind: docs-only
goal_ref: "loop-state.md 散文中の review phase hard_stop_eligible 誤記を修正し docs 整合性を回復する"
allowed_paths:
  - ".claude/skills/issue-refinement-loop/references/loop-state.md"
acceptance_criteria:
  - id: AC1
    description: "references/loop-state.md の散文中で hard_stop_eligible == true の例示から review が削除され、正しい prose が存在している"
  - id: AC2
    description: "同ファイルの phase table(review | continue_investigation | false)は変更されていない"
  - id: AC3
    description: "修正後の散文が post_rewrite_check および decide_next_action のみを hard_stop_eligible == true の phase として列挙している"
  - id: AC4
    description: "loop-state.md の phase table description が review phase で decide_next_loop_action.py を呼ばないことを明示している"
  - id: AC5
    description: "pnpm typecheck と pnpm test が pass する(pnpm lint/build は本 Issue 対象外の pre-existing failure があるため対象外)"
labels:
  - documentation
  - area/ai-ops
dedupe_key: "fix:loop-state.md:review-phase-hard-stop-eligible-prose"
related_issue: "#1013"
related_pr: "#1030"

Parent Issue

なし(standalone 実装 Issue)

Parent Goal Ref

issue-refinement-loop の phase gate 整合性維持 — PR #1030 マージ後に残存した loop-state.md 散文誤記を修正し、normative docs と実装の一貫性を保つ。

Current Validated Scope

  • .claude/skills/issue-refinement-loop/references/loop-state.md の散文中の hard_stop_eligible == true 例示から review を削除する 1 箇所のみ

Remaining Parent Gaps

なし

Goal

.claude/skills/issue-refinement-loop/references/loop-state.md の散文中で review phase の hard_stop_eligible が true と誤記されている箇所を false に修正する。

Background

PR #1030(Issue #1013: issue-refinement-loop phase gate 追加)のマージ後、PR reviewer が以下の非ブロッカー誤記を指摘した:

  • ファイル: .claude/skills/issue-refinement-loop/references/loop-state.md
  • 問題: phase table 直後の散文で review phase が hard_stop_eligible: true であるかのように記述されている
  • 正しい値: review phase は pre-rewrite phase のため hard_stop_eligible: false
  • 影響: 直上の phase table(review | continue_investigation | false)は正確であり、実装・テストも正しい。runtime 動作への影響はなく、docs の一貫性問題のみ

具体的には、以下の誤記が存在する:

hard_stop_eligible == true (i.e., phase is 'review', 'post_rewrite_check', or 'decide_next_action')

この文の review は hard_stop_eligible: false であるため削除し、正しくは post_rewrite_check または decide_next_action とすべきである。

重要性: loop-state.md は orchestrator/agent 向け契約文書であるため、誤記を放置すると将来の routing 実装・手順修正で誤った hard stop を再導入するリスクがある。現行コードの phase gate と allowlist が守られる限り runtime 影響はないが、normative docs の矛盾として修正が必要。

品質ゲートについて: pnpm lint および pnpm build はこの Issue と無関係の pre-existing failure が存在する(pnpm lint: 3980 errors、pnpm build: rolldown error)。これらは本 Issue のスコープ外であり、別途追跡される。AC5 は pnpm typecheck と pnpm test のみを対象とする。

Outcome

.claude/skills/issue-refinement-loop/references/loop-state.md の散文中で review が hard_stop_eligible == true の例示から除外され、phase table との整合性が保たれる。review phase が explicitly not hard-stop eligible であることが散文中でも明確になる。

In Scope

  • .claude/skills/issue-refinement-loop/references/loop-state.md の散文誤記修正(review を hard_stop_eligible == true 例示から除外)

Out of Scope

  • runtime ロジック(build_refinement_phase_state.py 等)の変更
  • テストファイルの変更
  • phase table の変更(既に正確)
  • pnpm lint / pnpm build の pre-existing failure 修正

Acceptance Criteria

  • AC1: references/loop-state.md の散文中で hard_stop_eligible == true の例示から review が削除され、正しい prose が存在している
  • AC2: 同ファイルの phase table(review | continue_investigation | false)は変更されていない(既に正確)
  • AC3: 修正後の散文が post_rewrite_check および decide_next_action のみを hard_stop_eligible == true の phase として列挙している
  • AC4: loop-state.md の phase table description が review phase で decide_next_loop_action.py を呼ばないことを明示している
  • AC5: pnpm typecheck と pnpm test が pass する

Verification Commands

# AC1
$ rg "is .post_rewrite_check. or" .claude/skills/issue-refinement-loop/references/loop-state.md
# AC2
# baseline-expect: pass
$ rg "review.*continue_investigation.*false" .claude/skills/issue-refinement-loop/references/loop-state.md
# AC3
$ rg "post_rewrite_check. or.*decide_next_action" .claude/skills/issue-refinement-loop/references/loop-state.md
# AC4
# baseline-expect: pass
$ rg "NOT call.*decide_next_loop_action" .claude/skills/issue-refinement-loop/references/loop-state.md
# AC5
$ pnpm typecheck
$ pnpm test

Allowed Paths

  • .claude/skills/issue-refinement-loop/references/loop-state.md

Runtime Verification Applicability

runtime_verification_applicability:
  decision: not_applicable
  status: not_applicable
  reason: "docs-only 変更。loop-state.md は参照ドキュメントであり実行されない。"

Stop Conditions

  • Allowed Paths 外のファイルへの変更が必要と判明した場合
  • loop-state.md の phase table や実装ロジックを変更しないと散文修正できない場合
  • PR レビューで先行 Issue の実装が必要と判明した場合
  • scope-signal-guard.md の内容と矛盾する修正が必要と判明した場合
  • 散文修正が references/ 内の他ファイルへの連鎖修正を引き起こす場合
  • build_refinement_phase_state.py の実装と不整合が生じる修正が必要と判明した場合

Required Skills

  • Markdown ドキュメント編集
  • loop-state.md の phase gate 仕様の理解(hard_stop_eligible semantics)

Source

Activity

  1. added
    documentation
    area/ai-ops
    on Jun 20, 2026
  2. squne121 commented on Jun 20, 2026

    @squne121
    OwnerAuthor

    結論

    Issue #1040 は 対応すべきです。ただし、単なる「散文の誤字」ではなく、issue-refinement-loop の phase gate 契約に関わる normative docs の矛盾修正として扱うべきです。

    現状の loop-state.md は、phase table では review | continue_investigation | false と正しく定義している一方、その直後の散文で review を hard_stop_eligible == true の例に含めています。これは #1040 の指摘どおり矛盾しています。

    敵対的レビュー

    1. #1040 の問題設定は正しい

    #1040 は、PR #1030 後の follow-up として、loop-state.md の散文中にある review phase の hard_stop_eligible 誤記を直す Issue です。Issue 本文では、正しい値は review: false、hard_stop_eligible == true は post_rewrite_check と decide_next_action のみと明記されています。

    また、#1040 自体にはコメントがなく、追加仕様や反対意見はありません。

    2. 「runtime 影響なし」はやや危険な断定

    #1040 本文では「runtime 動作への影響はなく、docs の一貫性問題のみ」とされていますが、これは phase gate を正しく守る orchestrator 前提なら成立します。敵対的に見ると、この断定は弱いです。

    build_refinement_phase_state.py の実装では、review phase は hard_stop_eligible: False で、decide_next_loop_action.py も forbidden router に入っています。 一方、post_rewrite_check と decide_next_action は hard_stop_eligible: True です。

    ただし、decide_next_loop_action.py の中核 routing は、呼ばれてしまえば scope_signal_guard.triggered かつ excluded_by_anchor_reframe == false を human_escalation にします。 つまり、docs の誤記を読んだ人間または agent が review phase で router を呼ぶ実装に寄せると、#1013 が防ごうとした premature human escalation を再導入できます。

    したがって、#1040 の説明はこう補強すべきです。

    現行コードの phase gate と allowlist が守られる限り runtime 影響はない。ただし、loop-state.md は orchestrator/agent 向け契約文書であるため、誤記を放置すると将来の routing 実装・手順修正で誤った hard stop を再導入するリスクがある。

    3. 修正範囲は妥当。ただし同じ行周辺に小さな追加矛盾がある

    #1040 の Allowed Path を .claude/skills/issue-refinement-loop/references/loop-state.md だけに限定するのは妥当です。scope-signal-guard.md 側は、review を hard_stop_eligible: false として正しく記述しています。

    ただし、loop-state.md の preflight 行は “proceed to investigation/review” と書いており、scope-signal-guard.md 側の “investigation/web_research/review” と完全一致していません。
    #1040 の主目的ではありませんが、同一ファイル・同一表の整合性修正として、ついでに investigation/web_research/review にそろえる価値があります。

    推奨パッチ

    最小修正はこれです。

     When `triggered == true` AND `excluded_by_anchor_reframe == false` AND
    -`hard_stop_eligible == true` (i.e., phase is `review`, `post_rewrite_check`, or
    -`decide_next_action`), the loop stops with `human_escalation`.
    +`hard_stop_eligible == true` (i.e., phase is `post_rewrite_check` or
    +`decide_next_action`), the loop stops with `human_escalation`.

    品質を上げるなら、曖昧さを潰してこうする方が安全です。

     When `triggered == true` AND `excluded_by_anchor_reframe == false` AND
    -`hard_stop_eligible == true` (i.e., phase is `review`, `post_rewrite_check`, or
    -`decide_next_action`), the loop stops with `human_escalation`. See
    +`hard_stop_eligible == true` (i.e., phase is `post_rewrite_check` or
    +`decide_next_action`), the loop stops with `human_escalation`. The `review`
    +phase is explicitly not hard-stop eligible; route it directly by `VERDICT`
    +without invoking `decide_next_loop_action.py`. See
     `references/scope-signal-guard.md` for signal taxonomy and phase-gate rules.

    任意の同時修正として、同じ表の preflight 行も合わせるなら以下です。

    -| `preflight` | `continue_investigation` | false | Signal seen during preflight → proceed to investigation/review; do NOT call `decide_next_loop_action.py` |
    +| `preflight` | `continue_investigation` | false | Signal seen during preflight → proceed to investigation/web_research/review; do NOT call `decide_next_loop_action.py` |

    Acceptance Criteria の改善案

    現行 AC は概ね妥当ですが、grep が粗いです。特に AC3 の post_rewrite_check.*decide_next_action は、同じ行に両方があれば通るだけで、「review が除外された」ことの強い証明にはなりません。

    修正版は以下がよいです。

    - [ ] AC1: `loop-state.md` の hard-stop prose から `review` が除外されている。
    - [ ] AC2: phase table の `review | continue_investigation | false` 行は維持されている。
    - [ ] AC3: hard-stop prose は `post_rewrite_check` と `decide_next_action` のみを `hard_stop_eligible == true` phase として列挙している。
    - [ ] AC4: `scope-signal-guard.md` と `build_refinement_phase_state.py` の phase semantics と矛盾しない。
    - [ ] AC5: `pnpm typecheck && pnpm lint && pnpm test && pnpm build` が pass する。ローカル既存権限問題などで失敗する場合は、失敗理由と CI 結果を PR 本文に明記する。

    検証コマンドも、より exact にするなら以下です。

    # review 行が false のまま
    rg -n '^\| `review` \| `continue_investigation` \| false \|' \
      .claude/skills/issue-refinement-loop/references/loop-state.md
    
    # 誤った parenthetical が残っていない
    ! rg -n 'phase is `review`, `post_rewrite_check`, or `decide_next_action`' \
      .claude/skills/issue-refinement-loop/references/loop-state.md
    
    # 正しい true phase の列挙がある
    rg -n 'phase is `post_rewrite_check` or[[:space:]]*`decide_next_action`' \
      .claude/skills/issue-refinement-loop/references/loop-state.md

    WEB調査からの品質化ポイント

    JSON Schema では、additionalProperties: false により未定義プロパティを拒否でき、required で必須キーを定義します。したがって #1013 の設計どおり、phase を LOOP_STATE_V1 に混ぜず、別契約 ISSUE_REFINEMENT_PHASE_STATE_V1 として扱う方針は妥当です。(JSON Schema)

    python-jsonschema は validate() で最初の ValidationError を投げますが、複数エラーを構造化したい場合は iter_errors() が使えます。今回 #1040 ではコード変更不要ですが、将来 ISSUE_REFINEMENT_ROUTER_ERROR_V1 の missing_fields / unexpected_fields を高品質化するなら、単一メッセージ抽出より iter_errors() ベースに寄せるべきです。([jsonschema]2)

    また Python の sys.exit() は 0 が正常、非 0 が異常終了として扱われ、Unix 系では 2 がコマンドライン構文エラーによく使われます。decide_next_loop_action.py は exit 3 を router_error / inconsistent_state に使う内部契約なので、docs 側では human_escalation と router_error: rebuild_phase_state を混同しない記述にするのが重要です。([Python documentation]3)

    最終判定

    実装可。ただし PR レビューでは “docs-only trivial” として流さず、契約文書の矛盾修正として見るべきです。

    推奨する実装方針は次の通りです。

    1. loop-state.md の hard-stop prose から review を削除する。
    2. 可能なら同じ表の preflight 行を investigation/web_research/review に合わせる。
    3. runtime script・test は変更しない。
    4. PR 本文で「現行コードの phase gate とは整合済み、docs の normative prose を修正」と明記する。
    5. 品質ゲートは通常どおり実行し、失敗が既存環境由来なら握りつぶさず記録する。プロジェクト憲法上も docs-only 変更でも可能なら同じ品質ゲートを通す方針です。
  3. squne121 commented on Jun 20, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  4. squne121 commented on Jun 20, 2026

    @squne121
    OwnerAuthor

    CONTRACT_REVIEW_RESULT_V1

    schema: CONTRACT_REVIEW_RESULT_V1
    status: go
    issue_number: 1040
    repo: squne121/loop-protocol
    generated_at: "2026-06-20T13:48:00Z"
    body_sha256: "sha256:0f8f6f38f79f23dcdeba6e7159a3ad5a5e8b5c4b6299fdc953944a0c1f410933"
    
    outcome: >
      .claude/skills/issue-refinement-loop/references/loop-state.md の散文中で
      review phase が hard_stop_eligible == true の例示から削除され、
      phase table との整合性が保たれる。
    
    acceptance_criteria:
      - id: AC1
        description: "references/loop-state.md の散文中で hard_stop_eligible == true の例示から review が削除され、正しい prose が存在している"
      - id: AC2
        description: "同ファイルの phase table(review | continue_investigation | false)は変更されていない"
      - id: AC3
        description: "修正後の散文が post_rewrite_check および decide_next_action のみを hard_stop_eligible == true の phase として列挙している"
      - id: AC4
        description: "loop-state.md の phase table description が review phase で decide_next_loop_action.py を呼ばないことを明示している"
      - id: AC5
        description: "pnpm typecheck と pnpm test が pass する"
    
    allowed_paths:
      - ".claude/skills/issue-refinement-loop/references/loop-state.md"
    
    worktree_branch:
      worktree: ".claude/worktrees/issue-1040-loop-state-review-hard-stop-prose"
      branch: "worktree-issue-1040-loop-state-review-hard-stop-prose"
      collision: false
    
    required_skills:
      - "Markdown ドキュメント編集"
      - "loop-state.md の phase gate 仕様の理解(hard_stop_eligible semantics)"
    
    runtime_verification_applicability:
      decision: not_applicable
      status: not_applicable
      reason: "docs-only 変更。loop-state.md は参照ドキュメントであり実行されない。"
    
    checks:
      template_compliance:
        status: pass
        notes: "contract_schema_version: v1 / issue_kind: implementation / subkind: docs-only 確認済み"
    
      state_label:
        status: pass
        notes: "state/needs-human ラベルなし"
    
      allowed_paths_present:
        status: pass
        paths:
          - ".claude/skills/issue-refinement-loop/references/loop-state.md"
    
      vc_present:
        status: pass
        count: 6
    
      stop_conditions_complete:
        status: pass
        notes: "6 項目の Stop Conditions が明記されている"
    
      vc_preflight:
        schema: "baseline_vc_preflight/v1"
        status: pass
        summary:
          expected_fail: 2
          unexpected_pass: 0
          blocked: 0
          human_judgment: 0
          expected_pass: 4
          skipped: 0
          extraction_errors: 0
        classifications:
          - ac: AC1
            scope_class: baseline_fail_expected
            decision: go
            exit_code: 1
            note: "実装前は対象テキストが存在しないため exit1 は想定内"
          - ac: AC2
            scope_class: regression_gate
            decision: go
            exit_code: 0
            note: "phase table の review|continue_investigation|false 行は現在も正確"
          - ac: AC3
            scope_class: baseline_fail_expected
            decision: go
            exit_code: 1
            note: "実装前は正しい prose が存在しないため exit1 は想定内"
          - ac: AC4
            scope_class: regression_gate
            decision: go
            exit_code: 0
            note: "NOT call decide_next_loop_action テキストは現在も存在"
          - ac: AC5
            commands:
              - raw: "pnpm typecheck"
                scope_class: regression_gate
                decision: go
                exit_code: 0
              - raw: "pnpm test"
                scope_class: regression_gate
                decision: go
                exit_code: 0
                note: "67 test files, 898 tests passed"
    
      ac_verifiability:
        status: pass
        notes: "AC1-AC5 すべてチェックボックス形式。VC との番号一致確認済み"
    
      product_spec_check:
        applicability: not_applicable
        decision: pass
        notes: "allowed_paths が docs/product 配下でなく product spec トリガー条件非該当"
    
      worktree_branch_collision:
        status: pass
        notes: "issue-1040 の worktree/branch は現在存在しない"
    
      blockers:
        status: pass
        notes: "check_blockers.sh: ブロッカーなし"
    
      next_action: "implement-issue へ handoff"
      blocked_reasons: []
  5. squne121 commented on Jun 20, 2026

    @squne121
    OwnerAuthor

    実装完了レポート

    PR #1045 を Draft で作成しました。

    実施内容

    .claude/skills/issue-refinement-loop/references/loop-state.md の散文中、hard_stop_eligible == true の例示から review phase を削除しました。

    変更箇所 (91-96行目):

    修正前:

    hard_stop_eligible == true (i.e., phase is `review`, `post_rewrite_check`, or
    `decide_next_action`), the loop stops with `human_escalation`.
    

    修正後:

    hard_stop_eligible == true (i.e., phase is `post_rewrite_check` or `decide_next_action`),
    the loop stops with `human_escalation`. The `review` phase is explicitly not
    hard-stop eligible; route it directly by `VERDICT` without invoking
    `decide_next_loop_action.py`.
    

    AC 検証結果

    AC VC コマンド 結果
    AC1 rg "is .post_rewrite_check. or" exit 0 (pass)
    AC2 rg "review.*continue_investigation.*false" exit 0 (pass)
    AC3 rg "post_rewrite_check. or.*decide_next_action" exit 0 (pass)
    AC4 rg "NOT call.*decide_next_loop_action" exit 0 (pass)
    AC5 pnpm typecheck pass
    AC5 pnpm test 67 test files, 898 tests passed

    Allowed Paths 準拠

    変更ファイル: .claude/skills/issue-refinement-loop/references/loop-state.md のみ(contract の Allowed Paths 内)

  6. added a commit that references this issue on Jun 20, 2026
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

    area/ai-opsdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions