Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "Claude Code / Haiku の issue-reviewer final-response runtime で child intermediate compact envelope を専用 SubagentStop hook により fail-close 検証し、契約逸脱を parent validator に安全に返す"
change_kind: agent-output-runtime-guardParent Issue
none(単独改善。Codex runtime は非対象)
Parent Goal Ref
N/A(親 Issue なし)
Current Validated Scope
対象は Claude Code / Haiku の issue-reviewer final-response runtime に限定する。Codex の agent 定義・runtime・validator は非対象であり、既存の V1/V2 grammar や parent routing/binding/replay 契約も変更しない。
主対策は matcher ^issue-reviewer$ の専用 SubagentStop hook とする。hook は last_assistant_message を改変せずに受け取り、既存の child intermediate grammar / validator を再利用して、canonical envelope 外の出力を parent に渡す前に fail-close する。prompt の禁止文追加は defense-in-depth としてのみ行う。
Remaining Parent Gaps
なし(本 Issue は親 Issue の未完了 gap ではなく、専用 runtime gate の実装を扱う)。
Outcome
Claude Code / Haiku の issue-reviewer が返す final response は、既存 child intermediate grammar の exact 8-line approve または exact 9-line needs-fix(REVIEWER_BLOCKER_CLAIM を含む) のいずれかだけが SubagentStop を通過する。envelope 外の free-form prose、Markdown 見出し、code fence、必須行の欠落、行順違反は hook が decision: block と 1 回の修正理由 で拒否し、SubAgent に canonical stdout の再生成を促す。hook/runtime error または再修正失敗時は parent 側の既存 fail-close(human_judgment_required 等)を維持し、routing / issue binding / artifact identity / replay は parent の責務として変更しない。マージ判定の必須検証は CI と unit/integration test とし、個人開発環境での runtime smoke は補助証跡として扱う。
In Scope
.claude/agents/issue-reviewer.mdに、禁止対象を「canonical envelope 外の free-form prose、Markdown 見出し、code fence、説明文」と明記し、compact helper の stdout をそのまま返す指示を追加する(SUMMARY 行内の prose は許可)。.claude/settings.jsonにSubagentStopの専用 matcher^issue-reviewer$を登録し、他 SubAgentへ影響させない。.claude/hooks/validate_issue_reviewer_compact_output.py(新規または既存 hook)でlast_assistant_messageを改変せず取得し、既存review_compact.validate_intermediate_v1/validate_child_intermediate()と同一 grammar を再利用する。approve は 8 行、needs-fix は 9 行を許可し、違反時は block と一度だけの修正理由を返す。実 payload は同プロセスで一度だけ検証し、検証結果を raw transcript/payload なしの atomic receipt として記録してから decision を返す。- sanitized された実インシデント相当 fixture(
## Summaryprose、prefix/suffix prose、Markdown、code fence、欠落、順序違反、正しい 8/9 行)と hook 回帰テストを追加する。 - hook の error / timeout / 再修正失敗が parent validator の fail-close を迂回しないことをテストで固定する。
stop_hook_activeは再block抑止だけに使い、初回 invalid、retry valid、retry invalid の receipt/結果を分離し、retry invalid は parent fail-close へ渡す。 validate_review_compact_output.pyなど既存 V1/V2 grammar・producer・parent replay の実装は変更しない。
Out of Scope
- Codex の
issue-reviewer定義・runtime・hook。 validate_review_compact_output.py、review_compact.validate_intermediate_v1、V1/V2 envelope grammar、parent replay / routing / issue-number binding の仕様変更。- 他の SubAgent (
pr-reviewer/test-runner等) への matcher 拡張。 - hook が final response を自動修復・書換えする実装(hook は判定と block 理由の返却のみ)。
Runtime Automation Contract
run_issue_reviewer_runtime_probe.pyは任意のローカル開発補助として、認証済み環境で実際のclaude -p(利用可能な場合)による allow と controlled block→repair を試行できる。CLI、認証、Claude service が利用できない場合の SKIP は merge blocker ではない。caller-controlled JSON pipe、fixture、自己生成 payload は runtime PASS と偽らず、実行できた場合だけ補助証跡として記録する。validate_issue_reviewer_compact_output.pyは SubagentStop payload を一度だけ読み、matcher/agent_type を確認し、既存 child grammar を検証する。raw transcript/payload/prompt/path/secret は保存・公開せず、必要なら最小限のローカル診断だけを記録する。trusted-host provenance、sanctioned executor、head-bound TEST_VERDICT_MACHINE、外部 publisher/readback は merge/AC の必須条件ではない。stop_hook_activeは再block抑止のみとする。初回 invalid は block、retry valid は allow、retry invalid は別結果として parent fail-close へ渡す。hook/runtime error は PASS に昇格させず、ローカル検証では SKIP/FAIL を明示する。- CI と unit/integration test の結果を実装完了・マージ必須の検証とする。既存 runtime helper scripts は削除を要求せず、外部 executor を前提としない optional local developer helper として許容する。
Acceptance Criteria
- AC1: Claude Code / Haiku の
issue-reviewerのみを対象に matcher^issue-reviewer$の専用SubagentStophook が登録され、Codex および他 SubAgentには適用されない。 - AC2: exact 8-line approve child intermediate と exact 9-line needs-fix child intermediate(
REVIEWER_BLOCKER_CLAIM付き)が許可され、既存 validator の V1/V2 grammar は変更されない。 - AC3: envelope 外の free-form prose、Markdown 見出し、code fence、必須行欠落、順序違反を hook が
decision: blockと 1 回の修正理由で拒否し、last_assistant_message自体は改変しない。 - AC4: sanitized incident fixture と回帰テストが、prose-only / prefix-suffix / Markdown / code fence / 欠落 / 順序違反を block し、正しい 8/9 行を allow する。
- AC5: hook/runtime error または再修正失敗時に parent 側 fail-close が維持され、routing / binding / replay の証跡を hook が生成・上書きしない。
- AC6:
.claude/agents/issue-reviewer.mdの禁止文言が envelope 外の free-form prose 等を指し、SUMMARY 行内の prose を禁止しない。 - AC7: 実装: agent context budget inventory を導入し AGENTS/CLAUDE/skills/hooks/subagents/rules/scripts の重複読みに上限を設ける #1093(Claude/Codex の issue-reviewer 定義・compact output変更)と実装順・Allowed Paths の競合をコメントまたは実装記録で協調し、Codex 非対象と契約ドリフト防止を明記する。
- AC8: 認証済みローカル開発環境で実 Claude Code smoke を実行できる場合は allow と controlled block→repair を補助証跡として記録する。CLI/auth/service 未利用時の SKIP は merge blocker ではなく、SKIP を runtime PASS と偽らない。
- AC9: validator が actual payload を一度だけ検証して atomic receipt を記録し、raw transcript/payload を保存・公開せず、必須安全メタデータと sha256 digest を含める。
- AC10:
stop_hook_activeの初回 invalid / retry valid / retry invalid が分離された receipt/結果となり、retry invalid は parent fail-close に渡る。 - AC11: CI と unit/integration test が検証結果を再現可能に示す。runtime helper を実行した場合の観測値不一致は FAIL と記録し、実行しない場合は SKIP とする。head-bound
TEST_VERDICT_MACHINE/v2や publisher readback は必須にしない。 - AC12: runtime 補助証跡を共有する場合も sanitized summary のみとし、raw transcript/prompt/path/secret をアップロードしない。外部 publisher/readback は要求しない。
- AC13: runtime host unavailable は exit 77/SKIP で記録され、PASS へ昇格せず fail-closed となる。
Verification Commands
# AC1
$ rg -n '"matcher": "\^issue-reviewer\$"' .claude/settings.json
# baseline-expect: pass
$ rg -n "SubagentStop" .claude/settings.json# AC2
$ uv run --locked pytest .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py -k "approve or needs_fix"# AC3
$ uv run --locked pytest .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py -k rejects_invalid# AC4
$ uv run --locked pytest .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py -k incident_fixture# AC5
$ uv run --locked pytest .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py -k fail_close# AC6
$ rg -n "envelope 外の free-form prose" .claude/agents/issue-reviewer.md# AC7
$ rg -n "1093" .claude/agents/issue-reviewer.md
$ rg -n "Codex" .claude/agents/issue-reviewer.md# AC8
# preflight-scope: runtime_only
$ uv run --locked python3 .claude/scripts/run_issue_reviewer_runtime_probe.py --issue 1754 --scenario allow --scenario block-repair --no-publish
# optional local smoke; exit 77/SKIP is allowed# AC9
$ uv run --locked pytest .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py -k "receipt or atomic or raw"# AC10
$ uv run --locked pytest .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py -k "retry or stop_hook_active"# AC11
$ uv run --locked pytest .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py .claude/hooks/tests/test_issue_reviewer_runtime_probe.py# AC12
$ uv run --locked pytest .claude/hooks/tests/test_issue_reviewer_runtime_probe.py -k "test_unavailable_runtime_exits_77_and_writes_skip_without_raw_transcript"# AC13
$ uv run --locked pytest .claude/hooks/tests/test_issue_reviewer_runtime_probe.py -k "unavailable or exit_77"Allowed Paths
- .claude/agents/issue-reviewer.md
- .claude/settings.json
- .claude/hooks/validate_issue_reviewer_compact_output.py
- .claude/hooks/tests/test_validate_issue_reviewer_compact_output.py
- .claude/skills/issue-refinement-loop/tests/test_emit_parent_review_envelope_v2.py
- .claude/artifacts/1754/
- .claude/artifacts/1754/runtime-receipts/
- .claude/scripts/run_issue_reviewer_runtime_probe.py
- .claude/scripts/collect_issue_reviewer_runtime_evidence.py
- .claude/hooks/tests/test_issue_reviewer_runtime_probe.py
- docs/dev/issue-reviewer-runtime-evidence.md
- docs/dev/hook-boundaries.md
- .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合。
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合。
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)。
- 後続 Phase / 別スコープへの波及が判明した場合。
- nested SubAgent delegation が必要になった場合。
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合(ただし optional local helper の実行は除く)。
- 既存 V1/V2 grammar、producer、parent routing/binding/replay の変更が必要になった場合。
- hook を Claude Code / Haiku 以外へ拡張する要求が発生した場合。
- unit/integration test または CI の再現可能な検証が成立しない場合。runtime smoke を実行できないこと自体は stop 条件にしない。
- 実装: agent context budget inventory を導入し AGENTS/CLAUDE/skills/hooks/subagents/rules/scripts の重複読みに上限を設ける #1093 との同時変更で契約・Allowed Paths の解消不能な衝突が発生した場合。
Required Skills
- Python pytest(hook 回帰テスト)
- ci-test-performance(baseline timeout の CI レーン分析)
Required Design References
docs/dev/runtime-verification-policy.md(Runtime Verification Applicability と exit 77 規約).claude/skills/issue-refinement-loop/SKILL.md(child intermediate / parent V2 routing 境界).claude/skills/issue-refinement-loop/scripts/emit_parent_review_envelope_v2.py(既存 8/9-line child grammar の実装根拠)docs/dev/agent-skill-boundaries.md(SubAgent 出力・fail-close 契約)- Claude Code SubagentStop hooks 仕様(https://code.claude.com/docs/en/hooks)
- Claude Code headless /
claude -p公式仕様(https://code.claude.com/docs/en/headless) - 人間要望コメント(https://github.com/squne121/loop-protocol/issues/1754#issuecomment-5083428757)
Runtime Verification Applicability
- decision: immediate
- reason: SubagentStop hook の matcher、payload 判定、block/allow、runtime error fail-close は Claude Code / Haiku の実行境界で成立するため。ただし runtime smoke は補助的で、CI と unit/integration test が merge 必須の検証である。
applicable_acs: AC1, AC2, AC3, AC4, AC5
execution_environment: Python 3 とuv run --locked pytestを実行できる CI/ローカル環境。実 Claude Code smoke は認証済み開発環境で任意実行し、Codex runtime は対象外。
skip_conditions: Claude CLI、認証、または service が利用できない場合の runtime smoke は exit 77/SKIP とし、merge blocker にしない。SKIP を runtime PASS と扱わない。
fallback_policy: synthetic fixture、caller-controlled payload、prompt 指示だけの結果を runtime 成功の証跡にしない。hook/runtime error は FAIL または明示的 SKIP とし parent fail-close を維持する。
artifact_requirements: raw transcript/payload/prompt/path/secret は保存・公開しない。必要な場合は.claude/artifacts/1754/配下に sanitized な最小診断を記録する。trusted-host provenance、head-bound TEST_VERDICT_MACHINE、publisher/readback は必須 artifact ではない。
Scope Delta(任意)
- prompt-only 対策から、Claude Code / Haiku の専用 SubagentStop hook を主対策へ変更。
- 8-field 固定記述を、既存 child intermediate の 8-line approve / 9-line needs-fix に正規化。
- Codex 非対象、実装: agent context budget inventory を導入し AGENTS/CLAUDE/skills/hooks/subagents/rules/scripts の重複読みに上限を設ける #1093 協調、sanitized incident fixture、Required Design References、Runtime Verification Applicability を追加。
Notes for Reviewer
- 発端は CI python-test pytest実行phase高速化: test lane分類・pytest統合・Ruff導入・Skill化 #1059 で、内部 artifact は正しいにもかかわらず Haiku の final response が
## Summaryprose へ置換された事象。今回の修正は consumer validator の fallback ではなく、final-response と parent validator の境界に決定論的 gate を置く。 - hook は文法の allow/block だけを担当し、issue number binding、artifact identity、parent replay、routing 判断を引き受けない。
last_assistant_messageは観測値として保持し、hook が書換えた応答を成功扱いしない。
Scope Collision Note
check_issue_overlap.py の共有ファイル overlap は維持するが、#1093 とは実装境界を明示して協調する。#1093 が Claude/Codex 定義または compact output を変更する場合は、本 Issue の Claude / Haiku 専用 hook と grammar 非変更制約を優先し、同一ファイルの変更を統合して契約ドリフトを防ぐ。#1650、#1677、#1007 等の concern は本 Issue の runtime gate とは分離する。
Activity
squne121 commentedon Jul 26, 2026
判定
REQUEST_CHANGES / needs-fix。現状の Issue 契約では実装着手すべきではありません。
問題意識は妥当ですが、対策が「禁止文を一文追加する」に偏っており、発生したランタイム逸脱を構造的には防げません。さらに、Issue本文が現在の child intermediate / parent V2 構成に追随しておらず、誤った検証箇所を修正する危険があります。
敵対的レビュー
P0-1: AC1 は Outcome の「保証」を証明しない
現行
.claude/agents/issue-reviewer.mdにはすでに、compact_review_result.pyの stdout のみという強い指示があります。ここへ「prose要約やMarkdown見出しを含めない」を一文追加しても、同じ prompt-level 制約を重ねるだけです。
rgで文言の存在を確認しても、Haiku が実行時に従うことは証明できません。今回のインシデント自体が、「肯定形の厳密な指示が存在しても、最終応答がモデル生成の要約に置換され得る」ことを示しています。したがって、AC1は防御の追加にはなっても、Outcomeの達成条件にはなりません。
P0-2: Issueの出力契約が現在の実装より古い
現在の child
issue-reviewer出力は単純な8行固定ではありません。approve: canonical 8行needs-fix: 8行にREVIEWER_BLOCKER_CLAIMを加えた9行の child intermediatePARENT_REPLAY_*を追加したV2 envelopeを決定論的に生成という構造です。
emit_parent_review_envelope_v2.pyも、V1 final grammarとは別の「8行 / 9行 child intermediate grammar」であることを明示しています。compact_review_result.pyも、needs-fix時にはREVIEWER_BLOCKER_CLAIMを追加し、routing semantics はparent専有であると実装しています。したがって、#1754の「常に列挙された8フィールドを含む」という記述は不完全です。誤って8行のみを強制すると、正常な
needs-fix経路を壊します。P1-1: AC2 は新しい防御ではなく、既存挙動の重複確認
現在のvalidatorは、完全一致しない入力、prose prefix/suffix、Markdown fence、未知フィールド、順序違反などをすでに拒否します。全文proseも必須フィールドを一つも持たないため、現行ロジック上すでにinvalidです。
既存テストにも、正しいenvelopeの前後へproseを追加した入力を拒否するケースがあります。
test_fully_prose_response_is_invalidの追加自体は有用ですが、これはカバレッジ改善です。SubAgentがproseを返すことの予防にはなりません。また、production child seamでは現在review_compact.validate_intermediate_v1が使われるため、旧V1 final validatorだけを対象にするのも不十分です。P1-2: Allowed Pathsでは構造的対策を実装できない
Claude Codeには、
SubagentStophookで以下を行う公式の仕組みがあります。agent_typeとlast_assistant_messageを受け取るdecision: "block"と修正理由を返すこれは今回の障害境界に直接作用します。(Claude)
一方、#1754のAllowed Pathsには
.claude/settings.json、専用hook、hookテストがありません。現行のSubagentStopは全SubAgent共通のsession manifest coordinatorだけで、issue-reviewerのcompact outputを検証していません。さらに既存coordinatorは、guard失敗時にも最終的にexit 0とする監査用途のfail-open設計です。ここへ出力契約検証を混在させるべきではありません。
P1-3: 「proseを一切排除」は用語として誤り
canonical形式自身に、
が含まれます。禁止すべきなのはprose一般ではなく、canonical envelope外のfree-form prose、Markdown見出し、code fence、説明文です。
曖昧な禁止文は、実装者が
SUMMARYまで空にする、またはvalidatorとproducerの意味を変える原因になります。P1-4: Claude限定か、Claude/Codex共通かが不明
Issue名は汎用的な
issue-reviewer SubAgentですが、変更対象はClaude定義だけです。Codex側にもすでに、structured output only、8フィールド、needs-fix時のclaimという対応契約があります。次のどちらかを明示する必要があります。
既存parity testは主にschema名、permission、delegation境界を検査しており、禁止文の意味的同等性までは保証していません。
推奨する実装設計
prompt追記はdefense-in-depthとして残し、主対策を専用
SubagentStophookに変更すべきです。^issue-reviewer$に限定するlast_assistant_messageを改変せず取得するreview_compact.validate_intermediate_v1、または同じvalidate_child_intermediate()を再利用するdecision: "block"を返し、「compact_review_result.pystdoutをそのまま最終応答にする」と一度だけ修正させるhuman_judgment_requiredfail-closeを維持するhookは文法修復だけを担当し、issue number binding、artifact identity、parent replay、routing判断を引き受けてはいけません。これらは既存parent側検証の責務です。
修正後の最低限のAcceptance Criteria
issue-reviewer以外のSubAgentへ影響しないvalidate_review_compact_output.pyの既存V1/V2 grammarを変更しない必要なAllowed Pathsは少なくとも次です。
関連Issueとの整理
#794はcompact contract導入、#1507 / PR #1519はconsumer側fail-close、PR #1557はchild intermediateからparent V2を生成する決定論的経路を実装済みです。#1754はこの既存経路を変更するIssueではなく、SubAgentのfinal messageがconsumerへ渡る直前の修復ゲートとして位置づけるのが適切です。
#1650、#1677、#1007はconcernが異なります。一方、#1093はClaude/Codexの
issue-reviewer定義とcompact outputを変更対象に含むため、同時実装時の競合・契約ドリフトを明示的に調整すべきです。なお、#1754には現時点でコメントがありません。インシデントの生データ、sanitized fixture、想定するruntime境界について第三者が確認できる証跡も不足しています。
結論として、禁止文追加とprose-only単体テストだけでは不十分です。Issue本文を現行8/9-line child intermediate契約へ更新し、専用SubagentStop hookを主実装に据えてから実装フェーズへ進めるべきです。
squne121 commentedon Jul 26, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jul 26, 2026
Contract Review Result
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
優先実装の人間判断: 当該 C1 重なりは非競合として扱い、Issue #1754 を継続します。
squne121 commentedon Jul 26, 2026
Contract Review Result
22 remaining items
squne121 commentedon Jul 26, 2026
Contract Review Result
test: fixture preflight の外側 timeout を延長 (#1754)
squne121 commentedon Jul 26, 2026
you asked
message time: 2026-07-26 21:01:10
非対話で完結する形で実現できないか。
実行後ローカルのセッションログから証跡を集められないか。
Claudeのセッション目的に証跡のアップロードを含められないか。
Claudeの自己報告とローカルのセッションログを照らし合わせられないか。
chatgpt response
添付ログの停止理由を分解し、Claude Code の非対話実行・hook・ローカルセッション記録の実仕様と、Issue/PR 側の契約を照合します。最終的に「何を実装すれば完全自動化できるか」と検証フローを具体化します。
現行PRの専用 hook は判定だけで、trusted receipt の保存処理を持っていません。一方、Claude Code 自体は
-p非対話実行、hookイベントのストリーム出力、主・子セッションの transcript path を公式に提供しているため、停止理由は「実行不能」ではなく「証跡採取・検証器が未実装」に近いです。設計上の重要点は、判定 hook と証跡 writer を同一プロセスに統合することです。Claude Code は同一イベントに一致した複数 hook を並列実行するため、別の recorder hook では validator の最終 decision を確実に観測できません。
結論
実現可能です。ただし、現行 PR #1787 の実装のままでは完結しません。
添付ログの「完結した1コマンドはない」「現行 hook は head-bound receipt を保存しない」という判断は、現在のリポジトリ実装については正しいです。Claude Code 自体が非対話実行できないわけではなく、不足しているのは以下です。
現状のブロッカーも、実装不備というより、この runtime evidence と current-head の機械判定がないことです。 現行 hook が receipt を自動生成しない点もログ内で確認されています。
4点への回答
claude -pと/goal、外側の実行 wrapper を使うClaude Code は
-pで通常のプロジェクト設定や hooks を読み込んだまま非対話実行できます。--bareは hooks 等の自動検出を省略するため、この用途では使用しません。/goalもclaude -p "/goal ..."の1プロセス内で完了まで反復できます。(Claude)ただし
/goalの評価モデルはファイルや GitHub を独立して読みません。会話に現れた報告だけを判断するため、runtime evidence の真正性判定を/goalに委ねてはいけません。(Claude)推奨する完全自動フロー
1. 親 wrapper から非対話実行する
提案する最終インターフェースは次のような1コマンドです。これは新規実装するコマンド案であり、現時点では存在しません。
内部では概ね次のように Claude を起動します。
stream-json、hook lifecycle event、turn・費用上限、既知パスへの debug log 出力は現在の Claude Code CLI で利用できます。debug log には、どの hook が一致したか、終了コード、stdout、stderr が記録されます。(Claude)2. validator と receipt writer を統合する
現在の settings では、グローバルな session manifest coordinator と
issue-reviewervalidator が別々の SubagentStop hook として登録されています。Claude Code は同一イベントに一致した hooks を並列実行します。そのため、別の recorder hook を追加しても、validator が返した
allow/blockdecision を順序どおり観測できません。(Claude)したがって、
validate_issue_reviewer_compact_output.py自身が以下を一度に実行すべきです。agent_typeと matcher を確認last_assistant_messageを既存 grammar で検証decision: blockを返すSubagentStop payload には
session_id、agent_id、agent_type、main transcript path、subagent transcript path、last_assistant_message、stop_hook_activeが公式に含まれます。したがって transcript 全体を解析せずとも、final response と実行主体を直接取得できます。(Claude)3. receipt の内容
raw prompt や raw transcript は公開せず、次のようなメタデータと hash のみを保存します。
リポジトリには既に、固定 private path、所有者・mode・symlink 検査、SHA計算、
O_EXCL/O_NOFOLLOWを使った原子的な証跡保存の実装パターンがあります。これを一般化すれば、新規に信頼境界を設計し直す必要はありません。現行 hook で修正すべき点
PR差分では、
stop_hook_active: trueの場合に validator が即時終了します。これは無限 retry 回避にはなりますが、block 後に再生成された2回目の応答が正しかったことを証明できません。次の動作へ変更すべきです。
decision: blockつまり、
stop_hook_activeは「検証を省略する条件」ではなく、再blockを抑止する条件に限定します。また、既存 session manifest producer は best-effort telemetry であり、失敗しても exit 0、セッション継続となる設計です。そのままでは Issue #1754 の fail-closed runtime receipt には使えません。
allow と block の実ランタイム検証
2シナリオを別々に実行します。
allow シナリオ
通常の project
issue-reviewerを起動し、canonical 8行または9行を返させます。実 SubagentStop が発火し、receipt がvalidation_status: validになったことを確認します。block→repair シナリオ
actual Claude Code runtime 内で、probe 専用の adversarial instruction により初回だけ Markdown/prose を返させます。hook stdin に JSON を直接 pipe する方法は使用しません。実 SubagentStop が block を返し、同一
session_id・agent_idの再応答が canonical になったことを確認します。Issue 契約には次の区別を明記する必要があります。
これにより、「再現性のある異常系」と「偽の hook payload」を明確に分離できます。
Claude自己報告との照合
Claude の最終応答は、次のような構造化 claim に限定します。
{ "reported_head_sha": "...", "reported_session_id": "...", "reported_agent_ids": ["..."], "reported_decisions": ["block", "allow"], "reported_receipt_sha256": "...", "reported_test_verdict": "PASS", "reported_publish_url": "..." }親 wrapper は、この claim を次のローカル観測値と比較します。
git rev-parse HEAD1項目でも違えば
SELF_REPORT_MISMATCHとして FAIL にします。Claude自己報告は証拠ではなく、照合対象の主張です。ローカル transcript は通常 JSONL として保存され、SubAgent には個別 transcript があります。証跡収集時は
agent_transcript_pathを hook から受け取り、内容を公開せず byte hash と必要最小限の event だけを抽出します。(Claude)アップロードの責務
Claude のセッション目的に「証跡をアップロードする」を含めること自体は可能です。しかし merge gate に使う公開処理は、次の順番にすべきです。
Claude 自身に upload と成功判定を両方任せると、自己報告と観測が同じ信頼主体になります。
現在の runtime verification policy も、ローカル artifact は worktree-local とし、永続化は PR 本文への inline 引用または Actions artifact 等で行う設計です。 test-runner が VC と artifact を統合して
TEST_VERDICT_MACHINEに載せ、後段が PR へ引用する責務分離も既に定義されています。必要な Scope Delta
PR #1787 を完全自動化するには、少なくとも以下を追加します。
この構成なら、人間が Claude の対話画面を操作せず、実Claude runtime起動、allow/block観測、ローカルログ照合、自己報告検査、TEST_VERDICT_MACHINE/v2生成、PR投稿、readbackまでを単一コマンドで完結できます。
Powered by AI Exporter
squne121 commentedon Jul 26, 2026
Contract Review Result
feat(claude): issue-reviewer runtime receipt gate を実装 (#1754)
fix(ci): issue-reviewer runtime検証のlintを修正 (#1754)
fix(ci): runtime evidence collectorのlintを修正 (#1754)
squne121 commentedon Jul 26, 2026
Contract Review Result
fix(runtime): local self-reportを独立照合する (#1754)
fix(runtime): Claude session reportを独立照合する (#1754)
squne121 commentedon Jul 26, 2026
Contract Review Result
squne121 commentedon Jul 26, 2026
PR #1787 を未マージでクローズしました。既存 parent validator で compact stdout の拒否境界は既にあり、追加 SubagentStop hook と runtime probe 基盤はサブエージェントの権限・worktree 隔離を解決しません。公式仕様との decision 値不整合、固定 receipt 識別子、保守コストを踏まえ、本件は not planned とします。