Skip to content

CodeRabbit レビュー再開#62

Merged
HappyOnigiri merged 4 commits intomainfrom
cursor/coderabbit-e4e0
Mar 12, 2026
Merged

CodeRabbit レビュー再開#62
HappyOnigiri merged 4 commits intomainfrom
cursor/coderabbit-e4e0

Conversation

@HappyOnigiri
Copy link
Owner

@HappyOnigiri HappyOnigiri commented Mar 11, 2026

Summary

  • Automatically resumes CodeRabbit reviews when they fail due to a head commit change, improving automation reliability.

Related issues

  • Closes #

Changes

  • Added logic to detect CodeRabbit's "Review failed (The head commit changed...)" status comment.
  • Integrated auto-resume for this failure type, respecting coderabbit_auto_resume_max_per_run limits and preventing duplicate posts.
  • Modified completion logic to maintain refix:running status while an active Review failed comment exists.
  • Updated README.md, README.ja.md, and .refix.yaml.sample to document the new auto-resume trigger.

Testing

  • New unit tests cover Review failed detection, auto-resume posting, and per-run limit enforcement.
  • Verified with make ci.

Checklist

  • I verified the change locally or in CI as appropriate.
  • I added or updated tests when needed.
  • I updated documentation for user-facing changes.
  • I confirmed there are no unintended breaking changes, or documented them clearly.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • 新機能

    • レビュー失敗時の自動再開を追加。該当状態を検出すると設定に基づき自動で再開コマンドを投稿します(実行上限にカウント)。
  • 動作変更 / バグ修正

    • レビュー失敗がアクティブな場合、処理中ラベルを維持して重複した再開投稿を防止する挙動を追加。
  • ドキュメント

    • coderabbit_auto_resume の説明を英日ドキュメントとサンプル設定で拡張。重複回避と実行あたり上限の記載を明確化。
  • テスト

    • レビュー失敗自動再開と実行あたり上限を検証するテストを追加。

Co-authored-by: HappyOnigiri <nodemeld+happy-onigiri@gmail.com>
@cursor
Copy link

cursor bot commented Mar 11, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: eda17832-eb9a-4abb-befa-ba840e9f3e7f

📥 Commits

Reviewing files that changed from the base of the PR and between bc9802c and e4622fb.

📒 Files selected for processing (2)
  • README.md
  • src/auto_fixer.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

📝 Walkthrough

Walkthrough

CodeRabbitの「Review failed」ステータス検出と、それに基づく自動再開(resume)投稿ロジックをsrc/auto_fixer.pyに追加し、関連ドキュメントとテストを更新しました。公開APIの署名変更はなく、既存の自動再開フローを拡張しています。

Changes

Cohort / File(s) Summary
Documentation
\.refix\.yaml\.sample, README\.md, README\.ja\.md
coderabbit_auto_resumeの説明を「CodeRabbitが再開可能なときに自動再開する」に書き換え、レビュー失敗("Review failed" ヘッドコミット変更)による自動再開と重複回避条件、coderabbit_auto_resume_max_per_runの語彙を明確化。
Auto-fixer implementation
src/auto_fixer.py
CODERABBIT_REVIEW_FAILED_MARKER等を追加。_extract_coderabbit_review_failed_status_get_active_coderabbit_review_failed_maybe_auto_resume_coderabbit_review_failedを追加。_update_done_label_if_completedcoderabbit_review_failed_active引数を追加し、process_repoの呼び出し箇所へ該当フラグを伝播。自動再開判定フローにレビュー失敗ケースを組み込み。
Tests
tests/test_auto_fixer.py
レビュー失敗ステータス抽出、アクティブ判定、自動再開投稿、per-run制限への計上などを検証するテスト群を追加・拡張。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

refix:done

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトル「CodeRabbit レビュー再開」は変更セットの主要な機能(CodeRabbitのレビュー失敗時の自動再開)を簡潔に説明しており、開発者の観点から最も重要な変更を反映しています。
Description check ✅ Passed プルリクエストの説明は必須セクション(Summary、Related issues、Changes、Testing、Checklist)をすべて含んでおり、変更の目的と実装内容が明確に記載されています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/coderabbit-e4e0

Comment @coderabbitai help to get the list of available commands and usage tips.

@HappyOnigiri HappyOnigiri marked this pull request as ready for review March 11, 2026 23:43
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 177-183: Update the README.md to make the description of the
coderabbit_auto_resume setting consistent: in the Full schema block update the
coderabbit_auto_resume entry to state it resumes on both rate-limit windows and
when CodeRabbit posts a "Review failed" status comment caused by head-commit
changes (matching the earlier paragraph), and ensure the example
usage/documentation text and any default/boolean notes for
coderabbit_auto_resume reflect the same behavior so readers cannot miss the new
auto-resume trigger.

In `@src/auto_fixer.py`:
- Around line 2054-2055: active_review_failed set by
_get_active_coderabbit_review_failed is not passed through to
_update_done_label_if_completed on the no-review-target path, allowing a PR with
an active "Review failed" to be marked refix:done; update the calls to
_update_done_label_if_completed (including the no-review-target branch around
where resume_comment_posted_for_pr is used) to pass
coderabbit_review_failed_active=bool(active_review_failed) (and mirror the same
fix in the other affected block around lines 2082-2108) so the function receives
the active review-failed flag.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cee26cec-7ad9-41f3-a1e7-5e56e27e0b19

📥 Commits

Reviewing files that changed from the base of the PR and between 8fd5a92 and 5e69d14.

📒 Files selected for processing (5)
  • .refix.yaml.sample
  • README.ja.md
  • README.md
  • src/auto_fixer.py
  • tests/test_auto_fixer.py

@HappyOnigiri HappyOnigiri added the refix:running Refix is currently processing review fixes. label Mar 12, 2026
…rabbit_review_failed_active を追加

active_review_failed が CI-fix 後の完了判定に伝播せず、「Review failed」アクティブな
PR が誤って refix:done に遷移する可能性があった。
…d トリガーを追記

Full schema ブロックのコメントが rate-limit のみ記載で「Review failed」による
自動 resume トリガーが欠落していたため、説明文と一貫性を持つよう更新。
@HappyOnigiri
Copy link
Owner Author

HappyOnigiri commented Mar 12, 2026

🤖 Refix Status

処理済みレビュー一覧 (System Use Only)
Comment ID 処理日時
r3933141618 2026-03-12 10:53:21 JST
discussion_r2921548611 2026-03-12 10:53:22 JST
discussion_r2921548613 2026-03-12 10:53:22 JST
r3933423102 2026-03-12 11:01:22 JST

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/auto_fixer.py (1)

2431-2447: ⚠️ Potential issue | 🟠 Major

coderabbit_review_failed_active をこの呼び出しにも渡してください。

この no-review-target 経路だけ coderabbit_review_failed_active が未伝播です。active_review_failed が残っている PR でも _update_done_label_if_completed()refix:done に戻してしまい、auto_merge_enabled 次第ではそのまま auto-merge 判定まで進み得ます。

修正例
                 _update_done_label_if_completed(
                     repo=repo,
                     pr_number=pr_number,
                     has_review_targets=False,
                     review_fix_started=review_fix_started,
                     review_fix_added_commits=review_fix_added_commits,
                     review_fix_failed=review_fix_failed,
                     state_saved=True,
                     commits_by_phase=commits_by_phase,
                     pr_data=pr_data,
                     review_comments=review_comments,
                     issue_comments=issue_comments,
                     dry_run=dry_run,
                     summarize_only=summarize_only,
                     auto_merge_enabled=auto_merge_enabled,
                     coderabbit_rate_limit_active=bool(active_rate_limit),
+                    coderabbit_review_failed_active=bool(active_review_failed),
                 )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/auto_fixer.py` around lines 2431 - 2447, The no-review-target call to
_update_done_label_if_completed is missing the coderabbit_review_failed_active
flag so PRs with active_review_failed can be incorrectly marked refix:done and
potentially auto-merged; update this invocation to pass
coderabbit_review_failed_active=coderabbit_review_failed_active (matching other
call sites) so the function receives and respects that state when deciding label
updates and auto-merge behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/auto_fixer.py`:
- Around line 2431-2447: The no-review-target call to
_update_done_label_if_completed is missing the coderabbit_review_failed_active
flag so PRs with active_review_failed can be incorrectly marked refix:done and
potentially auto-merged; update this invocation to pass
coderabbit_review_failed_active=coderabbit_review_failed_active (matching other
call sites) so the function receives and respects that state when deciding label
updates and auto-merge behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 93c55c41-db2a-4d8e-bcff-ee517eb7750f

📥 Commits

Reviewing files that changed from the base of the PR and between 5e69d14 and bc9802c.

📒 Files selected for processing (2)
  • src/auto_fixer.py
  • tests/test_auto_fixer.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/test_auto_fixer.py

@HappyOnigiri HappyOnigiri added refix:done Refix finished review checks/fixes for now. and removed refix:running Refix is currently processing review fixes. labels Mar 12, 2026
@HappyOnigiri HappyOnigiri merged commit 3e1837a into main Mar 12, 2026
2 checks passed
@HappyOnigiri HappyOnigiri deleted the cursor/coderabbit-e4e0 branch March 12, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refix:done Refix finished review checks/fixes for now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants