GitHub Integration
Your team opens a pull request, a reviewer is busy for two days, and the PR sits idle. Meanwhile, another teammate mentions a bug in an issue and nobody has bandwidth to investigate. What if an agent could review every PR within minutes of opening and start working on issue comments the moment they are posted? That is exactly what Codex does when connected to GitHub.
What You’ll Walk Away With
Section titled “What You’ll Walk Away With”- Codex Cloud connected to a GitHub repository
@codex reviewworking on pull requests for on-demand code reviews- Automatic code reviews enabled for every new PR
@codexmentions in issues and PR comments triggering cloud tasks- Review guidelines in AGENTS.md customizing what Codex flags
- A working workflow from issue to PR to merge
Prerequisites
Section titled “Prerequisites”GitHub integration requires:
- ChatGPT subscription (Plus, Pro, Business, or Enterprise) — API key auth does not support cloud features
- Codex Cloud environment configured with your repository
- Repository admin access (or someone with admin access to approve the Codex GitHub app)
Connect a Repository to Codex Cloud
Section titled “Connect a Repository to Codex Cloud”-
Open chatgpt.com/codex in your browser.
-
Go to Settings > Environments and click New Environment.
-
Connect your GitHub account if you have not already. This installs the Codex GitHub app on your account or organization.
-
Select the repository you want Codex to work with.
-
Configure the environment: choose the branch, set up any required environment variables, and define setup commands (like
npm installorpip install -r requirements.txt). -
Save the environment. Codex can now launch cloud tasks against this repository.
On-Demand Code Reviews
Section titled “On-Demand Code Reviews”Once your repository is connected, any collaborator can request a Codex review by commenting on a pull request.
Request a Review
Section titled “Request a Review”Add a comment on any PR:
@codex reviewCodex reacts with an eyes emoji to acknowledge the request, reads the PR diff, and posts a standard GitHub code review with inline comments — just like a human reviewer.
Focus a Review
Section titled “Focus a Review”You can scope the review to specific concerns:
@codex review for security regressions@codex review focusing on error handling and edge cases@codex review the database migration for data loss risksEnable Automatic Reviews
Section titled “Enable Automatic Reviews”If you want Codex to review every PR without being asked:
-
Toggle on Automatic reviews for your repository.
-
Save. From now on, Codex posts a review whenever a new PR is opened for review.
Automatic reviews use the same review guidelines from your AGENTS.md files. Codex flags only P0 and P1 issues by default — it does not nitpick formatting or style unless your AGENTS.md tells it to.
Customize Review Guidelines
Section titled “Customize Review Guidelines”Codex applies guidance from the closest AGENTS.md to each changed file. Add a “Review guidelines” section to your project’s AGENTS.md:
## Review guidelines
- Flag any API endpoint missing authentication middleware.- Flag any database query using string interpolation instead of parameterized inputs.- Verify that new dependencies have an active maintainer and more than 1000 weekly npm downloads.- Treat typos in user-facing strings as P1 issues.- Do not flag formatting issues -- ESLint handles those.For package-specific scrutiny, place a more targeted AGENTS.md deeper in the tree:
## Review guidelines
- Every change to payment logic must include a test case.- Flag any modification to the refund flow that does not update the audit log.- Verify PCI compliance: no card numbers logged, no plaintext storage.Trigger Cloud Tasks from GitHub
Section titled “Trigger Cloud Tasks from GitHub”@codex review is one specific command. Any other @codex mention in a PR or issue comment triggers a general cloud task using the PR or issue as context.
Fix CI Failures
Section titled “Fix CI Failures”When CI is red on a PR, comment:
@codex fix the CI failuresCodex launches a cloud task, reads the CI logs, identifies the failing tests, and pushes a fix commit to the PR branch.
Implement from an Issue
Section titled “Implement from an Issue”On an issue describing a bug or feature request, comment:
@codex implement thisCodex creates a new branch, implements the changes based on the issue description, and opens a PR.
Follow Up on Review Comments
Section titled “Follow Up on Review Comments”After reviewing a PR, a human reviewer might add feedback. Codex can address it:
@codex address the review feedbackThe Full PR Workflow
Section titled “The Full PR Workflow”Here is how an end-to-end workflow looks with Codex and GitHub:
-
A developer opens an issue describing a bug.
-
The developer (or a bot) comments
@codex implement a fix for this issue. -
Codex Cloud launches a task, reads the issue, clones the repo, identifies the root cause, implements a fix, and opens a PR.
-
Codex automatically reviews the PR (if automatic reviews are enabled) or a teammate comments
@codex review. -
The human reviewer reads Codex’s review, adds their own feedback.
-
If changes are needed, comment
@codex address the review feedbackon the PR. -
Codex pushes follow-up commits.
-
The reviewer approves and merges.
Local Surfaces and Git
Section titled “Local Surfaces and Git”The App, CLI, and IDE extension also integrate with Git, but they work with your local repository rather than through GitHub’s API.
The Codex App has built-in Git tools: view diffs, stage/unstage files and hunks, commit, push, and create PRs directly from the review pane. Worktree threads automatically create isolated branches.
The CLI runs git commands in your project directory. Ask Codex to commit, push, or create branches. Use /review in the TUI for local code review before pushing.
The IDE extension can delegate to Cloud for PR-based workflows, or work locally with your Git state. It shares worktree context with the App when both are open.
When This Breaks
Section titled “When This Breaks”@codex does not respond to comments: Verify the Codex GitHub app is installed on the repository’s organization/account. Check that the repository has a Codex Cloud environment configured. The Codex app needs access to read and write comments.
Review does not flag expected issues: Codex only flags P0 and P1 issues by default. Add explicit review guidelines to your AGENTS.md. For example, add “Treat typos in docs as P1” if you want Codex to catch typos.
Cloud task fails to create a PR: Check the environment configuration at chatgpt.com/codex. Ensure setup commands run successfully (Codex needs to build the project). Check that the branch permissions on GitHub allow the Codex app to push.
“MFA required” error: Codex Cloud requires multi-factor authentication. Enable MFA on your ChatGPT account (or social login provider).
Codex creates a PR but CI fails: Codex does not always run your full CI pipeline before opening a PR. Add "Always run the test suite before opening a PR" to your AGENTS.md review guidelines so Codex includes this step.