Skip to content

bug(adapter): webhook handling re-arm is dropped in channel and mcp_hook delivery modes #1798

Description

@smileygames

目的

channel / mcp_hook delivery mode で、webhook の取り扱い指示が毎ターン面から落ちている経路を塞ぐ。イベント配送は届いているのに、届いたものをどうするかを述べる面が無い。

観測事実(本セッション、2026-08-24)

LI_PLUS_WEBHOOK_DELIVERY=mcp_hook。ターン 1 で 9 pending GitHub webhook events (pull_request_review:1, workflow_run:8) が context へ注入された。しかし inspect も mark_processed も走らなかった。実際に走ったのは、PR #1763 の due check がその手続きを名指しした時点であり、注入から約 15 tool call 後である。

これは PR #1763 の観測エントリが自ら名指していた失敗方向そのものである:

Both failure directions are real — main invoking the stub anyway is regression, and the intake silently not happening is the relocation losing the behavior.

もう一方の方向(stub を invoke してしまう)は起きていない。description の絞り込みは効いている。落ちたのは残り半分である。

前提(実測済み)

毎ターン hook の webhook ブロックは、分離可能な 2 つを運んでいる。

  1. ツールを呼べRun mcp__github-webhook-mcp__get_pending_status silently.
  2. 結果をどう扱うかReport only foreground-relevant or notable items.

channel / mcp_hook が置き換えるのは (1) だけである。(2) を置き換えるものは無い。しかし条件式はブロック全体を落とすため、(2) も一緒に消える。3 port すべてで同形:

port 条件式 落ちる行
adapter/claude/hooks/on-user-prompt.sh :28 :30-33
adapter/codex/hooks/on-user-prompt.sh :39 :40-44
adapter/codex/hooks/on-user-prompt.ps1 :41 :42-46

正本は rules/operations/main-agent-procedures.md ## Foreground webhook notification intake にあり、always-on で載っている。しかしその発火時刻は :484 が述べるとおり each user turn start であり、always-on 常駐はロード保証であって発火保証ではない。ターン境界を発火できる面は hook だけである。

mark_processed については、poll ブランチも運んでいない。rules/operations/operations.md:91mark_processed is mandatory for every consumed webhook event. Omission causes backlog accumulation. と述べており、main-agent-procedures.md:493 は own-operation event の promptly な処理を要求する。3 モードのいずれの hook 面にもこの語は現れない。

先例

同一の推論が同一リポジトリに既にある。rules/model/trigger-check-gate.md ## Trigger firing

Do not re-add a self-declaration trigger: a forgettable relief path is strictly dominated by the deterministic hook.

5-axis Gate は同じ理由で on-user-prompt.sh の決定論的 re-arm へ移されている。本件は同じファイルの別ブロックに同じ修理を当てる。rules/model/subtractive-structural-beauty.md Application notes の「実行保証の無い手続きは構造へ置き換える」も同じ側を指す。

制約

  • (1) を channel / mcp_hook へ戻さないこと。 on-user-prompt.sh:22-24 が述べる double delivery(reminder text と mcp_tool entry の二重発火)は mcp_hook 設定が防いでいる当のものである。追加するのは取り扱い半分のみ。
  • codex port は parity 対象。3 port すべてを同時に変更する(spec(evolution,adapter,task,operations): always-on surface audit phase 1 - cut cold-start anchor to the rule preamble and trim skill description catalogs [rules, skills, adapter, tests, docs] #1766test_every_port_anchors_the_same_bytes と同じ理由)。
  • hook 本体のコメントが Source of truth is this file; keep hooks-settings.md reference consistent. と述べているため、adapter/claude/hooks-settings.md / adapter/codex/hooks-config.md の記述も追従させる。
  • 正本を hook へ写さない。hook が運ぶのは terse な re-arm であり、Gate re-arm が Axis detail: rules/model/trigger-check-gate.md (always-on). で正本を指しているのと同じ形にする。

変更予定ファイル

  • adapter/claude/hooks/on-user-prompt.sh — 条件分岐を 2 分岐化(poll = 呼べ + 扱え / channel・mcp_hook = 扱え のみ)
  • adapter/codex/hooks/on-user-prompt.sh — 同上
  • adapter/codex/hooks/on-user-prompt.ps1 — 同上
  • adapter/claude/hooks-settings.md — mcp_hook 記述の追従
  • adapter/codex/hooks-config.md — 同上
  • docs/5.-Notifications.md / docs/6.-Adapter.md — 該当記述があれば追従
  • tests/ — 3 port が全 mode で取り扱い行を運ぶことの契約テスト

Metadata

Metadata

Assignees

Labels

bug動いていない、壊れているready本文が実装開始できる形まで収束している状態。ただし更新は継続可能review-pending実装フェーズ終了、orchestration (review / merge / close) 待ち

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions