Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR reference と Issue close gate を別の判断として整合し、post-merge live evidence の未取得時に Issue を閉じず、かつ merge 後の Task Context cleanup binding が対象 Issue を見失わない"
change_kind: workflowParent Issue
なし(単独 follow-up。#2842 は発見元であって parent ではない)
Parent Goal Ref
- Goal: 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 / Draft PR fix: trusted human-context contract-update の安全性と producer 到達性を修正 #2861 で露呈した PR reference と close timing の契約ずれを、再発しない workflow contract と regression にする。
- Desired Destination: producer / validator / reviewer / impl-review-loop / post-merge consumer が同一の reference authority model を使い、post-merge evidence が必要な Issue を PR merge と切り離して OPEN に保ち、かつ merge 後の Task Context cleanup binding(signal 発行と phase 判定)が対象 Issue に到達できる。worktree / branch 削除を実行する
cleanup_execの linked Issue 認可は別 Outcome であり follow-up に分離する(Out of Scope 参照)。
Current Validated Scope
open-prの reference producer / PR body validator、pr-review-judgeの linked Issue 解釈、impl-review-loopの repair 判定を、1 つの reference authority model(下記 Background)で整合する。- non-closing
Refs #Nの PR をpost-merge-cleanupの Task Context adapter が closing relation とは独立した authority で対象 Issue に bind できるようにし、merge と Issue close を分離する close gate を workflow 文書に記載する。 - 対応する focused regression を追加し、実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 / fix: trusted human-context contract-update の安全性と producer 到達性を修正 #2861 は変更しない。
Remaining Parent Gaps
なし(親 Issue なし)。#2842 の AC6/AC7 live smoke 実施と close 判断は #2842 側に残る。
Background
#2842 は AC6/AC7 に「PR SHA 隔離実 Git repo での pre-merge evidence」と、merge 後に実際の canonical main root / default branch・linked worktree 0 件で取得する live production subprocess positive/negative evidence の両方を要求する。#2861 は Draft / OPEN であり、human decision により Refs #2842 が正しい。merge 前に Closes #2842 へ復元すると auto-close が live evidence に先行するため禁止。
根本原因は「linked Issue 特定」と「merge 時に close してよいか」を Closes だけで兼用したこと。fresh main(f7a2cff5)で確認した現状の断絶は次の 4 点。
- producer / validator / reviewer:
open_pr.pyは Issue state のみで OPEN→Closes / CLOSED→Refs を既定とし、validator(LP057)は Refs も受けるが、pr-review-judgeはCloses不在を一律 REQUEST_CHANGES とする。 - post-merge identity:
task_context_workflow_signal.py::_merged_evidence()はclosingIssuesReferences.nodesがちょうど 1 件で対象 Issue と一致することを要求し、0 件はRELATION_ISSUE_MISMATCH。post-merge-cleanup/SKILL.mdの決定表ではこれは「停止(local-only なし、削除なし)」で、RefsPR は merge 後 cleanup に入れない。open_pr.py::classify_closing_issue_relation()も 0 件をNO_LINKとするためimplementation_pr_observedも発行されない。 - close gate: 実装 Issue を evidence 確認後に close する production consumer は存在しない(
parent_issue_closeは frozen wire で常に false、gh issue closeは orchestrator / 人間の明示操作)。Refs-bound Issue は GitHub semantics により merge で auto-close されず OPEN のまま残るため、必要なのは「OPEN を保つ判断の authority」と「閉じてよい条件の文書化」であり、新たな自動 close 実行器ではない。 - impl-review-loop:
test_handoff_pr_hygiene_regression.pyに「Refs-only は Closes 欠落で failure」という legacy 前提が残り、step-5-feedback-and-termination.mdはensure_closing_keywordを無条件の body-only 自動修復とする。reviewer だけ Refs-aware にしても、隣接 repair が Refs を Closes へ戻す。
Reference authority model(本 Issue で固定する唯一の判断規則)
判断は facts を入力とする 1 つの pure evaluator(validate_pr_body.py 内)に集約する。evaluator は GitHub を取得せず、caller が渡す facts(PR 本文、linked Issue の state、linked Issue 本文、A1 の comment 事実)だけから decision(closing_required / nonclosing_required / fail_closed)・level(A1 / A2 / A3 / CLOSED)・reason_code を返す。evaluator は CLI entrypoint(validate_pr_body.py --evaluate-reference-policy、出力は 1 つの JSON object)も持ち、producer(open_pr.py)、pr-review-judge Step 1、impl-review-loop step-5 の repair 判定は、いずれも facts を gh で fresh 取得してこの entrypoint を呼び、その結果だけを消費する。prose / フリーテキストのキーワードからは推測しない。--reference-facts-file を渡さない既存 caller(update_pr.py 経由の body 更新を含む)は従来の LP057(番号一致の検証)のまま動作し、本 Issue はそれを変更しない。policy 判定を要求する caller は facts を必ず供給し、facts の欠落・不正は fail_closed とする。
CLI contract(既存の必須引数を再利用し、新 schema / 新 CLI は作らない):
- 入力の分担: PR 本文は既存
--body-file(evaluator は bytes を読み、UTF-8 として解釈する。改行変換・正規化なし)、対象 Issue 番号は既存--linked-issue、対象 Issue 本文は既存--linked-issue-body-file、残りの facts は新規--reference-facts-file(JSON)で渡す。 --reference-facts-file単独(--evaluate-reference-policyなし)は既存 lint の LP057 を policy 判定へ切り替える(出力は従来のloop_body_lint/v1のまま)。--evaluate-reference-policyは--reference-facts-fileと--linked-issue-body-fileを必須とし、lint を実行せず evaluator 結果の JSON object だけを stdout に出す。いずれかが欠けた場合はfail_closed(facts_invalid)の JSON を出す。lint mode(--reference-facts-fileあり・--evaluate-reference-policyなし)で--linked-issue-body-fileが無い場合も同じくfail_closed(facts_invalid)とし、LP057 エラーにする(A1 のみで確定できる場合でも本文なしは受け付けない)。--body-fileが読めない場合のみ既存どおり stderr + exit 2。- exit code: evaluator mode は JSON を出力できた場合は decision によらず exit 0(呼び出し側は JSON の
decisionを読む。exit code で decision を伝えない)。 - facts JSON(
--reference-facts-file)の exact keys(これ以外の key・型違い・欠落はfail_closed/facts_invalid):repo(<owner>/<repo>文字列)、issue_state(OPENまたはCLOSED)、pr_number(正の整数。PR 作成前の評価ではnullを許す)、decision_comment(A1 の fresh 取得結果。取得していなければnull、あればurl/id(整数)/issue_url(comment の issue API URL)/author_association/bodyの 5 key を持つ object)。facts.repoと--linked-issueは対象 Issue の identity を決め、PR 本文・comment URL との一致検証に使う。updated_atは facts に含めず、authority にも freshness にも使わない(freshness は caller が評価直前に fresh 取得する責務と、merge 直前の再評価で担保する)。 - evaluator output の exact keys と enum:
decision(closing_required/nonclosing_required/fail_closed)、level(A1/A2/A3/CLOSED/null。fail_closedはnull)、reason_code(issue_closed/a1_explicit_decision/a1_decision_invalid/a1_decision_ambiguous/a2_contract_deferred/a3_close_ready/runtime_applicability_unresolved/facts_invalidのいずれか)、repo、issue_number、pr_number(facts の値の echo)、pr_body_sha256(evaluator が実際に評価した--body-fileの bytes から算出した小文字 hex。別経路の文字列から算出しない)、effective_kind(closing/non-closing/notes-only/none)、body_verdict(valid/repair/block)、body_reason(ok/closing_for_other/closing_forbidden/closing_missing/reference_missing/not_evaluated)。fail_closedのときbody_verdictはblock、body_reasonはnot_evaluated。
reference の grammar(evaluator が唯一の定義元。GitHub の closing 判定を over-approximate する保守的な定義):
- closing の検出は PR 本文の生 text 全体(code fence・inline code・引用行を除外しない)を対象にする。GitHub の closing keyword 全て(
close/closes/closed/fix/fixes/fixed/resolve/resolves/resolved、大文字小文字無視、keyword の後に任意の:と空白)の直後が actual issue target grammar に入る場合だけを closing reference の候補とする。target grammar は ASCII 数字列[0-9]+(文字列として比較。#21010と#2101の prefix collision を起こさない)を持つ#N、<owner>/<repo>#N、https://github.com/<owner>/<repo>/issues/Nの 3 形のみで、GitHub 公式の linking 仕様(keyword の直後に#ISSUE-NUMBER/OWNER/REPO#ISSUE-NUMBER、issue URL。keyword と target の間の任意の:と空白)に合わせる。実装時に GitHub 公式 docs を fresh に確認して grammar を固定する。候補の target が対象 Issue(同一 repository・同一番号)なら「closing for target」、別 Issue・別 repository なら「closing for other」とする。keyword の直後が target grammar に入らない場合(fixes the typo、resolved by the earlier change、closes the loop等の通常 prose)は reference ではなく単に無視し、fail_closedにしない(fail_closedは facts / authority 側の不正に限る)。code fence や引用内の keyword も同様に検出する(GitHub が link するか未検証のため、検出側に倒す)。 - non-closing は、code fence・inline code・引用行を除いた text 中の
Refs #N(ASCII 数字。#21010と#2101の prefix collision を起こさない完全一致)を対象 Issue への参照として数える。 - effective kind は 1 つに決める: 対象への closing keyword が 1 つでもあれば
closing(Closes #NとRefs #Nの併存もclosing)、無ければ対象へのRefsがあればnon-closing、どちらも無ければnone。同種別の重複参照は許容する。closing for otherが 1 つでもあれば常に reject する(番号違い)。Related issue:の Notes 欄だけの参照(既存validate_pr_body.py::_extract_notes_related_issueを再利用して値を取り出し、番号が対象 Issue と文字列として完全一致する場合)はnotes-only、Notes の番号が対象と異なる場合や参照が全く無い場合はnoneとして扱う。 - 判定の組合せ(
body_verdict/body_reasonの写像。closing for otherは常にblock/closing_for_other):closing_requiredではclosingがvalid/ok、non-closing(根拠のない Refs-only)はrepair/closing_missing(Closes へ。repair の可否は caller が決め、evaluator は auto repair を行わない)、noneとnotes-onlyはblock/reference_missing。closing_requiredのvalid判定が数える closing は code fence・引用行の外にある closing for target に限る(fence / 引用内にしか対象への closing keyword が無い本文は GitHub が link しない可能性があるためrepair/closing_missing。この場合もeffective_kindは検出(raw)基準のままclosingで、fence 外のRefs #Nの有無や参照なしでもeffective_kind/body_verdict/body_reasonは変わらない。AC2 の fixture はこの exact output を固定する。nonclosing_required と closing for other の検出は従来どおり fence / 引用内も数える)。nonclosing_requiredではnon-closingがvalid/ok、closing(併存を含む)はblock/closing_forbidden、none/notes-onlyはblock/reference_missing。CLOSED の linked Issue(level: CLOSED。authority 評価をしない)は専用の写像に従う:non-closing(対象への Refs)とnotes-only(Notes のRelated issue:が対象番号と一致)はvalid/ok、対象への closing keyword(fence / 引用内を含む)はblock/closing_forbidden、none(参照なし、または Notes の番号違い)はblock/reference_missing(現行 LP057 が Notes のみを許容する挙動を保つ)。
authority(OPEN の linked Issue。上から評価し最初に確定した結果を採る。total な優先順位):
| 順 | 条件 | decision |
|---|---|---|
| 0 | linked Issue が CLOSED | nonclosing_required(level: CLOSED。authority 評価なし) |
| 1 | A1 present かつ valid | nonclosing_required(level: A1。Runtime Verification Applicability section の状態に依存しない) |
| 2 | A1 present かつ invalid | fail_closed(A2 / A3 へ降格しない) |
| 3 | A1 なし、A2 成立 | nonclosing_required(level: A2) |
| 4 | A1 なし、A2 不成立、A3 成立 | closing_required(level: A3) |
| 5 | 上記以外(Issue state 取得不能、Runtime Verification Applicability section の欠落・重複・解釈不能、facts 不正) | fail_closed |
- A1 explicit reference decision: PR 本文(raw text 全体。code fence・引用を除外しない)の行頭が
Reference-Decision:の行を数える。0 行なら A1 なし。2 行以上は URL が同一でも A1 present かつ invalid(a1_decision_ambiguous、fail_closed。A2 / A3 へ降格しない)。ちょうど 1 行の場合、その値は canonical 形https://github.com/<owner>/<repo>/issues/<N>#issuecomment-<id>でなければならない(形が違う行も A1 invalid)。A1 valid となる条件は全て: (1) URL の owner/repo/N が facts.repo と--linked-issueに一致、(2) facts.decision_commentが非 null で、そのurlが PR 本文の URL と文字列として完全一致し、idが URL fragment の数字列と一致し、issue_urlがhttps://api.github.com/repos/<owner>/<repo>/issues/<N>と一致する、(3) comment のauthor_associationが OWNER / MEMBER / COLLABORATOR、(4) comment 本文に完全一致 1 行REFERENCE_DECISION_V1: nonclosing issue=#<N>がちょうど 1 つある。comment の fresh 取得失敗(facts のdecision_commentが null)・別 Issue・権限不足・marker 欠落・複数 marker・URL 不一致は A1 invalid(a1_decision_invalid)。A1 の信頼はdocs/dev/の Accepted Trust Model(operator-asserted human context、実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086)と同一であり、agent が同一 principal の identity で投稿した comment を排除するものではない。この限界をworkflow.mdに明記する。 - A2 contract deferred: 対象 Issue 本文の Runtime Verification Applicability が
docs/dev/runtime-verification-policy.mdの正規形(decision: deferred、deferred_destinationのdestination_type: phaseとdestination_ref: post-merge-live-evidence)を満たす。post-merge-live-evidenceは本 Issue でruntime-verification-policy.mdに追記する予約 literal で、既存 enum・必須 field は変更しない。- parser は新規 regex を独自実装せず、既存 SSOT を再利用する: section の抽出は
.claude/skills/create-issue/scripts/prose_boundary_policy.pyのextract_level2_section_with_bounds()(fenced code block 内の見出しを除外、level-3 以降の nested 見出しで終端しない。validate_pr_body.pyが既にimplementation_landed_evidence.pyを load している方式と同じくimportlib.util.spec_from_file_location+ 一意な module 名で path 指定 load し、同名 module 衝突を避ける)。section の複数検出は、1 回目の戻り値のend_index以降の行に対する再抽出がNone以外を返すかで判定する(返れば複数 → 不成立でfail_closed/runtime_applicability_unresolved)。key の読み取りはvalidate_issue_body.pyの LP020 と同じ単純な行形式- key: value(deferred_destination配下のdestination_type/destination_refも同形)に限り、decisionが 3 enum 以外・欠落・複数行、deferred_destination/deferred_verification_condition(非空)の欠落は解釈不能として row 5 へ送る。section 自体の欠落は row 5(A1 valid の場合は row 1 が先に確定するため影響しない)。
- parser は新規 regex を独自実装せず、既存 SSOT を再利用する: section の抽出は
- A3 close-ready: Runtime Verification Applicability の
decisionがnot_applicable/immediate、またはdeferredで destination が A2 以外。 decisionと effective kind の verdict は上記の組合せ表を producer / validator / reviewer / impl-review repair 共通の唯一の正本とし、fail_closedは常に停止(auto repair しない)する。- 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の historical 不整合(Runtime Verification Applicability が
not_applicableなのに post-merge 要件が prose にある)は A2 では表現できず、A1 でのみ non-closing になる。実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 本文は変更しない。fixture は合成データで作る。 - reviewer の経路:
pr-reviewer-liteの allow-list はCloses #Nの存在を要求するため、Refs-bound PR は lite の適用対象外であり Sonnetpr-reviewer(pr-review-judge)で扱う。この点をpr-review-judge/SKILL.mdに明記し、pr-reviewer-lite.md自体は変更しない。
post-merge identity binding(closing relation 非依存)
adapter は GitHub I/O を行わない。orchestrator は fresh snapshot の query に pullRequest.body を追加し(post-merge-cleanup/SKILL.md の snapshot 手順と task-context.md に記載)、上記 entrypoint の出力のうち 7 key(decision / level / reason_code / repo / issue_number / pr_number / pr_body_sha256。effective_kind / body_verdict / body_reason は含めない)を、snapshot JSON object の top-level key non_closing_authority(pullRequest の兄弟であり、pullRequest の内側ではない)として添える(形は docs/dev/task-context.md に記載)。producer(open_pr.py)は同じ 7 key の dict を classify_closing_issue_relation(..., non_closing_authority=...) の引数として受け取り、consumer(adapter)は snapshot の non_closing_authority から読む。producer output → snapshot → adapter input は同一 dict の写像であり、key の追加・改名はしない。pr_body_sha256 は GitHub から取得した pullRequest.body 文字列そのものの UTF-8 bytes の SHA-256(正規化・改行変換なし)と定義する。adapter は PR 本文の grammar を再実装せず、次を全て満たす場合だけ binding を認める: closingIssuesReferences.nodes が空、non_closing_authority.decision == nonclosing_required かつ level が A1 または A2(A1 / A2 は評価時点で Issue が OPEN であることを含意するため adapter は Issue state を再判定しない)、repo(既存 _merged_evidence / _relation_repo_identity と同じく case-insensitive: 双方を lower() 正規化して比較)/ issue_number / pr_number が snapshot と一致、pr_body_sha256 が snapshot の pullRequest.body(欠落・非 string は拒否)の SHA-256 と一致。non_closing_authority は orchestrator-attested であり、既存 snapshot と同じ trust 境界(snapshot 自体の真正性を adapter が独立検証しない)にあることを task-context.md に明記する。それ以外は既存の reason code(RELATION_ISSUE_MISMATCH 等)で拒否し、書き込み 0。closing node が 1 件以上ある場合は従来規則のまま(別 Issue の node があれば拒否し、non-closing 判定へ fall through しない)。
適用 phase は --phase merged と --phase completed(main() の同一 _merged_evidence 経路)に限定する。_merged_evidence は _fresh_merged_evidence(recover / local-only)からも呼ばれるため、signature を _merged_evidence(snapshot, issue_number, pr_number, *, allow_non_closing: bool = False) のように keyword-only 引数で拡張し、merged / completed の呼び出しだけが True を渡す(既定 False は従来挙動のまま)。AC7 の parity matrix は既定値 False(non-closing を受理しない)と True の両方で固定する。--phase recover と --phase local-only(_fresh_merged_evidence 経由)は non-closing binding を受理せず従来どおり RELATION_ISSUE_MISMATCH で停止する(post-merge-cleanup/SKILL.md の決定表の行は変更しない)。signal_kind 集合・disposition / reason_code の既存値・各 phase の出力意味は変更しない。Task Context ctl / schema 側の変更が必要になった場合は Stop Condition。
producer 側(open_pr.py)は、emit_implementation_pr_observed の既存 GraphQL query(現行は number と closingIssuesReferences のみ)に pullRequest.body を追加した上で、classify_closing_issue_relation(snapshot, candidate_issue, candidate_repo=None, non_closing_authority=None) と emit_implementation_pr_observed(*, repo, pr_number, linked_issue, non_closing_authority=None) を拡張し、3 つの発行経路(新規 PR・既存 PR・canonical 既存 PR)のいずれでも、local の final_body ではなく GitHub から fresh 取得した live の PR 本文 に evaluator を実行して non_closing_authority を得る。evaluator が nonclosing_required(A1 または A2)で、closing node が空、pr_body_sha256 が snapshot の本文と一致する場合に限り、implementation_pr_observed を既存 wire のまま発行する。evaluator が fail_closed、authority が snapshot に束縛できない(hash 不一致等)、または authority 未取得の場合は、従来の NO_LINK / RELATION_ISSUE_MISMATCH 等の既存 disposition のまま発行しない。
Outcome
PR reference producer / validator / reviewer / impl-review-loop repair の判定と post-merge Task Context adapter の binding が同一の reference authority model(単一 evaluator)に従い、#2842 型(post-merge live evidence 待ち)の OPEN Issue では Refs が有効な linked reference として review・repair・merge 後の Task Context cleanup binding(implementation_pr_observed の発行と merged / completed phase の対象 Issue 束縛)まで通り、review を通過した経路では merge しても Issue は evidence readback と残 AC の確認が揃うまで OPEN のまま扱われる状態にする。merge 時点の guard は final head の PR 本文に対する reviewer の fresh な evaluator 実行であり(update_pr.py は facts 未供給の従来 LP057 のため、review 後の本文編集は次の review で検出する)、workflow.md に orchestrator が merge 直前に entrypoint を再実行し pr_body_sha256 を attested 値と照合する手順を記載する。通常の close-ready Issue は従来どおり Closes で閉じる。impl-review-loop の intake における context URL の provenance 判定(build_intake_capsule.py)は Refs-only PR に対し引き続き fail-closed であり、本 Issue の対象外とする。同様に、worktree / branch 削除を実行する scripts/agent-ops/cleanup_exec.py::_verify_linked_issue(現行は closingIssuesReferences または research fallback を要求し、Refs-bound PR に linked_issue_number を渡すと LINKED_ISSUE_MISMATCH で停止する。fresh main で再確認済み)の closing relation 非依存認可は本 Issue の対象外であり、dedupe 済みの follow-up Issue(Out of Scope 参照)が所有する。それまで Refs-bound PR の削除系 cleanup は安全側(削除なし)に停止したままで、post-merge-cleanup/SKILL.md にこの既知の制限を記載する。
Runtime Verification Applicability
decision: immediate
reason: Allowed Paths の .claude/skills/pr-review-judge/SKILL.md / .claude/skills/post-merge-cleanup/SKILL.md / .claude/skills/open-pr/SKILL.md は docs/dev/extension-surface-runtime-policy.yaml の skill-invocation-procedure-or-contract-change(skill-invocation-runtime-smoke)および subagent-lifecycle-start-stop-delegation-fallback(subagent-lifecycle-causal-evidence-smoke)の hard selector に該当し、default_decision: immediate である。免除条件(runtime 非読込・実行意味不変)は満たさない。#2842 の live smoke 自体は本 Issue の AC に含めない。
applicable_acs: [AC9]
execution_environment: current-head LOOP_PROTOCOL worktree と current Claude Code runtime。既存の scripts/agent-ops/run_worktree_agent_runtime_smoke.py を --mode structured で実行するだけとし、新しい harness・runner・恒久 runtime gate は追加しない。fixture(prompt と output schema)は GitHub へ mutation を行わない合成データのみを使う。
skip_conditions: claude 実行ファイルまたは uv が利用不能な場合は exit 77 + stdout 先頭 SKIP: で停止し、AC9 を PASS 扱いしない(docs/dev/runtime-verification-policy.md の SKIP 規約)。
fallback_policy: AC1〜AC7 の unit / subprocess test の PASS を AC9 の代替にしない。AC9 は変更後の pr-review-judge が実 runtime の SubAgent 経由で Refs-bound の合成 fixture を扱えることの確認であり、判定の意味は AC1〜AC7 が担う。
artifact_requirements: runner が出力する bounded な evidence(current-head identity、Claude Code 版、結果)を PR 本文に要約する。raw transcript・secret は記載しない。新しい artifact 形式は追加しない。
runtime_assertion_bindings:
- profile: skill-invocation-runtime-smoke
assertion: procedure_steps_executed_in_declared_order
ac: AC9 - profile: skill-invocation-runtime-smoke
assertion: output_contract_schema_fields_present
ac: AC9 - profile: subagent-lifecycle-causal-evidence-smoke
assertion: subagent_start_stop_causal_evidence_correlated
ac: AC9
In Scope
- 上記 evaluator と CLI entrypoint の実装(
validate_pr_body.py)、open_pr.pyの reference 選択(evaluator の結果を使う)と non-closing PR のimplementation_pr_observed発行(live の PR 本文で評価)、open-pr/SKILL.mdの契約記載。A1 のReference-Decision:行とREFERENCE_DECISION_V1marker、A2 の予約 literalpost-merge-live-evidence、non_closing_authorityの形を本 Issue の固定契約として追加する。 validate_pr_body.pyの LP057 は facts 未供給なら従来どおり、facts 供給時は evaluator の結果に従い、同一 linked Issue の妥当な Closes / Refs を認め、番号違い・全 closing keyword・authority に反する reference を拒否する。pr-review-judge/SKILL.mdStep 1 が entrypoint の結果で linked Issue を Closes または Refs から特定し、Closes 不在だけで REQUEST_CHANGES にしない。missing / mismatched / unknown authority は fail closed。同 SKILL.md のCloses不足を機械的修正対象とする記述(verdict 決定節)を含め、Closes不足に言及する全箇所を policy-qualified にする。pr-reviewer-liteが Refs-bound PR の対象外であることを明記する。impl-review-loopの legacy な Refs-only strict-xfail 前提を policy-aware な regression に置換し、step-5-feedback-and-termination.mdのensure_closing_keywordに言及する全箇所を policy-qualified にし、entrypoint がclosing_requiredを返した根拠なし Refs-only にのみ適用する。action 名・schema は変更しない。task_context_workflow_signal.pyの non-closing binding(merged/completed限定。Outcome は Task Context cleanup binding までで、cleanup_execの削除認可は 実装: cleanup_exec の linked Issue 認可を closing relation 非依存の non_closing_authority に対応させる #2891 が所有)と、post-merge-cleanup/SKILL.mdへの「Refs-bound PR の削除系 cleanup は 実装: cleanup_exec の linked Issue 認可を closing relation 非依存の non_closing_authority に対応させる #2891 までLINKED_ISSUE_MISMATCHで安全側停止し、linked_issue_number省略で迂回しない」旨の記載と、post-merge-cleanup/SKILL.mdの snapshot 取得手順・決定表・「PR 本文のCloses #N文字列は authority にしない」の記述の限定、docs/dev/task-context.mdの snapshot 安全条件の更新。docs/dev/workflow.mdに merge と Issue close の分離、decision table と grammar の単一の正本、A1 の trust の限界、Refs-bound Issue を close してよい条件(live evidence の取得・証跡リンク・残 AC 充足の確認後に operator / orchestrator が明示的に close する)を記載する。post-merge-cleanup/SKILL.mdは同 matrix を参照する。runtime-verification-policy.mdに予約 literalpost-merge-live-evidenceを追記する。
Out of Scope
- 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 本文・コメントや fix: trusted human-context contract-update の安全性と producer 到達性を修正 #2861 PR / diff の変更、merge / auto-merge / close、AC6/AC7 の live smoke の代行
- 調査: issue-refinement-loop の root_entry_router が post-merge の duplicate impl-review-loop handoff を防げない blind spot を調査し、follow-up 実装方針を確定する #2680 の duplicate-dispatch、実装: マージ済み PR に Task Context の claim を遡及付与する復旧経路を追加する #2817 の retroactive claim、実装: Agent/Skill の重複を削減し progressive disclosure へ移行する #1732 の preload 設計、再発防止: PR body authoring validator と pr-review-judge の evidence/safety contract drift を解消する #2808 の safety/evidence parity の再実装
- 全 Issue の無条件 nonclosing 化、GitHub 権限設定・secret の変更
- 新たな自動 close 実行器・close eligibility evaluator・ledger・新 Task Context schema の構築(close は引き続き operator / orchestrator の明示操作)
build_intake_capsule.pyの_pr_closes_target_issue()(closing relation 前提の comment provenance 判定)の non-closing 対応。Refs-only PR 上の context URL を reject する fail-closed 側の制限で、誤 close を起こさないため follow-up で扱う.claude/agents/implementation-worker.md・.claude/agents/pr-reviewer-lite.md・update_pr.pyの変更(update_pr.pyは facts 未供給の従来 LP057 のまま。ensure_closing_keywordの発行側を policy-aware にするため worker の routing は変更しない)- Refs + CLOSED Issue の post-merge adapter binding(現行どおり停止のまま)、
scripts/agent-ops/cleanup_exec.pyの research fallback scripts/agent-ops/cleanup_exec.py::_verify_linked_issueの closing relation 非依存認可(non_closing_authorityによる Refs-bound PR の worktree / branch 削除認可)。独立 Outcome・別 Allowed Paths のため follow-up 実装: cleanup_exec の linked Issue 認可を closing relation 非依存の non_closing_authority に対応させる #2891 が所有する(OPEN / CLOSED 検索で同一 Outcome の既存 Issue がないことを確認済み。実装: cleanup_exec.py が research issue(closing keyword不使用)のPRに対してlinked_issue_mismatchで恒常的にworktree/branch cleanupを拒否する問題を修正する #2508 は research issue 限定 fallback で別 Outcome)。post-merge-cleanup/SKILL.mdの worker dispatch でlinked_issue_numberを省略して認可を迂回する運用は採らない
Acceptance Criteria
- AC1: producer は同一の OPEN Issue state でも authority の違い(A1 valid / A1 invalid / A2 / A3 / unknown、A1 valid かつ Runtime Verification Applicability section 欠落を含む)だけで Closes / Refs / 停止が変わることを regression で固定する。実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 型 OPEN の明示 Refs を Closes に戻さず、CLOSED は Refs、不明・矛盾時は誤 close に進まず停止する。
- AC2: evaluator と validator は decision table の全行を fixture matrix で固定する。全 closing keyword(
Fixes/Resolves/Close等)、cross-repo 形(Fixes <owner>/<repo>#N)と issue URL 形、通常 prose(fixes the typo/resolved by .../closes the loopは reference として無視されfail_closedにならない negative fixture。keyword 直後が#N/<owner>/<repo>#N/ issue URL の場合のみ closing 候補)、ClosesとRefsの併存(effective kind は closing)、同種別の重複、code fence / 引用内の closing keyword(decision ごとの写像に従う:nonclosing_requiredと closing for other では検出して blocker、closing_requiredでは fence / 引用内のみの対象 closing はrepair/closing_missingで valid にならない。2 つを別 fixture case とする)と Refs(参照として数えない)、Related issue:のみ(notes-only。OPEN ではblock、CLOSED ではvalid)、CLOSED × {Refs, Closes, Notes のみ, 参照なし, Notes 番号違い} の写像、番号違い、prefix collision、A1 invalid を含み、nonclosing_requiredでの closing keyword とclosing_requiredでの根拠なし Refs-only / none を拒否する。さらに wire 契約を固定する: facts JSON の exact keys(未知 key・型違い・欠落はfacts_invalid)、evaluator output の exact keys / enum、pr_body_sha256が--body-fileの bytes(CRLF を含む本文で改行正規化した場合と値が異なること)から算出されること、--evaluate-reference-policyと既存--body-file/--linked-issue/--linked-issue-body-file/--reference-facts-fileの関係(必須引数の欠落はfacts_invalid、decision によらず exit 0)、A1 comment URL と PR 本文Reference-Decision:URL の exact 一致(id・issue_url・repo・番号の不一致は A1 invalid)、Reference-Decision:行が 2 行以上(同一 URL を含む)はa1_decision_ambiguousでfail_closed(A2 / A3 へ降格しない)、A2 section の欠落・重複・fenced code block 内の偽 section・nested 見出し・解釈不能な decision。facts 未供給の LP057 は従来挙動のままで、update_pr.py経由の close-ready Issue の body 更新は退行しない。A2 の予約 literal はruntime-verification-policy.mdの記載と一致する。 - AC3:
pr-review-judge/SKILL.mdStep 1 は entrypoint の実行コマンドと reason code を明記し、Refs 経由でも Issue contract を取得して AC / evidence を通常どおり評価する。テストは文書化された command 行が実在すること、同 entrypoint が matrix 上で期待どおりの decision を返すこと、SKILL.md が同じ reason code を参照することを確認する(reviewer 本体は LLM の prose であり、残る gap は AC9 の runtime 確認が担う)。pr-reviewer-liteが Refs-bound PR の対象外であることの記載、およびCloses不足に言及する全箇所が policy-qualified であること(無条件の指示が残らないこと)も確認する。 - AC4: production の
task_context_workflow_signal.py(CLI の subprocess 実行)で、(a) 有効なnon_closing_authority(A1 / A2)付きの merged PR は対象 Issue に bind され、adapter が GitHub への close を一切行わず close 権限を返さない、(b) closing node なし + attestation 欠落 / decision 不一致 / level が A3 または CLOSED / 番号・PR 番号・repo 不一致 /pr_body_sha256不一致 /pullRequest.body欠落・非 string は既存 reason code で拒否され書き込み 0、(c) closing node がある場合の従来挙動が不変、(d)--phase recoverと--phase local-onlyは non-closing binding を受理せず従来どおり停止し書き込み 0、(e)--phase completedはmergedと同じ binding 判定、を regression で固定する。producer 側は 3 つの発行経路(新規・既存・canonical 既存)それぞれで live の PR 本文に基づき、evaluator がnonclosing_requiredかつ hash が束縛できる場合のみimplementation_pr_observedが既存 wire のまま発行され、evaluator がfail_closed・hash 不一致・authority 未取得の場合は従来の disposition のまま発行されないことを固定する。 - AC5:
workflow.mdとpost-merge-cleanup/SKILL.mdが同一の decision table と close gate(merge と Issue close の区別、live evidence 欠落中は OPEN、証跡リンクと残 AC 充足後のみ operator / orchestrator が close 可、merge 時 guard は final head 本文に対する fresh な evaluator 実行と merge 直前のpr_body_sha256照合)を記載し、2 文書の table が一致し、post-merge-cleanup/SKILL.mdの「Closes 文字列は authority にしない」記述が限定された規則に更新されていることを regression で固定する。post-merge-cleanup/SKILL.mdが Refs-bound PR の削除系 cleanup は 実装: cleanup_exec の linked Issue 認可を closing relation 非依存の non_closing_authority に対応させる #2891 までLINKED_ISSUE_MISMATCHで安全側停止しlinked_issue_numberの省略で迂回しない旨を記載していることも固定する。この AC は文書契約であり、実動作の検証は AC4 が担う。 - AC6:
step-5-feedback-and-termination.mdはensure_closing_keywordに言及する全箇所で entrypoint の decision に従い(無条件の指示を残さない)、closing_requiredの根拠なし Refs-only だけを repair / block し、nonclosing_required+ Refs は valid、nonclosing_required+ closing keyword は blocker、fail_closedは auto repair せず停止する。regression は entrypoint を matrix 上で実行し、step-5 が同じ command と reason code を参照することを確認する。legacy の Refs-only 前提は置換し、既存 fixture は変更しない。 - AC7: producer 側 classifier(
open_pr.pyのclassify_closing_issue_relation(..., non_closing_authority=None))と consumer 側 classifier(task_context_workflow_signal.pyの_merged_evidence)が、同一の snapshot(pullRequest.bodyを含む)+non_closing_authorityfixture matrix で同じ accept / reject 判定になる parity regression を持つ(同名 module 衝突を避け path 指定で import する)。snapshot のnon_closing_authorityは top-level key(pullRequestの兄弟)で、producer には同一 dict を引数として渡す。fixture matrix の各 case は (snapshot, authority) の組で、accept は「producer がNO_LINK/RELATION_ISSUE_MISMATCH以外 ⇔ consumer が binding 成立」、reject は双方が既存 reason code で拒否と定義し、最低限 valid A1 / valid A2 / level A3 / level CLOSED / authority 欠落 /pr_body_sha256不一致 / repo(別 repo は reject、case 違いのみは accept)・issue・PR 番号の各不一致 /decision: closing_required/pullRequest.body欠落 / 同一 Issue の closing node あり / 別 Issue の closing node あり を含む。 - AC8: 既存の通常 PR selection と reviewer gate を退行させず、標準品質ゲートと既存の
update_pr.py検証テストを通す。実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 / fix: trusted human-context contract-update の安全性と producer 到達性を修正 #2861 に変更を加えず、変更ファイルは Allowed Paths 内に収まる。 - AC9: 変更後の
pr-review-judgeSkill を current Claude Code runtime の SubAgent 経由で起動し、post-merge-pending の Refs-bound 合成 fixture に対して Step 1 が Closes 不在だけで REQUEST_CHANGES とせず linked Issue を Refs から特定する手順を宣言順に実行し、出力契約の全 field を返し、SubAgent の start / stop の causal evidence が実行と相関することを実 runtime で確認する。SKIP は PASS ではない。 検証は runner の既存 flag で実体化する:--expect-ordered-markerをpr-review-judge/SKILL.mdの Procedure の宣言順(Step 1 linked Issue 特定 → AC / evidence 評価 → verdict 出力)に対応する 3 つの literal marker で渡し(fixture prompt が SubAgent に各 Step 完了時にその literal を出力させる。marker は実装時に SKILL.md の Procedure 見出しと突き合わせて確定する)、--output-schema-pathは本 Issue が追加する単一の fixture 用 JSON Schema(reference_policy_runtime_smoke.output.schema.json。pr-review-judgeの出力契約の最小 convention であるverdict/reviewed_head_sha/blockers/warningsと smoke 用linked_issue_resolution/smoke_markerを required とする。汎用 schema registry や新しい runner 機能は作らない)で最終応答の JSON を full validation する。
Verification Commands
# AC1
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py::test_given_authority_matrix_when_selecting_reference_then_closes_or_refs_or_stop
# AC2
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_validate_pr_body.py::test_given_reference_policy_matrix_when_validated_then_accept_or_reject .claude/skills/open-pr/scripts/tests/test_validate_pr_body.py::test_given_reference_facts_wire_when_evaluated_then_exact_keys_and_body_bytes_hash
# AC3
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/pr-review-judge/tests/test_pr_reviewer_skill_contract_drift.py::test_given_refs_binding_when_step1_then_issue_resolved_by_entrypoint_not_closes_only
# AC4
# baseline-expect: fail
$ uv run --locked pytest tests/task-context/test_post_merge_workflow_signal_adapter.py::test_given_non_closing_authority_when_merged_phase_then_binds_without_close_authority tests/task-context/test_post_merge_workflow_signal_adapter.py::test_given_invalid_non_closing_authority_when_merged_phase_then_rejected_with_zero_writes tests/task-context/test_post_merge_workflow_signal_adapter.py::test_given_closing_node_when_merged_phase_then_legacy_behavior_unchanged tests/task-context/test_post_merge_workflow_signal_adapter.py::test_given_recover_or_local_only_phase_when_non_closing_authority_then_still_rejected tests/task-context/test_post_merge_workflow_signal_adapter.py::test_given_non_closing_pr_when_open_pr_observed_then_signal_emitted_only_when_authority_binds_to_live_body
# AC5
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py::test_given_close_gate_matrix_when_compared_then_workflow_and_post_merge_skill_match
# AC6
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_handoff_pr_hygiene_regression.py::test_given_reference_policy_matrix_when_repairing_then_closing_keyword_only_for_closing_required
# AC7
# baseline-expect: fail
$ uv run --locked pytest tests/task-context/test_post_merge_workflow_signal_adapter.py::test_given_fixture_matrix_when_classified_then_producer_and_consumer_agree
# AC8
$ pnpm typecheck
# AC8
$ pnpm lint
# AC8
$ pnpm test
# AC8
$ pnpm build
# AC8
$ uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py
# AC8
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_update_pr_validation_hook.py
# AC9
# preflight-scope: runtime_only
$ uv run --locked python3 scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --worktree . --prompt-file .claude/skills/pr-review-judge/tests/fixtures/reference_policy_runtime_smoke.prompt.md --output-dir artifacts/runtime-smoke/reference-policy --evidence-json artifacts/runtime-smoke/reference-policy.evidence.json --require-subagent-causal-evidence --expect-marker REFERENCE_POLICY_SMOKE_OK --expect-ordered-marker REFERENCE_POLICY_STEP1_LINKED_ISSUE_RESOLVED_FROM_REFS --expect-ordered-marker REFERENCE_POLICY_STEP_AC_EVIDENCE_EVALUATED --expect-ordered-marker REFERENCE_POLICY_STEP_VERDICT_EMITTED --output-schema-path .claude/skills/pr-review-judge/tests/fixtures/reference_policy_runtime_smoke.output.schema.jsonAllowed Paths
- .claude/skills/open-pr/SKILL.md
- .claude/skills/open-pr/scripts/open_pr.py
- .claude/skills/open-pr/scripts/validate_pr_body.py
- .claude/skills/open-pr/scripts/tests/test_open_pr_validation_hook.py
- .claude/skills/open-pr/scripts/tests/test_validate_pr_body.py
- .claude/skills/pr-review-judge/SKILL.md
- .claude/skills/pr-review-judge/tests/test_pr_reviewer_skill_contract_drift.py
- .claude/skills/post-merge-cleanup/SKILL.md
- .claude/skills/post-merge-cleanup/scripts/task_context_workflow_signal.py
- .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
- .claude/skills/impl-review-loop/tests/test_handoff_pr_hygiene_regression.py
- tests/task-context/test_post_merge_workflow_signal_adapter.py
- tests/test_post_merge_cleanup_boundary.py
- docs/dev/workflow.md
- docs/dev/task-context.md
- docs/dev/runtime-verification-policy.md
- .claude/skills/pr-review-judge/tests/fixtures/reference_policy_runtime_smoke.prompt.md
- .claude/skills/pr-review-judge/tests/fixtures/reference_policy_runtime_smoke.output.schema.json
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- Task Context の signal_kind 集合・
disposition/reason_code既存値の変更、または Task Context ctl / schema 側の変更が必要になった場合 - 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 参照選択の authority が確定しない、または 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の OPEN 維持・明示 Refs decision に反する実装が必要になった場合
- 自動 close 実行器や新 ledger / schema を追加しないと AC を満たせないと判明した場合
Required Skills
なし
Required Design References
- docs/dev/workflow.md
- docs/dev/runtime-verification-policy.md
- docs/dev/task-context.md
- .claude/skills/open-pr/SKILL.md
- .claude/skills/pr-review-judge/SKILL.md
- .claude/skills/post-merge-cleanup/SKILL.md
- .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
Delivery Rule
1 Issue = 1 PR、専用 worktree、Draft PR 既定。fix: trusted human-context contract-update の安全性と producer 到達性を修正 #2861 の diff には混ぜない。- Allowed Paths overlap は edit intent が異なる。再発防止: pr-review-judgeでrequired runtime scenarioのinfra_skipをreview時に除外してAPPROVEしない #2838(pr-review-judge)/ 実装: open_pr.py の emit_implementation_pr_observed の GraphQL query の波括弧不均衡を修正し、実 GitHub で parse 可能であることを test で保証する #2825(open_pr.py)/ 実装: open-pr SKILL.md の validator rule 一覧を runtime LP059 まで同期し drift を pytest で検出する #2820(open-pr SKILL.md)は 2026-10-03 時点で OPEN、実装: Claude-GPT issue-refinement preflight の stale credentialless transport 選択を #2299 の native GitHub auth 契約へ整合する #2872 は CLOSED。着手時に fresh な overlap 確認を行い、同一ファイルは直列化する(preflight:
overlap_requires_comment, C1)。 - 本 PR の merge は 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の close を意味しない。実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 AC6/AC7 の live evidence・残 AC は 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 側で別途判定する。
Activity
squne121 commentedon Oct 2, 2026
Findings
P0 —
Refsを採用すると、現行post-merge-cleanupの通常経路が対象 Issue を特定できないこれは現状の #2878 で最も大きい契約欠陥です。
#2878 は「post-merge evidence pending の OPEN Issue →
Refs #N」を正規ケースにしたうえで、merge 後にpost-merge-cleanupが evidence を確認して close gate を処理する設計です。しかし current main のpost-merge-cleanupは、merged PR の Issue identity を GraphQL のclosingIssuesReferencesから取得しています。具体的には:
.claude/skills/post-merge-cleanup/SKILL.mdclosingIssuesReferences(...)を relation authority とするCloses #N文字列自体も authority にはしない.claude/skills/post-merge-cleanup/scripts/task_context_workflow_signal.pypr["closingIssuesReferences"]["nodes"]を直接読む.claude/skills/open-pr/scripts/open_pr.pyimplementation_pr_observedsignal も同じclosingIssuesReferencesを使い、0件ならNO_LINK一方、GitHub が PR↔Issue の closing relation として扱うキーワードは
close/closes/closed/fix/fixes/fixed/resolve/resolves/resolvedで、Refsは含まれません。リンクされた PR を default branch に merge すると Issue を自動 close するのが GitHub の標準セマンティクスです。[GitHub Docs](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue?utm_source=chatgpt.com) GitHub CLI も PR 側にはclosingIssuesReferences、Issue 側にはclosedByPullRequestsReferencesを公開しています。GitHub CLIつまり #2842 型 PR を
Refs #2842にすると、「auto-close は防げる」が「現行 post-merge relation authority から #2842 が消える」という構造です。Impact: #2878 の中心ユースケースが、merge 後に通常 cleanup lane へ入らず
NO_LINK/ relation unavailable 側へ落ちる可能性が高いです。producer / validator / reviewer だけ直しても destination に到達しません。最小修正:
Refsケースで post-merge が使う Issue identity の authority を契約に追加する必要があります。新しい大掛かりな harness は不要です。既存 Task Context が保持する explicitissue_number/ implementation claim 等を再利用できるなら、それを closing relation とは独立した authoritative binding とするのが最も自然です。これに伴い少なくとも以下は Allowed Paths / regression 対象の再検討が必要です。.claude/skills/post-merge-cleanup/scripts/task_context_workflow_signal.pytests/task-context/test_post_merge_workflow_signal_adapter.pydocs/dev/task-context.md逆にここを別 Issue に分けるなら、#2878 の Outcome から「post-merge close gate を実動作まで整合する」を外し、明示 dependency にするべきです。
P1 — 「post-merge evidence pending」を機械的に判定する authority がまだ定義されていない
#2878 は「フリーテキストの曖昧なキーワードだけで post-merge gate を推測しない」「機械的に確定できなければ fail closed」と明記しています。これは正しい方針ですが、現在の contract には、その機械的 authority が何かがありません。
current
open_pr.pyが取得しているのは Issue state だけです。既存
Refs #Nが本文にある場合は caller intent として保存します。実際、test_open_pr_validation_hook.pyには既に「OPEN Issue に既存 Refs があれば保存する」という regression があります。つまり AC1 の難しい部分は「Refs を保存する」ことではなく、
です。
ここで代表例の #2842 に別の不整合があります。#2842 は AC6/AC7 で「merge 後の live canonical main subprocess evidence を取るまで OPEN」と要求しているのに、
Runtime Verification Applicabilityはdecision: not_applicableです。ところが canonicaldocs/dev/runtime-verification-policy.mdではnot_applicableは「静的検証のみで完結し runtime 証跡不要」、deferredは後続 Issue/phase/milestone と検証条件を明示するもの、と定義されています。そのため、#2842 の prose を読めば人間には意図が分かりますが、既存の structured SSOT からは逆の信号が出ています。
Impact: AC1/AC2/AC3 を実装すると、次のどちらかになりがちです。
Refsだけを authority にする → 新規 PR body に reference がまだ無い場合を解けない最小修正: reference-policy の authority hierarchy を Issue に明示すべきです。例えば既存 SSOT を使うなら、
deferredかつ destination phase が post-merge →RefsClosesのようにできます。
特に #2842 型は
Runtime Verification Applicability: deferred+destination_type: phase+ post-merge canonical-main condition で表せる余地があります。新 schema を作る前に、既存 policy で表現可能かを詰める方がこの個人開発には適しています。P1 — AC4 の Verification Command は現在 false-green
AC4 は、
と要求しています。
しかし AC4 の唯一の command は:
current main のこの test file を確認すると、
post-merge-cleanup、docs/dev/workflow.md、close gate matrix を検証していません。Closes #Nが reviewer Step 1 の issue-resolution authority である、という既存契約の assertion があるだけです。したがって、
post-merge-cleanup/SKILL.mdとdocs/dev/workflow.mdを一文字も変更しなくても AC4 command が green になり得ます。Impact: #2878 の最重要 destination の一つがテストされず、PR review は false-green になります。
最小修正: 既存テスト資産を使って behavioral regression を追加すべきです。候補は:
tests/task-context/test_post_merge_workflow_signal_adapter.pytests/test_post_merge_cleanup_boundary.py少なくとも「Refs-bound implementation issue + merged PR + evidence pending → OPEN」「evidence complete/readback valid + remaining AC complete → close eligible」の matrix が production consumer に届く必要があります。単なる
SKILL.mdの文字列 assertion だけでは不足です。P1 —
impl-review-loopに逆方向の「Refs-only は修正対象」という契約が残っている#2878 の Allowed Paths は
pr-review-judgeまでは含みますが、review 結果を修復するimpl-review-loop側を含みません。current main では:
.claude/skills/impl-review-loop/tests/test_handoff_pr_hygiene_regression.pyRefs #Nonly は「Closes 欠落なので failure であるべき」という legacy strict-xfail が残るRefs-onlyをensure_closing_keyword対象として記述.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.mdensure_closing_keyword.claude/agents/implementation-worker.mdensure_closing_keyword→update_pr_body_hygiene→open-pr/scripts/update_pr.pyという契約が残っています。
さらに
build_intake_capsule.pyの PR conversation comment provenance binding も_pr_closes_target_issue()を使い、closingIssuesReferencesが対象 Issue を含むことを要求しています。Refs-only PR 上の trusted context/report URL を impl-review intake に渡すケースでは reject されます。Impact:
pr-review-judgeを Refs-aware にしても、隣接 consumer が Closes-only 前提を維持し、将来 regression や自動修復で Refs を Closes に戻す余地が残ります。最小修正: 少なくとも legacy regression を policy-aware に変える必要があります。
ensure_closing_keywordという action 名まで一般化するかは別判断でよく、#2878 で無理に schema/action 名を増やす必要はありません。まず既存 regression の意味を直すのが小さい変更です。P2 — AC1/AC2 は既存機能の再確認だけで部分 green になりやすい
current main では既に:
Closes #NとRefs #Nの両方を認めるまで実装済みです。
そのため AC1/AC2 のテストを素直に増やすだけだと、「新しい reference-policy authority を実装していないのに大半が PASS」という状態になり得ます。
AC1/AC2 では単なる keyword matrix ではなく、同じ OPEN Issue state に対して authority input の違いだけで Closes/Refs/reject が変わることを regression の中心にした方がよいです。
外部仕様との照合
GitHub の native model は基本的に「linked PR = merge 時に Issue を閉じる relation」です。supported closing keywords に
Refsはなく、manual Development link も default branch merge 時の auto-close 対象です。[GitHub Docs](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue?utm_source=chatgpt.com)したがって、
Refsを「non-closing linked Issue」として採用する場合、GitHub nativeclosingIssuesReferencesをそのまま Issue identity SSOT にすることはできません。ここは repository-owned workflow が explicit relation を保持する必要があります。gh pr viewとgh issue viewの公開フィールドも closing relation と closed-by relation に分かれています。[GitHub CLI](https://cli.github.com/manual/gh_pr_view?utm_source=chatgpt.com)その他の live state
確認時点で #2878 自体にコメントはなく、
2878を参照する implementation PR も検索結果にはありませんでした。したがって Issue contract を修正するなら、まだ実装差分との互換性を気にせず直せる段階です。Issue 本文の overlap preflight も一部 stale です。#2872 は現在 CLOSED。一方 #2838 / #2825 / #2820 は OPEN でした。着手時 fresh preflight を行うという Delivery Rule 自体は正しいので、これは blocker ではありません。
推奨する refinement
現状のまま実装へ入るより、#2878 を一度 refinement した方がよいです。追加すべきものは大きな security/harness layer ではなく、次の4点だけで十分です。
RefsPR を post-merge でどの authoritative Issue identity に bind するかを明示する。この4点を解決しない場合、producer/validator/reviewer だけは整っても、#2842 型の本来のシナリオは 「Refs にしたため auto-close は防げたが、merge 後の canonical workflow が Issue を見失う」 という別の failure mode に移る可能性があります。
squne121 commentedon Oct 3, 2026
live GitHub を確認したところ、#2878 は現在 OPEN、対象コメント
#issuecomment-5963286403は repository OWNER によるコメントで、現時点では #2878 を参照する実装 PR は見つかりませんでした。対象コメントは current contract に対し、post-merge binding、reference authority、AC4 の false-green、impl-review-loopの Closes-only 前提を具体的に指摘しています。推奨アクションは、対象コメントを operator-selected trusted human context として current
issue-refinement-loopに投入し、単なる再レビューではなく Issue contract の実修復 → fresh review → approved termination まで進めることです。特に、現在の Allowed Paths にないファイルが必要なこと自体を停止理由にせず、同じ Outcome 内の最小限の scope expansion は今回の明示承認として扱わせます。Repository:
squne121/loop-protocol対象:
実装: PR Closes/Refs 選択と post-merge OPEN close gate を整合する #2878 (comment)
.claude/skills/issue-refinement-loop/SKILL.md既に auto mode で起動しているこの対話的 Claude Code session をそのまま使用してください。新しい session を開始しないでください。
Objective
Issue #2878 に対して current HEAD の
issue-refinement-loopを実行し、上記 OWNER anchor の findings を current repository evidence と照合したうえで Issue contract を実際に修復し、canonical review loop をapprovedまたは genuine な repository-definedhuman_judgment_requiredの terminal condition まで完遂してください。今回は「調査して提案するだけ」ではありません。必要な Issue 本文 mutation、再レビュー、fresh readback、termination publish まで実行してください。
ただし refinement 完了後に implementation を開始してはいけません。
impl-review-loop、implementation worker、implementation worktree、implementation PR 作成には進まず、issue-refinement-loop の正常終了点で停止してください。Explicit operator authorization
私は repository owner/operator として、この refinement を完了するために必要な以下の非破壊的作業を明示的に承認します。
issue-refinement-loopが必要とする dedicated refinement worktree の作成または既存 canonical worktree の再利用この承認は、既存 canonical guard / permission / freshness / provenance check を迂回する許可ではありません。
--dangerously-skip-permissionsや permission bypass を使用しないでください。また以下は承認していません。
Fresh-state first
過去の会話や anchor 内の「current main」記述をそのまま current fact とみなさないでください。
最初に fresh に以下を取得してください。
5963286403の full body、author association、identitymainHEAD.claude/skills/issue-refinement-loop/SKILL.md少なくとも anchor の findings に直接関係する以下を current HEAD から確認してください。
.claude/skills/post-merge-cleanup/SKILL.md.claude/skills/post-merge-cleanup/scripts/task_context_workflow_signal.py.claude/skills/open-pr/SKILL.md.claude/skills/open-pr/scripts/open_pr.py.claude/skills/open-pr/scripts/validate_pr_body.py.claude/skills/pr-review-judge/SKILL.md.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md.claude/skills/impl-review-loop/tests/test_handoff_pr_hygiene_regression.pyimpl-review-loopintake/provenance code.claude/agents/implementation-worker.md(finding が現在も relevant なら read-only 確認)tests/task-context/test_post_merge_workflow_signal_adapter.pytests/test_post_merge_cleanup_boundary.pydocs/dev/runtime-verification-policy.mddocs/dev/workflow.mddocs/dev/task-context.mdファイル名や役割は anchor から推測せず、current repository の実体を確認してください。
Treat the OWNER anchor as a technical directive requiring resolution
anchor の各 finding を independently validate してください。単に文章として Issue にコピーしないでください。
特に以下を解決してください。
1. non-closing
Refsと post-merge Issue identityRefs #Nを採用した場合、GitHub nativeclosingIssuesReferencesから対象 Issue が消える現在の consumer behavior を fresh code で確認してください。#2878 の Outcome が「post-merge close gate を実動作まで整合する」ことを維持するなら、non-closing PR を post-merge workflow がどの authoritative binding によって対象 Issue へ結び付けるのかを contract に明確化してください。
既存 Task Context の explicit
issue_number/ implementation claim / repository-owned binding 等を再利用可能なら、新規の大規模 registry や harness を作るより既存 mechanism の再利用を優先してください。一方、current architecture 上どうしても別 Outcome になるなら canonical scope/dependency mechanism に従って分離してください。単に Allowed Paths が現在狭いという理由だけで人間へ戻さないでください。
2. close-ready / post-merge-pending の mechanical authority
同じ
OPENstate でも reference decision が変わるため、単なる Issue state や prose heuristic に依存しない mechanical authority hierarchy を定義してください。anchor の提案は候補であり、そのまま固定実装せず current SSOT と照合してください。
優先して検討するもの:
新 schema / ledger / wrapper を追加する前に、既存 canonical SSOT で表現できるか確認してください。
#2842 の body 自体は変更禁止です。#2842 の historical inconsistency が fixture として重要でも、#2878 refinement のために #2842 を mutation しないでください。
3. AC4 false-green の除去
AC4 は post-merge consumer の behavior を要求しているため、
pr-review-judgeの contract-drift test だけが green でも AC4 が満たされたことにならないようにしてください。少なくとも current production consumer path を使い、
等の本質的 behavior を regression で固定できる Verification Command にしてください。
単なる Skill prose の文字列 assertion だけで destination を green にしないでください。
4.
impl-review-loopに残る Closes-only semanticspr-review-judgeだけ Refs-aware にしても downstream repair/intake がRefs-onlyを無条件で defect と扱うなら end-to-end contract は不整合です。current code/tests を確認し、最低限以下の policy matrix が system-wide に矛盾しない contract になるよう #2878 を refinement してください。
ensure_closing_keyword等の action/schema 名を一般化する必要が本当にあるかは current design から判断してください。具体的 defect を解消しない抽象化追加は避けてください。build_intake_capsule.py等に closing-relation-only provenance binding が残っている場合も、対象 scenario に影響するか fresh に確認してください。Scope expansion handling
現在の #2878 body の Allowed Paths が anchor findings を完全には cover していないことは既知です。
今回の operator instruction は、同じ #2878 Outcome を完結させるための 最小限の path expansion を明示的に承認しています。
anchor に exact path literal がある場合は current
issue-refinement-loopの trusted human-context contract に従って利用してください。exact path が anchor に無く、architecture/workflow-level directive から追加 path が必要な場合は、current
anchor-comment-handlingcontract が許すならcodebase-investigatorSubAgent を read-only で使い、current main から exact repository-relative paths を導出してください。その investigation evidence を canonical preflight と mutation phase の双方へ current Skill の規定どおり伝播してください。
NEXT_ACTION: issue_editor_requiredが返った場合、それは停止指示ではありません。current Skill の canonical issue-editor/full-rewrite route を実行し、その後 fresh readback → fresh preflight に戻ってください。SubAgent requirements
適切な SubAgent を積極的に使用してください。
最低限、scope/path/consumer wiring の調査に read-only
codebase-investigatorが有効なら使用してください。review phase では currentissue-refinement-loopが指定する reviewer / semantic reviewer / issue editor 等の canonical agent/skill routing に従ってください。SubAgent へは必ず明示してください。
親会話の暗黙 context に依存させないでください。
重要:
SubAgent を dispatch しただけで完了扱いにしないでください。
各 SubAgent の terminal completion と final result を必ず取得してから、その結果を検証して downstream step へ進んでください。
dependency の無い read-only investigations は必要なら並列化して構いません。ただし mutation / fresh readback / review の依存順序は守ってください。
SubAgent に再帰的な nested delegation を勝手にさせず、root conversation が control-plane を保持してください。ただし current agent contract が明示的に許可・要求する場合はその SSOT に従ってください。
Canonical refinement loop
current
issue-refinement-loopの実際の procedure を正本として、概ね以下の lifecycle を完遂してください。古い prompt の command name や flags を優先せず、必ず current
SKILL.md/ command registry / references の procedure を使ってください。通常の
needs_fix、review finding、stale body、修正可能な deterministic failure は人間への停止理由にしないでください。自動修復し、fresh evidence で再評価してください。Recurrence-prevention Issue
refinement 中に、#2878 の direct scope とは独立して再発しうる root-cause defect が確認された場合は、まず OPEN/CLOSED を含め repository-wide に既存 Issue を検索してください。
既存 Issue が同じ Outcome を所有していれば新規 Issue を作らず、その Issue を参照してください。
重複がなく、current repository-native follow-up/materialization policy で creation-ready と確認できる場合、この invocation は再発防止 Issue の作成を明示的に承認します。
作る場合は canonical issue creation / controlled mutation path を使い、最低限:
を記録してください。
「再発しそうだから」という抽象論だけで security/harness/schema/wrapper を増やさないでください。具体的 failure class を固定する最小恒久対策を優先してください。
新規 Issue の必要性が判明したことだけを理由に、人間承認待ちで停止しないでください。この prompt は上記条件を満たす non-duplicate follow-up creation を承認しています。ただし canonical repository contract が現在の invocation とは別の不可欠な authority を要求する場合、その guard を迂回してはいけません。
Completion criteria
以下を満たすまで作業を継続してください。
approved後は implementation を開始しないでください。Final report
最後に簡潔に以下を報告してください。
通常の修正可能 failure を blocker として残さず、canonical loop の範囲内で修復してから報告してください。
このプロンプトでは、対象コメントに明記された path expansion を「現 Allowed Paths 外だから即停止」と扱わず、current skill の human-context / investigation evidence 経路で吸収するようにしています。また、refinement の終了後にそのまま実装へ流れないよう明示的に境界を置いています。
squne121 commentedon Oct 3, 2026
issue-refinement-loop: human_escalation
76e45944fdc1de6490d374db64835432df5dc87e8e87d33fcdaeff5517f1205f(GitHub readback で remote 一致を確認済み。以後この body は未変更)実施した契約修復(anchor findings の disposition)
_merged_evidence()がclosingIssuesReferencesちょうど 1 件を要求し、Refs-only はRELATION_ISSUE_MISMATCHで cleanup が停止することを一次確認。orchestrator-attested なnon_closing_authority(PR 本文 SHA-256 束縛、merged/completed限定)による closing relation 非依存 binding を契約化。deferred+予約 literalpost-merge-live-evidence/ A3 close-ready の total な decision table と fail-closed を契約化(新 schema・ledger・自動 close 実行器は追加しない)。SKILL.mdが hard selector に該当するのにnot_applicableで、EXTSURF001 / RUNTIMEASSERT001 を満たしていなかった。decision: immediate+runtime AC9+runtime_assertion_bindingsに修正し、VC を baseline-expect の canonical 形に修正。task_context_workflow_signal.py、tests/task-context/test_post_merge_workflow_signal_adapter.py、tests/test_post_merge_cleanup_boundary.py、docs/dev/task-context.md、docs/dev/runtime-verification-policy.md、impl-review-loop のstep-5-feedback-and-termination.mdとtest_handoff_pr_hygiene_regression.py、AC9 用pr-review-judge/tests/fixtures/reference_policy_runtime_smoke.prompt.md)。削除なし。workflow.mdは元から含まれる。edit_issue_txn.py)で反映した。残 blocker(最終 review の findings。body には未反映)
fixes the typo/resolved by …等の通常 prose で fail_closed になりうる。keyword 直後が#/<owner>/<repo>#/ issue URL の場合だけ reference 候補とし、それ以外は無視する定義へ狭め、prose の negative fixture を AC2 に追加する。pr_body_sha256の出自(evaluator が評価した本文から算出すべき)、--evaluate-reference-policyと既存必須引数--body-file/--linked-issueの関係、A1 comment URL と本文 URL の一致検証、updated_atの用途が未定義。固定契約として明記が必要。cleanup_exec._verify_linked_issueは closing relation(または research fallback)を要求するため、Refs-bound PR では orchestrator がlinked_issue_numberを渡すとLINKED_ISSUE_MISMATCHになる。Outcome を「Task Context cleanup binding」に狭めるか、worker をlinked_issue_numberなしで dispatch する運用をpost-merge-cleanup/SKILL.mdに明記し、cleanup_exec の closing-relation 非依存認可を follow-up として名指しする。non_closing_authorityの位置)と accept / reject 写像が未定義。Reference-Decision:行(A1 present かつ invalid)の扱いが未定義。次の操作(人間判断)
上記 5 件は本文の機械的な修正で解消できる範囲です。
max_iterationsの上限により自動継続は停止しました。続行する場合は、この終了コメントを anchor としてissue-refinement-loopを再実行してください。squne121 commentedon Oct 3, 2026
live state を確認したところ、#2878 は OPEN・
phase/implementationですが、最新 OWNER コメント5964870175はissue-refinement-loop: human_escalation / max_iterations_exceededです。実装 PR・2878branch は現時点で存在せず、currentmainはf7a2cff5aa727f5b30bf86f9cb4e1440bf82fdc5。添付ログでも 5 件の semantic finding を残して refinement が停止し、implementation 未開始と記録されています。貼り付けたテキスト(1)したがって推奨は、実装を強行せず、最新終了コメントを anchor に refinement を1 invocationだけ再開 →
approvedを得た直後、このユーザー指示を実装 authority として freshimpl-review-loopentry に入り →draft_pr_readyまで自律継続です。approvedhandoff comment 自体を実装承認として扱わない点も明示しています。Repository:
squne121/loop-protocol対象:
実装: PR Closes/Refs 選択と post-merge OPEN close gate を整合する #2878 (comment)
実装: PR Closes/Refs 選択と post-merge OPEN close gate を整合する #2878 (comment)
.claude/skills/impl-review-loop/SKILL.md.claude/skills/issue-refinement-loop/SKILL.mdこの fresh な対話的 Claude Code session は既に auto mode で起動済みです。この session を継続し、新しい session を開始しないでください。
Objective
Issue #2878 を、人間への iteration ごとの承認要求なしで、最終的に current
impl-review-loopの正常終了点である **draft_pr_ready(人間が merge 判断できる直前)**まで進めてください。ただし、現時点の live GitHub state では #2878 の最新 canonical refinement termination は
approvedではなく、human_escalationmax_iterations_exceededです。
したがって作業は必ず次の 2 phase で行ってください。
最新 OWNER termination comment
5964870175を operator-selected human-context anchor として、currentissue-refinement-loopを新しい invocation として再開し、残る semantic findings を Issue contract へ反映してapprovedまで完了する。Phase A が canonical
approvedで正常終了した場合のみ、このユーザー指示そのものを明示的な implementation request / authority として、currentimpl-review-loopの Root-Owned Synchronous Entry Transition から fresh に開始し、実装・検証・PR review・修正をdraft_pr_readyまで完遂する。issue-refinement-loopのapprovedcomment やLOOP_HANDOFF_RESULT_V1marker 自体を implementation authority として扱わないでください。Phase B の authority は、このユーザーによる明示的な実装依頼です。Phase A が genuine な repository-defined
human_judgment_required、再度の canonicalmax_iterations_exceeded、またはその他の非迂回可能な terminal blocker で終了した場合は、Phase B を開始せず exact reason を報告して停止してください。Explicit operator authorization
私は repository owner/operator として、この invocation の目的を達成するために必要な以下の非破壊的作業を明示的に承認します。
Phase A: refinement recovery
mainHEAD の fresh 取得5964870175を operator-selected trusted human context として利用5963286403を背景 evidence として再確認.claude/skills/issue-refinement-loop/SKILL.mdと references の読込needs-fix/ review finding / stale readback / deterministic repair の自動修復Phase B: implementation + review loop
Phase A が
approvedになった場合、以下を明示的に承認します。.claude/skills/impl-review-loop/SKILL.mdの正式 entry の実行implementation-worker等の current canonical implementation SubAgent の使用test-runnerによる独立検証pr-reviewer/pr-review-judgeによる fresh-head review-必要に応じた failed CI job の bounded rerun
draft_pr_ready到達までの current canonical loop iteration通常の test failure、review finding、REQUEST_CHANGES、stale reviewed HEAD、BEHIND、修正可能な CI failure、implementation-related mergeability warning は人間承認待ちの理由にしないでください。current Skill の routing に従って自律的に修復・再検証してください。
Recurrence-prevention Issue
refinement または implementation 中に、#2878 の direct Outcome とは独立した再発可能な root-cause defect が fresh evidence で確認された場合は、まず repository-wide に OPEN/CLOSED 両方の既存 Issue を検索してください。
同じ Outcome を所有する Issue が存在すれば新規作成せず、その Issue を参照してください。
重複がなく、current repository-native issue creation/materialization policy 上 creation-ready であれば、新規 follow-up Issue の作成を明示的に承認します。
特に latest refinement finding 3 が current main でも成立し、
cleanup_exec._verify_linked_issueの closing-relation 非依存認可が #2878 の最終 scope 外として残る場合は、既存 Issue を dedupe した上で follow-up 候補として評価してください。新規 Issue には最低限:
を記録してください。
抽象的な「再発しそう」「security を強化した方がよい」という理由だけで schema / wrapper / gate / approval layer / ledger を新設しないでください。具体的 failure class を固定する最小恒久対策を優先してください。
Not authorized
以下は承認していません。
--dangerously-skip-permissionsFresh-state first
過去 transcript、上記で記載した SHA、過去の Skill procedure を current fact とみなさないでください。
最初に fresh に確認してください。
5964870175の full body、author association、identity5963286403mainHEAD.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/impl-review-loop/SKILL.md現時点の外部観測では #2878 の PR / branch は見つかっていませんが、これは開始時に必ず再確認してください。存在していれば duplicate を作らず再利用してください。
Phase A — refinement recovery
latest OWNER termination comment
5964870175を今回の operator-selected human-context anchor として currentissue-refinement-loopを実行してください。original anchor
5963286403は、既に disposition 済みの背景 technical evidence として利用してください。latest termination comment の未反映 findings が今回の主要修復対象です。必ず解消する残 findings
latest comment に記録された以下 5 件を current main で independently validate し、まだ成立するものを Issue body に反映してください。
1. closing keyword grammar の過剰 fail-closed
現契約の「closing keyword の後が解釈不能なら fail_closed」が通常 prose:
fixes the typoresolved by ...等まで誤検出しないようにする。
GitHub closing reference の候補とするのは、current external semantics と repository contract を確認したうえで、keyword 直後が actual issue target grammar(例:
#N/<owner>/<repo>#N/ issue URL)に入る場合へ bounded に限定することを検討してください。通常 prose が reference と誤認されない negative regression を AC / VC に固定してください。
外部仕様の判断が必要なら current GitHub official docs を fresh に確認してください。
2. reference facts / evaluator wire contract を固定
以下を prose ambiguity のまま実装へ渡さないでください。
pr_body_sha256は evaluator が実際に評価した PR body bytesから算出すること--evaluate-reference-policyと既存--body-file/--linked-issueCLI contract の関係Reference-Decision:URL の exact identity bindingupdated_atを authority / freshness に使うのか、diagnostic に限定するのか既存 schema / parser / CLI convention を再利用できるなら新 schema は作らず、current architecture と最小整合する形を選んでください。
3.
cleanup_exec._verify_linked_issueとの境界current main で、Refs-bound PR に対して
cleanup_exec._verify_linked_issueがclosingIssuesReferencesまたは research fallback を要求し、linked_issue_numberを渡すとLINKED_ISSUE_MISMATCHになる failure class を再確認してください。#2878 の Outcome が本当にどこまでを所有するかを明確にしてください。
候補は current architecture に基づいて決めること:
大掛かりな新 harness は追加しないでください。
closing-relation 非依存の
cleanup_exec認可そのものが独立 Outcome なら #2878 に無理に混ぜず、既存 Issue を dedupe した上で follow-up Issue として materialize してください。4. AC7 parity の wire を固定
producer / consumer parity regression が曖昧にならないよう、
non_closing_authorityが snapshot のどこに存在するかを contract 上 exact にしてください。
5. A2 parser と複数 A1 decision 行
A2 Runtime Verification section をどの existing parser / SSOT で読むかを決め、独自の脆い regex 再実装を避けてください。
また、PR 本文に複数の
Reference-Decision:行が存在する場合を明示し、ambiguous A1 は fail closed とするのか等を exact regression として固定してください。Phase A completion gate
以下をすべて満たすまで implementation を開始しないでください。
issue-refinement-loop: approvedtermination が publish 済みnormal な semantic
needs-fixは新 invocation の canonical iteration budget 内で自動修復してください。max_iterationsを迂回したり手動で approve を捏造してはいけません。再び canonical upper bound に到達した場合は Phase B に進まず停止してください。Transition from Phase A to Phase B
Phase A が approved になったら、refinement Skill が implementation を自動起動しないことは正しい挙動です。
その termination が完了した後、このユーザー prompt が既に implementation を明示的に依頼していることを authority として、root/main thread から current
impl-review-loopの正式 entry を fresh に開始してください。過去の contract snapshot を盲目的に再利用せず、current Issue body / current main / current PR state をもう一度取得してください。
Phase B — current impl-review-loop
current
.claude/skills/impl-review-loop/SKILL.mdを正本として従ってください。古い transcript の Step 名、command、flag、agent role を優先しないでください。特に current contract の Root-Owned Synchronous Entry Transition を守り、内部 step を ad hoc に飛び越えて worker を直接開始しないでください。
概念的には:
fresh intake → preparation / landing disposition → Step 1 implementation → Step 2 verification → Step 4 PR review → Step 5 routing → fix/retest/rereview → draft_pr_readyまで継続します。
Preparation
worker / new worktree / new PR を作る前に current canonical preparation を完了してください。
既存 PR が存在すれば current canonical
existing_pr_resume等の disposition に従って再利用し、duplicate PR を作らないでください。実装済み / already-satisfied が fresh deterministic evidence で確定した場合は current Skill の early-exit contract に従い、不要な implementation delta を作らないでください。
SubAgent lifecycle
必要な SubAgent を積極的に利用してください。
少なくとも current Skill が定義する役割:
を適切な phase で使用してください。
各 SubAgent には親会話の暗黙 context に依存させず、最低限:
を明示してください。
SubAgent を dispatch しただけで phase 完了扱いにしてはいけません。
dependency のある各 phase は、SubAgent の terminal result / background completion notification / structured final output を実際に回収してから downstream phase へ進んでください。
independent な read-only investigation は必要なら並列化して構いません。
nested delegation は current Agent / Skill contract が許可する場合のみ行ってください。
Implementation
Issue #2878 の current approved contract を実装してください。
implementation 中に Allowed Paths 外の変更が本当に不可欠だと判明した場合、勝手に scope 外を編集しないでください。current repository-native contract update / refinement route へ戻し、必要な scope adjustment を canonical に materialize してから fresh implementation entry へ戻ってください。
Verification
Issue body の Verification Commands を current approved body から fresh に取得して実行してください。
を current contract に従って検証してください。
Runtime Verification AC9 等で環境が unavailable / SKIP になった場合は、SKIP を PASS に昇格しないでください。current runtime verification policy に従い exact evidence / reason を保持してください。
test が green でも destination behavior を検証していない false-green でないことを Step 4 reviewer が独立確認できる状態にしてください。
PR
current
open-prcontract を使用してください。1 Issue = 1 PRPR を作成または更新したら、current HEAD と Issue contract を bind して verification / review を実行してください。
Review / fix loop
Step 4 の fresh
pr-reviewer/pr-review-judgereview を必ず実施してください。REQUEST_CHANGES が返った場合:
まで自動継続してください。
reviewer が返す自己申告だけで merge readiness を決めず、current
impl-review-loopcontrol-plane が所有する live mergeability / CI / HEAD routing に従ってください。reviewed_head_shaが stale なら current head で再 review。branch が BEHIND なら current canonical update-branch route。
修正可能 CI failure は原因を調査して修正または bounded rerun。
actual Git conflict は current conflict runbook に従ってください。
Completion target
以下の current
impl-review-loop正常終了条件まで続行してください。IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readydraft_pr_readyに到達したら停止してください。以下は実行しないでください。
Stop / escalation boundary
次だけを genuine stop 候補として扱ってください。
human_judgment_requiredを返したmax_iterationsに再到達通常の test failure、review finding、REQUEST_CHANGES、stale HEAD、fixable CI failure、main drift は停止理由にしないでください。
Final report
最後に簡潔に以下を報告してください。
Refinement recovery
Implementation
-主要 implementation delta
IMPL_REVIEW_LOOP_RESULT_V1statusRecurrence prevention
Remaining state
調査・提案だけで終わらず、canonical workflow が許す範囲で実作業を完遂してください。
この形なら、現在の
max_iterations_exceededを無視して false-start することを避けつつ、refinement が通った後は追加の人間承認を挟まず、そのまま正式なimpl-review-loopentry からdraft_pr_readyまで進められます。squne121 commentedon Oct 3, 2026
issue-refinement-loop: approved
feb0cfa81ea7254649c4ca696b79259148ba29ddac60d106b8da27dc48afdf3b(GitHub readback で一致を確認済み)run_contract_review_once.py --mode executeがstatus: go(baseline VC preflight pass)。Contract Snapshot コメントは未投稿で、impl-review-loopの preparation が materialize する前回 human_escalation の残 5 findings の disposition
#N/<owner>/<repo>#N/ issue URL の場合だけ reference 候補とし、通常 prose は無視する定義へ限定。negative fixture を AC2 に追加pr_body_sha256は--body-fileの bytes から算出、既存 CLI 引数との関係、A1 URL の exact 一致、updated_atは不使用と固定cleanup_exec._verify_linked_issue: fresh main で成立を再確認。Outcome を Task Context cleanup binding に限定し、closing 非依存の削除認可は follow-up 実装: cleanup_exec の linked Issue 認可を closing relation 非依存の non_closing_authority に対応させる #2891(dedupe 済み・実装: PR Closes/Refs 選択と post-merge OPEN close gate を整合する #2878 に blocked-by)へ分離non_closing_authorityは snapshot の top-level key(pullRequestの兄弟)、producer 引数との写像と accept / reject 写像、allow_non_closingkeyword-only 引数を固定prose_boundary_policy.extract_level2_section_with_boundsを再利用し独自 regex を作らない。複数Reference-Decision:行はa1_decision_ambiguousで fail_closed追加で semantic review の指摘(CLOSED の写像と
notes-only、lint mode の欠落入力、fence 内 closing の decision 別扱い、AC9 を ordered-marker と fixture 用 output schema で実体化、repo 比較の case 扱い)も反映済み。squne121 commentedon Oct 3, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Oct 3, 2026
implement-issue: 実装完了 (2026-10-03T04:34:48Z)
.claude/worktrees/issue-2878-pr-closes-refs-post-merge-open-close-gatworktree-issue-2878-pr-closes-refs-post-merge-open-close-gat9012daa404a7bc9f0ddaf77af34ccf9f3904cb03fix: Refs 本文だけでは OPEN 維持を保証しない native auto-close risk check と PR #2896 …
Merge: PR #2896 の最新 remote branch を取り込む (#2878)
Merge: PR #2896 の最新 remote branch を取り込む (#2878)
feat: PR の Closes/Refs 選択と post-merge OPEN close gate を単一の reference …