Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#829"
goal_ref: "publisher 経路の real renderer E2E 回帰を固定し、termination report docs の prose 重複を Japanese-check と整合する形に整理する"
change_kind: mixedRuntime Verification Applicability
decision: not_applicable
reason: "pytest とドキュメント更新で完結する。runtime UI / simulation 動作確認は不要"Parent Issue
Parent Goal Ref
- Goal: issue-refinement-loop の termination report 入力正規化を安全化する
- Desired Destination: publish 経路で real renderer を通す退行が固定され、termination-policy / SKILL.md の prose が Japanese-check と review 摩擦を起こしにくい状態に整理される
Current Validated Scope
.claude/skills/issue-refinement-loop/tests/test_publish_termination_report.pyに real renderer を通した publish E2E regression を追加する.claude/skills/issue-refinement-loop/SKILL.mdとreferences/termination-policy.mdの英語 prose 重複を、日本語 prose 中心の記述に整理する
Remaining Parent Gaps
- なし
Outcome
publisher 経路の real renderer E2E regression が追加され、termination report 関連 docs の prose 重複が整理され、対象 pytest と marker VC が PASS している状態。
In Scope
publish()と real renderer を組み合わせた E2E regression test の追加- fake
_post_github_comment()で最終 body を検査する testcase の追加 SKILL.md/termination-policy.mdの英語 prose 重複削減と日本語 prose への整理
Out of Scope
render_termination_report.py/publish_termination_report.pyの意味論変更TERMINATION_REPORT_INPUT_V1の key 集合や schema 変更- 実装: human_escalation 停止時の termination comment に Cause と blocker_summary が表示されない問題を修正 #829 で入れた
normalize_input()契約そのものの再設計
Acceptance Criteria
- AC1:
test_publish_with_real_renderer_posts_normalized_human_escalation_bodyが追加され、publish()が realrender_termination_report.pysubprocess を実行し、GitHub 投稿層(_post_github_comment)だけを monkeypatch して最終投稿 body を検査する - AC1a: 入力が
termination_reason: human_escalation、termination_cause未指定、legacyblocker_summary: list[str]のとき、投稿 body にCause: human judgment requiredが含まれ、Cause: noneが含まれない - AC1b: 投稿 body に
## Blockersと legacy alias 由来の blocker 文字列が含まれる - AC1c:
_post_github_commentが exactly once 呼ばれ、投稿先 issue number がpublish(issue_number=...)と一致する - AC2:
SKILL.md/termination-policy.mdでblockers_summaryを canonical として説明し、blocker_summaryは旧 alias として validation 前に正規化される旨だけを日本語で説明する - AC2a:
termination-policy.mdにblocker_summaryが旧 alias として日本語で記述されていることを肯定 marker で確認する - AC3:
uv run pytest .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py -vが PASS する
Verification Commands
# AC1
$ rg -n "test_publish_with_real_renderer_posts_normalized_human_escalation_body" .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py
# AC1a
$ rg -n "Cause: human judgment required" .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py
# AC1b
$ rg -n 'assert "## Blockers" in body' .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py
$ rg -n 'assert "legacy blocker entry" in body' .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py
# AC1c
$ rg -n "assert len.posted. == 1|posted\[0\]\[0\] ==" .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py
# AC2
$ rg -n "blocker_summary.*旧 alias" .claude/skills/issue-refinement-loop/SKILL.md
# AC2a
$ rg -n "blocker_summary.*旧 alias" .claude/skills/issue-refinement-loop/references/termination-policy.md
# AC3
# preflight-scope: pr_review_only
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py -vAllowed Paths
.claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/issue-refinement-loop/references/termination-policy.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PR。#829 merge 後に着手する。worktree 作成・Draft PR を既定とする。Depends on #829 merge。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jun 13, 2026
Verdict: REQUEST_CHANGES
#838 の方向性は妥当です。#829 / PR #833 で
normalize_input()と publisher 側 shim は入っていますが、PR #833 の publish test は fake renderer に渡る JSON を見るだけで、real renderer が生成した最終 GitHub comment body を検査していません。#838 の AC1 はその穴を埋める Issue として成立します。ただし、このまま実装に流すには AC が弱いです。
Cause: noneを含まないことだけを見ても、Cause:行が消えている、別の誤った cause が出ている、fake body を投稿している、という退行を検出できません。確認した事実
#838 自体のコメントは 0 件です。したがって、直接コメント由来の追加合意はありません。
#838 は #829 を parent とし、publisher 経路の real renderer E2E 回帰固定と、
SKILL.md/termination-policy.mdの prose 重複整理を目的にしています。AC1 はpublish()+ real renderer + fake_post_github_comment()でCause: noneを含まず legacy blocker が表示されること、AC2 はblocker_summary/human_escalation説明の英語 prose 重複を日本語中心へ整理することです。#829 を閉じた PR #833 は、
human_escalationの cause 欠落時にhuman_judgment_requiredを補完し、blocker_summaryalias をblockers_summaryに正規化し、alias conflict を fail-closed にする実装です。PR #833 の publisher 実装は
render_termination_reportからnormalize_inputを import し、publish()内で正規化後に_invoke_renderer(normalized_input)を呼ぶ形です。これは renderer / publisher の意味論を揃える方向としては正しいです。一方、PR #833 の publish test は
subprocess.runを fake にして_fake_renderer_proc(_make_render_result())を返し、renderer_inputsを検査しています。つまり、real renderer が body をどう生成し、それを GitHub comment 投稿層へ渡すかは固定していません。#829 のレビューコメントでも、publish path の実欠陥を捕まえるには「real renderer + fake gh で human_escalation missing cause の投稿 body を検査する」回帰が必要だと指摘されています。
Blockers
1. AC1 が「body の質」を十分に固定していない
現 AC1 は
Cause: noneがないことと legacy blocker 表示だけです。最低限、次まで固定しないと弱いです。#829 の原因は #814 の
max_rewrite_attempts系でしたが、#829 は false-positive cause を避けるためhuman_judgment_requiredfallback に寄せています。#838 の docs/test でhuman_escalationomission を再びmax_iterations_exceededと読ませる表現を入れるべきではありません。#814 は checker approve が budget 判定より後に扱われて human_escalation された問題が背景です。2. “fake
_post_github_comment()” が存在しない場合、Allowed Paths が破綻する#838 は fake
_post_github_comment()と書いていますが、PR #833 の publisher 差分上は_invoke_renderer()呼び出しとsubprocess.runベースの構造しか確認できていません。もし現行
publish_termination_report.pyに_post_github_comment()seam が存在しないなら、テストだけでは fake できません。その場合は次のどちらかに Issue を修正すべきです。または
Python 公式 docs 上、
subprocess.run(input=...)は stdin に渡され、capture_output=Trueは stdout/stderr を捕捉します。また、check=Trueで non-zero exit が例外になりますが、既定のcheck=Falseでは戻り値で扱います。したがって real renderer subprocess は通し、GitHub 投稿だけを fake するのがこの回帰の目的に合います。([Python documentation]1)GitHub CLI 公式 docs でも
gh issue commentは--body-file <file>を持ち、-指定で stdin から body を読むとされています。fake する場合は、gh issue comment ... --body-file -のinputが real renderer body であることを検査できます。([GitHub CLI]2)3.
subprocess.run全体 mock は #838 の価値を殺すPR #833 の既存 publish test は
subprocess.runを丸ごと fake しています。これを #838 でも踏襲すると、real renderer E2E ではなくなります。pytest の
monkeypatch.setattrは attribute を安全に差し替え、test 後に戻せます。したがって、最優先はpub._post_github_commentのみを monkeypatch し、renderer subprocess は実行する構成です。([pytest ドキュメント]3)4. AC2 の
rgmarker が脆すぎる#838 の AC2 verification は、特定の日本語句があるかだけを見ています。これは「英語 prose 重複が消えた」ことの検証になっていません。
PR #833 では、
SKILL.mdにlegacy alias blocker_summary is normalized to canonical blockers_summaryやhuman_escalation example includes termination_cause and blockers_summary:が追加されています。termination-policy.mdにも同様の英語 prose と重複文が残っています。したがって AC2 は、肯定 marker だけでなく、英語重複の否定検証も必要です。
さらに、既存の Japanese-check / prose boundary checker があるなら、それを AC に入れるべきです。#838 の目的が “Japanese-check と整合” なら、
rgだけでは不十分です。5. docs で alias を primary path と誤読させる危険がある
blocker_summaryは canonical ではなく legacy alias です。docs ではblockers_summaryを主語にし、blocker_summaryは互換 note に落としてください。JSON Schema の
additionalProperties: falseは未定義プロパティを拒否する指定です。closed schema 境界で alias を扱うなら、validation 前にblocker_summaryを canonicalblockers_summaryへ正規化し、canonical object から alias を取り除く説明にするのが安全です。([JSON Schema]4)修正版 AC 案
実装指針
test はこういう形が望ましいです。
_post_github_commentseam がない場合は、Issue #838 の Allowed Paths にpublish_termination_report.pyを追加するのが筋です。無理にsubprocess.runを全体 mock すると、今回固定したい real renderer E2E が消えます。docs は次のような日本語に寄せるのが安全です。
最終判断
#838 は「やるべき後続 Issue」です。特に PR #833 の publisher test が fake renderer 入力検査止まりである以上、real renderer の最終投稿 body を固定する AC1 は必要です。
ただし、現状のままでは「テスト名が存在する」「
Cause: noneがない」「日本語 marker がある」だけで通る弱い Issue になります。実装前に、real renderer を本当に通すこと、GitHub 投稿層だけを fake すること、期待 cause をhuman judgment requiredまで固定すること、英語重複 prose の negative VC を追加することを AC に入れてください。squne121 commentedon Jun 13, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jun 13, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 13, 2026
CONTRACT_REVIEW_RESULT_V1
checks
Contract Snapshot
squne121 commentedon Jun 13, 2026
squne121 commentedon Jun 13, 2026
IMPL_REVIEW_LOOP_RESULT_V1
結果サマリー
PR #876 はマージ準備完了です。人間がマージ判断を行ってください。
fix(#838): 英語重複 prose 削除・TestTerminationReportDocsProse 追加
squne121 commentedon Jun 13, 2026
詳細
修正 1: PR body 日本語化
update_pr.pywrapper 経由で PR body を更新## Summary、## Checks、## Schema Change Applicability、## Schema Consumer Inventory、## Safety Claim Matrix、## Notes)を追加validate_pr_body.pyがstatus: passを返すことを確認済み修正 2: 英語重複 prose 削除
SKILL.md行 240:"human_escalation example includes termination_cause and blockers_summary:"→"human_escalation の入力例(termination_cause と blockers_summary を明示):"SKILL.mdJSON 値:"owner decision is required"→"オーナー判断が必要"/"conflicting scope signals remain unresolved"→"スコープの矛盾が未解決"termination-policy.md行 91: 同様の見出し日本語化・JSON 値日本語化修正 3: TestTerminationReportDocsProse 追加
検証結果
uv run pytest .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py -v: 43 passedpnpm typecheck && pnpm lint && pnpm test && pnpm build: 全 PASS(585 tests)squne121 commentedon Jun 13, 2026
IMPL_REVIEW_LOOP_RESULT_V1
結果サマリー
PR #876 はマージ準備完了です。人間がマージ判断を行ってください。
feat(#838): termination report publish real renderer E2E regression +…
squne121 commentedon Jun 13, 2026
post-merge-cleanup: 完了 (2026-06-13T13:05:00Z)
実行内容
.claude/worktrees/issue-838-termination-report-e2e-regression削除(untracked: artifacts/ のみ、force 削除)worktree-issue-838-termination-report-e2e-regression削除済み