1# Code review in GitHub β Codex1# Codex code review in GitHub
2 2
3Use Codex code review to get another high-signal review pass on GitHub pull3Use Codex code review to get another high-signal review pass on GitHub pull
4requests. Codex reviews the pull request diff, follows your repository guidance,4requests. Codex reviews the pull request diff, follows your repository guidance,
5and posts a standard GitHub code review focused on serious issues.5and posts a standard GitHub code review focused on serious issues.
6 6
7<YouTubeEmbed
8 title="Codex code review walkthrough"
9 videoId="HwbSWVg5Ln4"
10 class="max-w-md mr-auto"
11/>
12<br />
13
7## Before you start14## Before you start
8 15
9Make sure you have:16Make sure you have:
10 17
11- [Codex cloud](https://developers.openai.com/codex/cloud) set up for the repository you want to review.18- [Codex cloud](https://learn.chatgpt.com/docs/cloud) set up for the repository you want to review.
12- Access to [Codex code review settings](https://chatgpt.com/codex/settings/code-review).19- Access to [Codex code review settings](https://chatgpt.com/codex/settings/code-review).
13- An `AGENTS.md` file if you want Codex to follow repository-specific review guidance.20- An `AGENTS.md` file if you want Codex to follow repository-specific review guidance.
14 21
15## Set up Codex code review22## Set up Codex code review
16 23
171. Set up [Codex cloud](https://developers.openai.com/codex/cloud).241. Set up [Codex cloud](https://learn.chatgpt.com/docs/cloud).
182. Go to [Codex settings](https://chatgpt.com/codex/settings/code-review).252. Go to [Codex settings](https://chatgpt.com/codex/settings/code-review).
193. Turn on **Code review** for your repository.263. Turn on **Code review** for your repository.
20 27
2128<div class="not-prose max-w-3xl mr-auto">
29 <img src="https://developers.openai.com/images/codex/code-review/code-review-settings.png"
30 alt="Codex settings showing the Code review toggle"
31 class="block h-auto w-full mx-0!"
32 />
33</div>
34<br />
22 35
23## Request a Codex review36## Request a Codex review
24 37
251. In a pull request comment, mention `@codex review`.381. In a pull request comment, mention `@codex review`.
262. Wait for Codex to react (π) and post a review.392. Wait for Codex to react (π) and post a review.
27 40
2841<div class="not-prose max-w-xl mr-auto">
42 <img src="https://developers.openai.com/images/codex/code-review/review-trigger.png"
43 alt="A pull request comment with @codex review"
44 class="block h-auto w-full mx-0!"
45 />
46</div>
47<br />
29 48
30Codex posts a review on the pull request, just like a teammate would. In49Codex posts a review on the pull request, just like a teammate would. In
31GitHub, Codex flags only P0 and P1 issues so review comments stay focused on50GitHub, Codex flags only P0 and P1 issues so review comments stay focused on
32high-priority risks.51high-priority risks.
33 52
3453<div class="not-prose max-w-3xl mr-auto">
54 <img src="https://developers.openai.com/images/codex/code-review/review-example.png"
55 alt="Example Codex code review on a pull request"
56 class="block h-auto w-full mx-0!"
57 />
58</div>
59<br />
35 60
36## Enable automatic reviews61## Enable automatic reviews
37 62
46 71
47To set guidelines for a repository, add or update a top-level `AGENTS.md` with a section like this:72To set guidelines for a repository, add or update a top-level `AGENTS.md` with a section like this:
48 73
49```74```md
50## Review guidelines75## Review guidelines
51 76
52- Don't log PII.77- Don't log PII.
67After Codex posts a review, you can ask it to fix issues in the same pull92After Codex posts a review, you can ask it to fix issues in the same pull
68request by leaving another comment:93request by leaving another comment:
69 94
70```95```md
71@codex fix the P1 issue96@codex fix the P1 issue
72```97```
73 98
76 101
77## Give Codex other tasks102## Give Codex other tasks
78 103
79If you mention `@codex` in a comment with anything other than `review`, Codex starts a [cloud task](https://developers.openai.com/codex/cloud) using your pull request as context.104If you mention `@codex` in a comment with anything other than `review`, Codex starts a [cloud task](https://learn.chatgpt.com/docs/cloud) using your pull request as context.
80 105
81```106```md
82@codex fix the CI failures107@codex fix the CI failures
83```108```
84 109
85## Troubleshoot code review110## Troubleshoot code review
86 111
87If Codex doesnβt react or post a review:112If Codex doesn't react or post a review:
88 113
89- Confirm you turned on **Code review** for the repository in [Codex settings](https://chatgpt.com/codex/settings/code-review).114- Confirm you turned on **Code review** for the repository in [Codex settings](https://chatgpt.com/codex/settings/code-review).
90- Confirm the pull request belongs to a repository with [Codex cloud](https://developers.openai.com/codex/cloud) set up.115- Confirm the pull request belongs to a repository with [Codex cloud](https://learn.chatgpt.com/docs/cloud) set up.
91- Use the exact trigger `@codex review` in a pull request comment.116- Use the exact trigger `@codex review` in a pull request comment.
92- For automatic reviews, check that you turned on **Automatic reviews** and that117- For automatic reviews, check that you turned on **Automatic reviews** and that
93 the pull request event matches your review trigger settings.118 the pull request event matches your review trigger settings.