Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "operator-only VC timeout の根拠となる occurrence と実適用予算を root review artifact から追跡可能にする(#2860 の独立 follow-up)"
change_kind: workflow
dedupe_key: "follow-up:squne121/loop-protocol:issue-2860:timeout-vc-identity-v1"Parent Issue
なし(#2860 から発見した独立 defect。#2860 の子 Issue / prerequisite / hard dependency ではない)
Parent Goal Ref
- Goal: 単独改善。operator-only timeout の発生元 VC と実適用予算を、後から推測なしに特定して安全に回復できること。
- Desired Destination: 実装: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped temporary workspace で解消する #2860 は Auto mode の scratch workspace false-deny の修正。そこへ本 defect を混入させない。
Current Validated Scope
main 3d75aac938e2406f441c679c6b19b0b2c2f0883c で確認した、情報が落ちる 3 つの境界(上流から順)。
- readiness 変換:
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.pyの各 result item はtimeout_provenance(timeout_seconds/cleanup_tail_seconds/source/estimator_version/estimator_input_digest)、execution_key_hash、dedup replay 時のdedup.source_result_indexを持つ。しかし.claude/skills/issue-contract-review/scripts/contract_readiness_check.pyのmap_preflight_result_to_errors()が作るerrors[].source_payloadはcommand_hash/duration_ms/runner_env_delta等を持つ一方、timeout_provenance/execution_key_hash/dedup/ result 順序を引き継がない。line_startは result のline(fenced block 内の相対行番号。本文全体の絶対行番号ではない)をそのまま使う。同一 AC・同一コマンドを別 fenced block に置くとlineとcommand_hashが衝突し得る。 - review merge:
.claude/skills/review-issue/scripts/check_issue_contract.pyのreadiness_errors_to_structured_blockers()はhuman_judgmentで[]を返し、merge_readiness_into_review_result()は identity をblocking_issuesの文字列(fix_hint)へ縮退させる。 - 永続化:
.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.pyのrun_checker_pipeline_once()は readiness 結果を一時ディレクトリへ書き、finallyで削除する。正式な readback /gate-final-reviewは full review artifact ではなく verified transport artifact(REVIEWER_COMPACT_ARTIFACT_V2)のsemantic_resultを読む。したがって診断を transport の serialize 後や full artifact だけに足しても、正式 readback には届かない。
REVIEW_ISSUE_RESULT_V1(.claude/skills/review-issue/schemas/review_issue_result_v1.json)は additionalProperties: true である。
Remaining Parent Gaps
なし(単独改善。#2860 の scratch 契約は #2860 に残し、変更しない)
Background
2026-10-03、#2860 refinement-only recovery の独立診断。前回の .claude/artifacts/issue-refinement-loop/2860/root_review_pipeline_20261003T040757Z_2595636_2aeb9e158234.json は blocking_issues: ["Command exceeded timeout"]、failure_class: contract_readiness_human_judgment、structured_blockers: []、parsed VC 12 occurrences のみ保持し、timeout した occurrence / command_hash / 実適用予算 / plan digest の紐付けがない。対応する transport の attempt_result.json は exit_code: 0, timeout: false, transport_status: ok で、transport outer timeout ではなく inner readiness failure。中間 readiness JSON は削除されるため、現存 artifact から timeout した exact occurrence と当時の実適用 budget は復元不能。12 occurrences に対する静的下限(2000s aggregate 等)は 当時の実適用値ではない。前回 artifact は診断用であり #2860 の acceptance authority ではない。
根本原因は、既存の正しい実行時情報(timeout_provenance 等)が readiness 変換・review merge・durable artifact の各境界で落ちること。修正方針は「既に存在する情報を必要なところまで落とさず運ぶ」ことであり、新しい estimator・ledger・観測基盤は作らない。duration_ms から budget を逆算せず、現在の history を読み直した値も過去の実適用値として記録しない(#2254 / PR #2382 により budget は履歴由来で増加し、同一 invocation 内では immutable snapshot が共有される。保持すべきは既存 result の timeout_provenance である)。operator が VC を当て推量して再実行する運用 workaround は誤った VC / 予算を選ぶため採用しない。
非重複: #2887 は Vitest results cache writer attribution、#2233 (CLOSED) は command-level budget の定義・配線、#2397 (CLOSED) は operator intervention route、#1892 (CLOSED) は VCP_TIMEOUT 誤分類。#2677 (OPEN) は authority_transport.consume の outer/inner budget、#2845 (OPEN) は snapshot transport cap、#1796 (OPEN) は hermetic fixture timeout。いずれもこの root review artifact での operator-only timeout identity loss の owner ではない。#2860 の acceptance / scratch workspace 修正を prerequisite にしない。
Outcome
baseline 実行結果に既に存在する適用予算・実行識別情報を、readiness 変換で失わず、error filtering 前の canonical result(command occurrence)順に結合した小さな bounded timeout 診断として保持する。その診断を verified transport が semantic_result を serialize する前に review result へ組み込み、一時 readiness artifact の削除後も、verified transport artifact の canonical readback と full review artifact の双方から同じ内容を取得できる。既存の timeout 判定・budget 計算・operator route・Compact V2 wire は変更されず、変更を readiness producer → review merge → root pipeline の 3 scripts と focused tests に限定する。
Runtime Verification Applicability
AC3 は durable artifact の保存と canonical readback(ファイル I/O)を通して初めて検証できる動作検証 AC であるため immediate とする。外部サービス・live GitHub mutation・live agent・実時間 timeout は使わず、実時間待機だけを bounded fake にした小さなローカル動作検証として成立する。証跡は PR 本文 ## Runtime Verification Evidence に inline 引用する(docs/dev/runtime-verification-policy.md に従う)。
decision: immediate
reason: "AC3 は artifact の保存・readback の I/O を通して検証する動作検証 AC。外部サービス・live mutation・実時間 timeout は不要で、一時ディレクトリ上のローカル検証で完結する"
applicable_acs:
- AC3
execution_environment:
cli_tools:
- uv
- python3
skip_conditions:
- "uv run --locked pytest を実行できないローカル環境の場合のみ exit 77 と SKIP: を出力する"
fallback_policy:
fallback_success_is_pass: false
artifact_requirements:
- "artifacts/runtime-verification-AC3-<timestamp>.log"In Scope
contract_readiness_check.py(readiness producer):map_preflight_result_to_errors()が、既存 result item の次の項目だけを allowlist 的にerrors[].source_payloadへ引き継ぐ。(a) canonical occurrence index(error filtering 前のresults配列内の位置)、(b) block-relativeline(補助表示として座標系を明記)、(c)command_hash、(d)execution_key_hash、(e) dedup replay か実 execution source かの区別(dedup.source_result_index)、(f)timeout_provenanceの bounded な数値・既知 source 項目、(g) canonical VC plan digest と error filtering 前のresults件数results_count(readiness producer が既存 preflight payload のdiagnostic_report.canonical_plan_digestとresultsの長さを読み、readiness result のトップレベルに引き継ぐ。--expected-plan-digestは子baseline_vc_preflight.pyの argv であり readiness CLI の入力ではないため source にしない。merge 段で body や現在の history から再計算しない)。early-return / static 経路でdiagnostic_reportがnot_computedの場合、digest は欠落(null)として引き継ぎ、補完しない。baseline_vc_preflight.py の既存 result だけで足りない場合に限り scope delta で判断する(本 Issue では変更しない)。check_issue_contract.py(review merge): human_judgment の timeouterrors[]から bounded な timeout diagnostic(pinned body SHA、canonical plan digest、occurrence index、block-relative line、command_hash、必要最小限の execution identity、適用された budget provenance、attribution status と reason code)を投影し、REVIEW_ISSUE_RESULT_V1の additive な optional fieldtimeout_diagnostics(自身のschema_version: "TIMEOUT_DIAGNOSTICS_V1"を持つ)として review result に載せる。この新規 optional key の追加は Stop Condition の対象ではない(additionalProperties: true)。structured_blockersに deterministic blocker を捏造せず、failure_classは従来どおり。run_root_review_pipeline.py(root pipeline): merged review result(timeout_diagnosticsを含む)は child stdout に出力され、verified transport がsemantic_resultとして verbatim に保存し、full review artifact も同じ dict から作られる。したがって診断は一時 readiness artifact の削除前、かつsemantic_resultの serialize 前に merged result へ結合済みであること。本 script の production 変更は、plan digest / occurrence binding を readiness 実行と merge 実行へ受け渡す配線(run_contract_readiness_check()/run_merge_readiness()周辺)が必要な場合に限る。配線が不要と判明した場合は production 変更なしの test-only integration point とし、その旨を PR に記載する。- bounded の数値上限:
timeout_diagnostics.occurrencesは最大 16 件(超過分は件数のみtruncated_countと合計total_timeout_occurrencesで保持)、各 field は型制約(hash はsha256:付き hex 文字列、budget は整数、source/attribution/reason_codeは列挙値)、診断全体の直列化サイズは 16 KiB 以下とする(reviewer_transport.STDOUT_CAP= 65,536 bytes を十分下回る。超過すると capture_failure で診断自体を失うため)。 - 識別子: 「
line + command_hash」を occurrence の一意識別子としない。error filtering 前の canonical result 順の index を主識別子とし、line(block-relative)は補助表示とする。実 execution source と dedup replay occurrence を混同しない。 - 帰属不能時の挙動: 識別・binding が欠落または不一致の場合、診断内で
attribution: unknownと bounded reason code を記録する。別 VC や現在再計算した budget で補完しない。 - focused tests(下記 Allowed Paths の 3 件)。production の変換経路(execution boundary の bounded fake → real result builder → real readiness conversion → real review merge → 既存 artifact writer → temporary workspace cleanup → persisted bytes / verified readback)を通す。完成済み
timeout_provenanceを直接 fixture に注入して downstream merge だけを検証するテストは本 Issue の検証として認めない。fake にしてよいのは実時間待機等の末端 execution boundary のみ。許可する seam は次の 2 種に限る。(1)baseline_vc_preflight.run_command()の戻り値(timeout は既存 sentinelexit_code == -1かつstderr == "timeout")の差し替え。(2) process 起動 adapter の in-process 化: production はrun_checker_pipeline_once()がrun_check_issue_contract()/run_contract_readiness_check()/run_merge_readiness()を subprocess で起動し、readiness はbaseline_vc_preflight.pyを子 process で起動し、transport はrun-checker-attemptを子 process で起動する。テストはこれらの「起動 mechanics」だけを、同じ実 script のmain()を in-process で呼び stdout / exit code を捕捉する adapter に差し替えてよい(子 process 内のrun_command()差し替えを成立させるため)。result builder・readiness 変換・review merge・transport artifact builder とverify_artifact/ readback・artifact writer は実物でなければならず、完成済みtimeout_provenanceや merged result を直接注入してはならない。上記 seam で表現できずbaseline_vc_preflight.pyへの test hook 追加が必要と判明した場合は Stop Conditions に従う。
Out of Scope
baseline_vc_preflight.pyの変更、command_timeout_budgetの計算・estimator 変更(実装: canonical VC plan に command-level timeout budget を追加し、全 review wrapper に同一 budget を配線する #2233 の範囲)、実行機構・cooperative supervisor の変更。- 実装: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped temporary workspace で解消する #2860 の body / comment / branch / scratch workspace、既存 Issue の mutation、実装: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped temporary workspace で解消する #2860 の VC acceptance 判定。
- 実装: canonical executor の Vitest results cache write を writer attribution に基づき狭域で判定する #2887 の Vitest cache attribution、実装: route_canonical_step2_result() に verified failure_class ベースの operator intervention route を追加する #2397 の route / compact V2 wire 変更、実装: baseline_vc_preflight の VCP_TIMEOUT 誤分類(pytestテスト名の文字列一致)を修正する #1892 の VCP_TIMEOUT 分類変更。
- 調査: authority_transport.consume の外側 timeout と内側予算の不整合を調査し対応方針を決定する #2677 の authority_transport.consume budget、実装: contract snapshot の vc_preflight_classifications transport 上限(16,000 文字)と readiness の VC 上限(40 件)の不整合を解消し、VC が 14 件以上の Issue でも snapshot を materialize できるようにする #2845 の snapshot cap、実装: baseline VC preflight の Issue #393 snapshot fixture timeout を hermetic 化する #1796 の fixture timeout。
- raw secret / env / command output / raw command text の保存。
minimal_context、raw command、stdout / stderr、environment、runner_env_deltaを durable artifact へ丸ごとコピーすること。 - 新たな DLP・署名・secret ledger・広範な observability framework・全 artifact の redaction 改修。
- 診断欠落を理由とする新しい workflow gate / route の追加。診断 status を routing authority にすること。
Acceptance Criteria
- AC1: readiness producer が既存 result の
timeout_provenance・execution_key_hash・dedup 情報・canonical occurrence index を bounded な allowlist としてsource_payloadへ引き継ぎ、synthetic inner command-level timeout を readinesshuman_judgmentとして merge した結果が、body SHA、occurrence index、block-relative line、command_hash を含む bounded な診断を保持する。structured_blockersに deterministic blocker を捏造せず、failure_class/ operator-only route は従来どおり。 - AC2: 同一 command_hash・同一 block-relative line・同一 AC を持つ別 fenced block の 2 occurrence のうち片方だけが timeout したケースで、診断は timeout した occurrence の canonical index にのみ関連付く。実 execution source と dedup replay occurrence を区別する。判別不能時は診断内で
attribution: unknown+ bounded reason code とし、別 VC へ誤帰属させない。unknownになる条件と reason code(列挙)は次のとおり:plan_digest_missing(readiness トップレベルの digest が null)、plan_digest_mismatch(error が持つ digest と readiness トップレベルの digest が不一致)、provenance_missing(timeout_provenance欠落)、execution_key_missing(execution_key_hash欠落)、dedup_binding_invalid(dedup replay のsource_result_indexがresults_count以上、または参照先が不整合)、occurrence_index_out_of_range(occurrence_indexがresults_count以上)。merge 段はこれらを readiness result 内の値同士の比較だけで判定し、review result のparsed_vc_commands(別 parser 由来で index 整合が保証されない)は参照しない。body SHA 不一致は既存の fail-closed(merge_readiness_into_review_result()がValueErrorで merge を拒否する挙動)を変更せず、診断も生成しない。この欠落は新しい workflow 停止理由にならず、既存の timeout による operator route は維持される。 - AC3: 一時 readiness artifact の削除後に、verified transport artifact の canonical readback と full review artifact の双方から、同じ bounded diagnostic(canonical VC plan digest と、当該 result に適用された既存
timeout_provenanceの bounded 項目を該当 occurrence に結合したもの)が取得できる。immutable snapshot 取得後に history が変化しても保存値は変わらない。duration_msや現在の再計算値から budget を復元しない。provenance / binding が欠落する場合は推測せずunknown+ reason code を記録する。transporttimeout: false/exit_code: 0の inner timeout を outer timeout に誤分類しない。 - AC4: 診断は上記の数値上限を満たし(17 件以上の timeout occurrence を持つ入力でも上限内で
truncated_countを保持し、transport capture_failure にならない)、raw secret / env / stdout / stderr / raw command /minimal_context/runner_env_deltaを含まない。通常成功・非 timeout human_judgment・outer transport failure の既存 route・compact V2 wire・body-SHA mismatch 等の既存 integrity 判定は変わらず、診断 field を持たない legacy payload / 通常成功に新しい必須 gate を追加しない(focused regression tests)。
Verification Commands
# AC1
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_readiness_timeout_provenance_passthrough.py::test_readiness_passes_bounded_provenance_and_occurrence_index
# AC1
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/review-issue/tests/test_timeout_diagnostic_projection.py::test_inner_timeout_preserves_bounded_identity_without_blocker
# AC2
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/review-issue/tests/test_timeout_diagnostic_projection.py::test_same_hash_same_line_other_block_only_timed_out_occurrence_attributed
# AC2
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/review-issue/tests/test_timeout_diagnostic_projection.py::test_mismatch_or_missing_binding_records_unknown_without_new_gate
# AC3
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_root_review_timeout_diagnostics.py::test_production_path_diagnostic_survives_cleanup_in_transport_and_full_artifact
# AC3
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_root_review_timeout_diagnostics.py::test_snapshot_budget_unchanged_after_history_mutation
# AC4
# baseline-expect: fail
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_root_review_timeout_diagnostics.py::test_no_leak_and_non_timeout_routes_unchangedAllowed Paths
.claude/skills/issue-contract-review/scripts/contract_readiness_check.py.claude/skills/review-issue/scripts/check_issue_contract.py.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py.claude/skills/issue-contract-review/tests/test_readiness_timeout_provenance_passthrough.py.claude/skills/review-issue/tests/test_timeout_diagnostic_projection.py.claude/skills/issue-refinement-loop/tests/test_root_review_timeout_diagnostics.py
上記 tests 配下の 3 件は新規ファイルである。いずれの tests ディレクトリも .github/ci/python-test-plan.json に登録済み。
Stop Conditions
- 上記 Allowed Paths 外の変更が必要と判明した場合(特に既存 result の identity / provenance / ordering だけでは要件を満たせず
baseline_vc_preflight.pyの変更が必要と判明した場合は、推測で補完せず scope delta として判断を求める) - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 機密情報を出さずには診断を結合できないと判明した場合
Required Skills
なし
Required Design References
docs/dev/agent-skill-boundaries.mddocs/dev/runtime-verification-policy.md
Delivery Rule
1 Issue = 1 PR。専用 worktree、Draft PR 既定。#2860 をブロックせず、同一ファイルを変更する OPEN Issue #2760 / #2680 / #2852 と並行で同一箇所を編集しない。実編集前に current head / PR 差分を再確認して直列化する。テストの独立性は uv run --locked ではなく、固定 snapshot・一時 history store(VC_RUNTIME_HISTORY_STORE_PATH 等の既存の test 用経路)・local artifact 領域で確保する。
Notes for Reviewer
- Overlap advisory (
ISSUE_OVERLAP_PREFLIGHT_RESULT_V1:decision=overlap_requires_comment,reason_code=allowed_paths_overlap,policy_class=C1): path scope overlap は 実装: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped temporary workspace で解消する #2860, 実装: Runtime Verification の assertion 単位 applicability を表現し、無関係な assertion の AC binding が readiness 通過のための空 evidence になる false-required を防ぐ #2852, 実装: cross-contract semantic review に親Goal traceabilityを追加し safety fix のnormal-flow driftを防ぐ #2829, 再発防止: issue-refinement-loopで既存fieldの意味拡張時にreader/consumer inventoryを早期要求する #2828, 調査: follow-up Issue の contract_schema_version: 1 反復生成経路を特定し v1 強制策を決定する #2787, 実装: issue-refinement-loop handoff の title_prefix_ready を live title readback で保証する #2776, 再発防止: skill-invocation-runtime-smoke の assertion applicability を明示化する #2775, 調査: issue-refinement-loop の root_entry_router が post-merge の duplicate impl-review-loop handoff を防げない blind spot を調査し、follow-up 実装方針を確定する #2680, 実装: check_issue_contract.py の C5_ac_vc_number_alignment が AC セクション全体への広域正規表現で説明文中の AC 番号を誤抽出し、かつ VC の余分な AC 参照を検出しない問題を修正する #1712, 実装: review-issue skill の一時ファイル body 取得を fetch_issue_body() と canonical に一致させ body_sha256 divergence を防ぐ #1650, 実装: Issue MRC 追加 key の検証ロスを塞ぐ #1396, 実装: fix(issue-refinement-loop): no-human-approval autonomy mode を loop state routing に明示する #1007, 実装: issue-refinement-loop の preflight result から LOOP_STATE を生成する route wrapper を追加し CLI/schema 迷走を防ぐ #1006, feat(agent-ops): issue-contract-fixer SubAgent を追加し、LLM rewrite 前に deterministic contract repair を完了させる #998, feat(issue-refinement-loop): LOOP_ITERATION_CAPSULE_V1 を導入し、raw body / raw log の main context 流入を禁止する #997, 実装: issue-refinement-loop の rewrite routing が既存 blocker contract を consume して non-body-author-fixable blocker を早期停止できるようにする #944, test: scope_signal_guard termination の publisher-level 回帰テストを追加する #926, 改善: scope_cvs_in_scope_mismatch path extension allowlist を repo extension inventory に同期 #438, 改善: scope_cvs_in_scope_mismatch bullet parser を ordered list / continuation line 対応 #437, 改善: scope_cvs_in_scope_mismatch warning の path/word token namespace 分離 #436 を検出。non_conflict_reason: 実装: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped temporary workspace で解消する #2860 は scratch / test directory、実装: Runtime Verification の assertion 単位 applicability を表現し、無関係な assertion の AC binding が readiness 通過のための空 evidence になる false-required を防ぐ #2852 は runtime assertion applicability、調査: issue-refinement-loop の root_entry_router が post-merge の duplicate impl-review-loop handoff を防げない blind spot を調査し、follow-up 実装方針を確定する #2680 は research-only、実装: check_issue_contract.py の C5_ac_vc_number_alignment が AC セクション全体への広域正規表現で説明文中の AC 番号を誤抽出し、かつ VC の余分な AC 参照を検出しない問題を修正する #1712 は C5 AC/VC numbering であり同 outcome を所有しない。edit_intent: readiness 変換での情報保持、human_judgment projection、durable root artifact への診断結合のみ。dependency ordering: hard dependency はなく、実編集前に OPEN PR / current head を確認して並行編集を避ける。再発防止: invalid baseline-expect annotation を body-author-fixable needs_fix として扱う #2760 は同じ pipeline ファイルを言及するが annotation 分類が目的であり本件と異なる。 - 2026-10-03 の OWNER REQUEST_CHANGES(https://github.com/squne121/loop-protocol/issues/2897#issuecomment-5970128517)を反映した契約改訂である。恒久判断は本文に取り込み済みで、コメントは永久仕様にしない。
REVIEW_ISSUE_RESULT_V1の additive field 名の最終決定と consumer(compact_review_result.py/reviewer_transport.py)互換性は実装時に確認する。既存 consumer が optional field を受理しない場合は Stop Conditions に従う。
Activity
squne121 commentedon Oct 3, 2026
判定:REQUEST_CHANGES — 狙いは正しいが、情報を失う境界をスコープに入れる必要があります
#2897 は有用な改善です。ただし、現在の「実装変更は2ファイルだけ」という制約では、実際に適用された予算と、重複する VC の正確な発生位置を保持する契約を満たせません。 新しい監視基盤や厳しいゲートを追加するのではなく、readiness producer での最小限の情報保持、保存前の診断結合、実際の変換経路を通すテストへ修正するのが適切です。
確認基準は、2026年10月3日に取得した
main3d75aac938e2406f441c679c6b19b0b2c2f0883cです。Issue 本文・コメント欄、発見元 #2860 のコメント、#2233、履歴予算を実装した PR #2382/#2254、operator route を実装した PR #2398/#2397、関連する現行コード・スキーマ・設計文書を照合しました。#2897 のコメントは取得時点で0件でした。P1-1:予算情報は merge より前に消えており、現在の Allowed Paths では修復できない
対象:Current Validated Scope、Outcome、AC3、Allowed Paths、Stop Conditions。
Issue は主に
merge_readiness_into_review_result()と root artifact の永続化を損失地点として挙げています。しかし、現行実装には、その手前にも重要な損失地点があります。baseline_vc_preflight.pyは各 result item に、そのコマンドの budget から作ったtimeout_provenanceを付けています。一方、contract_readiness_check.pyのmap_preflight_result_to_errors()が生成するsource_payloadには、command_hashやduration_msはありますが、timeout_provenanceとexecution_key_hashは引き継がれていません。また、build_result()のsource_checksは名前・スキーマ・status・exit code の要約であり、元の result item を保持する代替経路にはなっていません。つまり、現在の主要な流れはこうです。
後段の2ファイルだけ直しても、既に消えた実行時情報は取り戻せません。 root 側で計算した plan を後から添付するだけでは、「予定していた予算」と「当該 result の実行に適用された予算」の結合を証明したことにはなりません。
特に #2254/PR #2382 では、履歴から budget を増加させる実装と、同一 invocation 内で immutable snapshot を共有する配線が既に入っています。したがって、現在の履歴を読み直した値を過去の実適用値として保存する方法は不適切です。新しい estimator を作る必要もありません。
修正案: 少なくとも
contract_readiness_check.pyと、その focused regression test を Allowed Paths に加えてください。変更責務は、既存の実行結果から必要な情報だけを readiness へ引き継ぐことに限定できます。現状の「readiness producer の変更が必要なら停止」という Stop Condition は、未知の危険を検出する条件というより、既に判明している必要作業で実装を止める条件になっています。ここは実装開始前に解消すべきです。
P1-2:
line + command_hashは重複 occurrence の識別子にならない対象:AC1・AC2、occurrence の定義。
現行
baseline_vc_preflight.pyの adapter は、結果のlineにentry.block_line_number、つまりコードブロック内の行番号を採用しています。本文全体の行番号でも、Verification Commands セクション全体の行番号でもありません。この座標系は、互換性維持のため意図的に残されています。したがって、例えば同じ AC・同じコマンドを別々の fenced block に置いた場合、双方が次の同じ識別情報を持ち得ます。
一方だけ timeout した後に、フィルタ済みの
errors[]からline + hashで結合し直すと、どちらの実行結果だったかが失われます。line_startというフィールド名になっていても、本文上の絶対行番号になったわけではありません。 readiness 側は元のr["line"]をそのまま使っています。もう一つ注意すべきなのは、既存の duplicate diagnostic helper を、そのまま実行 occurrence の正本にしないことです。現行コードでは通常実行と canonical plan は共有 parser の adapter を使いますが、duplicate diagnostic の表示経路には legacy parser が残ると明記されています。今回のために別の parser で発生位置を再構築すると、再び識別対象がずれる余地を作ります。
修正案: エラーだけに絞り込む前の、canonical な result/command occurrence 順に基づく番号を保持してください。行番号は補助表示として残し、その座標系も明記します。
既存 result には
execution_key_hash、runner、dedup のsource_result_index等もあります。結果再利用を扱う場合は、実際の実行元と、それを参照する occurrence を混同しないように、必要なものだけ引き継ぐのがよいです。新しい UUID 台帳は不要です。AC2 の negative control は、「同一 hash」だけでなく、同一 hash・同一 block-relative line・同一 AC を持つ別ブロックの2 occurrence のうち、片方だけが timeout するケースまで具体化してください。
P1-3:「root artifact に保存」だけでは、正式な readback 側に診断が届かない実装を許してしまう
対象:AC3、root-owned durable artifact の定義。
run_root_review_pipeline.pyは、役割の異なる二つの artifact を扱っています。150秒待機、live #2860 の再実行、実 Claude-GPT の起動、大規模な性能測定は、この情報保持の検証には不要です。
P2:診断機能の欠落を、新しい workflow 停止理由にしない
AC2 の「fail-closed(unknown / operator intervention)」は、適用範囲をもう少し限定すべきです。帰属不能な診断を正確だと表示しないことと、診断が不完全だから workflow 全体を新たに停止することは別です。現在の Issue は既存 route の維持も要求しているため、この境界を明文化した方が実装者が迷いません。
PR #2398 は、Compact V2 の
NEXT_ACTIONを拡張する旧案を撤回し、verified なmerged_review_result.failure_classから operator route を決める方式に整理されています。今回もその責務を保ち、診断の status を新しい route authority にしないのが適切です。おすすめの契約は次です。
機密情報対策も、必要なフィールドだけを選んで保存する方法で十分です。readiness の
minimal_contextは raw command や出力断片を含み、source_payloadにはrunner_env_delta等もあります。これらを丸ごとコピーして後から消すのではなく、digest、occurrence 番号、座標情報、必要な execution identity、数値と既知の source を持つ budget provenance だけを選択してください。新しい DLP、署名、秘密鍵、包括的なログ台帳、全 artifact の redaction 改修は、本件の解決には不要です。
実装前に直したい、本文上の小さな詰まり
新規テスト用 VC に
# baseline-expect: failがありません。 現行 preflight には、新規 Allowed Path が baseline に存在しない場合に、この注釈を要求するmissing_baseline_expect_for_new_allowed_path判定があります。今回の新規2ファイルを参照する4コマンドには、それぞれ注釈を付ける形へ修正してください。これは新しいハーネスを足す話ではなく、既存の入口で不要な修正ループを起こさないための本文修正です。例えば、現在の AC1 用ブロックは次の形です。
Runtime Verification Applicability の理由も修正した方がよいです。 「GitHub mutation や実時間 timeout を伴わない」ことは、「I/O 境界を検証しなくてよい」ことと同義ではありません。AC3 は durable artifact の保存・readback を要求しており、現行 runtime policy は I/O を通して初めて検証できる AC を動作検証として扱います。AC3 を小さなローカルの動作検証として整理するのが素直であり、外部サービスや live agent の検証へ広げる必要はありません。
Web 調査からの実装上の注意
duration_msから timeout budget を逆算しないでください。 Python のsubprocess.run()は timeout 後に子プロセスを終了させて待機します。CPython の実装も、その終了処理を行ってから例外を再送出しています。経過時間と設定された timeout は別の値なので、既存のtimeout_provenanceを保持する設計が正しいです。今回のために、既存の cooperative supervisor や process cleanup を書き換える必要はありません。Python documentationまた、
uv run --lockedだけで hermetic になるわけではありません。uv の公式仕様では、--lockedは lockfile の更新を禁止しますが、環境の同期まで禁止する指定ではありません。テストの独立性は、固定 snapshot と一時 history store、ローカル artifact 領域で確保してください。既存実装にはVC_RUNTIME_HISTORY_STORE_PATHを使うテスト用経路があるため、別の隔離基盤を作る必要はありません。Astral Docs推奨する着地点
#2897 を分割せず、同じ Issue の契約を小さく修正して進めることを推奨します。 Outcome は、例えば次の内容にすると実装範囲と達成条件が揃います。
変更の中心は、既存2スクリプトに readiness producer と対応テストを加えることです。baseline 側を変更する必要性は、既存 result の順序・identity・provenance で足りるかを確認して判断し、先に estimator や実行機構まで広げない方がよいです。
#2860 の scratch 改善と本件を独立させる方針、過去の適用予算を推測で埋めない方針、operator-only failure を deterministic な本文修正 blocker に変換しない方針は、そのまま維持してください。最優先は「安全機構の追加」ではなく、「既にある正しい情報を、必要なところまで落とさず運ぶこと」です。
本レビューでは、リポジトリのテスト実行、live #2860 の再試行、履歴に記載されたローカル artifact の直接取得は行っていません。情報欠落と座標系・保存先の問題は取得した現行コードで確認しましたが、過去に timeout した exact occurrence 自体は特定していません。GitHub の本文変更・コメント投稿も行っていません。
# 判定:REQUEST_CHANGES — 狙いは正しいが、情報を失う境界をスコープに入れる必要があります#2897 は有用な改善です。ただし、現在の「実装変更は2ファイルだけ」という制約では、実際に適用された予算と、重複する VC の正確な発生位置を保持する契約を満たせません。 新しい監視基盤や厳しいゲートを追加するのではなく、readiness producer での最小限の情報保持、保存前の診断結合、実際の変換経路を通すテストへ修正するのが適切です。
確認基準は、2026年10月3日に取得した
main3d75aac938e2406f441c679c6b19b0b2c2f0883cです。Issue 本文・コメント欄、発見元 #2860 のコメント、#2233、履歴予算を実装した PR #2382/#2254、operator route を実装した PR #2398/#2397、関連する現行コード・スキーマ・設計文書を照合しました。#2897 のコメントは取得時点で0件でした。P1-1:予算情報は merge より前に消えており、現在の Allowed Paths では修復できない
対象:Current Validated Scope、Outcome、AC3、Allowed Paths、Stop Conditions。
Issue は主に
merge_readiness_into_review_result()と root artifact の永続化を損失地点として挙げています。しかし、現行実装には、その手前にも重要な損失地点があります。baseline_vc_preflight.pyは各 result item に、そのコマンドの budget から作ったtimeout_provenanceを付けています。一方、contract_readiness_check.pyのmap_preflight_result_to_errors()が生成するsource_payloadには、command_hashやduration_msはありますが、timeout_provenanceとexecution_key_hashは引き継がれていません。また、build_result()のsource_checksは名前・スキーマ・status・exit code の要約であり、元の result item を保持する代替経路にはなっていません。つまり、現在の主要な流れはこうです。
後段の2ファイルだけ直しても、既に消えた実行時情報は取り戻せません。 root 側で計算した plan を後から添付するだけでは、「予定していた予算」と「当該 result の実行に適用された予算」の結合を証明したことにはなりません。
特に #2254/PR #2382 では、履歴から budget を増加させる実装と、同一 invocation 内で immutable snapshot を共有する配線が既に入っています。したがって、現在の履歴を読み直した値を過去の実適用値として保存する方法は不適切です。新しい estimator を作る必要もありません。
修正案: 少なくとも
contract_readiness_check.pyと、その focused regression test を Allowed Paths に加えてください。変更責務は、既存の実行結果から必要な情報だけを readiness へ引き継ぐことに限定できます。現状の「readiness producer の変更が必要なら停止」という Stop Condition は、未知の危険を検出する条件というより、既に判明している必要作業で実装を止める条件になっています。ここは実装開始前に解消すべきです。
P1-2:
line + command_hashは重複 occurrence の識別子にならない対象:AC1・AC2、occurrence の定義。
現行
baseline_vc_preflight.pyの adapter は、結果のlineにentry.block_line_number、つまりコードブロック内の行番号を採用しています。本文全体の行番号でも、Verification Commands セクション全体の行番号でもありません。この座標系は、互換性維持のため意図的に残されています。したがって、例えば同じ AC・同じコマンドを別々の fenced block に置いた場合、双方が次の同じ識別情報を持ち得ます。
一方だけ timeout した後に、フィルタ済みの
errors[]からline + hashで結合し直すと、どちらの実行結果だったかが失われます。line_startというフィールド名になっていても、本文上の絶対行番号になったわけではありません。 readiness 側は元のr["line"]をそのまま使っています。もう一つ注意すべきなのは、既存の duplicate diagnostic helper を、そのまま実行 occurrence の正本にしないことです。現行コードでは通常実行と canonical plan は共有 parser の adapter を使いますが、duplicate diagnostic の表示経路には legacy parser が残ると明記されています。今回のために別の parser で発生位置を再構築すると、再び識別対象がずれる余地を作ります。
修正案: エラーだけに絞り込む前の、canonical な result/command occurrence 順に基づく番号を保持してください。行番号は補助表示として残し、その座標系も明記します。
既存 result には
execution_key_hash、runner、dedup のsource_result_index等もあります。結果再利用を扱う場合は、実際の実行元と、それを参照する occurrence を混同しないように、必要なものだけ引き継ぐのがよいです。新しい UUID 台帳は不要です。AC2 の negative control は、「同一 hash」だけでなく、同一 hash・同一 block-relative line・同一 AC を持つ別ブロックの2 occurrence のうち、片方だけが timeout するケースまで具体化してください。
P1-3:「root artifact に保存」だけでは、正式な readback 側に診断が届かない実装を許してしまう
対象:AC3、root-owned durable artifact の定義。
run_root_review_pipeline.pyは、役割の異なる二つの artifact を扱っています。full_review_artifactREVIEW_ISSUE_RESULT_V1。人間・ツール向けの完全な review 結果verified_transport_artifactREVIEWER_COMPACT_ARTIFACT_V2。完全な結果をsemantic_resultに含み、正式なreadback/gate-final-reviewが読む対象現行コードは、transport artifact を検証して
semantic_resultを取り出し、その後で full review artifact を保存します。正式な readback は full review artifact を入力にしないことも、コードに明記されています。そのため、例えば
_cmd_produce()の末尾で full review artifact だけに診断を追加する実装では、目視用 JSON には情報があるのに、正式な readback 対象にはない、という食い違いが生まれます。これは現在発生しているバグという指摘ではなく、現在の AC の曖昧さが許してしまう実装上の失敗経路です。修正案: 診断は、transport が
semantic_resultをシリアライズする前に結合してください。AC3 は次の二点を要求すると明確になります。なお、現行
REVIEW_ISSUE_RESULT_V1の JSON Schema はトップレベルのadditionalProperties: trueを許容しています。したがって、新フィールドのために必ずスキーマの大改訂が必要、という状況ではありません。optional な小さな診断オブジェクトで収める余地があります。ただし、その追加を許可する契約と、consumer の互換性テストは明示すべきです。P1-4:現行のテスト契約は、producer に存在しない値を fixture で与えても通せてしまう
対象:AC1・AC3、Verification Commands。
現在の AC は synthetic timeout と hermetic readback を要求していますが、どの境界に synthetic な結果を注入するかを固定していません。そのため、実際の readiness producer には存在しない
timeout_provenanceや occurrence ID を、テストの readiness JSON に最初から入れれば、後段の merge/保存だけを通して PASS にできてしまいます。P1-1 の情報欠落を見逃す構造です。これは単なる一般論ではありません。PR #2382 の OWNER レビューでは、同じ計算関数へ同じ手製 snapshot を渡すテストが、本番の subprocess 間で snapshot を渡していない問題を検出できなかったことが指摘されています。その後の実差分では、root から readiness、baseline への snapshot の受け渡しが追加されています。今回も「値の計算は正しいが、経路の途中で落ちる」という同種の問題です。
修正案: 少なくとも一つは、次の経路を通すテストにしてください。
fake にしてよいのは、実際に時間がかかるコマンド実行などの末端です。予算を落とす可能性がある変換関数そのものは fake にしないでください。pytest の
monkeypatch.context()は変更範囲を限定し、終了時に戻す仕組みとして使えます。標準ライブラリ全体の挙動を広く差し替える必要はありません。[pytest ドキュメント](https://docs.pytest.org/en/stable/how-to/monkeypatch.html)必要なケースは、次程度で十分です。
150秒待機、live #2860 の再実行、実 Claude-GPT の起動、大規模な性能測定は、この情報保持の検証には不要です。
P2:診断機能の欠落を、新しい workflow 停止理由にしない
AC2 の「fail-closed(unknown / operator intervention)」は、適用範囲をもう少し限定すべきです。帰属不能な診断を正確だと表示しないことと、診断が不完全だから workflow 全体を新たに停止することは別です。現在の Issue は既存 route の維持も要求しているため、この境界を明文化した方が実装者が迷いません。
PR #2398 は、Compact V2 の
NEXT_ACTIONを拡張する旧案を撤回し、verified なmerged_review_result.failure_classから operator route を決める方式に整理されています。今回もその責務を保ち、診断の status を新しい route authority にしないのが適切です。おすすめの契約は次です。
機密情報対策も、必要なフィールドだけを選んで保存する方法で十分です。readiness の
minimal_contextは raw command や出力断片を含み、source_payloadにはrunner_env_delta等もあります。これらを丸ごとコピーして後から消すのではなく、digest、occurrence 番号、座標情報、必要な execution identity、数値と既知の source を持つ budget provenance だけを選択してください。新しい DLP、署名、秘密鍵、包括的なログ台帳、全 artifact の redaction 改修は、本件の解決には不要です。
実装前に直したい、本文上の小さな詰まり
新規テスト用 VC に
# baseline-expect: failがありません。 現行 preflight には、新規 Allowed Path が baseline に存在しない場合に、この注釈を要求するmissing_baseline_expect_for_new_allowed_path判定があります。今回の新規2ファイルを参照する4コマンドには、それぞれ注釈を付ける形へ修正してください。これは新しいハーネスを足す話ではなく、既存の入口で不要な修正ループを起こさないための本文修正です。例えば、現在の AC1 用ブロックは次の形です。
Runtime Verification Applicability の理由も修正した方がよいです。 「GitHub mutation や実時間 timeout を伴わない」ことは、「I/O 境界を検証しなくてよい」ことと同義ではありません。AC3 は durable artifact の保存・readback を要求しており、現行 runtime policy は I/O を通して初めて検証できる AC を動作検証として扱います。AC3 を小さなローカルの動作検証として整理するのが素直であり、外部サービスや live agent の検証へ広げる必要はありません。
Web 調査からの実装上の注意
duration_msから timeout budget を逆算しないでください。 Python のsubprocess.run()は timeout 後に子プロセスを終了させて待機します。CPython の実装も、その終了処理を行ってから例外を再送出しています。経過時間と設定された timeout は別の値なので、既存のtimeout_provenanceを保持する設計が正しいです。今回のために、既存の cooperative supervisor や process cleanup を書き換える必要はありません。[Python documentation](https://docs.python.org/3/library/subprocess.html)また、
uv run --lockedだけで hermetic になるわけではありません。uv の公式仕様では、--lockedは lockfile の更新を禁止しますが、環境の同期まで禁止する指定ではありません。テストの独立性は、固定 snapshot と一時 history store、ローカル artifact 領域で確保してください。既存実装にはVC_RUNTIME_HISTORY_STORE_PATHを使うテスト用経路があるため、別の隔離基盤を作る必要はありません。[Astral Docs](https://docs.astral.sh/uv/concepts/projects/sync/)推奨する着地点
#2897 を分割せず、同じ Issue の契約を小さく修正して進めることを推奨します。 Outcome は、例えば次の内容にすると実装範囲と達成条件が揃います。
変更の中心は、既存2スクリプトに readiness producer と対応テストを加えることです。baseline 側を変更する必要性は、既存 result の順序・identity・provenance で足りるかを確認して判断し、先に estimator や実行機構まで広げない方がよいです。
#2860 の scratch 改善と本件を独立させる方針、過去の適用予算を推測で埋めない方針、operator-only failure を deterministic な本文修正 blocker に変換しない方針は、そのまま維持してください。最優先は「安全機構の追加」ではなく、「既にある正しい情報を、必要なところまで落とさず運ぶこと」です。
本レビューでは、リポジトリのテスト実行、live #2860 の再試行、履歴に記載されたローカル artifact の直接取得は行っていません。情報欠落と座標系・保存先の問題は取得した現行コードで確認しましたが、過去に timeout した exact occurrence 自体は特定していません。GitHub の本文変更・コメント投稿も行っていません。
squne121 commentedon Oct 3, 2026
GitHub の live state を確認済みです。#2897 は OPEN、指定コメントは
author_association: OWNERのREQUEST_CHANGES、current main はレビュー基準と同じ3d75aac938e2406f441c679c6b19b0b2c2f0883c、#2897 に紐づく PR は現時点で見つかっていません。currentissue-refinement-loopでは、この種のコメントはpreflight.run.with_human_context→ 必要なら controlled contract update /issue-editorへ進むのが正規経路です。そのまま既存の interactive Claude Code Auto mode に貼り付ける prompt です。
repo=
squne121/loop-protocol対象:
実装: operator-only VC timeout の occurrence・budget identity を root review artifact に保持する #2897 (comment)
.claude/skills/issue-refinement-loop/SKILL.mdあなたは既に interactive Claude Code の Auto mode で起動済みです。新しい Claude Code session を起動せず、この session を継続してください。
目的は、上記 OWNER
REQUEST_CHANGESを human-context authority として取り込み、current repository の canonicalissue-refinement-loopを実行し、Issue #2897 の contract を人間の iteration 承認なしで refinement 完了まで進めることです。今回は refinement-only です。Issue が approved になってもimpl-review-loop、implementation worker、production code 実装、実装用 PR 作成には進まないでください。1. 最初に fresh state を取得する
過去の会話や古い artifact を正本にせず、開始時に必ず fresh に以下を確認してください。
.claude/skills/issue-refinement-loop/SKILL.md.claude/agents/codebase-investigator.md.claude/agents/issue-editor.mdissue-creator等の current agent contract2026-10-03 のレビュー時点では main
3d75aac938e2406f441c679c6b19b0b2c2f0883cだったが、実行時には必ず再取得し、drift があれば current main を authority としてください。2. この invocation に対する明示的な operator approval
以下の通常・非破壊的作業は、このプロンプトにより明示的に承認します。各 iteration ごとに私へ承認確認しないでください。
issue-refinement-loopの canonical preflight / planner / checker / reviewcodebase-investigator等、current Skill が要求・許可する SubAgent の起動issue-editor/edit-issuecontrolled transaction による full rewriteneeds-fixに対する bounded 自動反復これは repository loop iteration の承認です。Claude Code の permission boundary を解除する指示ではありません。
以下は禁止します。
bypassPermissions--dangerously-skip-permissionscanonical
human_judgment_required、evidence-integrity failure、destructive operation、permission boundary change 等の hard stop は迂回しないでください。3. anchor comment は operator-selected human-context として処理する
指定 URL は、この invocation で私が human-context として明示選択したものです。
current
issue-refinement-loopの origin semantics に従い、canonicalpreflight.run.with_human_contextlane を使用してください。URL やauthor_associationだけから origin を再推定しないでください。comment snapshot は対象 Issue #2897 への所属を検証し、current anchor handling contract に従って固定してください。
raw anchor body を planner input や
issue-editorの raw feedback text として無制限に転送せず、current Skill が定める normalized human-context /reviewer_feedback_url境界を守ってください。4. 最初の SubAgent: codebase-investigator
anchor comment は repository fact に依存するため、Step 1 の
codebase-investigatorを必ず使用してください。最低限、以下を current main で fact-check させてください。
baseline_vc_preflight.pyの result item に存在するtimeout_provenanceexecution_key_hashsource_result_index.claude/skills/issue-contract-review/scripts/contract_readiness_check.pyの
map_preflight_result_to_errors()で何が失われるか.claude/skills/review-issue/scripts/check_issue_contract.pyの readiness merge 境界
.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.pyの
semantic_resultの actual producer/consumer sequence
lineの座標系この調査は read-only で行ってください。
SubAgent を dispatch しただけで次へ進まないこと。必ず terminal completion を待ち、最終 result を取得してからその evidence を downstream decision に使ってください。
SubAgent に暗黙 context を期待させず、task / target Issue / anchor URL / authority / constraints / expected evidence / expected output を明示してください。
nested SubAgent delegation は許可しないでください。
5. trusted contract update を canonical route で実行する
current Skill / command registry を読み、手書きの独自 mutation route を作らず、canonical command IDs / executor を使用してください。
preflight.run.with_human_contextの結果に従ってください。contract patch が安全に導出できる場合
canonical
contract_update.run.with_human_contextを使って適用してください。exact Allowed Path の導出に investigation evidence が必要な場合
current
codebase-investigatorの read-only evidence から exact repository-relative path を導出し、current Skill の investigation evidence transport 契約を使用してください。read-only preflight で manifest が生成された場合、contract update では同一 manifestを再利用し、独自に再生成しないでください。
NEXT_ACTION: issue_editor_requiredの場合contract_update.run.with_human_contextを no-progress 再実行しないでください。同じ anchor URL を
reviewer_feedback_urlとして current Step 4 のissue-editor/edit-issuecontrolled route へ渡し、Issue #2897 の full rewrite を実施してください。ここでも
issue-editorSubAgent の terminal completion を必ず待ち、mutation の結果だけで成功扱いせず、まで完了させてください。
6. anchor REQUEST_CHANGES で必ず解消すべき内容
anchor comment を authority としつつ、current main で fact-check 後に contract を修正してください。少なくとも次を解消してください。
A. readiness producer の損失境界を scope に含める
現在の 2 scripts 限定 scope では不足しています。
current main の exact path を確認した上で、少なくとも readiness producer
.claude/skills/issue-contract-review/scripts/contract_readiness_check.pyと対応する focused regression test を Allowed Paths / In Scope に含める方向で refinement してください。
ただし
baseline_vc_preflight.py自体の変更は先走って追加しないでください。既存 result の identity / provenance / ordering で要件を満たせるかを current code で確認し、不足すると判明した場合だけ canonical scope-delta route に従って判断してください。B. occurrence identity を明確化する
line + command_hashを unique occurrence identity とみなさないでください。lineが block-relative coordinate である current semantics を明記し、error filtering 前の canonical result / command occurrence order を用いた識別を contract に反映してください。negative control は最低でも、
を区別できるケースにしてください。
実 execution source と dedup replay occurrence も混同しないでください。
C. durable artifact の readback contract を明確化する
AC は「full review artifact に情報がある」だけでは不十分です。
timeout diagnostic を verified transport が
semantic_resultを serialize する前に結合し、の双方から同じ bounded diagnostic を取得できることを要求してください。
Compact V2 wire や operator routing authority を新しい diagnostic status に移さないでください。
D. production transformation path を通す regression を要求する
fixture に完成済み
timeout_provenanceを直接注入して downstream merge だけを試験する false-green を禁止してください。最低 1 件は、概念的に以下を通してください。
execution boundary の bounded fake
→ real result builder
→ real readiness conversion
→ real review merge
→ existing artifact writer
→ temporary workspace cleanup
→ persisted bytes / verified readback
fake にしてよいのは実時間待機等の末端 execution boundary です。情報を落とす可能性がある transformation function は fake にしないでください。
必要な focused cases:
150 秒の実待機、live #2860 再実行、実 Claude-GPT 起動は不要です。
E. diagnostic incompleteness を新しい workflow gate にしない
timeout による既存 operator route は維持してください。
診断の attribution が不能・不完全な場合は diagnostic 内で
unknownと bounded reason code を記録し、別 VC や現在再計算した budget で補完しないでください。diagnostic field が存在しない legacy payload / normal success に、新しい mandatory gate を追加しないでください。
既存 body-SHA mismatch 等の integrity decision は変更しないでください。
F. bounded / secret-safe projection
raw
minimal_context、raw command、stdout、stderr、environment、runner_env_delta等を丸ごと durable artifact へコピーしないでください。必要最小限のものだけを allowlist 的に保持する contract にしてください。
例:
新規 DLP、署名、secret ledger、汎用 observability framework は追加しないでください。
G. Verification Commands の baseline annotation
新規 test file を参照する baseline VC には current preflight contract に従って
# baseline-expect: failを付けてください。既存ファイルになった後の semantics と矛盾しない current canonical syntax を確認してください。
H. Runtime Verification Applicability を再評価する
現本文の
not_applicableをそのまま維持すると決め打ちしないでください。current
docs/dev/runtime-verification-policy.mdに照らし、durable artifact write/readback という I/O behavior を AC3 で検証するための小さなローカル動作検証として適切な decision / binding に修正してください。外部サービス、live GitHub mutation、live agent、実時間 timeout まで広げる必要はありません。
I. budget を duration から逆算しない
duration_msから configured timeout budget を復元しないでください。既存 result の
timeout_provenance/ immutable invocation snapshot を保持する contract にしてください。また
uv run --lockedだけを hermeticity の証明にせず、既存の固定 snapshot、temporary history store、local artifact isolation を使う方針にしてください。7. review / repair loop
contract rewrite 後は必ず fresh body を対象に canonical loop を続行してください。
run_root_review_pipeline.py経路を使うissue-reviewerSubAgent を起動しない(status, verdict, next_action)を current deterministic consumer に従って routing するneeds-fixかつ loop budget 内なら人間承認なしで自動継続human_judgment_requiredは捏造して突破しないStep 2 や rewrite の後も、dependent SubAgent / command の terminal completion と final result を取得してから次段へ進んでください。
8. Web research
current planner / Skill が critical external claim の fresh verification を要求する場合だけ
web-researcherを使ってください。Python subprocess timeout semantics、pytest monkeypatch、uv
--lockedsemantics 等を再検証する必要があるなら、公式 docs を優先してください。web-researcherを使った場合も dispatch だけで完了扱いせず terminal completion を待ってください。repository evidence だけで disposition が決定できるものについて無駄な Web 調査を増やさないでください。
9. 再発防止 follow-up Issue
refinement 中に、#2897 の scope に混ぜるべきでない recurrent defect / harness defect / contract gap を発見した場合は、再発防止策を別 GitHub Issue として扱ってください。
この invocation では、通常の非破壊的な follow-up Issue materialization を明示的に承認します。
ただし必ず:
follow-up-materialization/create-issuecanonical workflow を使うissue-creatorを使う場合は terminal completion を待つcurrent deterministic policy が
human_judgment_requiredと判定する場合は、それを迂回して無理に起票しないでください。その場合は final report に blocker と dedupe 調査結果を残してください。10. 終了境界
issue-refinement-loopがapprovedになったら、current termination policy に従って必要な termination report / handoff telemetry まで完了してください。ただし今回は refinement-only なので、その後の implementation を開始しないでください。
以下は行わないでください。
impl-review-loop起動11. 最終報告
最後に簡潔に以下を報告してください。
調査だけ・提案だけで止まらず、canonical workflow が許す範囲で Issue contract の実修正、fresh re-review、termination まで完遂してください。
特に今回のポイントは、canonical Step 2 では
issue-reviewerSubAgent を起動しない一方、Step 1 のcodebase-investigatorは明示的に使わせることです。また、OWNER コメントが要求する scope expansion は currentwith_human_context/issue_editor_required経路で処理できるため、手作業の Issue 編集を直接指示するより、この prompt の方が現行 workflow に整合します。squne121 commentedon Oct 3, 2026
Refinement Loop Termination(
issue-refinement-loop)verdict: approved
operator-selected human-context anchor(issuecomment-5970128517、OWNER の REQUEST_CHANGES)を基準に、fresh investigation(read-only SubAgent
codebase-investigatorによる fact-check)と、deterministic review + semantic design review(issue-design-reviewer)を 3 サイクル経て Issue 本文を改訂した。main3d75aac938e2406f441c679c6b19b0b2c2f0883cで確認。contract_readiness_check.pyと対応 test 3 件を追加(baseline_vc_preflight.pyは既存 result の identity / provenance / ordering で足りるため変更しない。不足判明時は Stop Condition)。occurrence は error filtering 前の canonical result 順 index を主識別子とし、line(block-relative)は補助表示。診断はtimeout_diagnostics(TIMEOUT_DIAGNOSTICS_V1)として verified transport のsemantic_resultserialize 前に結合し、verified readback と full review artifact の双方から取得可能にする。bounded な数値上限・allowlist 投影・unknown+ reason code 列挙を明記し、新 workflow gate は追加しない。production 変換経路を通す regression と許可 seam を定義。新規 test VC に# baseline-expect: failを付与。Runtime Verification Applicability はnot_applicableからimmediate(AC3、ローカル I/O 検証)へ変更。preflight.run.with_human_contextは freshpass。contract_update.run.with_human_contextは exact path 用 investigation manifest 付きでもcontract_patch_plan_missingで patch 導出不能だったため、Step 4 のissue-editor(edit_issue_txn.pycontrolled transaction、anchor URL をreviewer_feedback_url)で本文を rewrite した。approve(blocking issue なし)。semantic review: 最終 iteration は medium 1 件のみ(plan_digest_mismatchの error 側 digest の出所が未記述。join はapprove、warning 扱い。実装時にcanonical_plan_digestを各 timeout error のsource_payloadにも複写するか、当該 reason code を削除して解消すること)。issue-contract-review(execute / baseline)status: go、readinessgo、VC preflightpass。approvedは実装開始の代替承認ではなく、impl-review-loopは起動していない。final body sha256:
ff14d7ebc20f74cdd9254c99c0431ae29dd1ab491b002fa3a38d015bfbd9f7d2squne121 commentedon Oct 3, 2026
live GitHub と current
impl-review-loopを確認しました。現時点では #2897 は OPEN、refinement termination はapproved、mainは3d75aac938e2406f441c679c6b19b0b2c2f0883c、#2897 を対象とする既存 PR は検出されていません。添付ログ側でも最終 body SHAff14d7eb…で approved、impl-review-loop/ production 実装 / PR は未着手と記録されています。貼り付けたテキスト(1)推奨は、今回のユーザー指示そのものを explicit implementation request とし、current
impl-review-loopの Root-Owned Synchronous Entry Transition から開始することです。refinement の最後に残った medium warning(plan_digest_mismatchの error 側 digest の出所)については、実装時に「同一 preflight source の digest を readiness top-level と timeout error の bounded payload の双方へ運び、merge で再計算しない」方向を第一候補にし、live contract の固定キー制約に抵触するなら Stop Condition として扱わせます。そのまま fresh interactive Claude Code Auto mode に貼れます。
repo=
squne121/loop-protocol対象:
実装: operator-only VC timeout の occurrence・budget identity を root review artifact に保持する #2897 (comment)
実装: operator-only VC timeout の occurrence・budget identity を root review artifact に保持する #2897 (comment)
.claude/skills/impl-review-loop/SKILL.mdあなたは既に fresh interactive Claude Code の Auto mode で起動済みです。
新しい root Claude Code session を起動せず、この session を継続してください。
目的
Issue #2897 を current repository の canonical
impl-review-loopに従って、fresh intake → implementation → independent verification → PR review → fix/re-review loop → CI/mergeability 確認まで自律実行し、人間が merge 判断できる直前の状態まで完遂してください。
これは明示的な implementation work order / implementation request です。
過去の
refinement_approved、LOOP_HANDOFF_RESULT_V1、contract reviewgo、Issue label 等を implementation authorization として再解釈しないでください。今回のこの explicit implementation request を起点に、currentimpl-review-loopの Root-Owned Synchronous Entry Transition を使用してください。実 merge、auto-merge、merge queue 投入は行わないでください。
現在確認済みの参考状態 — 実行時には必ず fresh revalidate
この prompt 作成時点では:
実装:prefix を持つapprovedhttps://github.com/squne121/loop-protocol/issues/2897#issuecomment-5970366038ff14d7ebc20f74cdd9254c99c0431ae29dd1ab491b002fa3a38d015bfbd9f7d23d75aac938e2406f441c679c6b19b0b2c2f0883cただし、これらを execution-time authority にしないでください。
開始時に live GitHub / repository を再取得し、drift があれば current state を正本としてください。
1. 最初に current canonical contract を読む
実行前に current HEAD から最低限以下を読んでください。
.claude/skills/impl-review-loop/SKILL.mdsteps// references.claude/skills/impl-review-loop/steps/preparation.md.claude/skills/impl-review-loop/steps/step-1-implementation.md.claude/skills/impl-review-loop/steps/step-2-verification.md.claude/skills/impl-review-loop/steps/step-4-pr-review.md.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md.claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md.claude/agents/implementation-worker.md.claude/agents/test-runner.md.claude/agents/pr-reviewer.md過去 transcript やこの prompt に書かれた手順が current Skill と食い違う場合は、current repository canonical contract を優先してください。
2. Root-Owned Synchronous Entry Transition を必ず使用する
Step 1 を直接 dispatch せず、current
impl-review-loopが定める root-owned synchronous entry を実行してください。同一 continuous invocation / control flow 内で:
issue-contract-reviewinvoke_impl_review_loopの場合のみ Step 1を完了してください。
過去の termination comment、artifact、body SHA、snapshot、invocation ID を Step 1 authorization packet として利用しないでください。
current-run contract review / root router が
rerun_contract_review等を返した場合は、その canonical routing に従って bounded recovery を行ってください。3. pre-Step-1 landing disposition を省略しない
worker dispatch、worktree 作成、新規 PR 作成より前に current canonical
Evidence-Based Landing Disposition を実行してください。
fresh に以下を確認してください。
canonical producer の disposition を prose で再解釈しないでください。
implementation_already_landed→ worker / worktree / duplicate PR を作らないexisting_pr_resume→ 既存 PR / branch / worktree を再利用already_satisfied→ canonical recommendation を報告し、自動 close はしないordinary_dispatch_or_explicit_recovery→ Step 1reconciliation_required→ canonical reconciliation を行い、証拠を捏造して突破しない4. この invocation で明示的に承認する作業
以下の通常・非破壊的作業は、この prompt により明示的に承認します。
通常の loop iteration ごとに人間承認を取り直さないでください。
impl-review-loopの canonical preflight / intake / routingissue-contract-reviewartifacts/証跡生成BEHINDの場合の canonical update-branch action-通常の failed CI が実装 defect なら原因修正と再実行
これは通常の repository workflow の作業承認です。
Claude Code の permission boundary を無効化する指示ではありません。
bypassPermissions、--dangerously-skip-permissions等を勝手に使用しないでください。5. 明示的に禁止する操作
以下は実行しないでください。
baseline_vc_preflight.pyの変更(live contract が引き続き Out of Scope とする限り)duration_msから applied timeout budget を逆算すること6. Step 1 — implementation-worker
current Skill の static call shape と materialization rule に従い、
implementation-workerSubAgent を起動してください。child message には暗黙 context に依存せず、最低限以下を実値で含めてください。
技術上の recommendation
refinement 最終 semantic review では medium warning として、
plan_digest_mismatch判定時の「error 側 canonical plan digest の出所」が本文で完全には固定されていない点が残っています。実装前に current code / live Issue contract を照合し、可能なら次の最小設計で整合させてください。
plan_digest_mismatchを実際に判定する必要がある場合、同じ source value を timeout error の boundedsource_payloadにも保持するminimal_context/runner_env_deltaを durable diagnostic へコピーしないfailure_class/ Compact V2 semantics は変更しないただし、live Issue の固定 contract / Stop Conditions 上、この per-error field の追加が scope delta や固定キー変更に該当すると canonical checker が判断する場合は、勝手に契約を広げないでください。その場合のみ Stop Condition として扱い、具体的な必要変更を報告してください。
7. SubAgent completion barrier — 必須
SubAgent は dispatch しただけで完了扱いしないでください。
対象:
implementation-workertest-runnerpr-reviewerissue-creator等各 dispatch 後は、その SubAgent の terminal completion / hand-back / final structured result を取得するまで downstream step に進まないでください。
background 実行の場合も必ず join してください。
Agent started/ task ID / launch ledger / partial stdout は completion evidence ではありません。SubAgent が失敗・discovery failure になった場合は、current Skill が定める bounded Stage A / Stage B recovery を使用してください。
recovery でも最終 canonical result を取得してから次へ進んでください。
8. Step 2 — independent verification
Step 1 完了後、current
test-runnerSubAgent に 独立した Verification Commands 実行を委譲してください。Issue #2897 の literal AC labels と literal Verification Commands を current live body から取得し、exact head / exact body SHA / command hash に bind してください。
今回特に確認するもの:
timeout_diagnosticsが boundedSKIP は PASS にしないでください。
fallback success も PASS にしないでください。
Runtime Verification が環境上不可能なら contract の exit 77 / SKIP 規則に従い、虚偽の PASS を作らないでください。
9. Step 4 — current-head gate と pr-reviewer
Step 2 結果を受け取ったら、current
adjudicate_vc_result.py step4-adjudicateの canonical route でadapt → adjudicate → persist → gateを行ってください。
current PR head / live Issue body SHA / literal VC command hashes を fresh に bind してください。
gate が reviewer 起動を許可しない場合は
pr-reviewerを起動せず、canonical reason に従って Step 2 へ戻してください。gate が invoke を許可した場合のみ
pr-reviewerを起動してください。pr-reviewerには:を渡してください。
pr-reviewer の terminal completion を待ち、
verdict / reviewed_head_sha / blockers / warningsを取得してください。
reviewer 自己申告の mergeability を authority にしないでください。
mergeability は root/control-plane が live GitHub から取得してください。
10. Step 5 — review/fix loop
current
route_loop_verdict_v2()を authority にしてください。approvedCLEAN/HAS_HOOKSを確認して終了候補へ進む
continue_loopfix_deltaにして implementation-worker へ戻すroute_stale_head_rereviewroute_to_update_branchfail_closed-単なる transient state を即 human escalation に変換しない
conflict_hard_stoproute_human_escalation通常の test failure、CI failure、REQUEST_CHANGES、stale head、BEHIND は、修復可能な限り人間承認なしで自動修復してください。
max iteration は current canonical default / Issue contract に従ってください。
iteration budget を捏造して超過しないでください。
11. overlap / parallel edit
実編集直前に current open PR / current head を fresh 確認してください。
Issue #2897 の Delivery Rule にある関連 Issue / PR を含め、Allowed Paths の同一箇所を別の OPEN PR が現在編集していないか確認してください。
実際の path overlap があれば current repository policy で serialisation / reconciliation を行ってください。
単なる関連 Issue の存在だけで停止しないでください。
actual diff/path ownership を確認してください。
12. 再発防止 follow-up Issue
実装・検証・レビュー中に、#2897 の Allowed Paths / Outcome に混ぜるべきでない 具体的かつ再発性のある root cause を発見した場合は、再発防止 follow-up Issue を起票してください。
この invocation では、その通常・非破壊的な follow-up materialization を明示的に承認します。
ただし必ず:
follow-up-materialization/create-issueworkflow を使用issue-creator等を使う場合は terminal completion を待つ新しい gate / schema / wrapper を足すこと自体を目的にしないでください。
具体的 defect の再発防止に必要な最小変更を優先してください。
13. 停止境界
人間承認なしで進める方針ですが、以下は canonical stop / escalation として尊重してください。
baseline_vc_preflight.pyの変更が不可避human_judgment_requiredを返す通常の review finding / test failure / CI failure は停止理由ではありません。
14. Merge 直前の終了条件
以下を current PR HEAD に対して fresh に確認してください。
APPROVEここまで到達したら PR は merge せず停止してください。
15. 最終報告
最後に簡潔に、具体値付きで報告してください。
調査や提案だけで終了せず、canonical workflow が許す範囲で implementation、verification、review、fix、re-verification、PR 更新まで実行してください。
impl-review-loopの current contract ではAPPROVE単独では終了せず、live mergeability と blockers も root が判定するため、この prompt ではその点も明示しています。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: 実装完了 (iteration 0)
.claude/worktrees/issue-2897-operator-only-vc-timeout-occurrence-budget-identityworktree-issue-2897-operator-only-vc-timeout-occurrence-budget-identityfix: timeout_diagnostics の全体 stdout 予算・型不正 enum の unknown 劣化・dedup so…
fix: operator-only VC timeout の occurrence と実適用 budget を root review …