Table of Contents
Use Codex to investigate a repository, draft a focused change or diagnose a failing test. In Codex Cloud, connect a GitHub repository and select its environment. Review the resulting diff and test output before opening a pull request. You can also use Codex locally through the CLI.
Connect an authorized GitHub repository
- Open Codex in ChatGPT or visit the Codex Cloud guide for the current entry point and account requirements. Follow the sign-in and security prompts you see.



- Connect GitHub and grant access only to the repository you need. If an organization manages it, follow your team’s approval process.





- Select or create the environment. Specify setup commands and a test command if the repository needs dependencies or configuration. Begin with a small task on a branch and keep credentials out of prompts.





The screenshots show an earlier setup flow. Check the current buttons and access controls in your workspace.
Give Codex repository instructions with AGENTS.md
Put project-specific instructions in AGENTS.md. Include how to run tests, where to place changes and which generated files should be left alone. For example:
# Repository instructions
- Run python -m pytest tests before submitting Python changes.
- Use the formatter configured in the repository.
- Summarize test results and any checks that could not run.Applies only if those commands fit your project. See the AGENTS.md guide for how instructions in nested directories are applied.
Example 1: Fix a documentation mistake
Ask: “Fix the installation command in README.md to match the actual package name. Check the package manifest and touch only the README.” Inspect the diff for unrelated changes. If it looks right, open a pull request and include what you checked.



Example 2: Understand an unfamiliar code path
Ask: “Trace a request from the main interface through the function that invokes the backend. Cite files and symbols, identify error paths and make no edits.” Open the cited locations to check the explanation and distinguish observed behavior from inference.

Example 3: Diagnose a failing test
Ask: “Run the failing test, explain the root cause, make the smallest fix and rerun the targeted test. Tell me if a broader suite cannot run.” Compare the failing and passing logs. Check that the change fixes behavior without weakening the assertion.





Open the proposed pull request and check the base branch, diff and CI results. Merge only after the project’s review process is complete. To practice the workflow, see the GitHub pull request lab and these ways to use Codex on a project.




Reader Comments 0
Sign in with email or Google to join the discussion.