Leaders Insights
Leaders Insights

Stay at the top of your field, a little every day.

DomainsMarketingDataFinanceAI
ResourcesLearnTestToolsBlogGlossary
© 2026 Leaders Insights — All rights reserved.
Tracks/AI Essentials/ChatGPT & the OpenAI ecosystem/Coding, GitHub, and codex/Codex on GitHub and in the IDE
3/6+180 XP

Coding, GitHub, and codex

1ChatGPT for coding and canvas+1702Codex: agentic coding in your environment+1903Codex on GitHub and in the IDE+1804Loops and autonomous runs in codex+1905Codex on GitHub: PR reviews and actions+1906End to end: from issue to merged pull request+190

Codex on GitHub and in the IDE

# Codex on GitHub and in the IDE

You can hand Codex a GitHub issue, walk away, and come back to a reviewed, tested pull request waiting for your approval. That is the workflow we are building in this lesson: Codex as a coding teammate that lives inside your repository and your editor, not a chat window you copy-paste into.

Codex is OpenAI's software engineering agent. It runs in three places that matter here: the cloud (a sandboxed environment connected to your GitHub repos), your IDE (via the official extension), and the CLI / terminal. They share the same underlying agent but differ in how much autonomy you grant. Start with the official overview at the Codex docs.

The two surfaces: cloud and local

There is one distinction worth fixing in your head before anything else.

Cloud Codex runs each task in an isolated container. It clones your repo, gets its own filesystem, and by default has no network access mid-task. This is where the "assign an issue, get a PR" flow lives.

Local Codex (the IDE extension and the CLI) runs on your machine, against your actual working tree. It sees your uncommitted changes and your local tooling. This is where you pair on something live, with you watching every diff.

Same agent, different blast radius. Cloud is for delegating self-contained work. Local is for collaborating in the moment.

Connecting codex to GitHub

Inside ChatGPT, open Codex and connect your GitHub account, then grant access to specific repositories (not your whole org). Codex installs a GitHub App with scoped permissions. Once connected, you can point a task at any branch and Codex can open pull requests back to that repo.

In your editor, install the Codex extension for VS Code (and forks like Cursor) or the JetBrains plugin. Sign in with your ChatGPT account. The extension shares your Codex environment, so a task you start in the IDE can be inspected later in the cloud dashboard.

Walkthrough: pick up an issue, open a PR

Here is the concrete flow. Say your repo has this issue:

> #214: Login form accepts whitespace-only passwords

> Users can submit a password that is just spaces. Add validation and a test.

1. Assign the task

In the Codex cloud view, select the repo and branch, then describe the task. The single most effective thing you can do is paste the issue and reference real files:

> Fix issue #214. In src/auth/validators.py, reject passwords that are empty or whitespace-only. Match the existing ValidationError pattern used by validate_email. Add a unit test in tests/test_validators.py.

Codex spins up a container, reads the relevant files, and plans. Because the environment is sandboxed, it can run your test suite as it works.

2. Let it work, then read the diff

Codex edits the files, runs the tests, and iterates if something fails. When it finishes, you get a summary: what it changed, the commands it ran, and the test output. Read the diff. Treat this exactly like a junior engineer's PR: the agent is fast and tireless, not infallible.

3. Open the pull request

If the diff looks right, click to open a PR directly from Codex. It writes a title and description, links issue #214, and pushes a branch. Your normal branch protections, required reviewers, and CI all still apply. Nothing merges without your existing rules being satisfied.

That is the loop: issue in, reviewed PR out, with you as the gate.

Codex: assign a GitHub issue and review the PR

Watch on YouTube

Configuring the environment with AGENTS.md

Codex does not magically know your project's conventions. You teach it once, in a file it reads automatically: AGENTS.md at the repo root. Think of it as a README written for the agent instead of for humans.

A good AGENTS.md tells Codex how to install dependencies, how to run tests, and which conventions to honor. Keep it tight and factual.

yaml
# AGENTS.md (front-matter style config Codex reads)
setup:
  - pip install -e ".[dev]"

checks:
  test: pytest -q
  lint: ruff check .
  typecheck: mypy src/

conventions:
  - Follow PEP 8; format with ruff before committing.
  - All new functions need type hints and a docstring.
  - Tests go in tests/ and mirror the src/ path.
  - Never edit files under migrations/ by hand.

before_pr:
  - Run test, lint, and typecheck. All must pass.

With this in place, Codex installs the right way, runs your real checks, and refuses to touch directories you have marked off. If pytest fails, it sees the failure and tries again before handing you the PR. The result: fewer PRs that break CI the moment they land.

You can also place nested AGENTS.md files in subdirectories for monorepos, and the closest one wins for files in that path.

Codex in the IDE: pairing live

The cloud flow is delegation. The IDE flow is collaboration, and you reachreachThe number of unique people exposed to your message in a given period. Unlike impressions, reach counts each person once, no matter how often they see it.View full definition → for it when you want to watch the work happen.

In VS Code with the Codex extension, open the Codex sidebar and describe a change against your open project. A typical local task:

> Refactor OrderService.process to extract the discount logic into a DiscountCalculator class. Keep behavior identical and update the existing tests.

The difference from the cloud is approvals. Local Codex runs in modes that control how much it can do without asking:

  • Read-only / suggest: proposes diffs, you apply them.
  • Auto / agent: edits files and runs commands, pausing to ask before anything risky.
  • Full access: edits and runs freely in the workspace.

For day-to-day work, the middle mode is the sweet spot. Codex makes edits and runs your tests, but stops to ask before, say, deleting files or running a command it has not been pre-approved to run. You stay in the loop without babysitting every keystroke.

The IDE flow also shines for understanding code. Highlight a gnarly function, ask Codex to explain it or write tests for it, and it works against the live file with full project context.

Knowledge check

1. What is the fundamental distinction between Cloud Codex and Local Codex described in the lesson?

2. According to the lesson, when is it most appropriate to prefer Cloud Codex over Local Codex?

3. The lesson emphasizes that the single most effective thing you can do when assigning a task is to paste the issue and reference real files. Why does this matter?

MULTIPLE CHOICE

4. Select ALL statements that correctly describe how Codex connects to GitHub and the IDE.

Select all the correct answers.

MULTIPLE CHOICE

5. Select ALL characteristics that are true of Local Codex (the IDE extension and CLI).

Select all the correct answers.

Safety guardrails you should actually use

Codex is designed to be safe by default, but the defaults are conservative precisely so you can loosen them deliberately. Know the real levers.

Sandboxing and network

Cloud Codex tasks run without network access during execution unless you explicitly enable it. This is a deliberate guard: a task cannot quietly exfiltrate code or pull in untrusted packages. If your build genuinely needs to fetch dependencies, enable network access for that environment and prefer pinning what it can reachreachThe number of unique people exposed to your message in a given period. Unlike impressions, reach counts each person once, no matter how often they see it.View full definition →. Treat broad network access as a decision, not a default.

Approvals are your kill switch

In local modes, the approval prompt is the most important safety feature, not an annoyance. Commands that modify your system or reachreachThe number of unique people exposed to your message in a given period. Unlike impressions, reach counts each person once, no matter how often they see it.View full definition → outside the workspace surface for confirmation. Resist the urge to set everything to full access on a repo that matters. Reserve full autonomy for throwaway branches and experiments.

Branch protection does the heavy lifting

Codex respects your existing GitHub setup. Because every change arrives as a PR on a branch, your required reviews, status checks, and CODEOWNERS rules still gate the merge. The agent can open a PR; it cannot bypass a protected main. This is why the "open a PR" pattern is safer than letting any tool push directly: your human review process is unchanged.

Secrets stay out of the prompt

Do not paste APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → keys or credentials into task descriptions. For cloud environments that need secrets to run tests, use the environment's secret configuration rather than inlining them. Anything in the prompt is part of the task context; keep credentials in the secret store where they belong.

Scope the GitHub app

When you connected GitHub earlier, you granted access to specific repos. Keep it that way. There is no reason to give the Codex GitHub App access to repositories it will never touch. Review the granted repos periodically in your GitHub settings.

A simple mental model: cloud + sandbox + PR review for delegated work you will not watch, and local + approvals for work you will. In both cases, the merge gate is your existing GitHub rules, and you should never weaken those just to make the agent faster.

When to use which surface

A quick decision guide:

  • Well-defined, self-contained issue? Cloud Codex. Assign it, do something else, review the PR.
  • Exploratory refactor where you want to steer? IDE extension in auto mode.
  • Scriptable, repeatable task in CI or a terminal workflow? The Codex CLI.
  • A whole batch of small chores (bump versions, fix lint across files)? Cloud, one task each, review the stack of PRs.

The skill is matching the surface to how much you trust the task to run unattended. For the practical setup details and limits, keep the help center Codex articles handy, since exact environment options evolve.

Key Takeaways

  • Drive the loop, not the keyboard. Assign a GitHub issue with specific file references, let cloud Codex produce a PR, and review it like a teammate's work. The merge gate stays yours.
  • Write an `AGENTS.md`. One small file telling Codex how to install, test, lint, and which directories are off-limits dramatically improves PR quality and keeps CI green.
  • Pick the surface by autonomy. Cloud for delegated, self-contained tasks; the IDE extension for live pairing where you want to watch and approve.
  • Treat approvals and sandboxing as features. Keep cloud tasks network-isolated unless they truly need access, reserve full-access modes for throwaway branches, and never paste secrets into prompts.
  • Let branch protection do the gating. Because Codex hands you PRs, your existing required reviews, status checks, and CODEOWNERS rules already protect main. Do not weaken them to go faster.

What to do, from this lesson

These actions are compiled in the role's Playbook.

  • Write an AGENTS.md with install, test, lint, and off-limits directories
  • Set branch protection requiring PR, review, and passing checks before Codex runs
See the full action playbook →

Previous

Codex: agentic coding in your environment

Next

Loops and autonomous runs in codex