Skip to content

実装: Agent Run Readiness Preflight を追加し impl-review-loop 開始前の停止理由を 1 回で確定する #1052

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1047"
goal_ref: "impl-review-loop 開始前に readiness を 1 コマンドで確定し、CONTRACT_REVIEW_RESULT_V1 欠如・hook EACCES・worktree residue・CLI mismatch を事前検出する"
change_kind: workflow

Parent Issue

#1047

Parent Goal Ref

  • Goal: impl-review-loop 開始前に agent-run-preflight が readiness を 1 コマンドで確定する
  • Desired Destination: SubAgent spawn 前に missing contract / hook EACCES / worktree residue / script CLI mismatch が検出され、次に人間が実行するコマンドが 1 行で提示される状態

Current Validated Scope

  • .claude/skills/agent-run-preflight/SKILL.md を新規追加する
  • .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py を新規追加する
  • .claude/skills/agent-run-preflight/tests/test_check_agent_run_readiness.py を新規追加する

Remaining Parent Gaps

  • Issue 5〜9 が残る

Outcome

check_agent_run_readiness.py --issue N が AGENT_RUN_PREFLIGHT_RESULT_V1 を出力し、CONTRACT_REVIEW_RESULT_V1 status: go がない Issue で decision: stop_human と次コマンドを返し、uv run pytest .claude/skills/agent-run-preflight/tests/ が PASS している。

In Scope

  • .claude/skills/agent-run-preflight/SKILL.md
  • .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py(AGENT_RUN_PREFLIGHT_RESULT_V1 出力)
  • .claude/skills/agent-run-preflight/tests/test_check_agent_run_readiness.py
  • 検査項目: contract_go / hook_executability / worktree_residue / script_cli_contract / gh_auth
  • repo mutation なし(read-only preflight)

Out of Scope

  • impl-review-loop 内で issue-contract-review を自動実行しない
  • preflight 内での破壊的 cleanup
  • impl-review-loop SKILL.md 本体の変更(follow-up)

Acceptance Criteria

  • AC1: AGENT_RUN_PREFLIGHT_RESULT_V1 スキーマ(checks / decision / routing_action)が実装される
  • AC2: CONTRACT_REVIEW_RESULT_V1 status:go がない Issue では decision:stop_human を返す
  • AC3: 出力に次に人間が実行するコマンドを 1 行で含める
  • AC4: hook script が存在しないまたは実行不能な場合に hook_executability.status:fail を返す
  • AC5: baseline_vc_preflight.py など既知 script の引数が不一致な場合に script_cli_contract.status:fail を返す
  • AC6: preflight は repo mutation を行わない
  • AC7: unit test で missing contract / stale contract / hook EACCES / CLI mismatch を再現する
  • AC8: uv run pytest .claude/skills/agent-run-preflight/tests/test_check_agent_run_readiness.py -q が PASS する

Verification Commands

# AC1
$ rg -q "AGENT_RUN_PREFLIGHT_RESULT_V1" .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py

# AC2
$ rg -q "stop_human" .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py

# AC3
$ rg -q "next_action" .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py

# AC4
$ rg -q "hook_executability" .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py

# AC5
$ rg -q "script_cli_contract" .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py

# AC6
$ rg -c "gh.*edit" .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py

# AC7
$ rg -q "missing_contract" .claude/skills/agent-run-preflight/tests/test_check_agent_run_readiness.py

# AC8
$ uv run pytest .claude/skills/agent-run-preflight/tests/test_check_agent_run_readiness.py -q

Allowed Paths

  • .claude/skills/agent-run-preflight/SKILL.md
  • .claude/skills/agent-run-preflight/scripts/check_agent_run_readiness.py
  • .claude/skills/agent-run-preflight/tests/test_check_agent_run_readiness.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python 3(argparse / json / subprocess / os.access)

Scope Delta(任意)

N/A

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

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions