Closed
Labels
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "Claude Code 2.1.285 で runtime smoke の SubagentStop 由来 causal evidence が no_evidence になる原因を特定し、最小修正方針を決める"
change_kind: research-onlyParent Issue
none
Background
2026-09-30 に実測した事実を以下に記す。
- 対象コマンド(実装: 再発防止: Auto mode runtime VC の独立 claude -p session で approval context 欠落による false capability-blocker を防ぐ #2839 の AC10、runtime_only):
uv run --locked python3 scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --worktree "$PWD" --prompt-file scripts/agent-ops/tests/fixtures/runtime_vc_lifecycle_smoke_prompt.md --output-dir <dir> --timeout-seconds 300 --max-turns 6 --agent-type pr-reviewer --expect-marker-source subagent --expect-marker "RUNTIME_VC_LIFECYCLE_SMOKE_OK" --require-subagent-causal-evidence --require-min-subagents 1 --require-clean-postcondition - 以前の PASS: PR 実装: 独立 claude -p の runtime VC に bounded な approval carrier と non-executable 検出を追加する (#2839) #2844 head 12d4781(2026-09-29、Claude Code 2.1.284)で exit_code 0、
causal_evidence_source = hook_id_correlated、marker_provenance_verified = True、marker_provenance_transcript_fallback_used = False。 - 現在の FAIL: Claude Code 2.1.285(
claude --versionが2.1.285 (Claude Code))で exit_code 1、エラーはsubagent causal evidence insufficient (--require-subagent-causal-evidence): causal_evidence_source='no_evidence'。subagent_start_observed = True、subagent_stop_observed = True、tool_invocation_id_correlated = True、child_terminal_status = completed、multi_child_lifecycle verified = True、agent_transcript_verified = False、marker_provenance_verified = False、marker_provenance_transcript_fallback_used = True。 - 同一の 2.1.285 バイナリで 3 つの head(PR 実装: 独立 claude -p の runtime VC に bounded な approval carrier と non-executable 検出を追加する (#2839) #2844 head c5d9083、fix 前の PR head 763ba80、pristine main 8eeca46)に対して同一に再現した。main の実行では
--require-clean-postconditionを外している。したがって PR 実装: 独立 claude -p の runtime VC に bounded な approval carrier と non-executable 検出を追加する (#2839) #2844 の変更とは独立であり、以前の PASS との観測差分は Claude Code のバージョン(2.1.284 から 2.1.285)と解決された実行ファイルの sha256 のみである。 - 影響:
--require-subagent-causal-evidenceと--expect-marker-source subagentを要求する runtime_only AC は現環境で PASS できない。実装: 再発防止: Auto mode runtime VC の独立 claude -p session で approval context 欠落による false capability-blocker を防ぐ #2839 の AC10(PR 実装: 独立 claude -p の runtime VC に bounded な approval carrier と non-executable 検出を追加する (#2839) #2844 の merge readiness)を阻害し、同じ evidence flag を使う 実装: Claude-GPT model/proxy 更新の runtime migration を完了工程に含め、人間介入を genuine blocker に限定する #2810 / PR 実装: Claude-GPT model/proxy runtime migration の3分類ルーティングを追加する #2831 の AC9 / AC10 runtime verification も阻害する。 - 関連 Issue(所有権を重複させない): 実装: 再発防止: Auto mode runtime VC の独立 claude -p session で approval context 欠落による false capability-blocker を防ぐ #2839 / PR 実装: 独立 claude -p の runtime VC に bounded な approval carrier と non-executable 検出を追加する (#2839) #2844、実装: Claude-GPT model/proxy 更新の runtime migration を完了工程に含め、人間介入を genuine blocker に限定する #2810 / PR 実装: Claude-GPT model/proxy runtime migration の3分類ルーティングを追加する #2831、実装: 再発防止: 独立 VC の正規消費経路を Step 2 / 4 / 5 に接続し、検証未了・失効後の approved を防ぐ #2837、実装: runtime_only VC の repository PreToolUse guard 互換性を Step 2 で早期検証する #2824、調査: structured causal-evidence smoke の markerless FAIL を --no-session-persistence 契約と照合する #2338(CLOSED、2.1.245 の別事象)、実装: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定と runtime verification policy 更新を導入する #2183(CLOSED、hook-id causal evidence 導入)、調査: worktree-agent-runtime-smoke の当初意図(Claude Codeの対話的動作検証全般)と現行実装(hook/subagent偏重)のスコープドリフトを調査する #2655(OPEN、smoke skill の scope-drift 調査で本件とは別)。
Outcome
scripts/agent-ops/run_worktree_agent_runtime_smoke.py の marker provenance と causal evidence 導出が 2.1.285 で no_evidence になる根本原因を、2.1.284 と 2.1.285 の SubagentStop payload と subagent transcript path の差分証跡付きで特定し、最小修正方針(parser 適応、または version constraint の文書化)を本 Issue のコメントに記録して、必要なら follow-up implementation Issue が起票可能な状態にする。
In Scope
- run_worktree_agent_runtime_smoke.py 内の marker provenance / causal evidence 導出ロジックの読解
- 2.1.284 と 2.1.285 の stream-json、SubagentStop hook payload、subagent transcript path 有無の比較
- 2.1.285 が SubagentStop payload を変更したか(field の有無)の判定と証跡の記録
- 最小修正方針の決定(parser 適応 vs version constraint 文書化)
- 必要な場合の follow-up implementation Issue の起票(本 Issue の Allowed Paths 外の実装は含まない)
Out of Scope
- runner や skill、docs の実装変更(follow-up Issue で扱う)
- テスト追加
- 調査: worktree-agent-runtime-smoke の当初意図(Claude Codeの対話的動作検証全般)と現行実装(hook/subagent偏重)のスコープドリフトを調査する #2655 の scope-drift 調査
- 実装: 再発防止: Auto mode runtime VC の独立 claude -p session で approval context 欠落による false capability-blocker を防ぐ #2839 / PR 実装: 独立 claude -p の runtime VC に bounded な approval carrier と non-executable 検出を追加する (#2839) #2844 および 実装: Claude-GPT model/proxy 更新の runtime migration を完了工程に含め、人間介入を genuine blocker に限定する #2810 / PR 実装: Claude-GPT model/proxy runtime migration の3分類ルーティングを追加する #2831 の内容変更
Runtime Verification Applicability
- decision: immediate
- reason: runner と Claude Code runtime の相互作用は静的テストだけでは証明できず、2.1.285 の実 payload を採取して判定する必要があるため。
- if immediate: AC2 が runtime 証跡(実 payload 差分)を要求する。
Acceptance Criteria
- AC1: run_worktree_agent_runtime_smoke.py が marker provenance と causal evidence をどの入力(hook payload、transcript path、stdout)から導出するかが、本 Issue のコメントに記録されている
- AC2: 2.1.285 が SubagentStop payload を変更したか(field の存在と欠落)が 2.1.284 との比較証跡付きで判定され、コメントに記録されている
- AC3: 最小修正方針(parser 適応、または version constraint の文書化)が決定され、follow-up implementation Issue の参照、または文書化先が本 Issue のコメントに記録されている
- AC4: 導出ロジックの既存 fixture テストが baseline で通ることが確認され、調査結果の比較基準として記録されている
Verification Commands
# AC1
$ rg -n "marker_provenance_transcript_fallback_used" scripts/agent-ops/run_worktree_agent_runtime_smoke.py
# AC2
$ rg -n "SubagentStop" scripts/agent-ops/run_worktree_agent_runtime_smoke.py
# AC3
$ gh issue view 2839 --repo squne121/loop-protocol --json number,state
# AC4
$ uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_causal_evidence.py -qAllowed Paths
- (none) 読み取り専用。参照対象は
scripts/agent-ops/**、.claude/skills/worktree-agent-runtime-smoke/**、docs/dev/runtime-verification-policy.md。成果物は Issue コメントと report で表現する。
Stop Conditions
- Outcome / Scope / AC が検索可能な形で記載されていない場合は即停止
- Allowed Paths 外への書き込みを試みた場合は即停止
- 権限不足(permission denied)により操作が完了できない場合は即停止
- 成果物の書き込みに失敗した場合(I/O エラー等)は即停止
Handoff Contract
Current Objective: 2.1.285 で causal evidence が no_evidence になる原因の特定と最小修正方針の決定Bounded Current Context: 上記 Background の実測事実(3 head で同一再現、差分は Claude Code バージョンのみ)Open Questions: SubagentStop payload の field 変更有無、subagent transcript path が提供されるかNext Action: 判定結果に応じて parser 適応の implementation Issue を起票、または version constraint を文書化Artifact Refs: 実装: 再発防止: Auto mode runtime VC の独立 claude -p session で approval context 欠落による false capability-blocker を防ぐ #2839、実装: 独立 claude -p の runtime VC に bounded な approval carrier と non-executable 検出を追加する (#2839) #2844、実装: Claude-GPT model/proxy 更新の runtime migration を完了工程に含め、人間介入を genuine blocker に限定する #2810、実装: Claude-GPT model/proxy runtime migration の3分類ルーティングを追加する #2831、実装: 再発防止: 独立 VC の正規消費経路を Step 2 / 4 / 5 に接続し、検証未了・失効後の approved を防ぐ #2837、実装: runtime_only VC の repository PreToolUse guard 互換性を Step 2 で早期検証する #2824、調査: structured causal-evidence smoke の markerless FAIL を --no-session-persistence 契約と照合する #2338、実装: worktree-agent-runtime-smoke に hook ID ベースの SubAgent causal evidence 判定と runtime verification policy 更新を導入する #2183、調査: worktree-agent-runtime-smoke の当初意図(Claude Codeの対話的動作検証全般)と現行実装(hook/subagent偏重)のスコープドリフトを調査する #2655
Activity
squne121 commentedon Sep 30, 2026
調査結果(#2846 AC1〜AC4)
結論: 原因は repository 側の parser の欠陥ではなく、Claude Code 2.1.285 の upstream 挙動変更です。2.1.285 では
SubagentStophook payload からlast_assistant_messageが出なくなりました。runner はこの field を marker provenance の一次入力としているため、no_evidenceになります。最小修正は parser 適応です(version constraint の文書化ではありません)。調査は read-only で行い、repository file は変更していません。採取した raw stream は GitHub に投稿せず、field の有無・型・長さ・hash 相当の情報だけを記載します。
AC1: 導出元(producer → parser → decision)
すべて
scripts/agent-ops/run_worktree_agent_runtime_smoke.py内です(main8eeca46a)。claude -pの stream-json に含まれるSubagentStart/SubagentStopの hook_response(固定 overlay のcathook が payload を echo する)。extract_claude_hook_lifecycle_events()(約 2214 行以降)が embedded JSON からagent_id/agent_type/agent_transcript_path/last_assistant_messageを取り出す。_marker_provenance_verified()(約 3585 行)。last_assistant_messageに期待 marker がすべて含まれれば一次 provenance として成立する。無い場合だけ transcript を fallback として読む。subagent_causal_evidence_verdict()(約 3712〜3854 行)。agent_transcript_path存在、tool invocation 相関、terminal 成功、marker provenance が揃う候補がちょうど 1 件のときだけhook_id_correlated。それ以外はno_evidence。tool_use_result.handbackReportを現時点でどの経路でも参照していない(handbackの grep は 0 件)。AC2: 2.1.284 と 2.1.285 の SubagentStop payload 差分(runtime 実測)
同一 worktree・同一 prompt(
runtime_vc_lifecycle_smoke_prompt.md)・同一 argv(--no-session-persistence --include-hook-events --output-format stream-json、runner 固定 overlay と同一の--settings)で、ローカルに導入済みの 2.1.284 と 2.1.285 のバイナリをそれぞれ直接実行して比較しました。session_id, transcript_path, cwd, prompt_id, permission_mode, agent_id, agent_type, effort, hook_event_name, stop_hook_active, agent_transcript_path, last_assistant_message, background_tasks, session_cronslast_assistant_messageだけが欠落last_assistant_messageagent_transcript_pathtool_use_result.statuscompletedcompletedtool_use_result.agentIdと hook のagent_idtool_use_result.handbackReport.text読み取れること:
agent_transcript_pathは両バージョンとも存在します。--no-session-persistenceのため、どちらでも path の file は存在しません(transcript による fallback 検証は 2.1.284 でも成立しません)。したがって差は transcript path ではなく、last_assistant_messageの欠落です。last_assistant_messageだけで marker provenance が成立し、transcript を必要としませんでした。2.1.285 では成立せず、transcript fallback も使えないためmarker_provenance_verified=Falseとなりno_evidenceになります。tool_use_result.handbackReport.textに残っており、agentIdは hook のagent_idと一致します。upstream 側の裏付け(一次資料):
last_assistant_messageを使う」と述べているが、SubagentStop の入力 field 一覧には載っていない(https://code.claude.com/docs/en/hooks )。release notes にSubagentStoppayload の変更の記載は確認できなかった。つまり 文書化されていない挙動変更である。AC3: 最小修正方針
parser 適応を採用します。version constraint の文書化は採りません(新しい upstream を恒久的に排除することになり、runner の役割と合わないため)。
last_assistant_messageが無い場合に限り、同一agent_idに相関した Agent tool のtool_use_result.handbackReport.textを、marker provenance の追加の入力として使う。agentId一致(hook のagent_idとtool_use_result.agentId)で行い、terminal 成功(status == completed)を必須にする。last_assistant_messageがある場合の既存の挙動は変えない。follow-up implementation Issue: 下記コメントで参照する(起票後に追記)。
AC4: baseline 既存 fixture テスト
uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_causal_evidence.py -q→47 passed(main8eeca46a、exit 0)。既存テストはlast_assistant_messageを持つ payload を前提としており、last_assistant_messageが無くhandbackReportだけがある形は未カバーである。この形を新しい回帰テストとして follow-up で固定する。参考: 影響範囲
--require-subagent-causal-evidenceと--expect-marker-source subagentを併用する runtime_only AC は、現環境(2.1.285)では PASS できない。実装: 再発防止: Auto mode runtime VC の独立 claude -p session で approval context 欠落による false capability-blocker を防ぐ #2839 AC10 と、同じ flag を使う 実装: Claude-GPT model/proxy 更新の runtime migration を完了工程に含め、人間介入を genuine blocker に限定する #2810 の AC9/AC10 が該当する。squne121 commentedon Sep 30, 2026
調査結果の反映(follow-up implementation Issue)
最小修正方針(parser 適応)の follow-up implementation Issue を #2848 として起票しました。
#2848
AC3 の参照先はこの #2848 です。本 Issue(research-only)では repository file を変更していません。
squne121 commentedon Oct 2, 2026
Backlog audit (2026-10-02): close as completed. #2846 recorded the root cause and selected parser adaptation as the remediation. Follow-up implementation Issue #2848 is CLOSED / completed (2026-09-30). The research-only Issue therefore has no remaining delivery scope.