Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasestate/queuedQueued for implementation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "issue-contract-review に VC failure root cause 分類を追加する"
change_kind: workflowParent Issue
なし(単独改善)
Parent Goal Ref
- Goal:
issue-contract-reviewskill の VC preflight で fail した VC について、root cause を機械分類し、「想定どおり fail(実装後 pass)」と「想定外 fail(env / file_not_found)」を区別して BLOCKED 判定の精度を上げる - 背景: Issue 実装: gemini-cli-headless-delegation のランタイムセットアップテンプレを整備し SubAgent 起動可能状態にする #33 contract-review で AC9 の baseline fail (pyyaml 未導入) が「想定どおり fail」と「env 不備」のどちらか機械判定できず、warning として GO 判定した。これで進行はできたが、本来 env 不備は BLOCKED にすべきケース
- 関連: PR feat: gemini-cli-headless-delegation ランタイムセットアップチェッカーを追加 #38 の観測メモ section D、
.claude/skills/issue-contract-review/SKILL.md
Current Validated Scope
.claude/skills/issue-contract-review/SKILL.mdの Procedure ステップ 3「VC preflight」に「VC failure root cause 分類」サブステップを追加- 分類ルール(正規表現マッチベースの軽量分類)を明文化:
file_not_found_expected:test -f/test -d等の存在確認コマンドが exit 1 + empty stderr → 期待通り baseline failfile_not_found_unrunnable: コマンド実行対象ファイルが欠損(No such file or directory+ 実行対象が missing)→ 想定外、BLOCKEDenv_missing_dep:No module named|ModuleNotFoundError|ImportError|command not found|not found|ERR_MODULE_NOT_FOUND|Permission denied|is not executableを含む、または exit 126/127 → 想定外、BLOCKEDexpected_baseline_fail: grep/rg 系 exit 1 + no match、count assertion が threshold 未満 → 期待通りunknown: 上記いずれにも該当しない →human_judgment(自動 GO しない)
Remaining Parent Gaps
なし
Outcome
issue-contract-review skill SKILL.md の Procedure ステップ 3 に「VC failure root cause 分類」サブステップが追加され、5 分類のいずれかを CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications 配下に出力する手順が明示されたコミットが main にマージされている。
In Scope
issue-contract-review/SKILL.mdProcedure ステップ 3 への分類サブステップ追加- 出力 schema (
CONTRACT_REVIEW_RESULT_V1) へのclassificationsフィールド追加(VC 単位 evidence 付き配列、既存 field を破壊しない)
Out of Scope
- 分類ロジックの Python script 化(SKILL.md 内 bash 例示で十分)
- 過去 Issue への遡及適用
review-issueskill の判定ロジック変更
Acceptance Criteria
- AC1:
issue-contract-review/SKILL.mdの Procedure ステップ 3 内に「VC failure root cause 分類」サブステップが存在する - AC2: 5 分類(
file_not_found_expected/file_not_found_unrunnable/env_missing_dep/expected_baseline_fail/unknown)がそれぞれ SKILL.md 内に明記されている - AC3:
CONTRACT_REVIEW_RESULT_V1の出力スキーマにvc_preflight.classificationsフィールドが追加されている - AC4:
env_missing_dep分類時は BLOCKED 判定の判定基準として明示されている - AC5:
ModuleNotFoundErrorまたはNo module namedを stderr に含む VC fail はenv_missing_depに分類され BLOCKED 判定になることが明示されている - AC6: grep/rg 系コマンドの exit 1 + no match は
expected_baseline_failとして扱われることが明示されている - AC7: コマンド実行対象ファイルが欠損した場合は
file_not_found_unrunnableとして BLOCKED 判定になることが明示されている - AC8:
unknown分類は自動 GO ではなくhuman_judgmentとして明示されている
Verification Commands
rg -n "root cause|分類|classifications" .claude/skills/issue-contract-review/SKILL.md— # AC1: サブステップ存在rg -n "file_not_found_expected|file_not_found_unrunnable|env_missing_dep|expected_baseline_fail|unknown" .claude/skills/issue-contract-review/SKILL.md | wc -l | awk '$1 >= 5 {print "OK"; exit} {print "FAIL"; exit 1}'— # AC2: 5 分類記載rg -n "classifications" .claude/skills/issue-contract-review/SKILL.md— # AC3: schema 追加確認rg -n "env_missing_dep.*BLOCKED|BLOCKED.*env_missing_dep" .claude/skills/issue-contract-review/SKILL.md— # AC4: BLOCKED 判定基準明示rg -n "ModuleNotFoundError|No module named" .claude/skills/issue-contract-review/SKILL.md— # AC5: Python env 欠損検出語rg -n "expected_baseline_fail" .claude/skills/issue-contract-review/SKILL.md— # AC6: grep/rg no-match 分類rg -n "file_not_found_unrunnable.*BLOCKED|BLOCKED.*file_not_found_unrunnable" .claude/skills/issue-contract-review/SKILL.md— # AC7: unrunnable BLOCKEDrg -n "unknown.*human_judgment|human_judgment.*unknown" .claude/skills/issue-contract-review/SKILL.md— # AC8: unknown non-GO
Allowed Paths
.claude/skills/issue-contract-review/SKILL.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- 分類ロジックを Python script 化する必要が出た場合(別 Issue 化)
- 出力スキーマの破壊変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合
- 外部サービス利用・権限昇格が必要になった場合
- nested SubAgent delegation が必要になった場合
- 既存テスト大規模改変が必要になった場合
Required Skills
なし
Notes for Reviewer
観測元: PR #38 観測メモ section D。Issue #33 AC9 baseline fail で warning として GO 判定したが、env 不備は本来 BLOCKED が望ましい。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasestate/queuedQueued for implementation
Activity
squne121 commentedon May 19, 2026
着手タイミングに関する注記 (from PR #80 / Issue #72)
PR #80 (Issue #72「DoR 基準明文化 A1」、merged 2026-05-19) で
.claude/skills/issue-contract-review/SKILL.mdを更新済みです(Related セクションにdocs/dev/dor.mdへの参照リンクを追加)。本 Issue #43 と Allowed Paths が重複するため、以下の順序を推奨します:
06db85d) なので、本 Issue 着手時は最新mainを base にすれば衝突なしまた、Issue #86(PR #80 follow-up: dor.md 軽微 polish)と Issue #43 の Allowed Paths は重複しません(#86 は dor.md のみ)。
参照:
squne121 commentedon May 21, 2026
敵対的レビュー結論
Issue #43 は方向性は正しいです。PR #38 / Issue #33 で実際に「pyyaml 未導入による baseline fail」を warning GO にしており、issue-contract-review の VC preflight 判定精度を上げる必要があります。PR #38 の観測メモ D でも、この改善は明示的に提案されています。
ただし、現状の Issue #43 はこのまま実装すると誤判定を固定化するリスクが高いです。特に file_not_found と unknown の扱いは修正すべきです。
Blocker 1: file_not_found の扱いが Issue 内で矛盾している
Issue #43 の Parent Goal では「想定外 fail(env / file_not_found)」を区別して BLOCKED 精度を上げる、と書いています。
しかし Current Validated Scope では、file_not_found: No such file or directory を含む → 期待通り baseline fail としています。
これは矛盾です。
No such file or directory は、少なくとも次の 2 種類があります。
期待通り: test -f 新規追加予定ファイル が exit 1 になる
想定外: python missing_script.py / cat missing_file / rg pattern missing_dir など、VC 自体の参照先が壊れている
したがって、stderr の文字列だけで file_not_found を期待 fail 扱いするのは危険です。command family + exit_code + stderr + VC の意図 を組み合わせる必要があります。
修正案:
file_not_found_expected:
condition:
- command is existence assertion, e.g. test -f, test -d, [ -f ... ], [ -d ... ]
- exit_code == 1
- stderr is empty or non-fatal
verdict: expected_baseline_fail
file_not_found_unrunnable:
condition:
- stderr contains "No such file or directory"
- command execution target, script path, cwd, or searched directory is missing
verdict: BLOCKED
Blocker 2: unknown -> warning GO は preflight の責務と逆向き
Issue #43 は unknown を「warning として GO」にしています。
これは issue-contract-review の位置づけと整合しません。
現行 issue-contract-review は、実装着手直前に Issue を「このまま implement-issue に渡せるか」判定する preflight skill です。現行 Step 3 でも「実行不可能(コマンド不在 / ファイル不在)は BLOCKED」と定義されています。
さらに DoR では、VC の失敗が「実装不足」ではなく「VC 設計ミス」に起因しないかは確認対象です。
unknown は「実装不足による期待 fail」と証明できていない状態です。したがって安全側に倒すなら human_judgment または BLOCKED が妥当です。
修正案:
unknown:
verdict: human_judgment
next_action: propose_refinement_loop
rationale: "実装不足による baseline fail と証明できないため、自動 GO しない"
どうしても運用摩擦を下げたい場合でも、unknown を GO にする条件は「全 VC のうち unknown が非クリティカルで、他の VC が十分に fail-as-expected を示している」などの明示条件が必要です。
Blocker 3: expected_baseline_fail の判定が rg 0 hit 等 だけでは粗すぎる
Issue #43 は expected_baseline_fail を「rg 0 hit 等、追加実装で pass する想定」としています。
しかし grep 系コマンドの exit code は意味を持ちます。GNU grep では、通常 0 = 行が選択された, 1 = 行が選択されなかった, 2 = error です。
つまり、grep/rg 系で期待 baseline fail と見なせるのは主に exit 1 + no match であって、exit 2 や stderr ありは別扱いです。
修正案:
expected_baseline_fail:
exit_code: 1
stderr_pattern: "^$|non-fatal warnings only"
meaning: "pattern not found"
exit_code: 1
stderr_pattern: "^$"
meaning: "expected file/dir not present yet"
exit_code: 1
stdout_or_script_logic: "count below threshold"
meaning: "required token/schema not yet present"
Major: env_missing_dep の検出語彙が不足している
Issue #43 の env_missing_dep は No module named|command not found|not provided by package だけです。
これは狭すぎます。
最低限、以下を追加した方がよいです。
ModuleNotFoundError
ImportError
No module named
Cannot find module
ERR_MODULE_NOT_FOUND
command not found
not found
No such file or directory.*(node|pnpm|python|uv|pytest|ruff|tsc|vite)
Permission denied
is not executable
Python では ModuleNotFoundError は ImportError のサブクラスで、import 対象の module が見つからない場合に発生します。
Bash では、コマンドが見つからない場合は exit status 127、見つかっても実行不能なら 126 が使われます。
したがって、env_missing_dep は文字列 regex だけでなく exit code 126/127 も見るべきです。
Major: Issue #33 / PR #38 の実例に対して AC が弱い
Issue #33 の AC9 は uv run python -m pytest tests/ でしたが、実際には pyyaml が不足し、PR #38 では uv run --with pytest --with pyyaml python -m pytest tests/ によって PASS しています。
uv の公式ドキュメントでも、uv run --with により invocation ごとに追加依存を要求できると説明されています。
Issue #43 の AC は「分類名が書いてあること」だけなので、Issue #33/PR #38 の実例に対する回帰防止になっていません。
追加すべき AC:
ModuleNotFoundError: No module named 'yaml'またはNo module named yamlを含む VC fail はenv_missing_depに分類され、BLOCKED 判定になるgrep/rg系の no-match exit 1 はexpected_baseline_failに分類され、GO 可能な baseline fail として扱われるpython missing_script.py/cat missing_fileなど実行対象ファイル欠損はfile_not_found_unrunnableとして BLOCKED になるunknown分類は自動 GO ではなくhuman_judgmentまたは BLOCKED に接続されるMajor: classifications schema が集計しか想定していない
Issue #43 は CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications の追加を求めています。
しかし、単なる分類数だけではレビュー不能です。VC 単位で「どのコマンドが、どの出力で、なぜその分類になったか」が必要です。
推奨 schema:
vc_preflight:
passed: true | false
vc_failed_as_expected:
vc_passed_unexpectedly:
vc_unrunnable:
classifications:
- ac: AC1
command: "rg -n ..."
exit_code: 1
category: expected_baseline_fail
confidence: high
evidence:
stdout_excerpt: ""
stderr_excerpt: ""
decision: go
- ac: AC9
command: "uv run python -m pytest tests/"
exit_code: 1
category: env_missing_dep
confidence: high
evidence:
stderr_excerpt: "ModuleNotFoundError: No module named 'yaml'"
decision: blocked
これにより pr-review-judge や人間レビューが分類根拠を検証できます。
関連 Issue / PR との整合
Issue #33 / PR #38
Issue #43 の直接の根拠です。PR #38 では、AC9 の baseline fail が環境依存か期待 fail かを判定できず、warning GO にしたことが観測されています。
このため、Issue #43 は妥当な follow-up です。
Issue #72 / PR #80
PR #80 は docs/dev/dor.md を追加し、issue-contract-review/SKILL.md に DoR 参照を追加しています。
Issue #43 のコメントにも、PR #80 が同じ SKILL.md を変更済みで、最新 main を base にすべきことが記録されています。
現時点では PR #80 は merge 済みなので、Issue #43 は最新 main ベースなら衝突リスクは低いです。ただし、DoR 側は「VC preflight で baseline fail を確認する」と書くだけで root cause 分類までは定義していないため、Issue #43 の変更は SKILL.md 内に閉じてもよいです。
Issue #76
Issue #76 は state label 体系の再定義で、state/queued vs state/ready の役割分担を扱っていましたが、closed as not planned です。
Issue #43 は state ラベルではなく VC preflight の失敗分類なので、直接依存は不要です。
高品質化した推奨パッチ方針
Issue #43 をそのまま実装するより、以下のように Issue 本文を修正してから実装した方がよいです。
現行:
file_not_found / env_missing_dep / expected_baseline_fail / unknown
推奨:
expected_baseline_fail
env_missing_dep
command_not_found
file_not_found_expected
file_not_found_unrunnable
unknown_needs_human
command_not_found は env_missing_dep に含めてもよいですが、exit 127 を明示的に扱えるので分けた方がレビューしやすいです。
unknown_needs_human:
decision: human_judgment
next_action: propose_refinement_loop
現行 AC1〜AC4 は rg で文字列があるかを見るだけです。これは実装品質を担保しません。
最低限、AC5〜AC8 を追加してください。
ModuleNotFoundError/No module named) はenv_missing_depとして BLOCKED 判定になるexpected_baseline_failとして扱われるfile_not_found_unrunnableとして BLOCKED 判定になるunknownは warning GO ではなくhuman_judgmentまたは BLOCKED として明示されているAC5
rg -n "ModuleNotFoundError|No module named|env_missing_dep.*BLOCKED|BLOCKED.*env_missing_dep" .claude/skills/issue-contract-review/SKILL.md
AC6
rg -n "grep|rg|no match|exit[_ -]?code.*1|expected_baseline_fail" .claude/skills/issue-contract-review/SKILL.md
AC7
rg -n "file_not_found_unrunnable|No such file or directory.*BLOCKED|BLOCKED.*No such file or directory" .claude/skills/issue-contract-review/SKILL.md
AC8
rg -n "unknown.*human_judgment|human_judgment.*unknown|unknown.*BLOCKED|BLOCKED.*unknown" .claude/skills/issue-contract-review/SKILL.md
最終判定
Issue #43 は着手価値あり。ただし現行 contract のまま実装するのは非推奨。
特に以下は修正してから着手すべきです。
file_not_found を期待 fail と想定外 fail に分割する
unknown -> warning GO をやめ、human_judgment または BLOCKED にする
env_missing_dep に ModuleNotFoundError, exit 126/127, Node/npm 系 missing module を含める
AC/VC を「分類名が書いてある」ではなく「Issue 実装: gemini-cli-headless-delegation のランタイムセットアップテンプレを整備し SubAgent 起動可能状態にする #33/PR feat: gemini-cli-headless-delegation ランタイムセットアップチェッカーを追加 #38 型の誤判定を防げる」検証にする
classifications は集計ではなく VC 単位の evidence 付き配列にする
この修正を入れれば、Issue #43 は issue-contract-review の安全性を実質的に上げる良い小粒改善になります。
squne121 commentedon May 21, 2026
Issue 本文更新 — review-issue diff_proposal 適用
issue-refinement-loopStep 4 としてreview-issueが返したdiff_proposalを本文に反映しました。適用した変更
B1 対処:
file_not_foundの意味論的矛盾を解消file_not_foundをfile_not_found_expected(存在確認コマンドの期待通り fail)とfile_not_found_unrunnable(実行対象ファイル欠損、BLOCKED)の 2 分類に分割B2 対処:
unknownを自動 GO からhuman_judgmentに変更unknown分類はhuman_judgment(自動 GO しない)と明示B3 対処: pyyaml 不足 → ModuleNotFoundError への回帰防止 AC を追加
env_missing_depの検出語を拡充(ModuleNotFoundError,ImportError, exit 126/127 等)その他の更新
classificationsフィールド説明に「VC 単位 evidence 付き配列」を追記(In Scope)バックアップ
/tmp/issue_43_backup_20260521_142057.txtsqune121 commentedon May 21, 2026
issue-refinement-loop: 完了 (2026-05-21T05:22:43Z)
改善履歴
iteration 0 → 1 で以下を適用:
file_not_foundをfile_not_found_expected(test -f/test -d が exit 1 + empty stderr → GO)とfile_not_found_unrunnable(実行対象ファイル欠損 → BLOCKED)に分割warning として GO→human_judgment(自動 GO 廃止)に変更ModuleNotFoundError/ImportError/ERR_MODULE_NOT_FOUND/ exit 126/127 を追加次アクション
issue-contract-review 実行可能(着手前 preflight)
squne121 commentedon May 21, 2026
Contract Snapshot (2026-05-21T05:26:15Z)
issue-contract-reviewSKILL.md の Procedure ステップ 3 に「VC failure root cause 分類」サブステップが追加され、5 分類(file_not_found_expected/file_not_found_unrunnable/env_missing_dep/expected_baseline_fail/unknown)をCONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications配下に出力する手順が明示されたコミットが main にマージされている.claude/skills/issue-contract-review/SKILL.md.claude/worktrees/issue-43-issue-contract-review-vc-failure-root-caworktree-issue-43-issue-contract-review-vc-failure-root-casqune121 commentedon May 21, 2026
implement-issue: 実装完了 (2026-05-21T05:30:00Z)
.claude/worktrees/issue-43-issue-contract-review-vc-failure-root-caworktree-issue-43-issue-contract-review-vc-failure-root-casqune121 commentedon May 21, 2026
impl-review-loop: 完了 (2026-05-21T05:32:04Z)
検証証跡
次アクション
PR #122 はマージ可能状態です。人間がマージ判断してください。
feat: issue-contract-review に VC failure root cause 分類ステップを追加する (#43) (…