Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions docs/coderabbit-monitoring-efficiency.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,11 @@ ADR-018 が廃止したのは「同一プロセス内で 4 段間接連携 (daem

### 進捗

- ✅ **Bb-1 (順位 53) — マージ済 (PR #113、2026-05-05)**: `cli-pr-monitor` の rate-limit retry を CronCreate park モデルに切り替え (詳細 PR description 参照)。post-merge-feedback で T2-2 のみ採用 (順位 75)、T3-1/T3-2 はユーザー判断で却下 (memory: feedback_no_unenforced_rules)。
- 🚧 **Bb-2 (順位 54) + 順位 75 (T2-2 Bb-1 follow-up) — 実装完了 (未 PR / 未マージ、2026-05-05)**: review 完了待ちを CronCreate park モデルに展開し、polling 完全排除 + 二重 polling (45s gh API + 5s observer) を撤廃。T2-2 の sibling parity 回帰テストを同 PR で bundled。
- `PrMonitorState` に `review_recheck_count` を追加、wakeup 跨ぎで `build_state_for_iteration` が値を保持
- `wakeup_reason` 値に `"review_recheck"` を追加 (Bb-1 の `"rate_limit_retry"` と sibling)
- `run_poll_loop(is_wakeup: bool)` を single-iteration model に書き換え:
- `is_wakeup=false` (fresh push): checker 未呼び出し → `finalize_initial_review_park` で `INITIAL_REVIEW_WAIT_SECS=300s` 後の wakeup 予約 + park signal emit + early return (todo5.md spec 準拠、CR review 開始前の wasteful API call 回避)
- `is_wakeup=true` (CronCreate wakeup): `run_one_iteration` で 1 回 check → terminal / rate-limit park (Bb-1) / `finalize_review_recheck_park` (Bb-2) のいずれか
- `finalize_review_recheck_park` / `schedule_next_review_recheck_park`: `review_recheck_count` をインクリメント、`MAX_REVIEW_RECHECKS=3` 到達なら `action_required` で抜ける (review が想定時間内に未完了通知)
- `format_review_park_signal`: `[PR_MONITOR_PARK]` envelope に `reason: review_recheck` discriminator 付き、Bb-1 と同一 format で Claude Code 側パーサが両 signal を統一処理可能
- 既存 `format_park_signal` (Bb-1) にも `reason: rate_limit_retry` 追加で uniformity
- `run_monitor_only` に `detect_wakeup_resume`: 既存 state の `pr` / `repo` 一致 + `next_wakeup_at_unix <= now` で wakeup 判定、該当時は state.started_at を push_time として継続 + `start_monitoring_wakeup` で reset skip
- `state_file_path()` に env 変数 `PR_MONITOR_STATE_FILE_OVERRIDE` 経路追加 (T2-2 fault injection 用、本番コードは env 設定なしで挙動変化なし)
- `observe.rs` 削除 + `pnpm observe-pr` script 削除 + `--observe` 引数削除 (single-iteration 化で polling 自体が消えたため observer も不要、ADR-018 addendum を実質 supersede)
- `MonitorConfig::poll_interval_secs` を `#[allow(dead_code)]` で marker (Bb-3 で削除予定、後方互換のため保持)
- `print_report` を `parked_review_recheck` verdict 対応に拡張
- 副次的 refactor (touch-trigger ratchet 適用): `start_monitoring_inner` を `try_acquire_monitor_lock` + `init_or_resume_state` + `run_takt_stage` (+ `invoke_takt_into_outcome`) + `finalize_repush` に分割、`format_review_park_signal` を `collect_review_park_fields` + format に分割、`finalize_review_recheck_park` を `finalize_review_recheck_max_reached` + `schedule_next_review_recheck_park` に分割
- **T2-2 (順位 75 follow-up)** ★: 3 件の write_state 失敗時 fail-safe 回帰テスト追加
- `finalize_parked_returns_action_required_when_write_state_fails`: rate-limit park の fail-safe 確認
- `schedule_next_review_recheck_park_returns_action_required_when_write_state_fails`: review park の fail-safe 確認 (sibling parity)
- `finalize_park_siblings_have_symmetric_write_state_handling`: 両 sibling とも write 失敗で `action_required` に収束する invariant を 1 テストで machine-enforce (Bb-3 で新 `finalize_*` 追加時に invariant 違反を test 失敗で検出)
- 全 123 テスト pass、clippy clean、release ビルド済 (`.claude/cli-pr-monitor.exe` 配置済)
- ⏳ **Bb-3 (順位 55)** — 未着手 (Bb-2 land 後、`monitor.toml` 設定外出し + SessionStart catch-up)
- ✅ **Bb-1 (順位 53) — マージ済 (PR #113、2026-05-05)**: `cli-pr-monitor` の rate-limit retry を CronCreate park モデルに切り替え。post-merge-feedback で T2-2 のみ採用 (順位 75)、T3-1/T3-2 はユーザー判断で却下 (memory: feedback_no_unenforced_rules)。
- ✅ **Bb-2 (順位 54) + 順位 75 (T2-2 Bb-1 follow-up) — マージ済 (PR #114、2026-05-05)**: review 完了待ちを CronCreate park モデルに展開し、polling 完全排除 + 二重 polling (45s gh API + 5s observer) を撤廃。T2-2 の sibling parity 回帰テストを同 PR で bundled。CR Major 2 件 (head 不一致時の wakeup 誤判定 / fresh push での recheck count 持ち越し) は fold-in 修正で land。post-merge-feedback で 2 件採用 / 5 件様子見 / 3 件却下 (詳細レポート: `.claude/feedback-reports/114.md`)。
- ✅ **Bb-3 (順位 55) — 実装完了 (2026-05-05、PR 起票準備中)**: `[review_recheck]` config セクションを `pr-monitor-config.toml` に追加し旧 hard-coded const (INITIAL_REVIEW_WAIT_SECS / REVIEW_RECHECK_WAIT_SECS / MAX_REVIEW_RECHECKS) を `PollContext` 経由で thread。SessionStart hook (`hooks-session-start`) に catch-up nudge を追加 (state.action が `parked_*` かつ `next_wakeup_at_unix <= now` のとき additionalContext に `[PR_MONITOR_CATCHUP]` を注入)。MonitorConfig::poll_interval_secs (Bb-2 で未使用化) を削除し既存 toml は legacy フィールド無視で後方互換。T2-2 follow-up として `finalize_park_siblings_have_symmetric_write_state_handling` を 3 sibling 化 (`finalize_initial_review_park` を追加)。
- **設計判断: SessionStart catch-up は別プロセス spawn せず additionalContext で nudge** (advisor 推奨 option b)。Windows 環境での handle 継承 / stdout 可視性問題を回避し、PARK signal flow を session 内に保つ。
- **false-positive 抑制**: terminal action (`action_required` / `passed_clean` / `continue_monitoring`) では `next_wakeup_at_unix` が古い park 由来で残っていても nudge を出さない (action prefix `parked_` を gate に使用)。

---

Expand Down
7 changes: 3 additions & 4 deletions docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
| 49 | 🔧 Tier 2 | **`parse_findings` 系の error-path test infrastructure (PR #101 T2-1) ★ Bundle a Sub-PR 2** | todo5.md | M | 順位 42 / 43 / 46 と同 PR (Sub-PR 2、`unwrap_or_else(\|_\| empty)` silent fail 抑止 + cli-pr-monitor mock infra 流用) |
| 51 | 🚀 Tier 1 | **`.takt/review-diff.txt` を fix→review iteration 間で refresh (PR #103 観測)** | todo5.md | M | なし (PR #103 で stale-diff false positive による wasted iter ×2 = ~10 分浪費を実観測、6-iter outlier の構造的根因対策、Bundle Z 3 層では塞げない独立改善) |
| 52 | 💎 Tier 3 | **comment-lint hook の MultiEdit 対応 (順位 50 follow-up)** | todo5.md | S | なし (順位 50 で v1 = Edit のみ実装、MultiEdit は whole-file fallback で no-regression、利用頻度低く優先度は低) |
| 53 | 🚀 Tier 1 | **rate-limit retry の CronCreate 化 (Bundle b PR-1) ★ Bundle b** | todo5.md | M | なし (PR #104 で 47 min rate-limit 検出 → 現状 `max_duration_secs=600s` cap でバウンス → `action_required` 通知 = auto-retry 不能。CronCreate で reset_at+60s に wakeup 仕掛けることで長時間待機を可能にする致命点解消) |
| 54 | 🔧 Tier 2 | **review 完了待ちの CronCreate 化 + observer 廃止 (Bundle b PR-2) ★ Bundle b** | todo5.md | M | 順位 53 land 後 (Bb-1 で導入する Cron 機構を review 完了待ちにも展開、45s polling + 5s observer polling を完全排除、固定値 wakeup 化) |
| 55 | 💎 Tier 3 | **config 拡張 + SessionStart catch-up (Bundle b PR-3) ★ Bundle b** | todo5.md | S | 順位 53 / 54 land 後 (固定値の `monitor.toml` 化 + Claude Code 不在時に発火した wakeup を SessionStart で catch-up、AI 不在時の silent loss 防止) |
| 55 | 💎 Tier 3 | **✅ 完了 (Bb-3、PR 起票準備中、2026-05-05): config 拡張 + SessionStart catch-up + T2-2 follow-up (Parity test coverage 拡張)** | todo5.md | S+S | 完了内容: `[review_recheck]` config セクション追加 + `MonitorConfig::poll_interval_secs` 削除 + `PollContext` scalar threading + SessionStart hook の catch-up nudge (action=`parked_*` gate で false-positive 抑制) + parity test を 3 sibling 化。設計判断詳細は `docs/coderabbit-monitoring-efficiency.md` Bb-3 エントリ |
| 56 | 🔧 Tier 2 | **comment-lint hook test 拡充 (PR #104 T2-1+T2-2 bundle)** | todo5.md | S | なし (UTF-8 multi-byte 5 パターン + block comment boundary 6 パターンを `locate_string_line_ranges` / `span_overlaps_ranges` の回帰テストとして体系化、PR #104 Critical/Minor fix の固定化) |
| 57 | 🔧 Tier 2 | **Aggregation cap integration test (PR #105 T2-1 採用)** | todo5.md | S | なし (`collect_all_violations` の MAX_VIOLATIONS contract を test 化、将来の lint 追加時に `truncate(MAX)` 削除 regression を防止する explicit 安全網) |
| 60 | 💎 Tier 3 | **analyze-session の transcript filter 絞り込み (旧 #A-3)** | todo5.md | M | なし (旧 docs/pipeline-token-efficiency.md #A-3、ADR-036/037 化に伴い計画書削除、本 task のみ todo に移管。analyze-session の input range を PR 作成 commit〜merge に限定して input token 30-50% 削減見込み、dogfood で実測必要) |
Expand All @@ -69,7 +67,6 @@
| 67 | 💎 Tier 3 | **ADR-030 に abrupt 終了時の振る舞いを spec として明記 (PR #109 T3-2 採用) ★ Bundle c** | todo5.md | XS | 順位 63 / 64 と同 PR (実装と仕様の整合性確保、L1 in-process Drop guard + L2 out-of-process reaper の責務分離 + SLA 化) |
| 68 | 🔧 Tier 2 | **`no-ephemeral-todo-reference` self-exclusion invariant 単体テスト追加 (PR #110 T2-1 採用) ★ Bundle d** | todo5.md | S | なし (PR #110 直接対策、placeholder N 戦略の machine-enforceable 保護、TP/FP/Edge 3 軸テスト) |
| 69 | 💎 Tier 3 | **`no-ephemeral-todo-reference` の `yaml`/`yml` extensions 追加理由をコメントで明記 (PR #110 T3-1 採用) ★ Bundle d** | todo5.md | XS | なし (rule⑥ コメント欄に 1-2 行追記、設計 doc と実装の経緯保存、git blame 不要化) |
| 75 | 🔧 Tier 2 | **`finalize_parked` write_state 失敗時 fail-safe の回帰テスト追加 (PR #113 T2-2 採用) ★ Bb-1 follow-up** | todo5.md | S | なし (PR #113 で `finalize_posted_retrigger` との error path 対称性を後付け修正、本 task は test 固定化。durable な re-park ループ regression を防止、`finalize_*` sibling parity の machine-enforceable 保護) |

**戦略**: Tier 1 を 2〜3 セッションで片付け → Tier 2 で ADR-032 の前提 + rate-limit + convergence cost 削減を進める → Tier 3 で ADR-032 を land + ドキュメント整備。Tier 4-5 は cleanup / 外部展開で daily efficiency への直接効果は小さい。

Expand Down Expand Up @@ -101,6 +98,8 @@

**PR #113 (Bb-1 = Bundle b PR-1) post-merge-feedback (2026-05-05)**: 9 findings に対して **1 件のみ採用** (順位 75 = T2-2 の `finalize_parked` write_state 失敗時 fail-safe 回帰テスト)。T1 #1/#2 (lint rule 案) は NLP 必要 / FP リスクで却下、T2-1 (Windows path test) / T2-3 (state cycle integration) / T2-4 (CronCreate format lint) は ROI 不見合いで不採用、**T3-1 / T3-2 (`~/.claude/rules/common/coding-style.md` への ルール追記)** は **ユーザー判断で却下** — 「強制力のないルール追加は却下: 機械検知できなければ何もしない方がマシ。ルール乱立は重要ルール埋没の害悪」(memory: feedback_no_unenforced_rules.md として codify 済)、T3-3 (PARK signal 設計 ADR) は premature で 🤔 様子見保留。**本 PR 含意**: Bb-1 の sibling parity invariant (`finalize_*` 群の error path 対称性) は Bb-2 / Bb-3 で同種関数を追加する際に再発確度が高いため、**test レベルで machine-enforceable に保護** することを Bb-2 着手前の前提条件とする。

**PR #114 (Bb-2 + 順位 75 = Bundle b PR-2 + T2-2) post-merge-feedback (2026-05-05)** ✅ 完了: 9 findings に対して **2 件採用 / 5 件様子見 / 3 件却下**。**Bb-3 (順位 55) で fold-in する採用提案**: T2-2 (Parity test coverage 拡張 = `finalize_park_siblings_have_symmetric_write_state_handling` テストに `finalize_initial_review_park` を追加、self-violation 解消、Effort S)。T2-1 (Legacy JSON deserialize test) は **PR #114 で既に実装済** (`state_legacy_json_without_new_fields_deserializes_with_defaults`、Bb-3 以降の新フィールド追加時に同 pattern を継続するための reference として保存)。**様子見 (5 件)**: T1-1 (finalize_* parity lint、Effort M + NLP 必要、簡易プロキシで再評価) / T1-2 (polling block lint、FP リスクで dogfood 後判断) / T2-3 (env override コメント強化、XS Low) / T2-4 (CI parallel race 確認、preventive only) / T3-1 (Wakeup Resume Invariant ADR) / T3-2 (DI 戦略 ADR、Bb-3 着手時に再検討)。**却下 (3 件)**: T1-3 (Serde schema lint、ROI 低、T2-1 で代替) / T3-3 (parity invariant の global rules 追加) / T3-4 (test-only env var prefix rule) — 後 2 件は **memory: feedback_no_unenforced_rules.md** を直接引用してアナライザが正しく即却下判定。Bb-2 land 時点で Bundle b の核 (CronCreate park モデル) 完成、残る Bb-3 は config 整理 + SessionStart catch-up + T2-2 follow-up を bundled。

---

## 現在進行中
Expand Down
Loading