Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "impl-review-loop が Step 2 gate 閉鎖・max_iterations・human_escalation 等で停止するとき、既存 Human-history v1 で GitHub の source Issue/PR に durable な人間向け履歴を残してから user-facing final を返し、Claude Code Project memory だけに停止状態を残す memory-only handoff を防ぐ"
change_kind: code
dedupe_key: "impl-review-loop:terminal-human-history-required:memory-only-handoff-prevention:v1"Parent Issue
none
Parent Goal Ref
- Goal: impl-review-loop の停止・人間判断要請が、GitHub 上の human-facing history として必ず追跡できる状態にする。
- Desired Destination: 既存 Human-history v1(実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908)の matrix が terminal / human-escalation 系の停止経路も覆い、手順書・test が memory-only handoff を禁止する状態(本 Issue は parent を持たず単独で完結させる)。
Current Validated Scope
.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md、step-2-verification.md、context-protocol-and-guardrails.mdの手順書。.claude/skills/issue-refinement-loop/scripts/publish_termination_report.pyの_validate_human_history_identitymatrix と_HUMAN_HISTORY_REASONSの最小拡張。.claude/skills/impl-review-loop/tests/配下の既存 human-history test 追従と新規 test 1 件。- 新しい publisher / schema / wrapper / gate は作らない。
Remaining Parent Gaps
なし
Background
PR #2876(Issue #2872)の impl-review-loop で AC9(runtime verification)が UNAVAILABLE のまま Step 2 の current-head gate を通過できず、Step 4 pr-reviewer を起動せずに人間へ判断を返して終了した。このとき停止状態を Claude Code の Project memory にだけ書き、GitHub の source Issue/PR に durable な人間向け履歴を残さないまま user-facing completion を返した。OWNER は #2876 (comment) で「プロジェクトメモリに保存されても困ります。GitHubにコメントとして残してほしい」「再発防止策を検討してIssueを起票してほしい」と明示要求している。関連 OWNER review: #2876 (comment) 。
既存の Human-history v1 と publish_termination_report.py::publish_human_history()(既存 issue_comment.publish controlled lane)はあったが、現行コードには次の gap がある(起票時点の HEAD で確認)。
step-5-feedback-and-termination.mdの Human-history matrix はpre-PR-binding/binding-validation/post-PR-binding/post-PR-head-drift/conflict-resolutionの 5 origin のみ。Step 2 gate が閉じて Step 4/5 に到達しない停止(VC_ADJUDICATION_RESULT_V1.blocking == true、AC/runtime blocker、UNAVAILABLE)、max_iterations 到達、human_escalation に対応する phase が無い。- 同ファイルの「終了処理(max_iterations)」「終了処理(human_escalation)」は raw
gh issue commentの本文テンプレートで、Human-history v1 の identity / idempotent create-PATCH-noop / readback を使っていない。 step-2-verification.md表のblocking == true行は「Step 5 へ。rerun / REQUEST_CHANGES / human escalation を判定」とだけ書き、GitHub history の記録を要求しない。- Project memory を canonical workflow history / handoff / completion evidence として使ってはならないという規約が impl-review-loop の docs に存在しない。
- 実装本体は
.claude/skills/issue-refinement-loop/scripts/publish_termination_report.py(_validate_human_history_identity、publish_human_history、--human-history-request-file)。
先行実装 #1908 は完了済みで再実装しない。本 Issue はその matrix を停止系の経路へ最小拡張する。
Outcome
impl-review-loop の terminal / human-escalation 停止経路(Step 2 gate 閉鎖による停止、max_iterations、human_escalation)が、既存 Human-history v1 で GitHub history(create / PATCH / noop + readback)を完了してから user-facing final を返す状態にする。成果物は、拡張された publish_termination_report.py の matrix、更新された impl-review-loop 手順書 3 本、Project memory が canonical history の代替でないことを固定する regression test であり、完了条件は下記 AC の VC がすべて pass することである。
Runtime Verification Applicability
decision: not_applicable
reason: >-
matrix 検証ロジックの拡張・手順書・unit test の変更のみで、静的検証(pytest)で完結する。実 GitHub への投稿は fake publisher / 既存 controlled lane の test double で検証し、live 投稿は本 Issue の AC に含めない。In Scope
publish_termination_report.py:_validate_human_history_identityの matrix と_HUMAN_HISTORY_REASONSに、impl-review-loop の停止系 phaseterminal-stop(target は bound PR があれば pull_request、無ければ source Issue)と reasonstep2_gate_blocked/max_iterations/human_escalationを最小追加する。既存 5 origin の挙動と identity key set は変更しない。step-5-feedback-and-termination.md: Human-history matrix に上記停止経路を追記し、「終了処理(max_iterations)」「終了処理(human_escalation)」の rawgh issue commentテンプレートを Human-history v1 publish(identity / create-PATCH-noop / readback)へ置換する。step-2-verification.md:blocking == true行で、Step 5 へ進む前または停止時に GitHub history publication を必須とする旨を追記する。context-protocol-and-guardrails.md: 「Project memory は canonical durable workflow history / handoff / completion evidence ではない。terminal 停止では GitHub history publication の readback 完了前に user-facing final を返さない」「publication 失敗は terminal report に含め、memory write を成功扱いにしない」を明記する。- publication は raw transcript / credential / local absolute path を含めず、source Issue/PR binding を維持する。
- test: 既存
test_human_history_identity.py/test_human_history_phase_routing.pyの追従と、新規.claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py。.github/ci/python-test-plan.jsonの targets には.claude/skills/impl-review-loop/tests/が既に登録されているため、同ディレクトリ配下の新規 test は追加登録なしで収集される(実装時にpython-test-plan.jsonの整合を確認し、別ディレクトリへ置く場合のみ targets 登録が必要)。
Out of Scope
- 新しい publisher / schema / wrapper / gate / hook の追加
- 実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908 で完了した Human-history v1 の identity 構造・marker・template の変更
- issue-refinement-loop 側の termination 経路の変更
- Project memory 機構自体の変更・削除(memory は参考用途としては残り得る。禁止するのは canonical history としての代替利用)
- live GitHub への投稿を前提とする新しい required CI gate
- 実装: Claude-GPT issue-refinement preflight の stale credentialless transport 選択を #2299 の native GitHub auth 契約へ整合する #2872 / PR fix: Claude-GPT issue-refinement preflight の read transport を #2299 の native GitHub auth 契約へ整合する (#2872) #2876 自体の判断・修正
Acceptance Criteria
- AC1:
_validate_human_history_identityが("impl-review-loop", "terminal-stop", "issue" | "pull_request")と reasonstep2_gate_blocked/max_iterations/human_escalationを受理し、未知 reason・不正 target 組合せ・既存 5 origin の旧組合せ違反は従来どおり拒否する。 - AC2:
terminal-stopの identity / render / publish が、既存publish_human_history()経由で create / PATCH / noop の各 decision と readback を行い、同一 identity の再投稿が noop になる(idempotent)。 - AC3:
step-5-feedback-and-termination.mdの「終了処理(max_iterations)」「終了処理(human_escalation)」が rawgh issue commentではなく Human-history v1 publish を参照し、matrix に Step 2 gate 閉鎖停止が追記されている。 - AC4:
step-2-verification.mdのblocking == true行が GitHub history publication を要求する。 - AC5:
context-protocol-and-guardrails.mdが「Project memory は canonical durable workflow history / handoff / completion evidence ではない」と publication 失敗時の扱い(terminal report に含め、memory write を成功扱いにしない)を明記する。 - AC6: regression test が、terminal 停止で GitHub history publication の readback 成功なしに user-facing final を許す手順(memory-only success / handoff)を拒否することを固定する。
- AC7: publication 失敗(publisher エラー / readback 不一致)が terminal report の失敗として扱われ、成功扱いにならないことを test で固定する。
- AC8: 投稿本文に raw transcript / credential / local absolute path が混入せず、source Issue/PR binding が維持されることを test で固定する(既存の public-safe 検証の再利用)。
- AC9: 既存 human-history test(identity / phase routing / conflict taxonomy)が引き続き pass する。
Verification Commands
# AC1
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_terminal_stop_matrix_accepts_known_reasons_and_rejects_unknown -q
# AC2
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_terminal_stop_publish_is_idempotent_create_patch_noop_with_readback -q
# AC3
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_step5_termination_procedures_use_human_history_not_raw_gh_comment -q
# AC4
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_step2_blocking_row_requires_github_history_publication -q
# AC5
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_guardrails_declare_project_memory_not_canonical_history -q
# AC6
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_memory_only_handoff_is_rejected -q
# AC7
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_publication_failure_is_terminal_failure_not_success -q
# AC8
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py::test_terminal_history_is_public_safe_and_source_bound -q
# AC9
# baseline-expect: pass
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_human_history_identity.py .claude/skills/impl-review-loop/tests/test_human_history_phase_routing.py .claude/skills/impl-review-loop/tests/test_human_history_conflict_taxonomy.py -q標準品質ゲート(pnpm typecheck / pnpm lint / pnpm test / pnpm build、uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py)は PR 前に別途実行する。
Allowed Paths
- .claude/skills/issue-refinement-loop/scripts/publish_termination_report.py
- .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
- .claude/skills/impl-review-loop/steps/step-2-verification.md
- .claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md
- .claude/skills/impl-review-loop/tests/test_terminal_human_history_required.py
- .claude/skills/impl-review-loop/tests/test_human_history_identity.py
- .claude/skills/impl-review-loop/tests/test_human_history_phase_routing.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 新しい publisher / schema / wrapper / gate の追加が不可避と判明した場合
- Human-history v1 の identity key set / marker 形式の変更が必要になった場合
Required Skills
なし
Required Design References
- docs/dev/agent-skill-boundaries.md
- .claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md(Human-history v1)
- Issue 実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908(先行実装、完了済み)
Delivery Rule
1 Issue = 1 PR。専用 worktree で作業し、Draft PR を既定とする。
Activity