Skip to content

調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない #2778

Open
1 of 1 issue completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "構造化リスト表現(Markdown 順序付き/非順序付きリスト、HTML <ol>/<ul>/<li> 貼り付け)の違いによらず、trusted with_human_context directive の explicit 判定と issue_editor_required ルーティングが一貫して機能するようにする"
change_kind: research-only

Parent Issue

なし(issue-refinement-loop 自体の再発防止 Issue)

Source

Background

再現 1: Issue #2730(HTML 貼り付け形式)

Issue #2730 で、OWNER が Issue #2730 に投稿した敵対的レビューコメント(#2730 (comment) )は、明確な P1/P2 findings を含む構造化された(番号付きリスト形式の)レビューであり、with_human_context lane で処理する operator-selected human-context directive として扱われた。

しかし contract_update.run.with_human_context を実行したところ、STATUS: blocked / NEXT_ACTION: human_judgment_required(BLOCKERS: PLANNER_FAIL_CLOSED)が返り、期待される NEXT_ACTION: issue_editor_required(#2620/#2724 の既存 production route)には到達しなかった。

根本原因を scope_signal_delta.classify_scope_delta_authority() を該当 evidence で直接実行して特定した:

authority_category: "human_review_directive"  (期待通り)
directive.confidence: "ambiguous"             (期待は "explicit")
route.action: "human_escalation"              (期待は "contract_update_required")
route.reason_code: "ambiguous_human_directive"

対象コメントの GitHub API 上の生 body を確認したところ、Markdown のプレーンテキストではなく、リッチテキストエディタ/ChatGPT 等からのコピー&ペーストに由来すると見られる HTML マークアップ(<html><body><h2><span>...</span></h2><ol start="1"><li><p>...</p></li></ol>... 等)がそのまま格納されていた。番号付きリストは Markdown の 1. 記法ではなく HTML <ol><li> タグで表現されている。

再現 2: Issue #2805(native Markdown 順序付きリスト、HTML 不使用)

Issue #2805 の OWNER アンカーコメント(#2805 (comment) )は、HTML を一切含まない プレーンな Markdown 順序付きリスト(1. **P1 — ...**、2. **P1 — ...** 形式)で構成された明確な P1 findings のレビューだった。にもかかわらず、with_human_context lane の処理は Issue #2730 とまったく同一の失敗シグネチャ(STATUS: blocked / NEXT_ACTION: human_judgment_required / BLOCKERS: PLANNER_FAIL_CLOSED、詳細は #2805 (comment) )を再現した。

統一された root cause(単一の classifier defect)

直接のコードベース調査(read-only)により、Issue #2730 と Issue #2805 の再現は 単一の統一された classifier defect に収束することが確認された。二つの独立した HTML-vs-Markdown defect ではない。

  • .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py 806行目: _BULLET_LINE_RE = re.compile(r"^\s*[-*]\s+\S.*$", re.MULTILINE) — 非順序リストマーカー(-/*)のみにマッチし、順序付きリストマーカー(1. 、2. 等)には一切マッチしない。
  • 同ファイル 1143行目付近 extract_directive_items() も stripped.startswith("- ") / "* " のみをチェックしており、順序付きリストの prefix を見落としている。
  • classify_directive_confidence()(同ファイル)は has_bullets = bool(_BULLET_LINE_RE.search(text)) を使用しており、directive marker は見つかっても has_bullets が False の場合は explicit ではなく ambiguous を返す(1189/1200行目付近)。
  • _cf_html_canonical_text() は HTML を自分で Markdown に変換しているわけではなく、CF_HTML paste envelope から GitHub 自身がレンダリングした Markdown の tail 部分を抽出しているだけである。したがって HTML <ol><li> 貼り付けの場合も、その GitHub レンダリング済み tail は同じくプレーンな Markdown 1. /2. になる —— つまり、HTML 貼り付けのケースも native Markdown 順序付きリストのケースと まったく同じ _BULLET_LINE_RE のギャップに衝突する。
  • decide_rewrite_route.decide_human_review_directive_editor_route()(.claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py、eligibility check は 1185行目付近)は、directive_confidence == "explicit" に加えて route_action == contract_update_required、with_human_context、anchor_binding_ok、same_target_ok、operations_empty、構造化 scope reframe でないこと、reviewer_feedback_url が非空であることを要求してから ROUTE_ISSUE_EDITOR_REQUIRED を選択する。この routing ロジック自体は正しく、変更は不要である。修正が必要なのは、上流の bullet/list 検出ロジックのみである。

これは、OWNER が明示的に選択した human-context directive の内容自体は明確であるにもかかわらず、comment のソース表現(構造化リストの記法差異: Markdown 非順序 / Markdown 順序付き / HTML 貼り付け)だけを理由に trusted directive が human_escalation へ誤分類される、再現性のある classifier defect である。

Outcome

構造化リスト表現(Markdown 順序付き/非順序付きリスト、HTML <ol>/<ul>/<li> 貼り付け)の違いによらず、trusted with_human_context directive の bullet/list 検出が一貫して機能するようにする方針を確定する。あわせて、この検出ギャップを再現する fixture ベースの regression test(#2730 の HTML 貼り付け再現と #2805 の native Markdown 順序付きリスト再現の両方をカバーする)を追加する方針を確定する。

In Scope

  • classify_directive_confidence() / extract_directive_items() / _BULLET_LINE_RE(.claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py)の箇条書き検出ロジックが、非順序 Markdown 記法(- /* )のみを対象とし、順序付き Markdown 記法(1. 等)と HTML 貼り付け由来の構造化リストの両方を見落としていることの確認(現状分析、806行目・1143行目付近を明記)
  • Positive representation matrix: 以下の表現がいずれも、genuine な directive marker を伴う場合に同等に検出される(confidence classification 上、同一に扱われる)ようにする設計方針の確定
    • Markdown 非順序: - ...
    • Markdown 非順序: * ...
    • Markdown 順序付き(HTML 不使用): 1. ...、2. ...
    • HTML 貼り付け: <ol><li>...
    • HTML 貼り付け: <ul><li>...
    • 明示的な非スコープ注記: 本 Issue は既存の正規表現/抽出ロジックの対象拡張であり、汎用的な GFM/CommonMark フルパーサの新規導入プロジェクトへスコープクリープしない
  • Negative controls: 修正によって以下がいずれも explicit human_review_directive に誤分類されないことを保証する設計方針の確定
    • directive marker を含まない単なる観察リスト
    • failure log
    • TODO/status report
    • 命令的な directive 内容を含まない順序付き/非順序リスト
    • trusted with_human_context lane 上にないコメント
    • 既存の安全策(_has_semantic_directive_bullet() 等)を弱めてはならないことを明記する
  • Production routing regression: 本番経路 with_human_context → human_review_directive → confidence: explicit → contract_update_required → (section-bound patch で directive を表現できない場合)→ issue_editor_required を通しでカバーする regression test の設計方針の確定。あわせて、この full-rewrite handoff が既存契約どおり writes: 0(GitHub への早期 mutation なし)を維持することの確認方針の確定
  • 既存の SCOPE_DELTA_AUTHORITY_EVIDENCE_V1 / classify_scope_delta_authority() の契約を壊さない範囲での改修方針の確定
  • Issue 調査: markdownlint-cli2 の gitignore option 導入是非を検討する #2730 の実際の comment body(HTML 形式)と Issue 調査: follow-up Issue の no-parent parent_issue: null 反復生成経路を特定し canonical none 強制策を決定する #2805 の実際のアンカーコメント(native Markdown 順序付きリスト形式)の両方を fixture として再現する regression test の設計方針

Out of Scope

Acceptance Criteria

  • 現在の _BULLET_LINE_RE(.claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py 806行目)が非順序 Markdown 記法(-/*)のみを対象にしており、順序付き Markdown 記法や HTML 貼り付け由来のリストを検出しないことが、正確な file:line 引用とともに本 Issue に記載されている
  • extract_directive_items()(同ファイル 1143行目付近)が同様に非順序 Markdown 記法のみを対象にしていることが、正確な file:line 引用とともに本 Issue に記載されている
  • Positive representation matrix(Markdown 非順序 - /* 、Markdown 順序付き 1. /2. 、HTML 貼り付け <ol><li>/<ul><li> の 5 パターン)が、genuine な directive marker を伴う場合にすべて explicit として分類される設計方針が記載されている
  • Negative controls(directive marker のない観察リスト、failure log、TODO/status report、命令的内容のない順序付き/非順序リスト、trusted lane 外のコメントの 5 パターン)が、修正後も explicit に誤分類されない(ambiguous/inferred のまま)ことを保証する設計方針が記載されている
  • 本番経路の regression(with_human_context → human_review_directive → confidence: explicit → contract_update_required → issue_editor_required、かつ writes: 0 の維持)をテストでカバーする方針が記載されている
  • Issue 調査: markdownlint-cli2 の gitignore option 導入是非を検討する #2730 の実際の comment body(HTML 形式)と Issue 調査: follow-up Issue の no-parent parent_issue: null 反復生成経路を特定し canonical none 強制策を決定する #2805 の実際のアンカーコメント(native Markdown 順序付きリスト形式)の両方を再現する fixture が、後続 implementation Issue の Allowed Paths 候補として特定されている
  • 採用方針に基づく implementation Issue が、標準の create-issue/create_issue_txn.py route(raw gh issue create ではない)で dedupe_key を伴って起票され、調査: markdownlint-cli2 の gitignore option 導入是非を検討する #2730 と 調査: follow-up Issue の no-parent parent_issue: null 反復生成経路を特定し canonical none 強制策を決定する #2805 の両方の再現を linked evidence として含んだ上で、本 Issue がそれを link している(対応不要と判断した場合はその理由が記載されている)

Verification Commands

  • AC: 現在の classify_directive_confidence() が bullet marker をどう検出しているかを確認する
# baseline-expect: pass
$ rg -n "def classify_directive_confidence" .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py
  • AC: _BULLET_LINE_RE と extract_directive_items() の定義位置を確認する
# baseline-expect: pass
$ rg -n "_BULLET_LINE_RE|def extract_directive_items" .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py
  • AC: 既存の regression test(negative control の先例)を確認する
# baseline-expect: pass
$ rg -n "test_ac4_ambiguous_no_bullet_directive_never_escalates|test_bare_severity_heading_does_not_produce_explicit_directive_confidence" .claude/skills/issue-refinement-loop/tests/

Allowed Paths

  • (none)

Stop Conditions

  • Outcome / Scope / AC が検索可能な形で記載されていない場合は即停止
  • Allowed Paths 外への書き込みを試みた場合は即停止
  • 権限不足(permission denied)により操作が完了できない場合は即停止
  • 成果物の書き込みに失敗した場合(I/O エラー等)は即停止

Handoff Contract

Notes for Reviewer

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. changed the title [-]調査: HTML貼り付け形式のcommentでexplicit trusted human_review_directiveがissue_editor_requiredに到達しない[/-] [+]調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない[/+] on Sep 27, 2026
  2. squne121 commented on Sep 27, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(approved)

    Step 1 investigation(codebase-investigator)

    _BULLET_LINE_RE(scope_signal_delta.py:806)が -/* のみ対応し順序付きリストマーカーを検出しない単一の統一 defect であることを確認。HTML paste(#2730)と native Markdown 順序付きリスト(#2805)はいずれも _cf_html_canonical_text() の封筒正規化を経て同一の gap に収束する(HTML→Markdown 変換ではなく、GitHub 自身がレンダリングした Markdown tail の抽出であるため)。#2785(expands_allowed_paths false positive)とは根本原因が異なることを確認し、除外を維持。

    Step 2 review(canonical, 3 iteration)

    • iteration1: needs-fix(VC 3件が broad_search_path_unbounded。原因は ## Allowed Paths が prose のままで canonical (none) marker でなかったため)→ fix_delta((none) marker へ修正)
    • iteration2: needs-fix(VC 3件が missing_annotation。# baseline-expect: pass 未付与)→ fix_delta(annotation 追加)
    • iteration3: approve(BLOCKERS: 0)

    Step 2.5 semantic design review

    semantic_review_applicable: true(heuristic_concern_count=1 トリガー)。issue-design-reviewer が medium finding 1件(Positive matrix の HTML <ol>/<ul> 記載と Background の統一 gap 結論の間の tension。生 HTML タグ検出ロジックへのスコープクリープ懸念)。join_review_results は effective_verdict: approve(medium は non-blocking)。この懸念は Step 4.5 で起票した implementation Issue #2812 の Out of Scope に明記して解消済み。

    Step 4.5 follow-up materialization

    dedupe 確認: 既存の OPEN/CLOSED implementation Issue なし。新規 implementation Issue を1件のみ materialize:

    未実行事項

    final termination_reason

    approved(#2778 は research-only Issue のため LOOP_HANDOFF_RESULT_V1 marker の対象外。implementation follow-up #2812 へ引き継ぎ済み)。

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