feat/add ci failure handling instructions - #346
Conversation
PR作成後にCIが失敗した場合、そのブランチで解決できる問題は 必ず修正するよう指示するルールを追加しました。 ## 変更内容 - `.claude/CLAUDE.md`: セクション2.5としてCI失敗対応ルールを追加 - `.claude/commands/create-pr.md`: Step 8としてCI失敗時のフォローアップ手順を追加 ## 追加された指示 - CIが緑になるまでPRを放置しない - 修正可能な問題は自分のブランチで解決する - 解決不能な場合は原因と状況を明記してレビュアーに報告 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR作成ワークフローにOpenAI Codexによるコードレビューを追加しました。 ## 変更内容 - `/codex-review`コマンドを新規作成 - `codex exec`を使用した非対話モードでのレビュー実行 - 正確性・性能・セキュリティ・保守性・DXの観点でレビュー - verdict(正/誤)とconfidenceスコアを出力 - `create-pr.md`にStep 5としてCodexレビューを追加 - PR作成前にCodexレビューを実行 - verdictが"patch is incorrect"の場合は修正を実施 - レビュー結果をPR本文に記載 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR本文テンプレートの未定義変数を説明的なテキストに修正しました。
## 修正内容
- `${VERDICT}`、`${CONFIDENCE}`、`${ISSUES_COUNT}`を
説明的なプレースホルダーに変更
- レビュー結果の記録方法を明確化
## Codex Review
- Verdict: patch is correct
- Confidence: 1.0
- 指摘事項: 1件(対応済み)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR作成ワークフローからCodex ReviewとCI Checkのステップを削除し、 Skillsとして分離しました。 ## 変更内容 - `.claude/skills/codex-review.md`: Codex Review skillを新規作成 - `.claude/skills/ci-check.md`: CI Check skillを新規作成 - `.claude/commands/create-pr.md`: Skills参照セクションを追加 - `.claude/commands/codex-review.md`: 削除(Skillsに移行) ## 動作 PR作成後、以下のSkillsが自動的に適用されます: 1. Codex Review: コードレビューを実行 2. CI Check: CIの結果を確認し、失敗時は修正 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds AI review and CI-check documentation plus two new Claude hooks (post-PR and pre-exit-plan) and updates the Claude settings template to register those hooks and allow Codex/Gemini execution permissions. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Claude
participant Bash as "Bash Tool"
participant GitHub as "GitHub/gh"
participant Codex
participant Gemini
User->>Claude: Create PR (push + request)
Claude->>Bash: Execute: gh pr create
Bash->>GitHub: Create PR
GitHub-->>Bash: PR URL
Bash-->>Claude: Tool output (stdout/stderr)
Note over Claude: PostToolUse hook -> post_pr_ai_review.py
Claude->>Claude: Extract PR URL, detect Codex/Gemini
par AI reviews (non-blocking)
Claude->>Codex: Run read-only review (codex exec)
Codex-->>Claude: Verdict + details
and
Claude->>Gemini: Run diff-based review
Gemini-->>Claude: Verdict + details
end
Claude-->>Claude: Emit structured outputs to stderr and exit 0
sequenceDiagram
actor User
participant Claude
participant ExitPlanMode
participant FS as "File System (~/.claude/plans)"
participant Codex
participant Gemini
User->>Claude: Invoke ExitPlanMode
Claude->>ExitPlanMode: Trigger
Note over Claude: PreToolUse hook -> pre_exit_plan_ai_review.py
Claude->>FS: Locate latest plan.md
FS-->>Claude: Plan content
Claude->>Claude: Detect Codex/Gemini, build prompts
par AI plan reviews (blocking)
Claude->>Codex: Run plan review
Codex-->>Claude: Verdict
and
Claude->>Gemini: Run plan review
Gemini-->>Claude: Verdict
end
Claude->>Claude: Aggregate verdicts
alt Any tool => "needs revision"
Claude-->>User: Print messages, exit 2 (block)
else
Claude-->>User: Print success, exit 0 (proceed)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (4)📓 Common learnings📚 Learning: 2025-12-01T03:45:17.253ZApplied to files:
📚 Learning: 2026-01-12T10:08:03.062ZApplied to files:
📚 Learning: 2026-01-12T10:08:03.062ZApplied to files:
🧬 Code graph analysis (1).claude/hooks/post_pr_ai_review.py (1)
🪛 Ruff (0.14.11).claude/hooks/post_pr_ai_review.py29-29: Comment contains ambiguous (RUF003) 29-29: Comment contains ambiguous (RUF003) 41-41: Comment contains ambiguous (RUF003) 41-41: Comment contains ambiguous (RUF003) 54-54: String contains ambiguous (RUF001) 54-54: String contains ambiguous (RUF001) 86-86: (S603) 102-102: String contains ambiguous (RUF001) 102-102: String contains ambiguous (RUF001) 103-103: Do not catch blind exception: (BLE001) 108-108: Docstring contains ambiguous (RUF002) 108-108: Docstring contains ambiguous (RUF002) 116-116: Starting a process with a partial executable path (S607) 128-128: (S603) 129-129: Starting a process with a partial executable path (S607) 140-140: Comment contains ambiguous (RUF003) 140-140: Comment contains ambiguous (RUF003) 154-154: (S603) 169-169: String contains ambiguous (RUF001) 169-169: String contains ambiguous (RUF001) 170-170: Do not catch blind exception: (BLE001) 186-186: Comment contains ambiguous (RUF003) 186-186: Comment contains ambiguous (RUF003) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (7)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.claude/skills/codex-review.md:
- Around line 18-20: The long reviewer prompt is embedded directly in the codex
exec command which is hard to maintain and escape; refactor by extracting the
prompt into a heredoc assigned to a PROMPT variable (using cat <<'EOF' ... EOF)
and then invoke codex exec --sandbox read-only "$PROMPT", or alternatively store
the prompt text in a separate file (e.g.,
.claude/prompts/codex-review-prompt.txt) and call codex exec --sandbox read-only
"$(cat .claude/prompts/codex-review-prompt.txt)"; update the invocation that
previously contained the inline prompt to use PROMPT (or the cat file
substitution) and ensure quoting preserves literal content.
🧹 Nitpick comments (1)
.claude/CLAUDE.md (1)
63-79: Consider consolidating duplicated CI failure principles.The three principles listed here (lines 76-78) are duplicated verbatim in
.claude/skills/ci-check.md(lines 58-60). This creates maintenance overhead if the guidelines need updates in the future.💡 Recommendation to reduce duplication
Consider one of these approaches:
Option 1: Keep high-level guidance here in CLAUDE.md and reference it from ci-check.md:
## 原則 -- CIが緑になるまでPRを放置しない -- 修正可能な問題は自分のブランチで解決する -- 解決不能な場合は原因と状況を明記してレビュアーに報告 +詳細は [CLAUDE.md § 2.5](./../CLAUDE.md#25-pr作成後のci失敗対応) を参照。Option 2: Keep detailed workflow in ci-check.md and link from CLAUDE.md:
-**原則**: - -- CIが緑になるまでPRを放置しない -- 修正可能な問題は自分のブランチで解決する -- 解決不能な場合は原因と状況を明記してレビュアーに報告 +詳細な対応フローは [CI Check Skill](./skills/ci-check.md) を参照。
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.claude/CLAUDE.md.claude/commands/create-pr.md.claude/skills/ci-check.md.claude/skills/codex-review.md
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Follow the GitHub Issues workflow: create issues with clear requirements and acceptance criteria, mention claude for AI assistance, ensure quality checks pass, and conduct human code review in PRs
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Use GitHub Actions and Claude Code integration for automated issue resolution, PR review support, quality checks, and documentation synchronization
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/claude.yml : Trigger automatic AI assistance on claude mentions in issues, PRs, and comments using .github/workflows/claude.yml
📚 Learning: 2026-01-12T10:08:03.062Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Use GitHub Actions and Claude Code integration for automated issue resolution, PR review support, quality checks, and documentation synchronization
Applied to files:
.claude/skills/codex-review.md.claude/commands/create-pr.md.claude/skills/ci-check.md.claude/CLAUDE.md
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to {.codex/**,.devcontainer/codex*,package*.json,npm/global.json} : Use Conventional Commits format with release-triggering types (feat/fix/perf/revert/docs) for commits touching .codex/**, .devcontainer/codex*, package*.json, or npm/global.json
Applied to files:
.claude/skills/codex-review.md
📚 Learning: 2026-01-12T10:08:03.062Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Follow the GitHub Issues workflow: create issues with clear requirements and acceptance criteria, mention claude for AI assistance, ensure quality checks pass, and conduct human code review in PRs
Applied to files:
.claude/commands/create-pr.md.claude/skills/ci-check.md.claude/CLAUDE.md
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/claude.yml : Trigger automatic AI assistance on claude mentions in issues, PRs, and comments using .github/workflows/claude.yml
Applied to files:
.claude/commands/create-pr.md.claude/skills/ci-check.md.claude/CLAUDE.md
📚 Learning: 2026-01-12T10:08:03.062Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Follow the development quality standards defined in `CLAUDE.md`
Applied to files:
.claude/skills/ci-check.md.claude/CLAUDE.md
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/ci.yml : Validate code quality in CI pipeline (.github/workflows/ci.yml) with linting, formatting, testing, and building
Applied to files:
.claude/skills/ci-check.md
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Use structured approach for AI prompt design with clear separation between requirements gathering and code generation phases, emphasizing test-first development practices
Applied to files:
.claude/CLAUDE.md
🔇 Additional comments (7)
.claude/commands/create-pr.md (2)
242-256: Good architectural separation of concerns.Extracting the Codex Review and CI Check workflows into separate skill files (referenced here) promotes modularity and reusability. This approach allows these skills to be invoked independently from other workflows.
238-256: No duplication found—section appears only once.The "PR作成後のフォローアップ(Skills)" section exists only at line 238 and is not duplicated. No action is needed.
Likely an incorrect or invalid review comment.
.claude/skills/codex-review.md (2)
1-13: Clear prerequisites and scope definition.The frontmatter description and prerequisites clearly establish when and how this skill should be applied.
22-36: Well-structured verdict handling workflow.The three-tier response strategy (correct verdict, incorrect verdict, and severity-based prioritization) provides clear actionable guidance.
.claude/skills/ci-check.md (3)
35-45: Comprehensive and actionable failure patterns.The table covers common CI failure scenarios with specific remediation commands. The patterns are practical and the responses are concrete.
20-34: Clear three-step remediation workflow.The structured flow (identify → fix → verify) provides a systematic approach to CI failure resolution, aligning with the principles defined in CLAUDE.md.
9-18: GitHub CLI commands are correct and complete.All commands and flags have been verified:
gh pr checks,gh run list --limit, andgh run view --log-failedare valid and work as documented.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| ```bash | ||
| codex exec --sandbox read-only "You are acting as a reviewer for a proposed code change made by another engineer. Focus on issues that impact correctness, performance, security, maintainability, or developer experience. Flag only actionable issues introduced by the change. When you flag an issue, provide a short, direct explanation and cite the affected file and line range. Prioritize severe issues and avoid nit-level comments unless they block understanding of the diff. After listing findings, produce an overall correctness verdict ('patch is correct' or 'patch is incorrect') with a concise justification and a confidence score between 0 and 1. Review the current branch against origin/main. Use git merge-base to find the merge base, then review the diff from that merge base to HEAD." | ||
| ``` |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Refactor embedded prompt for maintainability.
The 500+ character prompt is embedded directly in the bash command, making it difficult to maintain, version, and modify. Prompt changes require careful attention to bash escaping and quoting.
♻️ Proposed refactor using heredoc
-```bash
-codex exec --sandbox read-only "You are acting as a reviewer for a proposed code change made by another engineer. Focus on issues that impact correctness, performance, security, maintainability, or developer experience. Flag only actionable issues introduced by the change. When you flag an issue, provide a short, direct explanation and cite the affected file and line range. Prioritize severe issues and avoid nit-level comments unless they block understanding of the diff. After listing findings, produce an overall correctness verdict ('patch is correct' or 'patch is incorrect') with a concise justification and a confidence score between 0 and 1. Review the current branch against origin/main. Use git merge-base to find the merge base, then review the diff from that merge base to HEAD."
-```
+```bash
+# Codexレビュー用プロンプト
+PROMPT=$(cat <<'EOF'
+You are acting as a reviewer for a proposed code change made by another engineer.
+Focus on issues that impact correctness, performance, security, maintainability, or developer experience.
+Flag only actionable issues introduced by the change.
+When you flag an issue, provide a short, direct explanation and cite the affected file and line range.
+Prioritize severe issues and avoid nit-level comments unless they block understanding of the diff.
+After listing findings, produce an overall correctness verdict ('patch is correct' or 'patch is incorrect')
+with a concise justification and a confidence score between 0 and 1.
+Review the current branch against origin/main.
+Use git merge-base to find the merge base, then review the diff from that merge base to HEAD.
+EOF
+)
+
+codex exec --sandbox read-only "$PROMPT"
+```
Alternatively, store the prompt in a separate file:
```bash
# .claude/prompts/codex-review-prompt.txt に保存
codex exec --sandbox read-only "$(cat .claude/prompts/codex-review-prompt.txt)"🤖 Prompt for AI Agents
In @.claude/skills/codex-review.md around lines 18 - 20, The long reviewer
prompt is embedded directly in the codex exec command which is hard to maintain
and escape; refactor by extracting the prompt into a heredoc assigned to a
PROMPT variable (using cat <<'EOF' ... EOF) and then invoke codex exec --sandbox
read-only "$PROMPT", or alternatively store the prompt text in a separate file
(e.g., .claude/prompts/codex-review-prompt.txt) and call codex exec --sandbox
read-only "$(cat .claude/prompts/codex-review-prompt.txt)"; update the
invocation that previously contained the inline prompt to use PROMPT (or the cat
file substitution) and ensure quoting preserves literal content.
|
(aside) |
|
Claude finished @keito4's task in 3m 19s —— View job マージコンフリクトの解決 ✅以下のタスクを完了しました:
解決内容
コンフリクトの原因:
解決方法:
コミット:
PRのマージ準備が整いました。CIが正常に完了することをご確認ください。 --- | Branch |
origin/mainとのコンフリクトを解決しました。 - .claude/commands/create-pr.md: Step 8のCI失敗時フォローアップを統合 Co-authored-by: keito4 <keito4@users.noreply.github.com>
PR作成後とExitPlanMode前にCodexによる自動レビューを実行するhooksを追加しました。 ## 追加ファイル - .claude/hooks/post_pr_codex_review.py: PR作成後のCodexレビュー - .claude/hooks/pre_exit_plan_codex_review.py: プラン作成後のCodexレビュー ## 変更ファイル - .claude/hooks/README.md: 新しいhooksのドキュメント追加 - .claude/settings.local.json.template: hooks設定の推奨テンプレート追加 ## 動作 - PR作成後: Codexがコード変更をレビューし結果を表示 - プラン作成後: Codexがプランをレビューし、問題があればブロック 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Codex自動レビューHooksとSkills追加このPRに対する詳細なレビューを実施しました。全体的に優れた実装ですが、いくつかの改善点と懸念事項があります。 ✅ 良い点1. アーキテクチャ設計
2. コード品質
3. ワークフロー統合
|
## 修正内容 ### post_pr_codex_review.py - gh pr create の判定をプレフィックス判定に変更 - --help コマンドを除外 - PR URL判定を正規表現で厳密化 ### pre_exit_plan_codex_review.py - Codex実行失敗時に成功メッセージを出さないように修正 - "plan is ready" の明示的な承認がある場合のみ成功表示 - それ以外は「明確な承認なし」と表示 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.claude/hooks/post_pr_codex_review.py:
- Around line 91-97: The current flow prints an error when result.returncode !=
0 but always prints the success banner ("✅ Codexレビュー完了"), which is confusing;
change the control flow so the success banner is only printed when
result.returncode == 0 — e.g., wrap the trailing prints (including the blank
line, separator lines and "✅ Codexレビュー完了") in an else branch or perform an early
return/exit after printing the error (the check involves result.returncode and
result.stderr) so that the success message is not emitted on failure.
🧹 Nitpick comments (1)
.claude/hooks/post_pr_codex_review.py (1)
32-34: The-hcheck may cause false positives.The substring check
"-h" in commandmatches-hanywhere in the command string, including in branch names, PR bodies, or other arguments.Example false positives:
gh pr create --head feature-branch-hgh pr create --body "Fix -h flag handling"🔧 Suggested fix: Match `-h` as a standalone argument
-# ヘルプコマンドは除外 -if "--help" in command or "-h" in command: - sys.exit(0) +# ヘルプコマンドは除外(独立した引数としてマッチ) +import shlex +try: + args = shlex.split(command) + if "--help" in args or "-h" in args: + sys.exit(0) +except ValueError: + pass # shlex parse error - continue with review
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.claude/hooks/post_pr_codex_review.py.claude/hooks/pre_exit_plan_codex_review.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Follow the GitHub Issues workflow: create issues with clear requirements and acceptance criteria, mention claude for AI assistance, ensure quality checks pass, and conduct human code review in PRs
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Use GitHub Actions and Claude Code integration for automated issue resolution, PR review support, quality checks, and documentation synchronization
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to {.codex/**,.devcontainer/codex*,package*.json,npm/global.json} : Use Conventional Commits format with release-triggering types (feat/fix/perf/revert/docs) for commits touching .codex/**, .devcontainer/codex*, package*.json, or npm/global.json
📚 Learning: 2026-01-12T10:08:03.062Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T10:08:03.062Z
Learning: Use GitHub Actions and Claude Code integration for automated issue resolution, PR review support, quality checks, and documentation synchronization
Applied to files:
.claude/hooks/post_pr_codex_review.py
🪛 Ruff (0.14.11)
.claude/hooks/post_pr_codex_review.py
28-28: Comment contains ambiguous ( (FULLWIDTH LEFT PARENTHESIS). Did you mean ( (LEFT PARENTHESIS)?
(RUF003)
28-28: Comment contains ambiguous ) (FULLWIDTH RIGHT PARENTHESIS). Did you mean ) (RIGHT PARENTHESIS)?
(RUF003)
40-40: Comment contains ambiguous ( (FULLWIDTH LEFT PARENTHESIS). Did you mean ( (LEFT PARENTHESIS)?
(RUF003)
40-40: Comment contains ambiguous ) (FULLWIDTH RIGHT PARENTHESIS). Did you mean ) (RIGHT PARENTHESIS)?
(RUF003)
77-77: subprocess call: check for execution of untrusted input
(S603)
100-100: String contains ambiguous ( (FULLWIDTH LEFT PARENTHESIS). Did you mean ( (LEFT PARENTHESIS)?
(RUF001)
100-100: String contains ambiguous ) (FULLWIDTH RIGHT PARENTHESIS). Did you mean ) (RIGHT PARENTHESIS)?
(RUF001)
102-102: Do not catch blind exception: Exception
(BLE001)
105-105: Comment contains ambiguous ( (FULLWIDTH LEFT PARENTHESIS). Did you mean ( (LEFT PARENTHESIS)?
(RUF003)
105-105: Comment contains ambiguous ) (FULLWIDTH RIGHT PARENTHESIS). Did you mean ) (RIGHT PARENTHESIS)?
(RUF003)
.claude/hooks/pre_exit_plan_codex_review.py
52-52: Do not catch blind exception: Exception
(BLE001)
92-92: subprocess call: check for execution of untrusted input
(S603)
126-126: String contains ambiguous ( (FULLWIDTH LEFT PARENTHESIS). Did you mean ( (LEFT PARENTHESIS)?
(RUF001)
126-126: String contains ambiguous ) (FULLWIDTH RIGHT PARENTHESIS). Did you mean ) (RIGHT PARENTHESIS)?
(RUF001)
127-127: Comment contains ambiguous ( (FULLWIDTH LEFT PARENTHESIS). Did you mean ( (LEFT PARENTHESIS)?
(RUF003)
127-127: Comment contains ambiguous ) (FULLWIDTH RIGHT PARENTHESIS). Did you mean ) (RIGHT PARENTHESIS)?
(RUF003)
129-129: Do not catch blind exception: Exception
(BLE001)
139-139: String contains ambiguous ( (FULLWIDTH LEFT PARENTHESIS). Did you mean ( (LEFT PARENTHESIS)?
(RUF001)
139-139: String contains ambiguous ) (FULLWIDTH RIGHT PARENTHESIS). Did you mean ) (RIGHT PARENTHESIS)?
(RUF001)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: check-ci-status
🔇 Additional comments (10)
.claude/hooks/post_pr_codex_review.py (4)
14-19: LGTM!Input parsing is robust with appropriate fallbacks for missing keys.
40-47: LGTM!The PR URL detection regex is appropriately strict and handles both stdout/stderr outputs.
61-74: LGTM!The Codex prompt is comprehensive and the
--sandbox read-onlyflag ensures safe execution.
105-106: LGTM!Exiting with 0 regardless of Codex results ensures the hook doesn't block the workflow, which is the correct behavior for a post-tool hook.
.claude/hooks/pre_exit_plan_codex_review.py (6)
1-22: LGTM!Imports and tool name validation are appropriate.
29-46: LGTM!Using modification time to find the latest plan is a reasonable heuristic for typical workflows.
48-61: LGTM!File reading with UTF-8 and graceful error handling is appropriate.
63-87: LGTM!The prompt is comprehensive and covers key aspects of plan review. The
--sandbox read-onlyflag ensures safe execution.
107-117: Verdict detection logic is correctly ordered.Checking "plan needs revision" before "plan is ready" is the safer approach - if both phrases somehow appear in output, the stricter condition takes precedence.
133-142: LGTM!The result display distinguishes between explicit approval and ambiguous results, which provides useful feedback to the user.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| if result.returncode != 0 and result.stderr: | ||
| print(f"⚠️ Codexエラー: {result.stderr}", file=sys.stderr) | ||
|
|
||
| print("", file=sys.stderr) | ||
| print("=" * 60, file=sys.stderr) | ||
| print("✅ Codexレビュー完了", file=sys.stderr) | ||
| print("=" * 60, file=sys.stderr) |
There was a problem hiding this comment.
Success message shown even on Codex execution failure.
When result.returncode != 0, both the error warning (line 92) and the success message "✅ Codexレビュー完了" (line 96) are printed, which is confusing.
🐛 Proposed fix
if result.returncode != 0 and result.stderr:
print(f"⚠️ Codexエラー: {result.stderr}", file=sys.stderr)
+ print("", file=sys.stderr)
+ print("=" * 60, file=sys.stderr)
+ print("⚠️ Codexレビュー完了(エラーあり)", file=sys.stderr)
+ print("=" * 60, file=sys.stderr)
+ else:
+ print("", file=sys.stderr)
+ print("=" * 60, file=sys.stderr)
+ print("✅ Codexレビュー完了", file=sys.stderr)
+ print("=" * 60, file=sys.stderr)
- print("", file=sys.stderr)
- print("=" * 60, file=sys.stderr)
- print("✅ Codexレビュー完了", file=sys.stderr)
- print("=" * 60, file=sys.stderr)🤖 Prompt for AI Agents
In @.claude/hooks/post_pr_codex_review.py around lines 91 - 97, The current flow
prints an error when result.returncode != 0 but always prints the success banner
("✅ Codexレビュー完了"), which is confusing; change the control flow so the success
banner is only printed when result.returncode == 0 — e.g., wrap the trailing
prints (including the blank line, separator lines and "✅ Codexレビュー完了") in an
else branch or perform an early return/exit after printing the error (the check
involves result.returncode and result.stderr) so that the success message is not
emitted on failure.
PR Review - feat/add ci failure handling instructionsこのPRは、CI失敗対応ルールの追加とCodexによる自動レビュー機能の実装を含む包括的な開発ワークフロー改善です。全体として非常によく設計されていますが、いくつかの改善提案があります。 全体評価✅ 良い点
1. コード品質post_pr_codex_review.py重大度: 中 問題点: タイムアウト設定が600秒(10分)は長すぎる可能性があり、フィードバックループが遅延する 推奨: タイムアウトを300秒(5分)に短縮 pre_exit_plan_codex_review.py重大度: 低 問題点: Line 105のoutput.lower()は英語の文字列マッチングを前提としているが、Codexの出力形式が変更された場合に脆弱 推奨: より堅牢なパターンマッチング(正規表現の使用) 2. セキュリティ重大度: 中 問題点: stderrの出力を500文字でトリミングしているが、機密情報が含まれる可能性 推奨: エラーメッセージのサニタイズ実装(トークン、APIキー、パスワードのマスキング) 3. テストカバレッジ重大度: 高 問題点: 新しいPythonスクリプトにユニットテストが存在しない 推奨: テストファイルを追加
根拠: CLAUDE.mdのTDD原則(70%+カバレッジ)に準拠する必要がある まとめ必須対応(マージ前)
推奨対応(マージ後可)
総合評価判定: 条件付き承認 理由:
素晴らしいワークフロー改善です。テストが追加されれば、組織全体の開発品質向上に大きく貢献するでしょう! |
Codex専用のhooksをCodex+Gemini両対応に拡張しました。 インストールされているAIツールで自動的にレビューを実行します。 ## 変更内容 ### 新規ファイル - post_pr_ai_review.py: PR作成後のAIレビュー(Codex+Gemini) - pre_exit_plan_ai_review.py: プラン作成後のAIレビュー(Codex+Gemini) ### 削除ファイル - post_pr_codex_review.py: Codex専用版を削除 - pre_exit_plan_codex_review.py: Codex専用版を削除 ### 更新ファイル - README.md: 新しいhooksのドキュメント - settings.local.json.template: hooks参照とgemini権限を更新 ## 動作 - Codex/Geminiのいずれか、または両方がインストールされていれば実行 - どちらも未インストールの場合はスキップ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review - feat/add ci failure handling instructions総合評価このPRは、PR作成後のCI失敗対応ルールとAI自動レビュー機能を追加する重要な機能追加です。全体的によく設計されていますが、いくつか改善が必要な点があります。 🟢 良い点1. 明確なCI失敗対応ルールの追加
2. AIレビュー機能の柔軟な設計
3. 適切なエラーハンドリング
4. Skills分離による再利用性CI CheckとCodex ReviewをSkillsとして分離し、再利用可能な設計になっている点は優れています。 🟡 改善が必要な点1. セキュリティ: コマンドインジェクションのリスク場所: 問題: 推奨対応: # pre_exit_plan_ai_review.py の改善例
# プランファイルの内容をサニタイズ
import shlex
# または、プロンプトをファイル経由で渡す方法を検討
with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) as f:
f.write(review_prompt)
prompt_file = f.name
codex_command = [
"codex", "exec",
"--sandbox", "read-only",
"--prompt-file", prompt_file
]2. エラーハンドリング: ステータスコードの不一致場所: 問題: "plan needs revision"の場合は 推奨対応: # レビュー実行失敗時の扱いを明確化
if not any_success:
print("⚠️ AIレビューが実行できませんでした。続行しますか?", file=sys.stderr)
# オプション: sys.exit(1) でブロックするか、sys.exit(0) で許可するか明確に3. 保守性: マジックナンバーとハードコーディング場所: 問題: タイムアウト値(600秒)、エラー出力制限(300文字)がハードコードされています。 推奨対応: # ファイル先頭で定数として定義
REVIEW_TIMEOUT_SECONDS = 600
ERROR_OUTPUT_MAX_LENGTH = 300
# 使用時
timeout=REVIEW_TIMEOUT_SECONDS
result.stderr[:ERROR_OUTPUT_MAX_LENGTH]4. パフォーマンス: 並列実行の検討場所: 問題: CodexとGeminiのレビューを順次実行しています。両方がインストールされている場合、レビュー時間が最大20分(10分×2)かかる可能性があります。 推奨対応: import concurrent.futures
# 並列実行
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
futures = []
if has_codex:
futures.append(executor.submit(run_codex_review))
if has_gemini:
futures.append(executor.submit(run_gemini_review))
concurrent.futures.wait(futures)5. ドキュメント: 設定例の不完全性場所: 問題: Geminiの実行権限が追加されていますが、Gemini CLIのインストール方法や設定方法がREADME.mdに記載されていません。 推奨対応:
6. テストカバレッジ: 単体テストの欠如問題: Pythonスクリプトに対する単体テストが含まれていません。 推奨対応: # tests/hooks/test_post_pr_ai_review.py の例
import unittest
from unittest.mock import patch, MagicMock
import json
class TestPostPRAIReview(unittest.TestCase):
@patch('subprocess.run')
@patch('shutil.which')
def test_codex_review_success(self, mock_which, mock_run):
mock_which.return_value = '/usr/bin/codex'
mock_run.return_value = MagicMock(
returncode=0,
stdout="patch is correct\nConfidence: 0.95"
)
# テストロジック7. Skills: 重複したドキュメント場所: 問題: このSkillは 推奨対応:
🔴 修正必須の問題1. CLAUDE.mdとの整合性場所: 問題: CLAUDE.mdには「Release Types Required for Tooling Changes」ルールがあり、 推奨対応: # CLAUDE.md の更新
- Release Types Required for Tooling Changes: Commits that touch `.codex/**`, `.claude/**`, `.devcontainer/codex*`, `package*.json`, or `npm/global.json` must use release-triggering types2. PR本文の未記入問題: PR本文のチェックリストやセクションが未記入です。CLAUDE.mdのDefinition of Doneに「ドキュメント更新」が含まれています。 推奨対応:
📊 品質メトリクス
✅ チェックリスト
🎯 推奨アクション優先度: 高
優先度: 中
優先度: 低
総評このPRは開発プロセスの自動化と品質向上に大きく貢献する重要な機能追加です。基本設計は優れていますが、セキュリティとエラーハンドリング、ドキュメントの面で改善が必要です。 優先度:高の項目を対応後、マージを推奨します。 レビュー実施: Claude Sonnet 4.5 |
|
(aside) |
|
Claude finished @keito4's task in 2m 1s —— View job CI失敗の修正
|
Geminiはファイルアクセスができないため、git diffの内容を プロンプトに直接含めるように修正。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review - PR #346このPRは、AI(Codex + Gemini)による自動レビュー機能をClaude Code hooksとskillsに統合する大規模な改善です。全体的に良く設計されており、コードの品質も高いですが、いくつかの改善点と懸念事項があります。 ✅ 良い点
|
| 基準 | 状態 | コメント |
|---|---|---|
| TDD (70%+カバレッジ) | ❌ | Pythonスクリプトのテストが欠如 |
| Lint/Format | ✅ | CIチェック待ち |
| セキュリティ | 機密情報マスキングの検討が必要 | |
| ドキュメント | ✅ | 包括的なREADME |
| Conventional Commits | ✅ | 適切なコミットメッセージ |
🎯 アクションアイテム
必須 (マージ前):
- セキュリティ: diffに機密情報が含まれる場合のマスキング処理を追加
- テスト: 基本的な単体テストを追加(少なくとも正常系とエラー系)
- Skillsファイル名と内容の整合性を修正
推奨 (次回PR):
- Codex/Geminiレビューの並列実行
- レビュー結果の永続化
- タイムアウト値の環境変数化
- エラーメッセージの改善
💭 総評
このPRは開発ワークフローに大きな価値を提供する優れた機能追加です。AIレビューの自動統合は品質向上に寄与しますが、セキュリティとテストカバレッジの観点でいくつかの改善が必要です。
推奨アクション: 上記の「必須」項目を対応後にマージ承認
🤖 Generated with Claude Code (Sonnet 4.5)

Summary
Type of Change
Related Issues
Changes Made
Testing
npm test)npm run test:integration)npm run lint)npm run format:check)Checklist
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
Documentation
New Features
✏️ Tip: You can customize this high-level summary in your review settings.