Repository navigation
Closed
Description
背景
issue-refinement-loop は max_iterations=1(デフォルト)で --no-approval 実行した場合、第1イテレーションで review が needs-fix を返すと needs_second_pass で停止する。
しかし、blockers が以下のような「auto-fixable structural blockers」のみの場合、人間がいなくても機械的に補完できる:
## Machine-Readable Contractセクション欠落(yaml フロントマター生成可能)## Stop Conditionsセクション欠落(issue_kind / change_kind から定型生成可能)## Verification Commandsの$/-プレフィックス欠落(形式変換のみ)contract_schema_version:欠落(固定値補完)
これらは内容判断を必要とせず、ルールベースで補完できる。一方、以下は auto-fixable ではない:
- AC の追加・削除・変更
- Allowed Paths の縮小・拡大
- Outcome のリライト
- スコープ外セクションの追加
--no-approval を指定した人間の意図は「自律完了」であり、auto-fixable blockers だけで停止することはその意図と矛盾する。
Outcome
issue-refinement-loop が --no-approval かつ last_verdict=needs-fix の場合、blockers を以下のように分類し、auto-fixable blockers のみなら max_iterations を超えても第2イテレーションへ自動継続する。
blocker_class:
auto_fixable_structural:
- missing_machine_readable_contract
- missing_stop_conditions
- vc_missing_prefix
- missing_contract_schema_version
requires_human:
- new_scope_area
- ac_removed_or_weakened
- allowed_paths_expanded
- outcome_rewrite_needed
auto-fixable blockers のみが残っている場合:
--no-approvalフラグが設定されている → 自動で第2イテレーションへ継続--no-approvalフラグが未設定 → 現行通りneeds_second_passで停止
Parent Issue
none
Parent Goal Ref
- Goal: issue-refinement-loop の自律完了率を高める — auto-fixable な構造的 blockers で不必要に停止しないようにする
- Desired Destination: スタンドアロン Issue のため parent スコープなし
In Scope
.claude/skills/issue-refinement-loop/SKILL.mdのLOOP_STATEにblocker_classフィールドを追加.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.pyにauto_fixable_structural_blocker_listを追加.claude/skills/issue-refinement-loop/references/termination-policy.mdの--no-approval時の継続ルール更新.claude/skills/issue-refinement-loop/tests/にauto_fixable分類テスト追加
Out of Scope
max_iterationsの既定値変更--no-approvalなしでのデフォルト継続(別 Issue で扱う)requires_humanblocker の自動処理check_issue_contract.pyのスコープ変更
Current Validated Scope
.claude/skills/issue-refinement-loop/SKILL.md— LOOP_STATE に blocker_class 追加.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py— auto_fixable_structural_blocker_list 出力.claude/skills/issue-refinement-loop/references/termination-policy.md— --no-approval 時の継続ルール.claude/skills/issue-refinement-loop/tests/— auto_fixable 分類テスト
Remaining Parent Gaps
none(スタンドアロン Issue)
Required Skills
- issue-refinement-loop SKILL.md 読み書き
- plan_refinement_loop.py スクリプト拡張
- Python pytest テスト作成
Acceptance Criteria
- AC1:
LOOP_STATEにblocker_classフィールドが追加され、auto_fixable_structural/requires_humanの2値で分類されること - AC2:
--no-approvalかつblocker_class: auto_fixable_structuralのみの場合、max_iterationsを超えた第2イテレーションが自動起動すること - AC3:
requires_humanblocker が1件でも含まれる場合はneeds_second_passで停止すること(現行動作維持) - AC4:
--no-approval未指定の場合は blocker 分類に関わらずneeds_second_passで停止すること(現行動作維持) - AC5:
plan_refinement_loop.pyのREFINEMENT_LOOP_PLAN_V1にauto_fixable_structural_blocker_listフィールドが追加されること
Verification Commands
# AC1
$ rg 'blocker_class' .claude/skills/issue-refinement-loop/SKILL.md# AC5
$ rg 'auto_fixable_structural_blocker_list' .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py# AC2
# AC3
# AC4
$ rg 'auto_fixable' .claude/skills/issue-refinement-loop/tests/$ uv run pytest .claude/skills/issue-refinement-loop/tests/ -v
$ pnpm typecheck
$ pnpm lint
$ pnpm buildAllowed Paths
.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py.claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/tests/
Stop Conditions
plan_refinement_loop.pyの既存テストが破壊される場合は停止するREFINEMENT_LOOP_PLAN_V1スキーマの後方互換性が壊れる場合は停止する- auto-fixable の判定基準が曖昧で、人間判断が必要な blocker を誤分類するリスクがある場合は停止する
--no-approval条件を迂回してrequires_humanblocker を自動継続しようとする場合は停止する- Allowed Paths 外のファイルを変更しようとする場合は停止する
max_iterations既定値変更など Out of Scope 変更が混入する場合は停止する
Runtime Verification Applicability
decision: not_applicable
reason: skill/script/doc-only changes — no runtime component to observeMachine-Readable Contract
contract_schema_version: "1"
issue_kind: implementation
change_kind: feature
parent_issue: none
dedupe_key: "improvement:issue-refinement-loop:auto-fixable-structural-blockers-auto-continue"Metadata
Metadata
Assignees
Labels
No labels
Activity
squne121 commentedon May 28, 2026
結論: まず #443 を issue-refinement-loop で契約修正。実装には進めない。
pnpm testの混入問題は #443 の実装修正に混ぜず、別件として隔離します。#443 は
docs/product/game-logic.mdの AimIntent 例示だけを{ x, y }arena 座標へ直す狭い docs Issue です。Allowed Paths もdocs/product/game-logic.mdの該当箇所だけに限定されています。([GitHub]1) また、元の PR #440 側でもAimIntent; angle例示は後続 PR で修正する follow-up issue にすべき、と明示されています。([GitHub]2)推奨順序
docs(game-logic): AimIntent 例示を {x, y} arena 座標表現に修正する #443 の contract を修正
## Product Spec Contextを追加diff_rationalechanged_requirement_idaffected_sections#2/#440/ anchor comment を明示VC を再設計
docs/product/game-logic.mdに対する baseline-fail → after-pass の検証にするmovement-projectile.md側が既に正しいことを確認するだけなので、baseline-fail 対象にしない# preflight-scope: pr_review_onlyを付けるか、AC3 を VC ではなく review evidence 扱いに落とすpnpm test失敗は別トラックissue-447 worktree test contamination的な別 Issue にする人間コメント案
そのまま #443 に入れるなら、次でよいです。
VC の考え方
rg 'AimIntent' docs/product/game-logic.mdは、人間が目視すれば使えますが、exit code だけでは「angle が消えた」ことを保証しません。contract VC としては弱いです。単一コマンド制約を守るなら、たとえば Python one-liner に寄せる方が安全です。
python3 -c "from pathlib import Path; import re, sys; s=Path('docs/product/game-logic.md').read_text(); sys.exit(0 if re.search(r\"type: 'AimIntent';\\s*x:\\s*number;\\s*y:\\s*number\", s) else 1)"python3 -c "from pathlib import Path; import re, sys; s=Path('docs/product/game-logic.md').read_text(); sys.exit(1 if re.search(r\"AimIntent[^\\n]*angle\", s) else 0)"AC3 は次のように pr_review_only にするのが妥当です。
判断
次アクションは「issue-refinement-loop で #443 の契約を直す」一択です。
pnpm test混入問題を先に追うと、単一ファイル docs follow-up の Issue に環境調査が混ざり、scope が崩れます。squne121 commentedon May 28, 2026
人間からのコメントです。
別のIssueでイテレーション数を上限1にすることでトークン使用量を減少させる試みを行ったが対処療法的であり無意味なため、廃棄する。
「max_iterations=1(デフォルト)」を3にする。3回レビューしても直らなければ、根本的な問題がある想定。
「--no-approval 実行した場合」とあり、現在は人間がプロンプトで「人間承認不要」を明示しているが、デフォルトで「人間承認不要」にしてほしい。人間エスカレーション不要でなければimpl-review-loop 、 issue-refinement-loopおよびオーケストラレーションスキル配下のサブエージェント起動およびサブエージェントの実行するエージェントスキルは人間が承認している。
squne121 commentedon May 28, 2026
#455 (comment)
結論: #455 は現行内容のまま進めない方がよいです。現行 #455 は「
max_iterations=1/--no-approval時に auto-fixable structural blockers だけ第2イテレーションへ逃がす」特例Issueですが、コメントの趣旨は 特例ではなく loop 実行ポリシーの既定値変更 です。現行本文もmax_iterations=1前提と--no-approval条件分岐に強く依存しています。([GitHub]1)判断
人間コメントは妥当です。
max_iterations=1はトークン削減策としては粗すぎます。1回目レビューで構造・文言・VC alignment のような機械的修正が出るのは通常なので、そこで停止すると「人間に2回目を押させるだけ」になり、自律 loop の価値を壊します。現行のissue-refinement-loopも Inputs でmax_iterations既定1、termination policy で「最初の needs-fix で Step 4 を自動実行せず停止」と定義しています。([GitHub]2)一方で、3回レビューしても収束しないなら根本問題ありという判断は自然です。これは「トークン節約」ではなく「収束性の上限」です。したがって、#455 の主題は
auto_fixable_structural追加ではなく、次の2点に変えるべきです。max_iterationsの既定値を1から3に変更する注意点として、ここでいう「人間承認不要」は Claude Code の実ツール permission bypass とは分離すべきです。Claude Code の permission mode はチャット指示ではなく CLI フラグや settings で制御され、
bypassPermissionsは isolated container / VM 向けで、prompt injection 等への保護を失います。([Claude Code]3)したがって Issue には「Claude Code permission mode を変更する」ではなく、このリポジトリの loop policy と prompt contract から明示的な
--no-approval依存を除去すると書くべきです。#455 の差し替え案
Title
Body draft
rg -n "no-approval|人間承認不要|approval" .claude/skills/issue-refinement-loop .claude/skills/impl-review-loop .claude/agentsrg -n "iteration.*max_iterations|needs_second_pass|human_escalation" .claude/skills/issue-refinement-loop .claude/skills/impl-review-looppnpm typecheck pnpm lint pnpm test pnpm buildAllowed Paths
.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/references/refinement-loop-plan-output.md.claude/skills/issue-refinement-loop/tests/.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/.claude/skills/impl-review-loop/tests/.claude/agents/docs/dev/agent-skill-boundaries.mddocs/dev/workflow.mdStop Conditions
以下の場合は自動継続せず、人間判断へエスカレーションする。
max_iterations=3でもapproveに到達しない場合bypassPermissions使用を必須化しようとする場合Machine-Readable Contract
この修正なら、コメントの意図に沿って「トークン削減のための上限1」という誤った設計を捨てつつ、無制限自走ではなく 3回収束しなければ根本問題として止める という健全な termination policy にできます。
[-]feat(issue-refinement-loop): auto-fixable structural blockers を第2イテレーションへ自動継続する[/-][+]refactor(loop-policy): max_iterations default を3にし、人間承認不要を既定化する[/+]squne121 commentedon May 28, 2026
Contract Review: BLOCKED (2026-05-29T00:00:00Z)
```yaml
CONTRACT_REVIEW_RESULT_V1:
status: blocked
generated_at: "2026-05-29T00:00:00Z"
generated_by: issue-contract-review
issue_url: #455
checks:
template_compliance: pass
state_label: ok
allowed_paths_present: pass
vc_present: pass
stop_conditions_complete: pass
vc_preflight:
passed: false
vc_failed_as_expected: 3
vc_passed_unexpectedly: 1
vc_unrunnable: 0
vc_expected_pass: 4
vc_skipped: 0
classifications:
- ac: AC1
command: "rg -n "max_iterations.*3|既定.*3" .claude/skills/issue-refinement-loop/SKILL.md"
exit_code: 1
classification: expected_fail
category: expected_baseline_fail
decision: go
scope_class: baseline_fail_expected
confidence: high
- ac: AC2
command: "rg -n "max_iterations.*3" .claude/skills/impl-review-loop/SKILL.md"
exit_code: 1
classification: expected_fail
category: expected_baseline_fail
decision: go
scope_class: baseline_fail_expected
confidence: high
- ac: AC8
command: "rg -n "no-approval|人間承認不要|bypassPermissions|permission mode" ..."
exit_code: 1
classification: expected_fail
category: expected_baseline_fail
decision: go
scope_class: baseline_fail_expected
confidence: high
- ac: AC6
command: "rg -n "iteration.*max_iterations|needs_second_pass|human_escalation" ..."
exit_code: 0
classification: unexpected_pass
category: unexpected_pass
decision: blocked
scope_class: baseline_fail_expected
confidence: medium
evidence:
stdout_excerpt: "SKILL.md:40: iteration + 1 >= max_iterations → Step 5 (needs_second_pass)"
fix_hint: "VC がすでに存在する文字列を検索している。実装後の状態変化を検出できるよう再設計が必要"
- ac: AC_UNKNOWN
command: "uv run pytest .claude/skills/issue-refinement-loop/tests/ -v"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
- ac: AC_UNKNOWN
command: "uv run pytest .claude/skills/impl-review-loop/tests/ -v"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
- ac: AC_UNKNOWN
command: "pnpm typecheck"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
- ac: AC_UNKNOWN
command: "pnpm lint"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
- ac: AC_UNKNOWN
command: "pnpm test"
exit_code: 1
classification: blocked
category: regression_gate
decision: blocked
scope_class: regression_gate
confidence: low
evidence:
stdout_excerpt: "FAIL .claude/worktrees/issue-447-.../tests/e2e/movement-projectile.spec.ts"
stderr_excerpt: "Error: Playwright Test did not expect test.beforeEach() to be called here."
fix_hint: "issue-447 worktree の playwright test が vitest に混入している pre-existing issue。VC に # preflight-scope: pr_review_only を追加するか、worktree 汚染を解消する必要がある"
- ac: AC_UNKNOWN
command: "pnpm build"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
ac_verifiability: pass
product_spec_check:
applicability: not_applicable
decision: pass
worktree_branch_collision: clear
next_action: propose_refinement_loop
blocked_reasons:
- "AC4/AC5/AC6 用 VC (rg iteration.*max_iterations|needs_second_pass|human_escalation) が baseline で unexpected_pass: 対象文字列が既存ファイルに存在するため baseline で exit 0 になる。実装後の状態変化を検出できる VC に再設計が必要"
- "pnpm test が regression gate で blocked: issue-447 worktree の playwright test (.claude/worktrees/issue-447-e2e-browser-playtest-foundation-movement/) が vitest に混入している pre-existing 問題"
warnings: []
```
不足項目
1. AC4/AC5/AC6 VC: unexpected_pass(baseline で exit 0)
$ rg -n "iteration.*max_iterations|needs_second_pass|human_escalation" \ .claude/skills/issue-refinement-loop/SKILL.md \ .claude/skills/issue-refinement-loop/references/termination-policy.mdこのコマンドは現在の SKILL.md に
iteration + 1 >= max_iterations → Step 5 (needs_second_pass)およびtermination_reason: ... | needs_second_pass | human_escalationが含まれているため、baseline で exit 0 になる。修正案: 実装後の具体的な状態変化を検証する VC に変更する。例:
rg -n "iteration.*<.*max_iterations" .claude/skills/issue-refinement-loop/SKILL.md(iteration < max_iterationsなら継続する記述の確認)rg -n "human_escalation.*3|3.*human_escalation" .claude/skills/issue-refinement-loop/references/termination-policy.md2. pnpm test: issue-447 worktree 汚染による regression gate 失敗(pre-existing)
issue-447 worktree の playwright test が vitest に混入している。#455 の実装とは無関係の pre-existing 問題。
修正案:
pnpm testVC に# preflight-scope: pr_review_onlyを追加するか、issue-447 worktree を削除して汚染を解消する。推奨アクション
pnpm testに# preflight-scope: pr_review_onlyを付けるか issue-447 worktree を削除issue-refinement-loop #455で修正後、再度issue-contract-reviewを実行[-]refactor(loop-policy): max_iterations default を3にし、人間承認不要を既定化する[/-][+]feat(issue-refinement-loop): auto-fixable structural blockers を第2イテレーションへ自動継続する[/+]squne121 commentedon May 28, 2026
Contract Snapshot (2026-05-29T07:20:00Z)
--no-approvalかつlast_verdict=needs-fixの場合、blockers を auto_fixable_structural / requires_human に分類し、auto-fixable のみなら max_iterations を超えても第2イテレーションへ自動継続する.claude/worktrees/issue-455-auto-fixable-structural-blockersworktree-issue-455-auto-fixable-structural-blockers```yaml
CONTRACT_REVIEW_RESULT_V1:
status: go
generated_at: "2026-05-29T07:20:00Z"
generated_by: issue-contract-review
issue_url: #455
checks:
template_compliance: pass
state_label: ok
allowed_paths_present: pass
vc_present: pass
stop_conditions_complete: pass
vc_preflight:
passed: true
vc_failed_as_expected: 3
vc_passed_unexpectedly: 0
vc_unrunnable: 0
vc_expected_pass: 4
vc_skipped: 0
classifications:
- ac: AC1
command: "rg 'blocker_class' .claude/skills/issue-refinement-loop/SKILL.md"
exit_code: 1
classification: expected_fail
category: expected_baseline_fail
decision: go
scope_class: baseline_fail_expected
confidence: high
- ac: AC5
command: "rg 'auto_fixable_structural_blocker_list' .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py"
exit_code: 1
classification: expected_fail
category: expected_baseline_fail
decision: go
scope_class: baseline_fail_expected
confidence: high
- ac: AC4
command: "rg 'auto_fixable' .claude/skills/issue-refinement-loop/tests/"
exit_code: 1
classification: expected_fail
category: expected_baseline_fail
decision: go
scope_class: baseline_fail_expected
confidence: high
- ac: AC_UNKNOWN
command: "uv run pytest .claude/skills/issue-refinement-loop/tests/ -v"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
- ac: AC_UNKNOWN
command: "pnpm typecheck"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
- ac: AC_UNKNOWN
command: "pnpm lint"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
- ac: AC_UNKNOWN
command: "pnpm build"
exit_code: 0
classification: expected_pass
category: regression_gate
decision: go
scope_class: regression_gate
ac_verifiability: pass
product_spec_check:
applicability: not_applicable
decision: pass
worktree_branch_collision: clear
next_action: implement_issue
blocked_reasons: []
warnings: []
```
squne121 commentedon May 28, 2026
implement-issue: 実装完了 (2026-05-28T22:24:05Z)
.claude/worktrees/issue-455-auto-fixable-structural-blockersworktree-issue-455-auto-fixable-structural-blockersfix(#455): address REQUEST_CHANGES blockers B1-B5
feat(issue-refinement-loop): auto-fixable structural blockers を第2イテレー…