Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "completed structured runtime-smoke で post-session statusLine observation を not_applicable として明示し、aggregate result.status の単独 fail 要因にしない"
change_kind: codeParent Issue
none
(補足: #2744 実装中に発見された、#2568 / PR #2708 由来の既存動作に関する独立した改善。関連: #2744。#2744 自身ではこのタイミング問題自体の修正は Out of Scope)
Parent Goal Ref
- Goal: なし(単独改善)
- Desired Destination: なし(単独改善のため parent tracker への destination mapping は不要)
Remaining Parent Gaps
なし
Current Validated Scope
scripts/task-context/task_context_runtime_smoke_verifier.pyのorchestrate_runtime_smoke()/collect_statusline_evidence()が返すstatusline_evidenceの解釈方法(aggregateRuntimeSmokeOrchestrationResult.statusへの反映方法)の見直しのみ
Outcome
scripts/task-context/task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke() は、invoke_generic_runner() の blocking subprocess.run() 完了後に collect_statusline_evidence() を呼ぶ現在の evidence lifecycle を維持したまま、completed non-interactive structured session(claude -p 等の structured runtime-smoke 実行が既に完了した状態)における post-session statusLine observation が collect_statusline_evidence() から "executed_degenerate" を返し、かつその根拠となる raw statusLine render(rendered フィールド)が "Unbound" である場合に限り、これを not_applicable として明示し、それ単独では RuntimeSmokeOrchestrationResult.status を "fail" にしない実装へ修正する。rendered が "Degraded" または空文字("")の場合は、collect_statusline_evidence() の戻り値が同じ "executed_degenerate" に分類されていても not_applicable へ昇格させず、引き続き violations に含め aggregate status を "fail" にする(.claude/hooks/task_context/statusline.py は "Degraded" を genuine な DB/query/transport failure として exit code 0 で返す設計であり、"Unbound"(binding/task が無い正常系)と意味論が異なるため区別する)。collect_statusline_evidence() が "failed"(statusline スクリプト自体の例外・非ゼロ終了)または "skipped"(claude_session_id が観測できない、すなわち runner の evidence 契約が壊れている可能性を示すケース)を返した場合も、not_applicable へ丸め込まず、引き続き violations に含め aggregate status を "fail" にする。collect_statusline_evidence() 自体が live/applicable statusLine observation を評価する場合の executed / executed_degenerate / failed の既存 fail-closed semantics(_DEGENERATE_STATUSLINE_RENDERS の定義を含む)は変更しない。この変更と、PR #2745 由来の tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py の既知 timing limitation 特例の撤去を含めた回帰テストが main にマージされている状態がゴールである。
因果説明の訂正: 当初の Outcome は「completed structured session では Claude session(SessionEnd を含む)が既に完了し operator Binding が SUSPENDED 状態になった時点で statusLine query が実行されるため非退化レンダリングを得られない」という因果を前提としていたが、これは scripts/task-context/task_context_hook_flows.py::_end_current_run() の実装(SessionEnd は runtime_health のみ SUSPENDED に変更し、current_claude_session_id はクリアしない)および .claude/hooks/task_context/statusline.py::render()(runtime_health != "ACTIVE" の binding も除外せず health={health} を付記してレンダリングする設計)と一致しないため撤回する。より正確な説明は「structured non-interactive run(claude -p)完了後に行う out-of-band statusLine probe は、interactive UI lifecycle 中の live statusLine verification と等価ではない。smoke seed が作る synthetic Binding には実 Claude session の claude_session_id が事前付与されていないため、実 SessionStart は seed Binding を復元できず別の新規 Binding を作る。その新規 ExecutionRun は task_id=None のまま開始され、nonce prompt も target classification を発生させないため Task へ bind されない。したがって statusline.py::render() は task = data.get("task") が偽のため "Unbound" を返す(session が終了しているから ではなく そのセッションに最初から Task が紐付いていないから)」である。
Runtime Verification Applicability
- decision: deferred
- reason:
collect_statusline_evidence()が"executed_degenerate"を返す決定論的な再現は実 claude CLI 環境の起動を要し、CI 標準実行では検証できないため。実装 PR では pytest によるモック検証(orchestrate_runtime_smoke()の aggregate 判定ロジック)を主とし、live 環境での再現確認は本 Issue の実装 PR で defer する。 - deferred_destination: 実装 PR のレビューコメントで live claude CLI 環境での bounded live canary 実行結果(AC4 の
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py実行結果を含む)を報告する - deferred_verification_condition: 実装 PR が実 claude CLI 環境で completed structured runtime-smoke を1回以上実行し、
result.statusが post-session statusLine observation だけを理由に"fail"にならないこと、かつtests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyの live test が既知 limitation 特例なしでresult.status == "pass"を確認できた時点
In Scope
orchestrate_runtime_smoke()内で、completed structured runtime-smoke(invoke_generic_runner()の blocking 実行が既に完了した後の状態)における post-session statusLine observation を、collect_statusline_evidence()の呼び出しタイミング自体は変更せず、statusline_evidenceの解釈(aggregatestatusへの反映方法)だけを変更する。この再解釈の対象はcollect_statusline_evidence()が"executed_degenerate"を返し、かつrendered == "Unbound"の場合に限る。renderedが"Degraded"または空文字の場合は、"executed_degenerate"に分類されていてもnot_applicableへ昇格させず、引き続きviolationsに含め aggregatestatusを"fail"にする(Degradedは genuine な DB/query/transport failure を表しうるため)。not_applicable として格納する evidence dict には元のstatusをunderlying_statusとして、renderedはそのまま保持し、タイミング起因の既知の non-applicability と genuine な regression を診断上区別できるようにする。collect_statusline_evidence()自体が返すexecuted/executed_degenerate/failed/skippedの判定ロジック(leaf 関数の fail-closed semantics、_DEGENERATE_STATUSLINE_RENDERS = frozenset({"Unbound", "Degraded", ""})の集合定義自体を含む)は変更しない。executed_degenerateを PASS 相当に読み替える設計、およびorchestrate_runtime_smoke()側でfailed/skippedをnot_applicableに丸め込む設計は禁止する。- runner failure、canonical_delta failure、その他 applicable な scenario failure が存在する場合、statusLine が
not_applicableでも aggregatestatusが必ず"fail"のままであることを保証する。 tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyに残る_KNOWN_STATUSLINE_TIMING_LIMITATION(PR 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 由来の既知 timing limitation 許容ロジック)を撤去し、live structured run の aggregateresult.status == "pass"を通常条件で検証できるようにする。- 上記変更に対する回帰テスト(
rendered == "Unbound"の completed structured session を模したケースでresult.statusが statusline evidence だけを理由に"fail"にならないこと、rendered == "Degraded"およびrendered == ""の completed structured session ケースではnot_applicableへ昇格せず aggregatestatusが"fail"のままであること、およびexecuted/executed_degenerate/failedの既存 fail-closed semantics が変更されていないことを検証するテスト)の追加。
Out of Scope
- 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2744 で追加された canonical entrypoint 強制・isolation 検証ロジック自体の変更。
scripts/agent-ops/run_worktree_agent_runtime_smoke.py(generic runner)の default behavior 変更。- statusLine のレンダリング仕様自体(
executed/executed_degenerateの判定ロジック)の変更。 invoke_generic_runner()のsubprocess.run()をPopenへ変更する等、runner 完了前に statusLine を評価するための concurrency 機構(stdout streaming、polling、evidence channel 拡張、generic runner protocol 拡張を含む)の導入。これは現在の evidence lifecycle と責務境界(generic runner = transport/Task Context verifier = semantics)に対して侵襲的であり、費用対効果が低いため採用しない。- statusLine の本当の runtime verification(interactive/live session lifecycle での検証)自体の設計・実装。これは 実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 の既存方針どおり interactive lane の責務のままとする。
RuntimeSmokeOrchestrationResult.statusトップレベルの schema を pass/fail の二値から変更すること(statusLine subsystem 内部の状態区分のみを明示すれば足り、top-level schema の三値化は行わない)。
Acceptance Criteria
- AC1: completed structured runtime-smoke(
invoke_generic_runner()の blocking 実行完了後の post-session statusLine observation)でcollect_statusline_evidence()が"executed_degenerate"を返し、かつrendered == "Unbound"の場合に限り、statusline_evidenceがnot_applicable(元のstatusをunderlying_statusとして、renderedをそのまま保持したもの)と明示され、それ単独で aggregateRuntimeSmokeOrchestrationResult.statusを"fail"にしない。同じ"executed_degenerate"であってもrenderedが"Degraded"または空文字の場合、あるいはcollect_statusline_evidence()が"failed"または"skipped"を返した場合はnot_applicableへ丸め込まず、引き続きviolationsに含め aggregatestatusを"fail"にする。 - AC2:
collect_statusline_evidence()自体の applicable な経路におけるexecuted/executed_degenerate/failed/skippedの既存 fail-closed semantics(executed_degenerateを PASS に読み替えない挙動を含む)は変更しない。 - AC3: runner failure、canonical_delta failure、その他 applicable な scenario failure が存在する場合、statusLine が
not_applicableでも aggregatestatusは必ず"fail"のままである。 - AC4:
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyに残る、PR 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 由来の live-shadow-isolation test の既知 timing limitation 特例(_KNOWN_STATUSLINE_TIMING_LIMITATIONおよびそれを許容する assert 分岐)を撤去し、live structured run で aggregateresult.status == "pass"を通常条件(特例なし)で確認できる。 - AC5:
--max-turnsの値やターン数を completed-session 判定のヒューリスティックとして使用しない(orchestrate_runtime_smoke()の実装が、実行された agentic turn 数や--max-turns引数の値を参照してnot_applicable判定を行っていない)。 - AC6: 単一ターン・複数ターンいずれの completed structured runtime-smoke でも、
collect_statusline_evidence()が"executed_degenerate"を返しrendered == "Unbound"である限り statusline evidence の扱いに起因する挙動差が生じない(両ケースとも AC1 と同一のnot_applicable扱いになる)。renderedが"Degraded"または空文字の場合は単一/複数ターンいずれでもnot_applicableの対象外であり、この区別は turn 数ではなくrendered値のみに基づく(「複数ターンならexecutedを返せる」という未検証の前提を新たな AC として固定しない)。 - AC7: 既存の
tests/task-context/test_runtime_smoke_verifier.py/tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.pyの既存テストが全件 PASS を維持する(orchestrate_runtime_smoke()の aggregate 判定ロジック変更に対する regression coverage)。
Verification Commands
# AC5
$ rg -n "max_turns" scripts/task-context/task_context_runtime_smoke_verifier.py# AC1
# AC2
# AC3
# AC6
$ uv run pytest tests/task-context/test_runtime_smoke_verifier.py -v# AC7
$ uv run pytest tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py -v# AC4
# baseline-expect: deferred
$ uv run pytest tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -v -m claude_live上記最後の live test(test_runtime_smoke_verifier_live_shadow_isolation.py)は実 Claude CLI lifecycle に依存するため、通常 CI の無条件必須ゲートにはしない。実装 PR で明示的に1回以上のライブ実行を行い、その証跡(AC4 の result.status == "pass" 確認結果を含む)を PR コメントで報告する(Runtime Verification Applicability: deferred の deferred_destination を参照)。SKIP を PASS と同一視しない docs/dev/runtime-verification-policy.md の既存方針を維持する。
Allowed Paths
- scripts/task-context/task_context_runtime_smoke_verifier.py
- tests/task-context/test_runtime_smoke_verifier.py
- tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py
- tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
invoke_generic_runner()のsubprocess.run()をPopenへ変更する、または stdout streaming / polling / evidence channel 拡張が必要と判明した場合(Out of Scope 節参照。判明した時点で実装を進めず本 Issue を止める)collect_statusline_evidence()のexecuted/executed_degenerate/failedの既存 fail-closed 判定ロジック自体の変更が必要と判明した場合- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- statusLine のレンダリング仕様自体(
executed/executed_degenerateの判定基準)の変更が必要と判明した場合
Required Skills
なし
Required Design References
- scripts/task-context/task_context_runtime_smoke_verifier.py
- docs/dev/runtime-verification-policy.md
Scope Delta(該当時のみ記載)
N/A
Notes for Reviewer
-
Scope Collision (C3, advisory, resolved): overlap preflight は本 Issue と 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2744 が
scripts/task-context/task_context_runtime_smoke_verifier.pyの Allowed Paths を共有すると報告していた(ISSUE_OVERLAP_PREFLIGHT_RESULT_V1decision=ambiguous_requires_human, reason_code=parent_child_collision)。PR 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745(実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2744 実装PR)は 2026-09-25 にmainへマージ済みで Issue 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2744 も completed(closed) のため、この overlap は解消済みである。実装着手前の追加の merge 待ちは不要。 -
発見元: PR 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745(実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2744 実装PR)のレビューサイクル中、OWNER trusted レビューコメント 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 (comment) のF1 finding対応で
orchestrate_runtime_smoke()の集約result.statusを直接検証するテストを追加したところ判明。 -
再現性: 実 claude CLI 環境で2回実行し、両方とも同じ
violations=["statusline_evidence status='executed_degenerate', expected 'executed'"]で決定論的に再現。 -
関連PR: 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745。関連コード:
scripts/task-context/task_context_runtime_smoke_verifier.pyのorchestrate_runtime_smoke()/collect_statusline_evidence()。 -
orchestrate_runtime_smoke()はinvoke_generic_runner()のブロッキングsubprocess.run()が完了した後にcollect_statusline_evidence()を呼んでおり、completed structured session では Claude session(SessionEndを含む)が既に完了し operator Binding がSUSPENDED状態になった時点で statusLine query が実行されるため非退化レンダリングを得られない。 -
OWNER 敵対的レビュー(trusted anchor: https://github.com/squne121/loop-protocol/issues/2747#issuecomment-5826095234)反映: 本 Issue の当初契約は (1)
Verification Commands/Allowed Pathsのテストディレクトリが現リポジトリ(tests/task-context/)と不一致だった(誤:scripts/task-context/tests/)、(2) 問題設定を「single-turn vs multi-turn」と記述しており、--max-turnsを実行ターン数の識別子として使えるという誤った前提に依存していた、(3) 「runner 完了前に statusLine を評価する」concurrency 拡張案が Out of Scope として明示されていなかった、(4) PR 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 の live-test workaround 撤去が Allowed Paths / AC に含まれていなかった、という4点の指摘を受け、本文全体(Outcome / In Scope / Out of Scope / Acceptance Criteria / Verification Commands / Allowed Paths / Stop Conditions)を上記の通り改訂した。問題設定は「single-turn vs multi-turn」ではなく「completed non-interactive structured session vs live/applicable statusLine observation」に変更した。collect_statusline_evidence()/RuntimeSmokeOrchestrationResultは genericdict[str, Any]で実装されており固定 Enum/Literal/TypedDict スキーマを持たないため、not_applicable値の追加は Allowed Paths 内の変更で完結し、別ファイルの schema 定義追加・Allowed Paths 外の変更は不要と判断した(.claude/skills/issue-refinement-loopの codebase-investigator 事前調査で確認済み)。 -
Semantic design review(Step 2.5,
issue-design-reviewer)反映:collect_statusline_evidence()の呼び出しはorchestrate_runtime_smoke()内の1箇所のみでmodeは常に"structured"に固定されているため、当初の Outcome / In Scope / AC1 の文言(「completed structured runtime-smoke であれば無条件に not_applicable」)のままでは、本 Issue が実際に再現・文書化した障害モード(executed_degenerate)だけでなく、無関係な既存 fail-closed ガードである"failed"(statusline スクリプト自体のクラッシュ)や"skipped"(claude_session_id未観測、runner の evidence 契約破損の可能性)まで意図せずnot_applicableに丸め込みうる high severity finding を受けた。Outcome / In Scope / AC1 / AC2 / AC6 を、not_applicable再解釈の対象をcollect_statusline_evidence()が"executed_degenerate"を返した場合に限定し、"failed"/"skipped"は引き続きviolationsに含め aggregate を"fail"にする、という設計判断を明示する形に改訂した。あわせて、not_applicable として格納する evidence dict に元のstatusをunderlying_statusとして保持し、タイミング起因の既知の non-applicability と genuine な regression を診断上区別できるようにする方針を In Scope に明記した。 -
Contract Reconciliation(2026-09-25、PR fix: 完了済み structured runtime-smoke の post-session statusLine を not_applicable として扱う #2749 OWNER レビュー反映): OWNER レビューコメント(https://github.com/squne121/loop-protocol/pull/2749#issuecomment-5827999244、正規化要約: https://github.com/squne121/loop-protocol/issues/2747#issuecomment-5828113788)により、当初の AC1/AC6(
executed_degenerateを一括not_applicableとする設計)がDegraded(genuine な DB/query/transport failure を exit 0 で表しうる)まで PASS へ丸め込むバグを指摘された。collect_statusline_evidence()の戻り値に含まれるrenderedフィールド(scripts/task-context/task_context_runtime_smoke_verifier.py:650)を参照してrendered == "Unbound"の場合のみnot_applicable候補とし、"Degraded"/""は従来どおりviolations/aggregate fail に残す設計へ Outcome / In Scope / AC1 / AC6 を改訂した(collect_statusline_evidence()leaf 関数自体・_DEGENERATE_STATUSLINE_RENDERS定義は変更不要であることをコード確認済み)。また「SessionEnd 済みだから Unbound」という当初の因果説明も、scripts/task-context/task_context_hook_flows.py::_end_current_run()(SessionEnd はruntime_healthのみ変更しcurrent_claude_session_idはクリアしない)および.claude/hooks/task_context/statusline.py::render()(SUSPENDED binding も除外せずレンダリングする設計)と不一致であったため撤回し、「synthetic smoke seed には claude_session_id が事前付与されていないため実 SessionStart が新規 Binding を作り、Task 未 bind のまま Unbound を観測している」という、より正確な説明に置き換えた。OWNER が提示した「structured lane では statusLine を verification 対象から完全に外す」という代替案(第一候補)は、AC2/AC3(failed/skippedは引き続き aggregate fail であるべき)と衝突するため不採用とし、OWNER 自身が提示した「より小さい安全な修正」(rendered=="Unbound"のみ N/A 候補、Degraded/空文字は自動昇格しない)を採用した。
Activity
squne121 commentedon Sep 25, 2026
総評
Issue #2747 が指摘している現象そのものは正しいです。現在の
orchestrate_runtime_smoke()は generic runner をsubprocess.run()で最後まで待ち、その後に statusLine を再実行するため、live test ではexecuted_degenerateが発生し、aggregateresult.statusが statusLine だけを理由にfailになります。PR #2745 の live test も、まさにこの既知制約だけを特例で許容しています。ただし、Issue の契約はそのまま実装に入れるには粗いです。特に「single-turn structured lane の statusLine をどう扱うか」という問題設定が、本来の #2568 の設計と Claude Code の statusLine ライフサイクルを混同しています。
私なら 実装前に #2747 をもう一度 refinement します。実装方針は「runner と並行して statusLine を無理に叩く」ではなく、completed structured lane では statusLine を
not_applicableと明示し、aggregate failure の対象外にする方向を推します。敵対的レビュー Findings
F1 — テストパスが現リポジトリと一致していない
#2747 は、
を AC3、Verification Commands、Allowed Paths に指定しています。
しかし現在のテストは、
にあります。実際に関連する既存資産も、
です。
したがって現在の
は正しい VC ではありません。
これは単なる typo より重大です。
scripts/task-context/tests/が Allowed Paths に固定されているため、実装エージェントが契約を忠実に守るほど、既存テスト体系とは別のテストディレクトリを新設する方向に誘導されます。最低限、
などに直すべきです。
F2 — 根本問題は「single-turn」ではなく、statusLine の観測時点
ここが一番重要です。
元 Issue #2568 の runtime matrix はすでに、
/clearについて、後者を interactive lane で検証する方針を明記しています。
一方 #2747 は、structured
claude -pが終了した後に statusLine script を手動再実行し、その値を aggregate verdict に使おうとしています。Claude Code の公式仕様上、status line は端末 UI の下部に表示される status bar であり、設定した script はセッション開始、assistant message 到着などのイベントで実行されます。つまり生きているセッションに付随する UI/evidence channelです。Claude
さらに
SessionEndは文字通り Claude Code session が終了すると実行される hook です。Claudeしたがって、
ことは、実際の Claude Code がセッション中に statusLine をロード・実行したという evidence と同義ではありません。
PR #2708 で追加した
collect_statusline_evidence()はmechanism probeとしては有用ですが、それを completed structured run の必須 verdict にしたことが設計上の歪みです。推奨する意味論
structured run 完了後は例えば、
として、
と分離する方が筋が通ります。
executed_degenerateを PASS に読み替えるのは避けるべきです。 それでは「本当に binding が壊れて Unbound なのか」「正常な teardown 後だから Unbound なのか」を区別できなくなります。F3 —
--max-turns 2を single-turn 判定に使ってはいけないIssue 本文は、
と記述していますが、Claude Code の
--max-turnsは実際に何ターン実行されたかではなく、agentic turn の上限です。公式 CLI reference も明確に「Limit the number of agentic turns」としています。Claudeつまり、
から、
は導けません。
したがって実装で、
のようにしてはいけません。
むしろ今回の distinction は、
ではなく、
で定義する方が堅牢です。
Issue タイトル・AC1 もこの用語へ変更した方がいいです。
F4 — 「subprocess 完了前に評価」はコストに見合わない
現在の流れは、
です。
Python の
subprocess.run()自体が「command が完了するまで待ってCompletedProcessを返す」APIです。Python documentationさらに current generic runner は、
extract_claude_parent_session_id(out)を実行schema_summary["parent_session_id"]を構築--evidence-jsonを書き込む構造です。
つまり verifier が単純に
subprocess.run()をPopen()に変えても、今使っている evidence JSON から session ID を早期取得できません。実現しようとすると、
などが必要になります。
しかも PIPE を伴う Popen の非同期管理では、stdout/stderr の読み方を誤ると pipe buffer による deadlock を起こし得るため、Python 公式も
communicate()等を使った慎重な管理を要求しています。Python documentation個人開発で品質・有用性とワークフローの軽さを優先するなら、ここに concurrency protocol を追加する価値は薄いです。
F5 — 「multi-turn structured は現状どおり executed」の AC は根拠不足
AC2 は、
としています。
しかし current implementation はターン数にかかわらず、
です。
したがって「2ターン以上なら終了後にも non-degenerate statusLine を取得できる」という区別には、少なくとも現在確認した Issue / PR / code 内に十分な根拠がありません。
ここを AC に固定すると、たまたま現在そう見える lifecycle artifact を仕様化する可能性があります。
この AC は、
程度へ置き換える方が安全です。
F6 — PR #2745 の workaround も同時に掃除すべき
現在の、
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyには明示的に、
があり、aggregate result が fail でも、その violation 1件だけなら live isolation test を続行する例外があります。
#2747 が直ったら、この exception を残す理由はありません。
今回ここを Allowed Paths に追加し、
を通常条件へ戻す方が、回帰テストとしてははるかに強くなります。
推奨する #2747 の設計
大規模には触らず、次の方向が最も費用対効果が高いです。
トップレベルの
RuntimeSmokeOrchestrationResult.statusは今の"pass" | "fail"を維持して構いません。statusLine subsystem だけ、のように明示すれば十分で、top-level schema を三値化する必要はありません。
そして
collect_statusline_evidence()の"executed_degenerate"判定自体は弱めないのが重要です。「structured post-session だから collector を必須評価しない」と、「degenerate を成功扱いする」は別物です。AC は例えばこう直すのがよいです
Verification Commands も最低限、
へ修正すべきです。
最後の live test は通常 CI に無理に常駐させる必要はありません。#2747 の現方針どおり、実装 PR で1回明示的に live canary を走らせ、その証跡を残す程度で十分です。今回の問題は real Claude lifecycle に依存するので、mock だけで完了扱いするよりはこの1本だけ残す価値があります。
結論
問題発見は妥当、修正対象も狭くてよい。ただし current Issue contract のまま
impl-review-loopに投入するのは勧めません。特に実装前に直すべきなのは、①
scripts/task-context/tests/→tests/task-context/、② single/multi-turn という区分の撤去、③ pre-completion concurrency 案を実質不採用にして structured post-session statusLine を明示的 N/A にする、④ PR #2745 の live-test workaround を scope に含めて撤去する、の4点です。この形なら generic runner、statusLine renderer、ハーネス自体には手を広げず、#2568 の「generic runner = transport / Task Context verifier = semantics」という責務境界も維持できます。また、#2568 が元々 statusLine を interactive lane の検証対象としていた設計とも整合します。
なお、PR #2745 は 2026-09-25 にすでに merge 済みで Issue #2744 も completed なので、#2747 Notes にある「#2745 merge 待ち」は現在は解消済みです。
## 総評[Issue #2747](#2747) が指摘している現象そのものは正しいです。現在の
orchestrate_runtime_smoke()は generic runner をsubprocess.run()で最後まで待ち、その後に statusLine を再実行するため、live test ではexecuted_degenerateが発生し、aggregateresult.statusが statusLine だけを理由にfailになります。PR #2745 の live test も、まさにこの既知制約だけを特例で許容しています。ただし、Issue の契約はそのまま実装に入れるには粗いです。特に「single-turn structured lane の statusLine をどう扱うか」という問題設定が、本来の #2568 の設計と Claude Code の statusLine ライフサイクルを混同しています。
私なら 実装前に #2747 をもう一度 refinement します。実装方針は「runner と並行して statusLine を無理に叩く」ではなく、completed structured lane では statusLine を
not_applicableと明示し、aggregate failure の対象外にする方向を推します。敵対的レビュー Findings
--max-turns 2等を single-turn の識別子にできないexecutedを返せる」という AC の前提が実証されていないF1 — テストパスが現リポジトリと一致していない
#2747 は、
を AC3、Verification Commands、Allowed Paths に指定しています。
しかし現在のテストは、
にあります。実際に関連する既存資産も、
です。
したがって現在の
は正しい VC ではありません。
これは単なる typo より重大です。
scripts/task-context/tests/が Allowed Paths に固定されているため、実装エージェントが契約を忠実に守るほど、既存テスト体系とは別のテストディレクトリを新設する方向に誘導されます。最低限、
などに直すべきです。
F2 — 根本問題は「single-turn」ではなく、statusLine の観測時点
ここが一番重要です。
元 Issue #2568 の runtime matrix はすでに、
/clearについて、後者を interactive lane で検証する方針を明記しています。
一方 #2747 は、structured
claude -pが終了した後に statusLine script を手動再実行し、その値を aggregate verdict に使おうとしています。Claude Code の公式仕様上、status line は端末 UI の下部に表示される status bar であり、設定した script はセッション開始、assistant message 到着などのイベントで実行されます。つまり生きているセッションに付随する UI/evidence channelです。:chatgpt-content-reference{index="0"}
さらに
SessionEndは文字通り Claude Code session が終了すると実行される hook です。:chatgpt-content-reference{index="1"}したがって、
ことは、実際の Claude Code がセッション中に statusLine をロード・実行したという evidence と同義ではありません。
PR #2708 で追加した
collect_statusline_evidence()はmechanism probeとしては有用ですが、それを completed structured run の必須 verdict にしたことが設計上の歪みです。推奨する意味論
structured run 完了後は例えば、
として、
と分離する方が筋が通ります。
executed_degenerateを PASS に読み替えるのは避けるべきです。 それでは「本当に binding が壊れて Unbound なのか」「正常な teardown 後だから Unbound なのか」を区別できなくなります。F3 —
--max-turns 2を single-turn 判定に使ってはいけないIssue 本文は、
と記述していますが、Claude Code の
--max-turnsは実際に何ターン実行されたかではなく、agentic turn の上限です。公式 CLI reference も明確に「Limit the number of agentic turns」としています。:chatgpt-content-reference{index="2"}つまり、
から、
は導けません。
したがって実装で、
のようにしてはいけません。
むしろ今回の distinction は、
ではなく、
で定義する方が堅牢です。
Issue タイトル・AC1 もこの用語へ変更した方がいいです。
F4 — 「subprocess 完了前に評価」はコストに見合わない
現在の流れは、
です。
Python の
subprocess.run()自体が「command が完了するまで待ってCompletedProcessを返す」APIです。:chatgpt-content-reference{index="3"}さらに current generic runner は、
extract_claude_parent_session_id(out)を実行schema_summary["parent_session_id"]を構築--evidence-jsonを書き込む構造です。
つまり verifier が単純に
subprocess.run()をPopen()に変えても、今使っている evidence JSON から session ID を早期取得できません。実現しようとすると、
などが必要になります。
しかも PIPE を伴う Popen の非同期管理では、stdout/stderr の読み方を誤ると pipe buffer による deadlock を起こし得るため、Python 公式も
communicate()等を使った慎重な管理を要求しています。:chatgpt-content-reference{index="4"}個人開発で品質・有用性とワークフローの軽さを優先するなら、ここに concurrency protocol を追加する価値は薄いです。
F5 — 「multi-turn structured は現状どおり executed」の AC は根拠不足
AC2 は、
としています。
しかし current implementation はターン数にかかわらず、
です。
したがって「2ターン以上なら終了後にも non-degenerate statusLine を取得できる」という区別には、少なくとも現在確認した Issue / PR / code 内に十分な根拠がありません。
ここを AC に固定すると、たまたま現在そう見える lifecycle artifact を仕様化する可能性があります。
この AC は、
程度へ置き換える方が安全です。
F6 — PR #2745 の workaround も同時に掃除すべき
現在の、
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyには明示的に、
があり、aggregate result が fail でも、その violation 1件だけなら live isolation test を続行する例外があります。
#2747 が直ったら、この exception を残す理由はありません。
今回ここを Allowed Paths に追加し、
を通常条件へ戻す方が、回帰テストとしてははるかに強くなります。
推奨する #2747 の設計
大規模には触らず、次の方向が最も費用対効果が高いです。
トップレベルの
RuntimeSmokeOrchestrationResult.statusは今の"pass" | "fail"を維持して構いません。statusLine subsystem だけ、のように明示すれば十分で、top-level schema を三値化する必要はありません。
そして
collect_statusline_evidence()の"executed_degenerate"判定自体は弱めないのが重要です。「structured post-session だから collector を必須評価しない」と、「degenerate を成功扱いする」は別物です。AC は例えばこう直すのがよいです
Verification Commands も最低限、
へ修正すべきです。
最後の live test は通常 CI に無理に常駐させる必要はありません。#2747 の現方針どおり、実装 PR で1回明示的に live canary を走らせ、その証跡を残す程度で十分です。今回の問題は real Claude lifecycle に依存するので、mock だけで完了扱いするよりはこの1本だけ残す価値があります。
結論
問題発見は妥当、修正対象も狭くてよい。ただし current Issue contract のまま
impl-review-loopに投入するのは勧めません。特に実装前に直すべきなのは、①
scripts/task-context/tests/→tests/task-context/、② single/multi-turn という区分の撤去、③ pre-completion concurrency 案を実質不採用にして structured post-session statusLine を明示的 N/A にする、④ PR #2745 の live-test workaround を scope に含めて撤去する、の4点です。この形なら generic runner、statusLine renderer、ハーネス自体には手を広げず、#2568 の「generic runner = transport / Task Context verifier = semantics」という責務境界も維持できます。また、#2568 が元々 statusLine を interactive lane の検証対象としていた設計とも整合します。
なお、PR #2745 は 2026-09-25 にすでに merge 済みで Issue #2744 も completed なので、#2747 Notes にある「#2745 merge 待ち」は現在は解消済みです。
squne121 commentedon Sep 25, 2026
確認した現状では、#2747 は実装へ進める前に、対象コメントを trusted human context の anchor として
issue-refinement-loopを回すのが適切です。現行
mainでは PR #2745 はすでに merge 済みで、tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyにはexecuted_degenerateだけを許容する workaround がまだ存在します。またcollect_statusline_evidence()の結果はdict[str, Any]で、トップレベルRuntimeSmokeOrchestrationResult.statusも"pass" | "fail"のままなので、現時点ではnot_applicable導入のために外部 schema を必ず変更する構造には見えません。ただし refinement 中に consumer を検索して確定させるべきです。対象コメントの設計判断も妥当です。Claude Code の status line はセッション開始時や assistant message 到着時などに実行されるセッション付随の表示機構であり、
SessionEndはセッション終了時の hook です。したがって終了済み structured session に対する外部再実行を live statusLine evidence と同一視しない整理には根拠があります。:chatgpt-content-reference{index="0"} また--max-turnsは「実際のターン数」ではなく agentic turn の上限なので、single/multi-turn 判定に使うべきではありません。:chatgpt-content-reference{index="1"}推奨アクションは次の通りです。
#issuecomment-5826095234を direct human context として固定し、preflight.run.with_human_context系の canonical lane から開始する。通常 iteration の承認確認は行わない。scripts/task-context/tests/→tests/task-context/、single/multi-turn 区分の撤去、pre-completion concurrency 案の不採用、not_applicablesemantics、実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 workaround 撤去を明示する。not_applicableが既存 consumer/type/schema に波及するかはcodebase-investigatorに調査させる。exact path が不足しても、skill に既存の trusted-human recovery route があるため、すぐ人間へ戻さない。issue-editorSubAgent に任せ、SubAgent の終了を必ず待ってから readback → fresh review → readiness を進める。background のまま次段階へ進まない。human_judgment_requiredを返す genuine hard stop まで無理に PASS 化しない。既に auto mode で起動している Claude Code へ、そのまま貼れる形です。
Repository:
squne121/loop-protocol対象 Issue:
#2747
今回の trusted anchor / human review directive:
#2747 (comment)
使用する skill:
https://github.com/squne121/loop-protocol/tree/main/.claude/skills/issue-refinement-loop
この Issue #2747 に対して
.claude/skills/issue-refinement-loop/SKILL.mdを SSOT として issue refinement loop を実行してください。現在の Claude Code セッションはすでに auto mode で起動済みです。
permission mode の変更、Claude Code の再起動、
--dangerously-skip-permissions等への切り替えは不要です。Execution policy
loop_iteration_approval_gate.default_required: falseとして扱い、needs-fixはmax_iterations未到達なら自動継続してください。max_iterationsは特段の理由がなければ skill 既定値 3 を使用してください。gh issue editや独自 GitHub mutation 経路を作らないでください。今回指定した anchor comment は OWNER による direct human context として扱ってください。
URL だけの unlabeled lane や agent-report lane として処理せず、canonical な
preflight.run.with_human_context相当の経路を使用してください。SubAgent requirements
必要な調査・rewrite は SubAgent を積極的に使用してください。
最低限、planner / skill の routing に従って以下を使用してください。
codebase-investigatorweb-researcherissue-editorissue-creator重要:
起動した SubAgent は必ず作業完了まで待ってください。
SubAgent の partial output、起動済みという事実、background task の進行中状態だけを根拠に次の phase へ進まないでください。
SubAgent の final result / required artifact が実際に返ってから、その結果を親 control-plane で consume してください。
worker SubAgent から nested delegation を行わせないでください。各 agent/skill の既存 delegation boundary を守ってください。
transient/environment failure に canonical bounded retry が定義されている場合は、先にそれを消化してください。人間確認を retry の代替にしないでください。
First: establish current repository state
mutation 前に current
mainを調査してください。少なくとも以下を確認してください。
tests/task-context/であること。scripts/task-context/task_context_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.pytests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pytest_runtime_smoke_verifier_live_shadow_isolation.pyに、実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 由来の_KNOWN_STATUSLINE_TIMING_LIMITATION/executed_degenerate特例が現在も存在すること。collect_statusline_evidence()、RuntimeSmokeOrchestrationResult、orchestrate_runtime_smoke()の current implementation と全 consumer/callsite を検索すること。statusline_evidence.status = "not_applicable"の追加が、別 schema、Literal/Enum、固定 consumer、Allowed Paths 外の変更を本当に必要とするか確認すること。current implementation では
statusline_evidenceが generic dict として保持されているように見えるため、外部 schema change が必要だと最初から仮定しないでください。一方、検索せず「不要」と断定することもしないでください。Anchor comment を反映する refinement direction
target comment の F1〜F6 を authoritative review feedback として反映してください。
特に以下を Issue contract に落とし込んでください。
1. Test path correction
現在の誤った
scripts/task-context/tests/を削除し、current repository に存在する
tests/task-context/配下の exact paths に修正してください。
最低限、実装スコープ候補として:
scripts/task-context/task_context_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyを調査してください。
test_runtime_smoke_verifier_canonical_carrier_regression.pyについても regression coverage 上必要か調査し、必要性を contract に明示してください。2. Problem framing correction
Issue の semantic distinction を
single-turn vs multi-turnから
completed non-interactive structured sessionvs
live/applicable statusLine observationへ変更してください。
--max-turns 2等を actual turn count の判定ヒューリスティックとして使用する設計は禁止してください。Issue title、Outcome、In Scope、Acceptance Criteria、Notes 等も、この semantic correction と整合させてください。
3. Do not introduce unnecessary concurrency
invoke_generic_runner()の blocking execution 中に session id を横取りして statusLine を実行するためだけに、subprocess.Popen等を追加する設計を既定案にしないでください。
current evidence lifecycle と責務境界を維持し、個人趣味開発として implementation complexity を増やさない方向を優先してください。
4. Recommended statusLine semantics
completed structured runtime-smoke の post-session statusLine observation は、概念上:
status = "not_applicable"として明示し、それ単独を aggregate
RuntimeSmokeOrchestrationResult.status == "fail"の violation にしない設計を第一候補としてください。ただし、
collect_statusline_evidence()自体の applicable な経路におけるexecutedexecuted_degeneratefailedの fail-closed semantics は弱めないでください。
特に
executed_degenerateを単純に PASS へ読み替える設計は禁止です。「completed structured run では collector verdict を aggregate 必須条件にしないこと」と、
「degenerate evidence を成功扱いすること」を混同しないでください。
5. Preserve aggregate fail-closed behavior
statusLine が
not_applicableでも、が存在する場合は aggregate
result.statusが必ずfailのままになる AC を明記してください。6. Remove #2745 workaround
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyに残っている既知 timing limitation の特例を #2747 の implementation scope に含めてください。#2747 実装後には、statusLine timing violation だけを特別許容する条件を撤去し、live structured runtime-smoke の aggregate result を通常の条件で検証できる contract にしてください。
実装時の期待形は概念上、
assert result.status == "pass"へ戻せることです。
これは今回の refinement ではコード変更せず、Issue の Allowed Paths / AC / VC に正しく反映してください。
Acceptance Criteria refinement target
anchor comment の提案を起点として、少なくとも次の意味を検証可能な AC にしてください。
AC1:
completed structured runtime-smoke では post-session statusLine observation が not-applicable と明示され、それ単独で aggregate result.status を fail にしない。
AC2:
statusLine evidence が applicable な経路における
executed/executed_degenerate/failedの既存 fail-closed semantics を変更しない。AC3:
runner failure、canonical-delta failure、その他 applicable scenario failure がある場合、statusLine が not-applicable でも aggregate status は fail のままである。
AC4:
PR #2745 由来の live-shadow-isolation test の既知 timing limitation 特例を撤去し、live structured run で aggregate
result.status == "pass"を検証できる。必要なら codebase investigation の結果に基づいて AC を追加・分割して構いませんが、根拠のない新規機能領域へ scope expansion しないでください。
Verification Commands
current repository layout に合わせて Verification Commands を修正してください。
最低限の候補:
uv run pytest tests/task-context/test_runtime_smoke_verifier.py -vuv run pytest tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py -vuv run pytest tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -vただし exact VC は current tests と refined AC を照合した上で決定してください。
live test を通常 CI の無条件必須にする必要はありません。
real Claude lifecycle に依存する検証については、Issue の Runtime Verification Applicability を明確化し、implementation PR で bounded live canary を少なくとも1回実施して証跡を残す方式を検討してください。
SKIP を PASS と同一視しない current runtime-verification policy は維持してください。
External research
web research routing が applicable なら実行してください。
特に current Claude Code official documentation で以下を確認してください。
--max-turnsの意味ブログ等より公式 Claude Code docs を優先してください。
external evidence は Issue の設計判断に必要な範囲だけ使用し、外部仕様を過剰に contract 化しないでください。
Trusted-human recovery / scope changes
anchor comment が意味論的には path expansion を要求しているが exact repository-relative path が不足している場合、すぐ人間へ質問しないでください。
issue-refinement-loopの current trusted-human handling / #2086 recovery route に従い、read-onlycodebase-investigatorSubAgent を使って current main から exact path を導出してください。導出後は canonical classifier / contract update consumer に戻してください。
contract_update.run.with_human_contextがNEXT_ACTION: issue_editor_requiredを返した場合も、人間確認を要求せず、skill の既存issue-editorcontrolled rewrite route へ進んでください。人間に手書き
ANCHOR_SCOPE_REFRAME_V1を再入力させないでください。Review loop
Issue 本文の mutation 後は必ず:
を current skill の順序で実施してください。
review が
needs-fixの場合、max iteration 未到達なら issue-editor へ戻し、自動で再度 review してください。SubAgent の完了を待たずに review を開始しないでください。
stale artifact、body hash mismatch、binding mismatch を無視して approval に進まないでください。
Stop policy
通常の承認確認では停止しないでください。
canonical skill に既存の automatic recovery / deterministic repair / bounded retry / trusted-human-context recovery が存在する場合は、それらを先に全て使用してください。
それでも canonical planner/router が以下を terminal と判定した場合のみ停止してください。
human_judgment_requiredその場合は勝手に approve へ読み替えず、blocker、実行済み recovery、残った判断点を具体的に termination report に残してください。
Completion boundary
今回のタスクは Issue #2747 の refinement 完了まで です。
refinement が approve されたら、current skill が要求する termination report /
LOOP_HANDOFF_RESULT_V1等の handoff bookkeeping を完了してください。ただし、このプロンプトでは #2747 の実装コード変更、PR 作成、merge は開始しないでください。
canonical root transition が downstream implementation を示す場合も、refinement の approved handoff 状態を報告したところで本タスクを終了し、implementation mutation には入らないでください。
Final response
終了時は簡潔に以下を報告してください。
この形なら、対象コメントを単なる「参考意見」ではなく trusted anchor として contract rewrite に使わせつつ、通常の確認待ちを排除できます。特に
with_human_context → contract update / issue-editor → fresh reviewの canonical route を明記した点が重要です。[-]実装: orchestrate_runtime_smoke() が単一ターン structured lane でも statusline evidence 判定を意味あるものにする[/-][+]実装: orchestrate_runtime_smoke() の completed structured runtime-smoke で post-session statusLine observation を not_applicable として扱う[/+]squne121 commentedon Sep 25, 2026
Issue Refinement Loop — 終了報告
verdict: approved(deterministic checker: APPROVE, semantic design review: 2周実施しblocker/high finding解消、残存は non-blocking low severity 1件)
iteration count: deterministic review 4回実行(1回目 needs-fix: VC test path exit5、2回目 needs-fix: baseline VC preflight regression-gate 誤分類、3回目 approve、semantic finding反映後の4回目 approve)。semantic design review 2周(1周目 high severity finding 1件 → fix_delta → 2周目 low severity finding 1件のみ、rewrite対象外)。
Anchor / trusted human context: OWNER trusted anchor #2747 (comment) を
preflight.run.with_human_context/contract_update.run.with_human_context経由で処理。この anchor は複数の指摘(F1〜F6)と concept-level directive を含む freeform review であり、classify_scope_delta_authority()はexpands_allowed_pathsboundary でroute.action: human_escalation(mixed extracted_directives により_has_explicit_exact_allowed_path_expansion()が不成立)と判定した。investigation_derived_path_literals経路(#2086 AC3)は当該コメントに既存の正規 path literal が含まれるため適用対象外と判断し、full-rewrite lane(issue-editor経由の全面書き換え)へ進んだ。Contract Delta(主な変更点)
scripts/task-context/tests/を実在するtests/task-context/test_runtime_smoke_verifier.py/test_runtime_smoke_verifier_canonical_carrier_regression.py/test_runtime_smoke_verifier_live_shadow_isolation.pyへ修正。--max-turnsをヒューリスティックに使わない AC5 を追加。invoke_generic_runner()をPopen化する等の設計を Out of Scope / Stop Conditions に明記。not_applicableとしていたが、semantic design review(high severity finding)でcollect_statusline_evidence()が返しうる"failed"/"skipped"まで丸め込みうる曖昧さを指摘され、"executed_degenerate"の場合に限定するよう Outcome/In Scope/AC1/AC2/AC6 を改訂。_KNOWN_STATUSLINE_TIMING_LIMITATION特例撤去を Allowed Paths / AC4 に追加。-m claude_live(pyproject.toml の marker gating)と# baseline-expect: deferredannotation を追加し、deterministic checker の regression-gate 誤分類を解消。Verification / Readiness / Review 最終結果
contract_readiness_check.py --mode execute:status: goguard-issue-body.py --issue-kind implementation:all_passed: truerun_root_review_pipeline.py produce):VERDICT: approve,BLOCKERS: 0issue-design-reviewer, 2周): 最終effective_verdict: approve(残存 finding は non-blocking low severity 1件、route_high_open_to_rewritepolicy 上 rewrite 対象外)dependency_materializer.py gate:decision: proceed,reason: no_hard_dependencies_confirmed_this_cycle(本 Issue に対する native predecessor 関係の確定なし)SubAgent 実行
codebase-investigator(read-only 事前調査、1回、完了待機済み)issue-editor(本文 rewrite/fix_delta、計4回、いずれも完了待機済み。edit_issue_txn.pycontrolled executor 経由、rawgh issue edit不使用)issue-design-reviewer(semantic design review、2回、いずれも完了待機済み)web-researcherは今回起動不要と判断(anchor comment 自体が公式ドキュメントの該当箇所を引用しており、repository evidence(実コード確認)で独立に検証可能だったため)Human Escalation
なし(genuine
human_judgment_requiredは発生していない)。Implementation-Ready 状態について
deterministic review / semantic design review はいずれも approve 済みであり、本 Issue の contract 自体は改善済み・安定した状態にある。
ただし、本タスクの Completion Boundary により、
issue-contract-review(実装着手直前の decision gate)およびimpl-review-loopへの handoff(root_entry_router.py経由のrun_root_transition())は意図的に実行していない。したがってLOOP_HANDOFF_RESULT_V1marker(status: impl_ready等)は本レポートでは発行しない。実装着手が必要な場合は、別途issue-contract-reviewの実行から開始すること。実装コード変更・PR 作成・merge は一切開始していない。
squne121 commentedon Sep 25, 2026
implement-issue: 実装完了 (2026-09-25T05:35:00Z)
.claude/worktrees/issue-2747-statusline-not-applicableworktree-issue-2747-statusline-not-applicable実装内容
scripts/task-context/task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke():collect_statusline_evidence()が"executed_degenerate"を返した場合に限りnot_applicable(underlying_status/rendered等を保持)として再解釈し、単独では aggregateresult.statusを"fail"にしないよう変更。"failed"/"skipped"は引き続き violations に含め fail のまま(丸め込みなし)。collect_statusline_evidence()自体の leaf 判定ロジックは無変更。tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py: PR 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 由来の_KNOWN_STATUSLINE_TIMING_LIMITATION特例を撤去し、通常のresult.status == "pass"を oracle とする形に書き換え(AC4)。tests/task-context/test_runtime_smoke_verifier.py: 回帰テストを追加(executed_degenerate→not_applicableかつ aggregate not fail、failed/skipped→ 引き続き fail、executed→ 既存 semantics 不変、runner failure が not_applicable にマスクされないこと の4系統)。Verification Commands 実行結果
→ マッチなし(既存記述以外の新規ターン数依存ロジックを追加していないことを確認。AC5)。
→ 42 passed(新規5テストを含む)。
→ 4 passed(AC7: 既存テスト全件 PASS 維持)。
live canary(deferred verification)の実行結果
実 claude CLI 環境(
claude 2.1.282、.claude/worktrees/issue-2747-statusline-not-applicableworktree 内、canonical repository root からは generic runner の root-checkout guard により実行不可のため worktree 内で実行)で以下を実行:→ 1 passed(
result.status == "pass"、result.violations == []、_KNOWN_STATUSLINE_TIMING_LIMITATION特例なしで PASS)。Issue #2747 のdeferred_verification_conditionを満たした。証跡ログは worktree localartifacts/runtime-verification-AC2-20260925T053257Z.log(.gitignore対象のためリポジトリには含めていない)。後続
squne121 commentedon Sep 25, 2026
Contract Reconciliation Request(PR #2749 OWNER レビュー由来)
PR #2749 の OWNER レビューコメント(https://github.com/squne121/loop-protocol/pull/2749#issuecomment-5827999244)を root/main thread が調査・正規化した technical recommendation です。raw comment 本文の直接転記ではなく、live Issue / PR diff / repository 実装と照合した上での要約です。
検出された contract conflict
現行 AC1 / AC6 は「
collect_statusline_evidence()が\"executed_degenerate\"を返した場合は(Unbound/Degraded/空文字の区別なく)一律not_applicableとし、単独では aggregate を\"fail\"にしない」と定めています。一方 OWNER 指摘(P1-1)は、
.claude/hooks/task_context/statusline.pyの実装上Degradedは genuine な DB/query/transport failure を表しうる(Degradedを print して exit 0 する設計)ため、executed_degenerateを一律not_applicableにすると本物の障害を PASS へ丸め込んでしまう、という点を指摘しています。これは現行 AC1/AC6 の文言(
executed_degenerateという leaf 戻り値だけを判定材料にする)と直接矛盾します。推奨される契約修正(最小限)
OWNER 自身が「最低限の fix」として提示した方式を採用する:
orchestrate_runtime_smoke()側のnot_applicable判定条件を、collect_statusline_evidence()が\"executed_degenerate\"を返し、かつ その根拠となる raw statusLine render が\"Unbound\"の場合に限定する。\"Degraded\"および空文字 (\"\") の raw render は、executed_degenerateに分類されていてもnot_applicableへ昇格させず、引き続きviolationsに含め aggregatestatusを\"fail\"のままにする。collect_statusline_evidence()自体(leaf 関数)のexecuted/executed_degenerate/failed/skipped判定ロジック・_DEGENERATE_STATUSLINE_RENDERSの集合自体は変更しない(AC2 / Stop Conditions の制約を維持)。orchestrate_runtime_smoke()側で raw render 値(renderedフィールド)を追加参照し、not_applicableへの昇格可否をさらに絞り込む。因果説明の修正(P1-2)
現行 Issue の「SessionEnd 相当のライフサイクルを終えた状態のため Binding が SUSPENDED になり非退化レンダリングを得られない」という説明は、Task Context 実装(
on_session_start()は SessionEnd でcurrent_claude_session_idをクリアせずruntime_healthのみ SUSPENDED にする設計)と整合しません。より正確な、より弱い因果説明に置き換える必要があります:「structured non-interactive run(
claude -p)完了後に行う out-of-band statusLine probe は、interactive UI lifecycle 中の live statusLine verification と等価ではない(seed Binding に claude_session_id が無いため実 SessionStart が新規 Binding を作り、そのため task_id=None のまま Unbound を観測している可能性が高い)」--max-turnsを実行ターン数の識別子として扱わない、という既存 AC5 の方針は変更不要(OWNER も妥当と認めている)。スコープ境界
invoke_generic_runner()のsubprocess.run()→Popen化、stdout streaming、statusLine polling、並行 observer、generic runner protocol 拡張は引き続き Out of Scope のまま維持する(Owner 推奨、Stop Conditions 既存方針と一致)。scripts/task-context/task_context_runtime_smoke_verifier.pyのorchestrate_runtime_smoke()内の判定ロジックと、対応するtests/task-context/test_runtime_smoke_verifier.pyの回帰テストのみで完結する)。以上を Issue #2747 の Outcome / In Scope / AC1 / AC6 / Notes for Reviewer に反映することを推奨します。
fix: executed_degenerate の not_applicable 再解釈を rendered=="Unbound" に限定する
squne121 commentedon Sep 25, 2026
impl-review-loop: 完了 (2026-09-25T00:00:00Z)
PR #2749 を current head
9ce36ee8a28227fac9035b402489321e88695adaでimpl-review-loopに再投入し、stale-head evidence を解消した。9ce36ee8a28227fac9035b402489321e88695ada(live PR head と一致、drift なし)current-head 独立検証(test-runner)
9ce36ee8a28227fac9035b402489321e88695adaで一致rg -n "max_turns" scripts/task-context/task_context_runtime_smoke_verifier.py→ no match (exit 1, AC5 期待どおり PASS)uv run pytest tests/task-context/test_runtime_smoke_verifier.py -v→ 44 passed (AC1/AC2/AC3/AC6)uv run pytest tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py -v→ 4 passed (AC7)uv run pytest tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -v -m claude_live→ 1 passed(実 claude CLI 環境で genuinely 実行、SKIP ではない。AC4 deferred_verification_condition 充足)current-head 独立 PR レビュー(pr-reviewer)
9ce36ee8a28227fac9035b402489321e88695ada/ blockers: []rendered=="Unbound"のみ not_applicable、"Degraded"/""/"failed"/"skipped"は引き続き fail 扱い)IMPLEMENTATION_SCOPE_COVERAGE_V1.pr_head_shaが旧 head5457a88a...のまま stale。hygiene blocker ではないため本ループでは body-only 更新を実施していない(次回本文更新時の是正を推奨)live mergeability
fix: 完了済み structured runtime-smoke の post-session statusLine を not_ap…