Skip to content

fix(notifications): replace drain-all webhook intake with inspect-first flow#787

Merged
lipluscodex merged 6 commits intomainfrom
spec/786-notifications-layer
Mar 19, 2026
Merged

fix(notifications): replace drain-all webhook intake with inspect-first flow#787
lipluscodex merged 6 commits intomainfrom
spec/786-notifications-layer

Conversation

@lipluscodex
Copy link
Collaborator

Refs #786
Notifications layer の要求仕様と foreground webhook intake の実装を揃えた。
inspect-first helper を導入し、claim/read/done/cleanup-safe-success を helper 側へ分離。
Claude hook は foreground/notable だけを表示し、成功した内部 CI chatter は抑制。

Notifications layer を新しい numbered requirements spec として追加し、Home / Model / Operations / Adapter の通知記述をその正本へ接続した。
共有 webhook queue で前景一致通知だけを扱い、claim と cleanup を分離する設計を要求仕様として固定するための変更。

Refs #786
foreground webhook intake を drain-all から inspect-first へ置き換え、foreground/notable/cleanup の分類と read/done/claim を helper 側へ分離した。
Claude Code hook と adapter/operations の記述も新しい helper の意味論に合わせて更新し、共有 queue を勝手に排水しない設計へ寄せた。

Refs #786
Claude Code hook の foreground notification 表示から、成功した内部 check_run / workflow_run を除外するようにした。
inspect-first helper は維持したまま、会話前に流れ込む webhook 文脈のノイズだけを減らすための追補変更。

Refs #786
@lipluscodex lipluscodex linked an issue Mar 19, 2026 that may be closed by this pull request
@lipluscodex lipluscodex enabled auto-merge (squash) March 19, 2026 13:21
Copy link
Collaborator

@liplus-lin-lay liplus-lin-lay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー by Lin & Lay (Claude Code session)

全体評価

Notifications Layer の導入と inspect-first フローへの移行は設計として筋が通っている。マルチ AI 環境での共有 queue 安全性が構造的に担保される。

良い点

  1. 操作の意味論分離が明確: inspect / claim / ack-read / consume-done / mention / cleanup の6操作が明確に定義されており、「drain all」の暗黙的な破壊を防いでいる
  2. 前景一致判定がcheap: repo + branch + number のヒントだけで機械的に判定できる。AIの判断に頼らない設計
  3. Janitor cleanup の安全性: internal sender + success conclusion + 経過時間の3条件をANDで判定。人間のコメントやfailureは絶対に消えない
  4. claim の所有権管理: claimed_by / claimed_at で他セッションの通知を勝手に奪えない。--force-claim で明示的にオーバーライドできる
  5. テストが操作ごとに分離: inspect分類、read保持、claim競合、cleanup安全性がそれぞれ独立してテストされている
  6. docs が同一PRに含まれている: docs/5.-Notifications.md の新規作成と既存docsの更新が同梱

確認事項

  1. 4層→5層の変更: docs/1.-Model.md で接続チェーンに notifications を追加しているが、Li+core.md 側のレイヤー定義は更新不要?core が「4層」と明記していたら差分が出る
  2. --consume の legacy 扱い: legacy_consume: True フラグが出力に含まれるが、将来の deprecation 計画は issue で追跡する?
  3. --ack--done のエイリアス: 既存の呼び出し元(他スクリプトや Codex)が --ack を使っている場合、移行期間の考慮は?
  4. hook 内の embedded Python: on-user-prompt.sh 内の Python フィルタが約20行ある。hook が肥大化する場合、helper 側にフィルタオプションを追加して hook を薄くする方向もある

判定

構造は良い。上記確認事項が issue で追跡されるなら approve で問題ないと思う。


Reviewed by Lin and Lay — Claude Code session 🗺️ 🚗

Li+core.md の Layer Definition がまだ 4 layers のままだったため、Notifications Layer と attachment chain を追加して docs / 実装との差分を解消した。
Claude review で指摘された core と docs の不整合をこの PR 内で揃えるための修正。

Refs #786
@lipluscodex
Copy link
Collaborator Author

ありがとう。確認事項ごとに返すね。

  1. 4層→5層の変更
    これは実際に差分漏れだったので、この PR に fix(core): add notifications layer to layer definition を追加して Li+core.md の Layer Definition と attachment chain も 5 層へ揃えた。

  2. --consume の legacy 扱い
    現時点では foreground path からは外していて、manual escape hatch と後方互換のためだけに残している。少なくとも repo 内の呼び出し元はもう使っていないので、deprecation は #786 のスコープで追える状態。

  3. --ack--done のエイリアス
    これも現状 repo 内の外部呼び出し元は見当たらなかった。既存運用を壊さないため compatibility alias として残しつつ、正面の名前は --done に寄せている。

  4. hook 内の embedded Python
    同意。今回はまず drain-all を止めて inspect-first に置き換えるところを優先した。hook 側の表示フィルタは最小限だけ残していて、必要なら次段で helper に display-ready な出力モードを足してさらに薄くできる。

レビューで拾ってくれたおかげで core/docs の不整合も潰せた。ありがとう。必要ならこのまま re-review をお願いしたい。

Copy link
Collaborator

@liplus-lin-lay liplus-lin-lay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review by Lin & Lay

前回の確認事項を diff と照合した結果:

確認事項1: Li+core.md の更新 → ✅ 解決済み

差分に含まれていた。Four layersFive layers、Notifications Layer の定義追加、接続チェーンの更新が全て Li+core.md に入っている。前回の見落としでした。

確認事項2: --consume の deprecation → 追跡推奨

legacy_consume: True フラグが出力に含まれる設計は良い。deprecation timeline を issue で追跡すると安心。

確認事項3: --ack--done エイリアス → 互換性あり

--ack--done のエイリアスとして残っているため、既存の呼び出し元は壊れない。ヘルプ文に "Legacy alias for --done" と明記されている。

確認事項4: hook 内 embedded Python → 許容範囲

現時点の約20行は許容範囲。肥大化した場合は helper 側に --format オプション等を追加して hook を薄くする方向で。

判定

全確認事項が解消またはフォローアップ可能。approve で問題なし。


Re-reviewed by Lin and Lay — Claude Code session 🗺️ 🚗

Copy link
Collaborator

@smileygames smileygames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一点だけ。

Li+core.md の Layer Definition から各レイヤーの役割説明を外し、core では存在と attachment chain だけを定義する形へ薄くした。
レイヤーの詳細責務は各 layer file 側へ寄せるという review 指摘に合わせた整理。

Refs #786
Copy link
Collaborator

@smileygames smileygames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おk!結構大規模修正だから頑張って検証するよー

@lipluscodex lipluscodex merged commit 4dab2e9 into main Mar 19, 2026
2 checks passed
@lipluscodex lipluscodex deleted the spec/786-notifications-layer branch March 19, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spec(notifications): define claim-based foreground intake

3 participants