Skip to content

実装: #1939 Workstream 2 — completion transaction and reconciliation(stop reason taxonomy / runtime lane識別) #2489

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1939"
goal_ref: >-
  #1939 Workstream 2(completion transaction and reconciliation)を、Claude Code /
  Claude-GPT の agent run terminal observation(runtime_lane / completion_outcome /
  completion_source)を agent_session_manifest/v1 の最小拡張として materialize し、
  idempotent completion transaction と provider telemetry unavailable coverage を
  確立する。Codex CLI は新規 hook infrastructure を追加せず、既存経路で取得できない
  path を unavailable として coverage に残す。
change_kind: workflow
dedupe_key: "1939:workstream-2:completion-transaction-and-reconciliation:v1"

human_context_comment

Parent Issue

#1939

Parent Goal Ref

Background / Problem

2026-08-28〜09-03のClaude-GPT / Native Claude Code retrospective調査(本Issue起票元セッション)で、以下が判明した:

  • agent_run_report/v1 の実インスタンス(GitHub Issue/PRコメントとして投稿されたもの)が、2026-08-28〜09-03の期間内コメント全文検索で0件だった
  • docs/schemas/agent-session-manifest.schema.json(agent_session_manifest/v1)は human_intervention.{required, type, summary} と phase.main_loop を持つが、「セッションが最後まで完走したか・どう止まったか」「どの runtime lane で実行されたか」を表現する専用フィールドを持たない
  • 結果として、「raw terminal completion rate」「native vs Claude-GPT の completion率」「completion artifact 欠落率」等の指標を、既存証跡から厳密に算出することができなかった

この構造的ギャップは #1939 Workstream 2(AC4-AC6、上記引用)が射程に入れている内容だが、Workstream 2はparent #1939の「Child Issues」セクションに未起票のまま記載されており、現時点でこのAC群を所有する子Issueが存在しなかった。

Owner 敵対的レビュー(human_context_comment)による指摘と本改訂での対応:

  1. 観測不能な stop_reason enum の要求(P0): 現在 .claude/settings.json が session manifest producer に接続しているのは Stop / SubagentStop / PostToolUse のみで、StopFailure は未登録。加えて Claude Code の Stop は user interrupt では発火しない(Claude Code hooks reference)。したがって interrupt / timeout / permission_interruption / human_clarification_request を1本の enum に含め、producer に「実際に値を埋める」ことを要求する設計は、観測できていない事象を推測させる false data 生成の危険がある。
    → 本改訂では stop_reason という単一 enum を廃止し、runtime_lane / completion_outcome / completion_source の3フィールドへ reframe する。unavailable / unknown を正規値として認め、未観測を推測しない。permission_interruption や human_clarification_request は既存 human_intervention オブジェクト側の責務とし、terminal taxonomy には含めない。retry も terminal reason ではなく transition/action として扱い、taxonomy に含めない。

    さらなる訂正(PR #2496上のOWNER敵対的レビュー feat: agent_session_manifest/v1 に runtime_lane/completion_outcome/completion_source を追加 (#2489) #2496 (comment) 、ブリッジコメント 実装: #1939 Workstream 2 — completion transaction and reconciliation(stop reason taxonomy / runtime lane識別) #2489 (comment) 、P0): Stop/StopFailure は Claude Code upstream仕様(hooks reference)上 turn-level event であり、SessionEnd が session-level event である。root completion_outcome/completion_source(session/run completionを表すフィールドとしてschemaに定義済み)を Stop/StopFailure から直接設定する設計は、観測していないsession/run completionをturn観測から推測することになり、意味論的に誤りだった。本Issueはこれを反映し、completion_outcome/completion_source を Stop/StopFailure からは設定しない(hook_event.event_type への StopFailure 追加と optional error_type フィールドのみをturn-level evidenceとして保持する)ようscopeを再修正する。root completion値は、scripts/generate-session-manifest.mjs が --completion-outcome/--completion-source CLI引数を受け取った場合にその値をそのまま書き込むCLI引数プラミングとしてのみ本Issueで用意し、launcher process exit時に実際にこれらの引数を渡す具体的呼び出し元(launcher本体)の新規配線は本Issueのスコープに含めない(別Issueに委ねる)。なお既存の tests/agent-logs/runtime-verification/test_hook_stop_failure_wiring.py は本改訂前の誤った意味論(Stop/StopFailureからcompletion_outcome/completion_sourceを設定する前提)で実装・CI PASS済みであり、実装側もこのIssue改訂に追従して再修正が必要になる(実装修正自体は本rewriteの作業ではなく、後続のimpl-review-loop fix_deltaの責務)。

  2. Codex CLI coverage の欠落(P0): 変更対象ファイルが Claude Code launcher 内の native/Claude-GPT 2 laneのみを区別しており、導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 Workstream 2 が要求する Codex CLI adapter 差が扱われていなかった。
    → 本改訂では runtime_lane enum に codex_cli を含め schema レベルの coverage を維持しつつ、Codex CLI 向けの新規 hook infrastructure はこの Issue のスコープに含めない(.codex/hooks.json は現時点でリポジトリに存在しない)。既存観測経路から Codex CLI の terminal evidence が取得できないため、producer 側の Codex CLI wiring は unavailable のまま coverage に残し、将来の別 Issue に委ねる。

  3. runtime_lane の provenance 未定義(P1): producer が actor.name 等から runtime lane を推測する設計は fragile。
    → 本改訂では launcher が明示的に渡す provenance のみを使う。具体的には .claude/hooks/generate_session_manifest_from_hook.mjs が既存の launcher-set 環境変数 CLAUDE_GPT_CLAUDE_BIN(調査: structured causal-evidence smoke の markerless FAIL を --no-session-persistence 契約と照合する #2338 で既に claude-gpt pin 識別に使われている既存の explicit provenance signal)の有無だけで claude_gpt / native_claude_code を判定し、producer 自身(scripts/generate-session-manifest.mjs)は --runtime-lane CLI 引数の値をそのまま受け取るだけで、名前や transcript からの推測は一切行わない。値を取得できない呼び出し元は unknown を渡す。

  4. completion transaction の owner が曖昧(P1): scripts/agent-logs/finalize-agent-run.mjs は実際には report JSON の生成・atomic write のみを行い、GitHub posting は行わない(scripts/agent-logs/post-agent-run-report.mjs の責務)。retro index upsert は scripts/agent-logs/update-retro-index.mjs、context marker upsert は scripts/agent-logs/lib/chatgpt-retro-context-marker-helper.mjs が担う。
    → 本改訂では finalize-agent-run.mjs へ transaction を寄せない。既存3つの exported 関数(postAgentRunReport / updateRetroIndex / upsertChatgptRetroContextComment)を順番に呼び出すだけの薄い coordinator(新規ファイル1つ)を追加し、各 operation の結果を created|updated|unchanged|failed 程度で返す。DB・transaction log・2-phase commit は追加しない。途中失敗時は既存 operation の idempotency を利用し、同じ completion command を再実行して convergence させる。

  5. AC3(partial success recovery)が「既存テストで確認」で完結してしまう(P1): 具体的な決定論的検証ケースを AC に明記する(後述 AC5 参照)。

  6. provider telemetry unavailable は既存実装でかなりカバー済み(P2): docs/schemas/agent-run-report.schema.json の observation_sources[].safety.reason_codes に既に source_unavailable があり、tests/agent-logs/observation-source-adapter.test.ts 等で unavailable ケースがテストされている。新しい fallback system は追加しない。既存 adapter が unavailable でも validation/finalization できることを focused test で確認する。

なお、duplicate-comment-prevention / upsert機構自体はゼロから作る必要はない。scripts/agent-logs/lib/chatgpt-retro-context-marker-helper.mjs の upsertChatgptRetroContextComment/findMalformedMarkerIntentComment/blocked_duplicate、および scripts/agent-logs/update-retro-index.mjs の updateRetroIndex、scripts/agent-logs/post-agent-run-report.mjs の postAgentRunReport 等、既存のupsert/duplicate検出インフラを最大限再利用し、再実装しない。

Current Validated Scope

  • docs/schemas/agent-session-manifest.schema.json に、以下3つの optional フィールドを追加する(既存 manifest との backward compatibility のため root required には含めない。producer は新規生成 manifest に対して常にこれらを埋める):
    • runtime_lane: closed enum native_claude_code | claude_gpt | codex_cli | unknown
    • completion_outcome: closed enum completed | failed | interrupted | incomplete | unavailable(session/run-levelのcompletionを表す。turn-level event である Stop/StopFailure hookからは設定しない)
    • completion_source: closed enum hook | launcher | reconciliation | unavailable(completion_outcome の値がどの経路から得られたかを示す。hook 値はturn-level hookからの推測ではなく、launcher/reconciliation側がturn-level evidenceを集約した上で明示的に設定する場合にのみ使う)
  • 既存 hook_event.event_type enum(optional object)に StopFailure を追加する(新規フィールドではなく既存フィールドの拡張)。hook_event はturn-level evidenceを保存するオブジェクトであり、ここへの追加はroot completion_outcome/completion_source の設定を意味しない。SessionEnd は Claude Code の reason enum が run-level crash taxonomy として粒度不足のため、本 Issue のスコープでは追加しない。
  • 既存 hook_event オブジェクトへ、StopFailure 発火時のupstream structured error taxonomy(rate_limit | overloaded | authentication_failed | billing_error | invalid_request | model_not_found | server_error | max_output_tokens | unknown)を保存するoptional error_type フィールドを追加する(turn-level evidenceの粒度向上。root completionフィールドとは独立)。
  • .claude/settings.json の Stop hooks 配列に、既存スクリプト session_manifest_coordinator.sh を再利用したまま StopFailure イベントを追加登録する(新規 hook script は作らない。既存スクリプトを追加イベントへ接続するだけ)。この追加登録が実際に埋めるのは hook_event.event_type(と error_type)のturn-level evidenceのみであり、root completion_outcome/completion_source はこの経路からは埋めない。
  • schemaへのフィールド追加だけでなく、実際に値を埋めるproducer側を最小変更する:
    • scripts/generate-session-manifest.mjs に --runtime-lane CLI引数を追加し、.claude/hooks/generate_session_manifest_from_hook.mjs がイベント種別と CLAUDE_GPT_CLAUDE_BIN 環境変数からこの値を導出してproducerへ渡す(既存方針を維持)。
    • scripts/generate-session-manifest.mjs は --completion-outcome / --completion-source CLI引数を受け取った場合、その値をそのまま(推測を挟まず)manifestへ書き込む。hook wrapper(.claude/hooks/generate_session_manifest_from_hook.mjs、turn-level)はこれらの引数を一切渡さない(root completion値がhookから設定されないことを保証する)。CLI引数受け取り→manifest書き込みのプラミングは本Issueで実装するが、launcher process exit時に実際にこれらのCLI引数を渡す具体的呼び出し元(launcher本体)の新規配線は本Issueのスコープに含めない。値を埋める実際のトリガー配線は将来の別Issueに委ねる。
    • hook wrapperは hook_event.event_type(Stop/StopFailure 等)とoptional error_type をproducerへ渡す。
      (schema定義のみでproducerが値を出力しない状態でAC1/AC2を満たしたことにしない)
  • agent_run_report/v1 / agent_retro_index/v1 / CHATGPT_RETRO_CONTEXT_V1 の生成・投稿を idempotent completion transaction として扱えるよう、既存3 upsert(postAgentRunReport / updateRetroIndex / upsertChatgptRetroContextComment)を順に呼び出す薄い coordinator(新規ファイル scripts/agent-logs/complete-agent-run.mjs 1つ)を追加し、package.json に agent-run:complete script entry を追加する。3番目のupsertへ渡すcontext payloadは1・2の実際の戻り値(comment_url・digest類)から構築し、事前生成済みMarkdownファイルの内容をそのまま渡さない(PR #2496上のOWNER敵対的レビュー feat: agent_session_manifest/v1 に runtime_lane/completion_outcome/completion_source を追加 (#2489) #2496 (comment) P0-2参照)。partial success recoveryとduplicate comment preventionを決定論的 test で検証する(AC5相当)
  • provider telemetry(Latitude等)がunavailableな場合でも、public-safe completion artifactまたは明示的unavailable coverageを残す既存ロジック(agent-run-report.schema.json の observation_sources[].safety.reason_codes 等)が provider trace absence を completion failure の gate にしていないことを focused test で確認する(AC6相当。新規 fallback 実装は行わない)

Remaining Parent Gaps

本Issue(#1939 Workstream 2)が閉じない #1939 の残課題:

  • Workstream 1(daily workset contract/result schema)— 未起票(別Child Issue)
  • Workstream 3(repository-level ChatGPT discovery entrypoint)— 未起票(別Child Issue、Workstream 1 に依存)
  • Workstream 4(follow-up Issue candidate materialization handoff)— 未起票(別Child Issue)
  • Workstream 5(opaque public evidence/private local audit resolver)— 未起票(別Child Issue、Workstream 2 に依存)
  • Codex CLI 向けの completion transaction producer wiring — 本Issueでは runtime_lane: codex_cli の schema enum coverage のみ提供し、実際の値充填(Codex CLI producer wiring)は別Issueへ委ねる(human_context_comment P0-2)
  • launcher process exit時に --completion-outcome/--completion-source CLI引数を実際に渡す具体的呼び出し元(launcher本体)の新規配線 — 本Issueでは scripts/generate-session-manifest.mjs のCLI引数受け取り→manifest書き込みのプラミングのみ提供し、実際の値充填トリガー(launcher呼び出し元)の新規実装は別Issueへ委ねる(semantic design review P0対応)

Outcome

agent_session_manifest/v1 に runtime_lane / completion_outcome / completion_source フィールドが追加され、runtime_lane フィールドおよび hook_event.event_type(StopFailure 追加分)/ error_type は Claude Code の Stop / StopFailure イベント(turn-level hook-provenance)から実際に値が埋まり、一方で completion_outcome / completion_source は Stop / StopFailure 等のturn-level hookからは設定されず、scripts/generate-session-manifest.mjs が --completion-outcome/--completion-source CLI引数を受け取った場合にその値をそのまま書き込むCLI引数プラミングが実装され(launcher process exit時に実際にこれらの引数を渡す具体的呼び出し元の新規配線は別Issueに委ねる)、新規の薄い coordinator(scripts/agent-logs/complete-agent-run.mjs)が run report / retro index / context marker の3 artifactをidempotentに生成・投稿でき、partial success recoveryとduplicate comment preventionが決定論的testで証明されており、pnpm typecheck && pnpm lint && pnpm test && pnpm build が全てPASSしている状態。

In Scope

  • docs/schemas/agent-session-manifest.schema.json への runtime_lane / completion_outcome / completion_source 追加と hook_event.event_type enum への StopFailure 追加
  • scripts/generate-session-manifest.mjs への --runtime-lane / --completion-outcome / --completion-source CLI引数追加
  • .claude/hooks/generate_session_manifest_from_hook.mjs の CLAUDE_GPT_CLAUDE_BIN 環境変数・イベント種別からのvalue導出
  • .claude/settings.json への StopFailure イベント登録(既存 session_manifest_coordinator.sh 再利用)
  • scripts/agent-logs/complete-agent-run.mjs(新規の薄い completion transaction coordinator)と package.json の agent-run:complete script entry
  • 上記に対応する tests/agent-logs/ 配下の focused test(動作検証 VC を含む)

Out of Scope

  • Workstream 1(daily workset contract/result schema)、Workstream 3(repository-level ChatGPT discovery entrypoint)、Workstream 4(follow-up Issue candidate materialization handoff)、Workstream 5(opaque public evidence/private local audit resolver)は本Issueでは扱わない(#1939の別Child Issueとして分離)。
  • Codex CLI 向けの新規 hook infrastructure(.codex/hooks.json の新設、Codex CLI producer wiring)は本Issueのスコープに含めない。 runtime_lane enum に codex_cli を schema レベルで含めるに留め、実際の値の充填は将来の別 Issue に委ねる(human_context_comment P0-2 対応)。
  • launcher process exit時に --completion-outcome/--completion-source CLI引数を実際に渡す具体的呼び出し元(launcher本体)の新規配線は本Issueのスコープに含めない。 本Issueが実装するのは scripts/generate-session-manifest.mjs 側のCLI引数受け取り→manifest書き込みのプラミングのみであり、値を実際に埋める起動トリガーの新規実装は将来の別Issueに委ねる(semantic design review 対応)。
  • SessionEnd hook の新規登録、および SessionEnd の reason を completion taxonomy へマッピングする設計は行わない(reason enum が粗く false precision を生むため)。
  • permission_interruption / human_clarification_request を terminal taxonomy の enum 値として追加しない(既存 human_intervention オブジェクト側の責務とする)。
  • Latitude/EntireCLIのraw trace内容そのものを公開artifactへ含めることは行わない(既存のpublic-safe boundaryを維持)。
  • 新しいpermission broker、新しいenforcing hook、新しいledger/digest checkerの追加は行わない(#1860の既存owner decisionと衝突するため)。
  • stop_reasonから自動的にfollow-up Issue起票やdeterministic remediationへ誘導する自動化(導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 Workstream 4の範囲)は本Issueでは扱わない。
  • scripts/agent-logs/finalize-agent-run.mjs へ completion transaction の責務を寄せることは行わない(既存の責務分離を維持する。human_context_comment P1-3)。
  • completion_outcome / completion_source を Stop / StopFailure 等のturn-level hookから直接設定する設計(root-levelのsession/run completionとしては使わない。turn観測からsession/run completionを推測しない。PR feat: agent_session_manifest/v1 に runtime_lane/completion_outcome/completion_source を追加 (#2489) #2496 feat: agent_session_manifest/v1 に runtime_lane/completion_outcome/completion_source を追加 (#2489) #2496 (comment) P0参照)。
  • --chatgpt-payload-markdown-file から読み込んだ事前生成済み Markdown をそのまま upsertChatgptRetroContextComment へ渡す設計(既存digest-chain resolverとの整合を壊すため。同レビューP0-2参照)。

Acceptance Criteria

  • AC1(導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 AC4相当): agent_session_manifest/v1 に runtime_lane(native_claude_code | claude_gpt | codex_cli | unknown)フィールドが追加され、schema validatorがこれを検証し、かつ .claude/hooks/generate_session_manifest_from_hook.mjs が既存の launcher-set 環境変数 CLAUDE_GPT_CLAUDE_BIN の有無だけから(actor.name や transcript からの推測ではなく)値を導出して scripts/generate-session-manifest.mjs へ渡し、実際にこの値が埋まることを既存test配置(tests/agent-logs/)に準じたfocused testで確認する
  • AC2(導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 AC4相当): agent_session_manifest/v1 の completion_outcome(completed | failed | interrupted | incomplete | unavailable)と completion_source(hook | launcher | reconciliation | unavailable)は session/run-level のcompletionを表すフィールドであり、turn-level event である Stop / StopFailure hookからは設定しない(Claude Code upstream仕様上 Stop/StopFailure はturn-level、SessionEndがsession-level。観測していないsession/run completionをturn観測から推測しない。PR #2496上のOWNER敵対的レビュー feat: agent_session_manifest/v1 に runtime_lane/completion_outcome/completion_source を追加 (#2489) #2496 (comment) 、ブリッジコメント 実装: #1939 Workstream 2 — completion transaction and reconciliation(stop reason taxonomy / runtime lane識別) #2489 (comment) 対応)。.claude/settings.json へ StopFailure イベント(既存 session_manifest_coordinator.sh を再利用)を追加登録し、既存 hook_event.event_type enumへの StopFailure 追加が turn-level evidence として実際に記録されることを、.claude/hooks/generate_session_manifest_from_hook.mjs を実プロセスとして起動する動作検証で確認する 。この動作検証は、Stop / StopFailure いずれの起動でも root completion_outcome / completion_source が producer によって設定されない(hook_event 配下にのみturn-level evidenceが記録される)ことを固定条件として含む。加えて、StopFailure 発火時にupstream structured error taxonomy(rate_limit / overloaded / authentication_failed / billing_error / invalid_request / model_not_found / server_error / max_output_tokens / unknown 等)を hook_event 配下のoptional error_type フィールドとして保存できることを同じ動作検証で確認する(判定困難な場合は unknown にfallbackしてよいが、値の有無自体は必ず記録する)。scripts/generate-session-manifest.mjs が --completion-outcome/--completion-source CLI引数を受け取った場合はその値をそのまま(推測を挟まず)manifestへ書き込むこと、および hook wrapper(.claude/hooks/generate_session_manifest_from_hook.mjs)経由ではこれらのCLI引数が一切渡されない(root completion_outcome/completion_source がhookから設定されない)ことをコードレベルで確認する。launcher process exit時に実際にこれらのCLI引数を渡す具体的呼び出し元(launcher本体)の新規配線は本Issueのスコープに含めない。CI required checks のうち少なくとも1レーンで、この動作検証testが実際にプロセスを起動して PASS すること(ローカル自己申告のみ・SKIP-onlyでの充足は認めない)を確認する
  • AC3(導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 AC4相当): Codex CLI については本Issueで新規 hook infrastructure を追加せず、runtime_lane: codex_cli が schema enumとして存在し、既存観測経路から値を取得できないケースが unavailable として coverage に残ることをドキュメント(本Issue本文 Out of Scope)と schema test で確認する(Codex CLI producer wiring自体は本Issueのスコープ外)
  • AC4(導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 AC5相当): scripts/agent-logs/complete-agent-run.mjs(新規の薄い coordinator)が既存3 upsert(postAgentRunReport / updateRetroIndex / upsertChatgptRetroContextComment)を順番に呼び出し、各結果を created|updated|unchanged|failed として返すことを、以下4ケースの決定論的 focused test で証明する。upsertChatgptRetroContextComment へ渡すcontext payloadは postAgentRunReport / updateRetroIndex の実際の戻り値(comment_url・report digest・canonical_index_digest・source_comment_set_digest 等)から構築すること。事前生成済み Markdown ファイル(--chatgpt-payload-markdown-file 由来のcontent)をそのまま3番目のupsertへ渡してはならない(PR #2496上のOWNER敵対的レビュー feat: agent_session_manifest/v1 に runtime_lane/completion_outcome/completion_source を追加 (#2489) #2496 (comment) P0-2、ブリッジコメント 実装: #1939 Workstream 2 — completion transaction and reconciliation(stop reason taxonomy / runtime lane識別) #2489 (comment) が指摘した、既存 CHATGPT_RETRO_CONTEXT_V1 digest-chain resolver(PR #1251由来)に対するreference chain断絶の是正)。run reportまたはretro indexがfailed/blockedの場合、そのinvocationではcontext markerを作成せず、既存artifact status vocabulary(created|updated|unchanged|failed)の範囲内で reason_code: prerequisite_failed を伴う failed として表現する:
    1. 初回実行 → run report / retro index / context marker の3 artifactが作成され、3番目のcontext marker payloadが1・2の実際の戻り値(comment_url・digest類)から構築されていることを確認する
    2. 同一 run を再実行 → GitHub コメント数が増えない(noop/unchanged)
    3. run report 投稿成功後、retro index 投稿が失敗するケースをモックし、同じ coordinator command を再実行すると run report を重複させず、残り(retro index / context marker)が完成し、かつretryで生成されたcontext markerを既存resolverへ渡した結果、actual report/index referencesとactual digestsが一致したresolved状態まで到達することを確認する(comment数が増えないことの確認だけで完結させない)
    4. malformed/ambiguous marker が既に存在するケースで、既存 policy(findMalformedMarkerIntentComment 等)に従って deterministic に blocked/repair されることを確認する
  • AC5(導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 AC6相当): provider telemetry(Latitude等)がunavailableな場合でも、既存 observation-source-adapter が availability: unavailable を持つ report を生成・validation/finalization できることと、provider trace absence だけでは agent completion failure(gate)にならないことを、tests/agent-logs/配下の既存またはfocused testで確認する(新規 fallback system は追加しない)
  • AC6: 既存の pnpm typecheck && pnpm lint && pnpm test && pnpm build が全てPASSする

Verification Commands

# AC6
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
# AC1
$ pnpm test
# AC3
$ pnpm test
# AC4
$ pnpm test
# AC5
$ pnpm test
# AC2
$ uv run pytest tests/agent-logs/runtime-verification/test_hook_stop_failure_wiring.py

Runtime Verification Applicability

  • decision: immediate
  • reason: AC2 は .claude/settings.json(hook_configuration component、hook-lifecycle-matcher-or-handler-change risk-trigger)への StopFailure イベント追加登録を含み、docs/dev/extension-surface-runtime-policy.yaml の hook-lifecycle-matcher-or-handler-change ルールが default_decision: immediate を要求する。hook wrapper(.claude/hooks/generate_session_manifest_from_hook.mjs)を実プロセスとして起動し、synthetic Stop / StopFailure stdin JSON を与えて実際に manifest artifact が期待どおりの runtime_lane / hook_event.event_type(StopFailure 追加後の値)/ optional error_type で書き出されること、および root completion_outcome / completion_source がこのhook経路からは設定されない(推測されない)ことを、本Issueの実装範囲内でプロセス起動・I/Oを伴う動作検証として確認できるため、deferred ではなく immediate とする。
    applicable_acs: [AC2]
    execution_environment:
    cli_tools: [node]
    auth_required: false
    network_required: false
    skip_conditions:
    • "node 実行環境が無い場合は SKIP として exit 77"
      fallback_policy:
      fallback_success_is_pass: false
      notes: "fallback 経由の推測値(producer が埋めた値)を検出した場合は FAIL として扱い、PASS と判定しない"
      artifact_requirements:
    • "artifacts/runtime-verification-AC2-.log"
  • 動作検証 AC: AC2(<!-- runtime-verification: true --> タグ付与済み)
  • VC: tests/agent-logs/runtime-verification/test_hook_stop_failure_wiring.py(uv run pytest で実行する。実装者が新規実装する。正常系: Stop stdin JSON を与えて .claude/hooks/generate_session_manifest_from_hook.mjs を実プロセスとして起動し、hook_event.event_type: Stop の manifest artifact が書かれ、root completion_outcome / completion_source がこの起動では設定されない(キー自体が存在しないか unavailable/unknown である)ことを確認。異常系: StopFailure stdin JSON → hook_event.event_type: StopFailure とoptional error_type(upstream taxonomy値、または未判定時 unknown)が manifest に書かれ、同様にroot completion_outcome / completion_source がこのhook起動からは設定されないことを確認。加えて CLAUDE_GPT_CLAUDE_BIN 環境変数の有無で runtime_lane が claude_gpt / native_claude_code に切り替わることを確認。node 実行環境が無い場合は pytest.skip(...) で SKIP 相当(exit 77 に準じる非PASS扱い)とし、PASS と誤判定しない。fallback 経由の値(producer が推測で埋めた値)を検出した場合、またはhookからroot completion_outcome/completion_source が設定されてしまった場合は test failure(FAIL)とし、PASS と判定しない)
  • 証跡: test-runner が artifacts/runtime-verification-AC2-<timestamp>.log に本ポリシー第4節の必須フィールド(AC / Timestamp / Environment / Input / Output / Verdict)で書き出し、PR 本文の ## Runtime Verification Evidence セクションへ inline 引用する

Allowed Paths

  • docs/schemas/agent-session-manifest.schema.json(runtime_lane / completion_outcome / completion_source フィールド追加、hook_event.event_type enumへ StopFailure 追加、hook_event 配下へのoptional error_type フィールド追加。completion_outcome と completion_source のpair constraint(両方存在するか両方存在しないか、JSON Schema dependentRequired 相当)の明記を検討する)
  • docs/schemas/agent-session-manifest.md(companion doc。フィールド追加をここに反映する)
  • scripts/generate-session-manifest.mjs(producer本体、--runtime-lane / --completion-outcome / --completion-source CLI引数を追加し、CLI引数として受け取った値をそのままmanifestへ書き込む変更。--completion-outcome/--completion-source はhook wrapperからは渡されない設計とするが、launcher process exit時に実際にこれらの引数を渡す具体的呼び出し元(launcher本体)の新規配線は本Issueのスコープに含めない)
  • .claude/hooks/generate_session_manifest_from_hook.mjs(hook経由のproducer。イベント種別と CLAUDE_GPT_CLAUDE_BIN 環境変数から runtime_lane と hook_event.event_type/optional error_type を導出しproducerへ渡す。root completion_outcome/completion_source はこのhook wrapperからは渡さない)
  • .claude/settings.json(Stop hooks配列に既存 session_manifest_coordinator.sh を再利用したまま StopFailure イベント登録を追加する。新規 hook script は追加しない)
  • scripts/agent-logs/complete-agent-run.mjs(新規。既存3 upsertを順番に呼び出す薄い coordinator。3番目のupsertへ渡すcontext payloadは1・2の実際の戻り値から構築し、事前生成済みMarkdownファイルの内容をそのまま渡さない)
  • scripts/agent-logs/lib/chatgpt-retro-context-marker-helper.mjs(P0-2対応のため、既存 upsertChatgptRetroContextComment/findMalformedMarkerIntentComment/blocked_duplicate 等の再利用に加え、新規exported関数 buildChatgptRetroContextPayloadFromResults()(postAgentRunReport/updateRetroIndex の実際の戻り値からcontext payloadを構築する関数)の追加に限定する。既存 upsert 本体の再実装は行わない)
  • package.json(agent-run:complete script entry を追加)
  • docs/dev/agent-run-report.md(新規 coordinator command のresponsibility boundary記述を追加。既存の agent-run:finalize / agent-run:post / chatgpt-retro-context:post の責務境界説明は変更しない。--chatgpt-payload-markdown-file はfresh completionの必須入力から外す方向を優先し、互換性のため残す場合もtemplate/supplemental text程度に限定し、comment URLやdigestのauthorityを持たせない旨を記述する)
  • tests/agent-logs/(既存test配置。新規focused testをここに追加する)
  • tests/test_hook_boundaries_doc.py(.claude/settings.json ↔ docs drift 検出用の既存 SSOT 契約テスト。StopFailure handler追加に伴い、意図的な追加のみを許容するallowlist調整が必要になった場合に限り変更する。未申告のhandler追加を引き続き検出できる設計を維持すること)
  • docs/dev/hook-boundaries.md(tests/test_hook_boundaries_doc.py が参照する hook配線ドキュメント。StopFailure handler追加に対応するエントリを追加する場合のみ変更する)
  • .github/ci/python-test-plan.json(新規pytestファイル追加に伴うCI test-plan registration。新規追加した pytest ファイルのtarget登録が必要な場合のみ変更する。AC2動作検証testをnode-backed-hook-testsレーンへ移す場合は、同ファイルの deselect[] / secondary_coverage.dedicated_lanes へ既存パターン(pytest_session_recording_fixed_location_cutover 等)に倣って登録する)
  • .github/workflows/ci.yml(node-backed-hook-tests job のみ、既存の pytest_session_recording_fixed_location_cutover ステップと同じパターンで、AC2動作検証test(tests/agent-logs/runtime-verification/test_hook_stop_failure_wiring.py、実 node child processを起動するため python-test-core の Python-only invariant=Issue 実装: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する #1760 と衝突する)の nodeid を明示的に追加登録する場合のみ変更する。他のjob・他の変更は行わない。編集前に .claude/skills/ci-test-performance/SKILL.md を読むこと)

以下は実装時に必要性を評価するが、既存責務(読み取り専用参照・exported関数の再利用のみ)を超える変更が不要と判明した場合は変更しない:

  • scripts/agent-logs/finalize-agent-run.mjs(変更不要の想定。completion transactionの責務をここへ寄せない)
  • scripts/agent-logs/post-agent-run-report.mjs / scripts/agent-logs/update-retro-index.mjs(exported関数をcoordinatorから呼び出すのみで、gapが見つからない限り本体は変更しない)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • schema変更が既存の agent_run_report/v1 public-safe validatorとの整合を壊す場合は、実装を進めず設計を再検討する
  • #1860(minimal harnessへの縮退方針)のowner reviewと衝突する新規enforcing機構が必要と判明した場合は、実装を止めてscopeを見直す
  • Codex CLI producer wiringが本Issueのスコープに実質的に必要と判明した場合は、スコープを拡張せず別Issueへ分離する

Required Skills

なし

Required Design References

  • Issue 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939(parent、delivery-rollup)
  • human_context_comment(本Issueの敵対的レビュー、上記参照)
  • docs/dev/agent-run-report.md(agent_run_report/v1 側の背景理解用、コマンド責務境界の記述箇所)
  • docs/schemas/agent-session-manifest.schema.json / docs/schemas/agent-session-manifest.md(本Issueが変更するschemaとそのcompanion doc)
  • docs/schemas/agent-run-report.schema.json(隣接schema、混同しないよう参照)
  • docs/dev/agent-skill-boundaries.md(CHILD_MATERIALIZATION_PLAN_V2、child issueの親body更新ルール)
  • Claude Code hooks reference(Stop / StopFailure / SessionEnd / SubagentStop / PermissionDenied の現在の仕様)

Dependencies / Overlaps

Delivery Rule

1 Issue = 1 PR。#1939 parent bodyの「Child Issues」セクションのWorkstream 2行を、本Issue起票後に 未起票 から起票済みのissue参照へ更新する(親body更新は本Issueのdeliveryの一部ではなく、issue-refinement-loop / edit-issue skillの通常の child materialization手順に従う)。

Activity

  1. added
    phase/implementation
    agent/implementer
    on Sep 3, 2026
  2. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    結論

    現状の #2489 は No-Go as-is です。
    方向性自体は有用ですが、Issue contract と実際に取得できる runtime evidence が噛み合っていません。特に stop_reason を追加するだけでは、今回欲しい「Claude-GPT はなぜ途中停止が多いのか」を正確に測れず、むしろ 観測できない理由を producer が推測して埋める false data を作る危険があります。

    個人趣味開発としての優先順位なら、大きな completion control-plane は作らず、既存の upsert 群を薄く束ねる + terminal event を best-effort に記録するところまで縮めるのが適切です。

    敵対的レビュー

    Severity | Finding | 判定 -- | -- | -- P0 | stop_reason AC が現在の Claude Code hook では観測不能な事象まで要求している | 修正必須 P0 | #1939 Workstream 2 は Claude Code と Codex CLI を扱うのに、#2489 は実質 Claude Code / Claude-GPT に縮退している | 修正必須 P1 | Parent Goal Ref が #1939 ではなく #1153 の内容を誤転記している | 修正必須 P1 | retry / permission_interruption / human_clarification_request を stop reason と同一 enum に入れる設計が意味論的に崩れている | 修正推奨 P1 | runtime_lane の authoritative source が未定義で、現 producer から native / Claude-GPT を判別できない | 修正必須 P1 | completion transaction の owner が曖昧。finalize-agent-run.mjs 自体は transaction coordinator ではない | 修正必須 P1 | AC3 は「既存テストでカバー済みなら確認」で終われるため、partial success recovery の実証が弱い | 修正推奨 P2 | provider telemetry unavailable は既存実装ですでにかなり表現可能で、新実装を増やしすぎる恐れ | scope削減 P2 | runtime verification を漠然と「数回実運用後」へ defer しており、producer wiring の誤りをマージ前に捕まえにくい | 改善推奨

    P0-1: 現在の hook では AC1 の stop reason を作れない

    現在 .claude/settings.json が session manifest producer に接続しているのは Stop、SubagentStop、PostToolUse です。StopFailure や SessionEnd は登録されていません。

    さらに現行 Claude Code 公式仕様では、Stop は main agent が応答を終えたときに発火しますが、ユーザー interrupt で止まった場合には発火しません。API error の場合も Stop ではなく StopFailure が発火します。(Claude)

    したがって #2489 AC1 が要求する

    normal_completion / runtime_failure / interrupt / timeout / permission_interruption / human_clarification_request

    を現在の hook producer だけから決定論的に生成するのは不可能です。#2489 は schema を定義するだけでなく producer に値を「実際に埋める」ことを要求しているので、実装者は次のどちらかに追い込まれます。

    観測できていない停止理由を actor name、transcript、終了時の状況から推測するか、ほぼ全 run を normal_completion にするかです。どちらも、Claude-GPT と native Claude Code の完走率比較という今回の用途には悪影響です。現在の hook wrapper 自体も、producer error を常に best-effort で無視する設計です。これは workflow friction の観点では良いのですが、completion completeness の authority にはできません。

    ここは stop_reason という名前そのものを再検討した方がよいです。

    推奨する最小モデルは、例えば以下です。

    terminal_observation:
      event: stop | stop_failure | session_end | reconciliation
      outcome: completed | interrupted | failed | unavailable
      reason_code: <bounded string / enum>
      evidence_source: hook | launcher | reconciliation

    重要なのは、unavailable を正規値として認めることです。

    retry は stop reason ではなく、その後の action/transition です。permission_interruption も tool permission event であって terminal result とは限りません。human_clarification_request も質問した状態であって、run が終わった理由とは限りません。これらを1本の enum に押し込むと分析時の分母・分子が壊れます。

    P0-2: Parent AC4 の Codex CLI coverage が落ちている

    #1939 の Workstream 2 は明示的に Claude Code と Codex CLI の adapter 差を扱い、normal completion / failure / interrupt / cancel / crash / hook timeout / network failure / retry を coverage として記録するよう要求しています。

    しかし #2489 の具体的な producer変更は、

    • scripts/generate-session-manifest.mjs

    • .claude/hooks/generate_session_manifest_from_hook.mjs

    • runtime_lane: native / claude_gpt

    が中心です。つまり Claude Code launcher の中の2 laneを区別するIssueに変質しており、Codex CLI adapterが消えています。

    これは parent Workstream を materialize した child としては scope loss です。

    ただし個人開発前提なら、ここで Codex 用の新しい大量 hook infrastructure を作る必要はありません。むしろ次のように明記するのがよいです。

    Codex CLI については、このIssueで新しい enforcing hook を追加しない。既存観測経路で terminal event が取得できる場合のみ materialize し、取得できない path は availability: unavailable として reconciliation coverage に残す。

    これなら #1939 AC4 を失わず、#1860 の minimal harness 方針とも整合します。

    P1-1: Parent Goal Ref が別Issueの内容

    #2489 は Parent #1939 の Goal として、

    Claude Code、Codex CLI、Google Antigravityの3 CLIについてcapture capability verdict ...

    を記載しています。

    しかし #1939 の実際の Goal は、repository URL / date / timezone から daily workset と artifact coverage を導出して、GitHub connector 経由の retrospective を成立させることです。

    3 CLI の capture capability verdict は #1153 の Goal です。

    単なる文章ミスに見えますが、今回は scope authority に使っている箇所なので軽視しない方がいいです。実際、上記の Codex/Claude-GPT scope drift とも符合しています。

    実装前に Parent Goal Ref を #1939 の実文へ直すべきです。

    P1-2: runtime_lane は良いが、値の出所がない

    runtime_lane 追加自体は今回の目的にかなり有効です。

    現状 hook wrapper は actor を基本的に claude-code-hook とし、SubAgentなら claude-code-subagent-* にしています。producer arguments に runtime lane はありません。

    つまり、producer側で

    actor.name contains X → claude_gpt

    のように判定すると fragile です。

    runtime_lane は launcherが明示的に producer に渡す provenance にしてください。例えば、

    --runtime-lane native_claude_code
    --runtime-lane claude_gpt
    --runtime-lane codex_cli
    --runtime-lane unknown

    程度で十分です。

    Claude-GPT launcher が環境変数をすでに設定しているならそこから渡すのでも構いませんが、producer自身が infer しないことが重要です。

    さらに native という値だけでは何の native なのか曖昧なので、native_claude_code の方が後から見て安全です。

    P1-3: completion transaction の責務が間違ったファイルに寄っている

    #2489 は scripts/agent-logs/finalize-agent-run.mjs を completion transaction の主要実装候補として挙げています。

    しかし現在の責務は明確に分離されています。

    finalize-agent-run.mjs は report JSON を生成して atomic write するだけです。GitHub posting はしません。

    post-agent-run-report.mjs が validated run report の GitHub upsert を担当しています。

    repository docs も agent-run:finalize = artifact generation、agent-run:post = run report upsert、context marker = 別 command、と明記しています。

    retro index も独立した update-retro-index.mjs で upsert されています。

    context marker にも malformed-marker detection、ownership marker、digest、upsert系の既存基盤があります。

    したがって、既存責務を1ファイルへ寄せるべきではありません。

    趣味開発として最も安い transaction は、

    completion command
      ├─ run-report upsert
      ├─ retro-index upsert
      └─ context-marker upsert

    を順番に呼び、結果だけ、

    {
      "run_report": "unchanged|created|updated|failed",
      "retro_index": "unchanged|created|updated|failed",
      "context_marker": "unchanged|created|updated|failed"
    }

    として返す薄い coordinator です。

    DB、transaction log、ledger、two-phase commit は不要です。

    途中で2番目が失敗しても、同じ command をもう一度全部実行するだけにします。各処理が既に upsert/idempotent だからです。

    これは #1860 の「過剰な control-plane を増やさない」という owner decision にも合っています。#1860 は新しい graph policy、ledger、digest checker、enforcing hook を避け、live state / actual tests / CIを authority にする方針です。

    P1-4: AC3 はもっと具体的にした方がよい

    現状のAC3は、

    既存testで既にカバーされているか確認し、なければ focused testを追加

    なので、「関連テストはある」と確認するだけでも通り得ます。

    completion transaction の価値を証明するなら、次の4ケースだけ固定してください。

    1. 初回実行 → 3 artifact が作成/更新される

    2. 同じ run を再実行 → comment 数が増えない

    3. run report 投稿後、retro index で失敗 → retry で report を重複させず残りが完成する

    4. malformed/ambiguous marker が既にある → 既存 policy に従って deterministic に blocked/repairされる

    これだけで十分です。failure injection frameworkのようなものは不要です。

    P2: provider telemetry unavailable はかなり既存実装で足りている

    ここは #2489 の中でも最も実装を増やしすぎやすい部分です。

    現行 report schema / adapter には source_unavailable の扱いがすでにあり、テスト資産にも unavailable ケースがあります。

    したがってAC4はまず、

    existing adapter に availability: unavailable を与えた report が validation/finalizationでき、provider trace absenceだけでは agent completion failureにならない

    ことを focused test で証明すればよいです。

    新しい fallback system は不要です。

    Claude Code 現行仕様から見た最小の観測設計

    Claude Code は現在、1 turn の終端に Stop または StopFailure、session 終端に SessionEnd を提供しています。StopFailure は API error type も構造化されています。(Claude)

    一方で Stop では user interrupt を捕まえられません。SessionEnd の reason も clear / resume / logout / prompt_input_exit / other 程度で、run-level crash taxonomyではありません。(Claude)

    なので、完全な stop taxonomy を hook だけで作ろうとしない方がいいです。

    今回の目的に必要なのはむしろ、

    native_claude_code:
      observed Stop → completed turn
      observed StopFailure → failed turn + error
      no terminal evidence → unresolved
    

    claude_gpt:
    same observations

    • launcher identity

    reconciliation:
    expected run exists but completion artifact absent → missing/unresolved

    という集計です。

    これだけでも、

    • native vs Claude-GPT の terminal completion率

    • API failure率

    • completion artifact欠落率

    • human intervention有無

    • unknown/unresolved率

    を比較できます。

    特に unknown率を出すこと自体が重要な観測結果です。unknownを無理に permission / timeout / interrupt へ分類する必要はありません。

    #2489 をどう直すか

    私なら Issueは維持して scope を縮めて reframe します。別Issueへ捨てる必要はありません。

    推奨する変更は、stop_reason を絶対的な terminal truth とする設計をやめ、

    • runtime_lane: native_claude_code | claude_gpt | codex_cli | unknown

    • terminal_event: stop | stop_failure | session_end | reconciliation | unavailable

    • completion_outcome: completed | failed | interrupted | incomplete | unavailable

    • provider-specific reason は取得できた場合のみ保存

    • observation source を必須化

    • 未観測を推測しない

    という形です。

    ただし schema をここまで増やしたくなければ、さらに削って、

    runtime_lane
    completion_outcome
    completion_source

    の3フィールドでも今回の分析用途には十分です。

    permission_interruption や human_clarification_request は既存 human_intervention や別イベント側から後で集計すればよく、terminal taxonomyへ詰め込まない方がデータ品質が上がります。

    最終判定

    REQUEST_CHANGES 相当です。

    特にマージ前ではなく実装着手前に直したい blocker は3点です。

    Parent Goal Ref の訂正、観測不能な stop_reason AC の再設計、Codex CLI coverage の扱いの明文化です。

    そのうえで completion transaction は、既存3 upsertを再利用する「再実行可能な薄い coordinator」に限定するのが最も費用対効果が高いです。新規 ledger、専用state DB、enforcing hook、permission brokerは不要です。

    なお #2489 には現時点で Issue comment はありません。 実装PRも #2489 および completion-transaction 関連の検索では特定できなかったため、今が contract を直す最も安いタイミングです。

    ## 結論

    現状の #2489 は No-Go as-is です。
    方向性自体は有用ですが、Issue contract と実際に取得できる runtime evidence が噛み合っていません。特に stop_reason を追加するだけでは、今回欲しい「Claude-GPT はなぜ途中停止が多いのか」を正確に測れず、むしろ 観測できない理由を producer が推測して埋める false data を作る危険があります。

    個人趣味開発としての優先順位なら、大きな completion control-plane は作らず、既存の upsert 群を薄く束ねる + terminal event を best-effort に記録するところまで縮めるのが適切です。

    敵対的レビュー

    Severity Finding 判定
    P0 stop_reason AC が現在の Claude Code hook では観測不能な事象まで要求している 修正必須
    P0 #1939 Workstream 2 は Claude Code と Codex CLI を扱うのに、#2489 は実質 Claude Code / Claude-GPT に縮退している 修正必須
    P1 Parent Goal Ref が #1939 ではなく #1153 の内容を誤転記している 修正必須
    P1 retry / permission_interruption / human_clarification_request を stop reason と同一 enum に入れる設計が意味論的に崩れている 修正推奨
    P1 runtime_lane の authoritative source が未定義で、現 producer から native / Claude-GPT を判別できない 修正必須
    P1 completion transaction の owner が曖昧。finalize-agent-run.mjs 自体は transaction coordinator ではない 修正必須
    P1 AC3 は「既存テストでカバー済みなら確認」で終われるため、partial success recovery の実証が弱い 修正推奨
    P2 provider telemetry unavailable は既存実装ですでにかなり表現可能で、新実装を増やしすぎる恐れ scope削減
    P2 runtime verification を漠然と「数回実運用後」へ defer しており、producer wiring の誤りをマージ前に捕まえにくい 改善推奨

    P0-1: 現在の hook では AC1 の stop reason を作れない

    現在 .claude/settings.json が session manifest producer に接続しているのは Stop、SubagentStop、PostToolUse です。StopFailure や SessionEnd は登録されていません。

    さらに現行 Claude Code 公式仕様では、Stop は main agent が応答を終えたときに発火しますが、ユーザー interrupt で止まった場合には発火しません。API error の場合も Stop ではなく StopFailure が発火します。(Claude)

    したがって #2489 AC1 が要求する

    normal_completion / runtime_failure / interrupt / timeout / permission_interruption / human_clarification_request

    を現在の hook producer だけから決定論的に生成するのは不可能です。#2489 は schema を定義するだけでなく producer に値を「実際に埋める」ことを要求しているので、実装者は次のどちらかに追い込まれます。

    観測できていない停止理由を actor name、transcript、終了時の状況から推測するか、ほぼ全 run を normal_completion にするかです。どちらも、Claude-GPT と native Claude Code の完走率比較という今回の用途には悪影響です。現在の hook wrapper 自体も、producer error を常に best-effort で無視する設計です。これは workflow friction の観点では良いのですが、completion completeness の authority にはできません。

    ここは stop_reason という名前そのものを再検討した方がよいです。

    推奨する最小モデルは、例えば以下です。

    terminal_observation:
      event: stop | stop_failure | session_end | reconciliation
      outcome: completed | interrupted | failed | unavailable
      reason_code: <bounded string / enum>
      evidence_source: hook | launcher | reconciliation
    

    重要なのは、unavailable を正規値として認めることです。

    retry は stop reason ではなく、その後の action/transition です。permission_interruption も tool permission event であって terminal result とは限りません。human_clarification_request も質問した状態であって、run が終わった理由とは限りません。これらを1本の enum に押し込むと分析時の分母・分子が壊れます。

    P0-2: Parent AC4 の Codex CLI coverage が落ちている

    #1939 の Workstream 2 は明示的に Claude Code と Codex CLI の adapter 差を扱い、normal completion / failure / interrupt / cancel / crash / hook timeout / network failure / retry を coverage として記録するよう要求しています。

    しかし #2489 の具体的な producer変更は、

    • scripts/generate-session-manifest.mjs
    • .claude/hooks/generate_session_manifest_from_hook.mjs
    • runtime_lane: native / claude_gpt

    が中心です。つまり Claude Code launcher の中の2 laneを区別するIssueに変質しており、Codex CLI adapterが消えています。

    これは parent Workstream を materialize した child としては scope loss です。

    ただし個人開発前提なら、ここで Codex 用の新しい大量 hook infrastructure を作る必要はありません。むしろ次のように明記するのがよいです。

    Codex CLI については、このIssueで新しい enforcing hook を追加しない。既存観測経路で terminal event が取得できる場合のみ materialize し、取得できない path は availability: unavailable として reconciliation coverage に残す。

    これなら #1939 AC4 を失わず、#1860 の minimal harness 方針とも整合します。

    P1-1: Parent Goal Ref が別Issueの内容

    #2489 は Parent #1939 の Goal として、

    Claude Code、Codex CLI、Google Antigravityの3 CLIについてcapture capability verdict ...

    を記載しています。

    しかし #1939 の実際の Goal は、repository URL / date / timezone から daily workset と artifact coverage を導出して、GitHub connector 経由の retrospective を成立させることです。

    3 CLI の capture capability verdict は #1153 の Goal です。

    単なる文章ミスに見えますが、今回は scope authority に使っている箇所なので軽視しない方がいいです。実際、上記の Codex/Claude-GPT scope drift とも符合しています。

    実装前に Parent Goal Ref を #1939 の実文へ直すべきです。

    P1-2: runtime_lane は良いが、値の出所がない

    runtime_lane 追加自体は今回の目的にかなり有効です。

    現状 hook wrapper は actor を基本的に claude-code-hook とし、SubAgentなら claude-code-subagent-* にしています。producer arguments に runtime lane はありません。

    つまり、producer側で

    actor.name contains X → claude_gpt
    

    のように判定すると fragile です。

    runtime_lane は launcherが明示的に producer に渡す provenance にしてください。例えば、

    --runtime-lane native_claude_code
    --runtime-lane claude_gpt
    --runtime-lane codex_cli
    --runtime-lane unknown
    

    程度で十分です。

    Claude-GPT launcher が環境変数をすでに設定しているならそこから渡すのでも構いませんが、producer自身が infer しないことが重要です。

    さらに native という値だけでは何の native なのか曖昧なので、native_claude_code の方が後から見て安全です。

    P1-3: completion transaction の責務が間違ったファイルに寄っている

    #2489 は scripts/agent-logs/finalize-agent-run.mjs を completion transaction の主要実装候補として挙げています。

    しかし現在の責務は明確に分離されています。

    finalize-agent-run.mjs は report JSON を生成して atomic write するだけです。GitHub posting はしません。

    post-agent-run-report.mjs が validated run report の GitHub upsert を担当しています。

    repository docs も agent-run:finalize = artifact generation、agent-run:post = run report upsert、context marker = 別 command、と明記しています。

    retro index も独立した update-retro-index.mjs で upsert されています。

    context marker にも malformed-marker detection、ownership marker、digest、upsert系の既存基盤があります。

    したがって、既存責務を1ファイルへ寄せるべきではありません。

    趣味開発として最も安い transaction は、

    completion command
      ├─ run-report upsert
      ├─ retro-index upsert
      └─ context-marker upsert
    

    を順番に呼び、結果だけ、

    {
      "run_report": "unchanged|created|updated|failed",
      "retro_index": "unchanged|created|updated|failed",
      "context_marker": "unchanged|created|updated|failed"
    }

    として返す薄い coordinator です。

    DB、transaction log、ledger、two-phase commit は不要です。

    途中で2番目が失敗しても、同じ command をもう一度全部実行するだけにします。各処理が既に upsert/idempotent だからです。

    これは #1860 の「過剰な control-plane を増やさない」という owner decision にも合っています。#1860 は新しい graph policy、ledger、digest checker、enforcing hook を避け、live state / actual tests / CIを authority にする方針です。

    P1-4: AC3 はもっと具体的にした方がよい

    現状のAC3は、

    既存testで既にカバーされているか確認し、なければ focused testを追加

    なので、「関連テストはある」と確認するだけでも通り得ます。

    completion transaction の価値を証明するなら、次の4ケースだけ固定してください。

    1. 初回実行 → 3 artifact が作成/更新される
    2. 同じ run を再実行 → comment 数が増えない
    3. run report 投稿後、retro index で失敗 → retry で report を重複させず残りが完成する
    4. malformed/ambiguous marker が既にある → 既存 policy に従って deterministic に blocked/repairされる

    これだけで十分です。failure injection frameworkのようなものは不要です。

    P2: provider telemetry unavailable はかなり既存実装で足りている

    ここは #2489 の中でも最も実装を増やしすぎやすい部分です。

    現行 report schema / adapter には source_unavailable の扱いがすでにあり、テスト資産にも unavailable ケースがあります。

    したがってAC4はまず、

    existing adapter に availability: unavailable を与えた report が validation/finalizationでき、provider trace absenceだけでは agent completion failureにならない

    ことを focused test で証明すればよいです。

    新しい fallback system は不要です。

    Claude Code 現行仕様から見た最小の観測設計

    Claude Code は現在、1 turn の終端に Stop または StopFailure、session 終端に SessionEnd を提供しています。StopFailure は API error type も構造化されています。([Claude]1)

    一方で Stop では user interrupt を捕まえられません。SessionEnd の reason も clear / resume / logout / prompt_input_exit / other 程度で、run-level crash taxonomyではありません。(Claude)

    なので、完全な stop taxonomy を hook だけで作ろうとしない方がいいです。

    今回の目的に必要なのはむしろ、

    native_claude_code:
      observed Stop → completed turn
      observed StopFailure → failed turn + error
      no terminal evidence → unresolved
    
    claude_gpt:
      same observations
      + launcher identity
    
    reconciliation:
      expected run exists but completion artifact absent → missing/unresolved
    

    という集計です。

    これだけでも、

    • native vs Claude-GPT の terminal completion率
    • API failure率
    • completion artifact欠落率
    • human intervention有無
    • unknown/unresolved率

    を比較できます。

    特に unknown率を出すこと自体が重要な観測結果です。unknownを無理に permission / timeout / interrupt へ分類する必要はありません。

    #2489 をどう直すか

    私なら Issueは維持して scope を縮めて reframe します。別Issueへ捨てる必要はありません。

    推奨する変更は、stop_reason を絶対的な terminal truth とする設計をやめ、

    • runtime_lane: native_claude_code | claude_gpt | codex_cli | unknown
    • terminal_event: stop | stop_failure | session_end | reconciliation | unavailable
    • completion_outcome: completed | failed | interrupted | incomplete | unavailable
    • provider-specific reason は取得できた場合のみ保存
    • observation source を必須化
    • 未観測を推測しない

    という形です。

    ただし schema をここまで増やしたくなければ、さらに削って、

    runtime_lane
    completion_outcome
    completion_source
    

    の3フィールドでも今回の分析用途には十分です。

    permission_interruption や human_clarification_request は既存 human_intervention や別イベント側から後で集計すればよく、terminal taxonomyへ詰め込まない方がデータ品質が上がります。

    最終判定

    REQUEST_CHANGES 相当です。

    特にマージ前ではなく実装着手前に直したい blocker は3点です。

    Parent Goal Ref の訂正、観測不能な stop_reason AC の再設計、Codex CLI coverage の扱いの明文化です。

    そのうえで completion transaction は、既存3 upsertを再利用する「再実行可能な薄い coordinator」に限定するのが最も費用対効果が高いです。新規 ledger、専用state DB、enforcing hook、permission brokerは不要です。

    なお #2489 には現時点で Issue comment はありません。 実装PRも #2489 および completion-transaction 関連の検索では特定できなかったため、今が contract を直す最も安いタイミングです。

  3. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    対象コメントを前提にすると、いきなり現行 #2489 を impl-review-loop に渡すのではなく、同じ Claude Code セッション内で Issue contract を最小修正 → current-run contract review を通過 → impl-review-loop へ連続遷移させるのが適切です。対象コメント自身が REQUEST_CHANGES 相当で、Parent Goal Ref、観測不能な stop_reason、Codex CLI coverage の3点を実装着手前 blocker としています。

    推奨アクションは以下です。

    以下をそのまま、Auto mode の対話的 Claude Code の root/main thread に渡すのを推奨します。

    対象リポジトリ:
    https://github.com/squne121/loop-protocol

    対象 Issue:
    #2489

    今回の human context:
    #2489 (comment)

    目的:
    Issue #2489 について、上記 human context の敵対的レビューを反映して Issue contract を必要最小限修正したうえで、impl-review-loop を実行し、実装・検証・PRレビュー・レビュー指摘修正・CI確認を自律的に反復してください。

    人間への通常の承認要求は行わず、PR が current-head で review APPROVE、required verification/CI が通過し、merge conflict がなく、マージ直前の状態になるまで進めてください。

    ただし実際の merge は行わないでください。
    gh pr merge、auto-merge の有効化、その他 merge を成立させる操作は禁止です。
    最終状態は merge-ready / draft_pr_ready 相当で停止してください。

    0. 基本方針

    これは個人趣味開発です。

    品質・実用性・単純さを優先してください。
    security / harness / control-plane を増やすこと自体を目的にしないでください。

    既存の live Issue / PR、実 diff、実 test、current-head CI、独立 review を authority としてください。

    以下を新設しないでください。

    • 新しい専用 ledger
    • state DB
    • two-phase commit
    • permission broker
    • enforcing hook
    • digest/checker を authority にする仕組み
    • failure injection framework
    • 観測できない事象を推測で埋める telemetry

    既存の upsert / validator / producer / poster を最大限再利用してください。

    routine な実装判断、ファイル編集、test実行、commit、push、Draft PR作成、PR更新、レビュー対応について私への確認は不要です。

    AskUserQuestion は、repository、Issue、human context、既存コード、test、公式仕様から合理的に決定できる事項には使わないでください。
    複数案がある場合は、最小変更で既存設計と整合する案を自分で選んで進めてください。

    Auto mode の classifier が routine operation を拒否した場合、classifier を迂回しようとせず、より低リスクな等価操作、既存 allow 済み経路、または設計変更で継続してください。

    1. 最初に live state を再取得する

    作業開始時点の main を authority としてください。

    最低限、以下を再取得してください。

    過去の artifact / snapshot / digest が live state と食い違う場合は live state を優先してください。

    2. SubAgent を使って contract repair を独立確認する

    実装前に read-only SubAgent を1つ以上使い、次を独立確認させてください。

    A. #2489 human context の blocker と #1939 AC4-AC6 の対応
    B. 現在の Claude Code / Codex CLI observation path から実際に観測可能な terminal evidence
    C. 既存 completion artifact upsert の責務分離
    D. 現行テストで既にカバーされている idempotency / unavailable ケース
    E. #1860 minimal harness 方針との衝突有無

    必要なら公式 Claude Code documentation も確認してください。
    特に Stop / StopFailure / SessionEnd / SubagentStop / PermissionDenied の現在の仕様を authoritative source で確認してください。

    SubAgent を起動しただけで次へ進まないでください。

    SubAgent が foreground の場合は終了するまで待ってください。
    background で起動した場合も completion notification / task status が terminal になるまで待ってください。

    全 SubAgent の結果を受け取る前に Issue mutation や implementation を開始しないでください。

    3. #2489 contract を先に修正する

    human context #5539261190 を human_context_comment として明示的に扱ってください。

    現状の #2489 をそのまま実装開始しないでください。

    root/main thread が Issue mutation を所有し、human context と live readback に基づき #2489 本文を必要最小限修正してください。

    最低限、以下を解消してください。

    3.1 Parent Goal Ref

    #1939 の実際の Goal / Workstream 2 に合わせて訂正すること。

    #1153 の capture capability goal を #1939 の Goal として扱わないこと。

    3.2 stop_reason の再設計

    観測不能な terminal reason を producer が推測する設計を廃止してください。

    最低限必要な分析軸は次です。

    • runtime_lane
    • completion_outcome
    • completion_source

    必要性が実装・既存schemaから明確なら、追加で

    • terminal_event
    • provider-specific reason

    を持たせても構いません。

    推奨 enum の方向性:

    runtime_lane:

    • native_claude_code
    • claude_gpt
    • codex_cli
    • unknown

    completion_outcome:

    • completed
    • failed
    • interrupted
    • incomplete
    • unavailable

    completion_source:

    • hook
    • launcher
    • reconciliation
    • unavailable

    terminal_event を採用する場合:

    • stop
    • stop_failure
    • session_end
    • reconciliation
    • unavailable

    重要:
    未観測状態を normal_completion / interrupt / permission / timeout 等へ推測分類しないでください。
    unknown / unavailable / incomplete を正常な観測結果として許容してください。

    retry は terminal reason ではなく transition/action として扱ってください。

    permission interruption や human clarification request は terminal outcome と混同せず、既存 human_intervention や event evidence から分析可能にしてください。

    3.3 runtime_lane provenance

    runtime_lane を actor.name、文字列パターン、transcript内容から infer しないでください。

    launcher、explicit CLI argument、既存の明示的 environment/provenance のいずれかから producer へ渡してください。

    値を取得できない場合は unknown としてください。
    false precision を避けてください。

    3.4 Codex CLI coverage

    #1939 Workstream 2 の Claude Code / Codex CLI adapter coverage を維持してください。

    ただし Codex CLI のためだけに重い新規 hook infrastructure を作らないでください。

    既存観測経路から terminal evidence が得られる場合は materialize。
    得られない path は unavailable / incomplete として coverage に残してください。

    3.5 completion transaction

    finalize-agent-run.mjs に posting transaction 全体を押し込まないでください。

    現在の責務分離を維持してください。

    • report generation/finalize
    • run-report upsert
    • retro-index upsert
    • context-marker upsert

    必要なら、これらを順番に呼び出す薄い coordinator を1つ追加してください。

    概念的には:

    completion coordinator
    -> run-report upsert
    -> retro-index upsert
    -> context-marker upsert

    各 operation の結果を
    created / updated / unchanged / failed
    程度で返せれば十分です。

    partial failure 時は独自 transaction log で復旧するのではなく、既存 operation の idempotency を利用し、同じ completion command を再実行して convergence させてください。

    3.6 Allowed Paths

    human context によって責務の所在が判明したため、Allowed Paths も live implementation に合わせて修正してください。

    少なくとも必要性を評価する対象:

    • .claude/settings.json
    • .claude/hooks/generate_session_manifest_from_hook.mjs
    • docs/schemas/agent-session-manifest.schema.json
    • docs/schemas/agent-session-manifest.md
    • scripts/generate-session-manifest.mjs
    • scripts/agent-logs/finalize-agent-run.mjs
    • scripts/agent-logs/post-agent-run-report.mjs
    • scripts/agent-logs/update-retro-index.mjs
    • scripts/agent-logs/lib/chatgpt-retro-context-marker-helper.mjs
    • 必要なら scripts/agent-logs/ 配下の薄い coordinator
    • tests/agent-logs/**

    実際に変更不要なファイルまで変更しないでください。

    3.7 Acceptance Criteria

    AC は「既存テストを確認した」で終了できない形にしてください。

    completion transaction について最低限、次を決定論的に検証してください。

    1. 初回実行で必要 artifact が create/update される
    2. 同一 run を再実行しても comment 数が増えない
    3. run-report 成功後に後続 upsert が失敗したケースを再実行すると、run-report を重複させず残りが完成する
    4. malformed / ambiguous marker が存在する場合、既存 policy に従って deterministic に blocked / repair される

    provider telemetry unavailable については、

    • unavailable observation source を持つ report が validation/finalization 可能
    • provider trace absence だけを agent completion failure gate にしない

    ことを focused test で証明してください。

    producer wiring についても fixture/test で merge 前に確認してください。
    実運用を数回待たなければ何も検証できない contract にしないでください。

    4. contract repair 後に current-run contract review を通す

    Issue body 更新後、古い GO / snapshot を authority にしないでください。

    root-owned synchronous entry policy に従い、current live body に対して current-run issue-contract-review を実行してください。

    body drift があれば同一 control flow 内で fresh review を取り直してください。

    GO にならない場合でも、単なる修正可能な contract defect を理由に私へ承認を求めないでください。
    human context と live repository から修正可能なら root/main thread で修正して再レビューしてください。

    5. GO 後、そのまま impl-review-loop #2489 を開始する

    current-run contract review が GO になったら、同一 continuous root/main control flow のまま impl-review-loop を開始してください。

    入力概念:

    issue_number: 2489
    human_context_comment_urls:

    古い contract snapshot URL を authorization として使用しないでください。

    impl-review-loop の現在の root-owned synchronous entry transition を尊重してください。

    6. SubAgent completion を必ず待つ

    impl-review-loop 内では既存設計どおり SubAgent を使用してください。

    最低限:

    • implementation-worker
    • test-runner
    • pr-reviewer

    各 dependent step で、SubAgent の完了を待たずに次へ進んではいけません。

    implementation-worker 完了
    → 結果と current HEAD を確認
    → test-runner 起動
    → test-runner 完了
    → current-head verification を確認
    → pr-reviewer 起動
    → pr-reviewer 完了
    → LOOP_VERDICT を route

    という同期境界を守ってください。

    background SubAgent が使われた場合も、
    「起動済み」「running」「async_launched」を完了扱いしないでください。

    completion notification / terminal task state / final report を受け取るまで待ってください。

    失敗した SubAgent は、原因が一時的 API error 等で再実行可能なら resume/retry してください。
    途中出力を completed result と誤認しないでください。

    7. 実装・レビュー修正ループ

    implementation-worker:

    • Allowed Paths 内で最小変更
    • issue contract の AC を満たす
    • focused tests を追加
    • full verification を実行可能な状態にする
    • commit / push / Draft PR 作成まで進める
    • PR body に Closes #2489 を含める

    test-runner:

    • current PR head SHA に対して独立検証
    • Issue Verification Commands
    • focused tests
    • pnpm typecheck
    • pnpm lint
    • pnpm test
    • pnpm build
    • 必要な schema validation
      を実行する

    pr-reviewer:

    REQUEST_CHANGES の場合:

    • blocker を fix_delta として implementation-worker に返す
    • implementation-worker の完了を待つ
    • current-head verification をやり直す
    • current head を pr-reviewer に再レビューさせる

    stale-head review を承認扱いしないでください。

    BEHIND なら既存 impl-review-loop policy に従って branch update を行い、その後 verification + review を再実行してください。

    8. 外部仕様の確認

    Claude Code の hook semantics に依存する実装では、記憶で仕様を決めず、現在の公式 documentation を確認してください。

    少なくとも確認すること:

    • Stop
    • StopFailure
    • SessionEnd
    • SubagentStop
    • PermissionDenied
    • background/foreground SubAgent semantics

    ただし外部仕様調査を理由に過剰な abstraction を追加しないでください。

    公式仕様から取得できない terminal reason は unknown / unavailable としてください。

    9. human escalation を極小化する

    以下は人間停止理由にしないでください。

    • advisory artifact の欠落
    • contract snapshot の telemetry 異常だけ
    • SubAgent の human_review_required: true 自己申告だけ
    • ordinary implementation choice
    • test failure
    • lint failure
    • review REQUEST_CHANGES
    • CI failureで原因が修正可能
    • branch being BEHIND
    • provider telemetry unavailable
    • terminal reason が観測不能
    • routine GitHub Issue/PR mutation

    これらは自律的に修正・再試行・再評価してください。

    本当に継続不能な場合だけ停止してください。
    例:

    • secret / credential の読み取りや公開が必要になる
    • repository scope 外への不可逆・破壊的操作が不可避
    • recover不能な actual Git conflict
    • Issue owner の明示的な停止指示
    • 外部課金・本番操作など、この依頼から合理的に承認を推定できない不可逆操作

    秘密情報を表示・ログ・Issue/PRへ投稿しないでください。

    10. merge は絶対に行わない

    この作業のゴールは「マージ直前」です。

    以下は禁止:

    Closes #2489 を PR body に入れ、Issue close は merge に委ねてください。

    APPROVE かつ current-head verification / required CI が pass し、live mergeability が merge-ready になったところで終了してください。

    11. 最終報告

    最終回答を返す前に、起動した全 SubAgent が completed / failed / explicitly stopped のいずれかの terminal state になっていることを確認してください。

    running の SubAgent を残したまま最終回答しないでください。

    最後に簡潔に以下を報告してください。

    PR が merge-ready なら、そこで停止してください。
    私への追加承認要求や「次に何をしますか?」は不要です。

    この形なら、対象コメントによる contract blocker の解消も同一セッションで自動化し、その後は既存 impl-review-loop の実装→独立検証→PRレビュー循環を使い切る構成になります。特に background SubAgent の完了待ちと gh pr merge 禁止を明文化している点が、現行 Claude Code Auto mode では重要です。

  4. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  5. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-04T11:57:20Z)

    • PR: feat: agent_session_manifest/v1 に runtime_lane/completion_outcome/completion_source を追加 (#2489) #2496
    • Worktree: .claude/worktrees/issue-2489-completion-transaction-runtime-lane
    • Branch: worktree-issue-2489-completion-transaction-runtime-lane
    • Verification: pnpm typecheck / lint / test(1899 passed)/ build すべて PASS、AC2 動作検証(uv run pytest tests/agent-logs/runtime-verification/test_hook_stop_failure_wiring.py)4/4 PASS
    • Scope Delta: docs/dev/hook-boundaries.md と .github/ci/python-test-plan.json は Allowed Paths 外だが、既存 SSOT 契約テスト(tests/test_hook_boundaries_doc.py の settings.json drift 検出、CI の uncovered_changed_test_files gate)との整合のため機械的な最小追従を行った。詳細は PR 本文の Scope Delta セクション参照。
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  6. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  7. self-assigned this
    on Sep 4, 2026
  8. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  9. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    Human Context Bridge(issue-refinement-loop anchor 用)

    本コメントは PR #2496 上の OWNER レビュー #2496 (comment) (REQUEST_CHANGES)を、issue-refinement-loop の --anchor-comment-url が受理する canonical issues/<N>#issuecomment-<M> 形式へブリッジするために、root/main thread が機械的に投稿するものです(PR comment URL はこの正規表現の対象外のため)。

    元レビューの要旨(本文全文は上記 PR コメントを参照。root/main が repository facts と突き合わせて正規化する前段の生データとして扱う)

    判定: REQUEST_CHANGES

    • P0: Stop / StopFailure hook を session/run の completion_outcome/completion_source として記録している設計が、Claude Code upstream 仕様(Stop/StopFailure は turn-level event、SessionEnd が session-level)と一致しない。現在 Issue 実装: #1939 Workstream 2 — completion transaction and reconciliation(stop reason taxonomy / runtime lane識別) #2489 AC2 が要求する Stop → completed / StopFailure → failed の動作検証 VC はこの誤った意味論を literal に固定しており、契約自体の修正が必要。
    • P0: scripts/agent-logs/complete-agent-run.mjs の completion transaction coordinator が、upsertChatgptRetroContextComment へ渡す context payload を postAgentRunReport() / updateRetroIndex() の実際の戻り値(comment_url・digest)ではなく事前生成済み Markdown ファイルからそのまま構築しており、partial failure 後の retry で既存 CHATGPT_RETRO_CONTEXT_V1 resolver が resolved へ収束しない。
    • P1: StopFailure の structured error type(upstream taxonomy)を保存していない。
    • P1: PR 本文の CI 証跡が current head に対して stale。
    • P2: completion_outcome/completion_source の pair constraint(JSON Schema dependentRequired 相当)が未設定。

    推奨技術判断(元コメントより):

    • Stop/StopFailure から root completion_outcome を設定しない。run/session completion は launcher process exit または後段 reconciliation evidence からのみ設定する。hook_event.event_type は evidence として保持する。新規 turn_outcome 等は最小変更で目的を達成できるなら追加しない。
    • StopFailure.error は既存 hook_event に optional error_type として保存する案を優先し、upstream error taxonomy の値を扱い、未知値は unknown へ正規化する。
    • completion transaction coordinator は既存3 upsert の実際の結果から context payload を構築するよう修正し、prerequisite failure 時は context marker を作らない。新しい DB/ledger/2PC/reconciliation daemon は追加しない。
    • completion_outcome/completion_source に dependentRequired の pair constraint を検討する(新規 runtime guard は追加しない)。

    この矛盾を残したまま Issue #2489 の現行 AC2 / VC を literal に実装しても、正しい実装が誤った VC に fail するため収束しません。以降の refinement は本コメントと上記元 PR コメントの両方を参照し、live repository facts / upstream Claude Code hooks 仕様と突き合わせて Issue 本文を再整合します。

  10. added a commit that references this issue on Sep 4, 2026
    6d7cedd
  11. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent/implementerphase/implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions