Skip to content
Back to Guides

Codex automations: how they work and how to set one up

The OpenAI logo labeled Codex, with a clock badge, joined to the Interfere logo by a line marked scheduled
LG

Levi Gans

·

AI agents

Codex automations are prompts Codex runs for you on a schedule, in the background. You pick a project, write the prompt, set a cadence, and each run reports back to an inbox in the app.

OpenAI’s docs now call them scheduled tasks, but the app and changelog still say automations, so both names mean the same feature. In the ChatGPT desktop app, select Codex and open Scheduled in the sidebar.

Where Codex automations run

Where you create itWhere it runsCan it work in your repo?Triggers
ChatGPT desktop app, CodexYour computer, in the project folder or a Git worktreeYes, while the computer is on and the app is openA schedule, or minute-based intervals inside a chat
ChatGPT web or mobileThe cloud, with connected tools, skills and pluginsNo. Runs keep no local folder or worktreeA schedule, or events (Gmail, Slack, GitHub) on eligible plans
Codex CLINowhere. The CLI has no Scheduled viewUse it to test the prompt firstNone

For anything that edits code and runs tests, use the desktop app. A standalone automation starts a new chat for every run. One inside a chat returns to the same chat and keeps its context, which suits watching a deploy.

Pick a background worktree over your local checkout, where a run can change files you’re editing. A new worktree has no node_modules or ignored files, so add a setup script in the project’s local environment settings and list files like .env in a .worktreeinclude file at the repository root.

What an unattended run is allowed to do

An automation runs with your default sandbox settings and, when your organization allows it, approval_policy = "never", so whatever would need approval fails. OpenAI recommends workspace-write plus rules for the exceptions. Two details matter for opening a pull request:

  • Network access is off for commands, so git push and gh pr create can’t reach GitHub.
  • The .git folder stays read-only inside workspace-write, so git commit may still need approval, which fails.

Rules fix both. A rule matches the start of a command and lets it run outside the sandbox.

How to set up a Codex automation

  1. Run the prompt by hand first in a normal chat in the same project.
  2. Turn the method into a skill in .agents/skills/ and call it from the prompt with $skill-name.
  3. Create the automation in Scheduled: project, prompt, cadence, and Worktree or Local.
  4. Read the first few runs, then tighten the prompt or the cadence.

Example: fix new production bugs with a Codex automation

Once a day, this automation reads Interfere for new Active, High priority problems, writes a failing test and a fix for each, and opens a draft pull request. You need an Interfere workspace receiving telemetry (get started), the repository connected to Interfere through GitHub, and the GitHub CLI signed in.

  1. Scheduled runOnce a day, in a fresh worktree$interfere-scheduled-fix
  2. Read Interfere over MCPActive problems with High priority
  3. Failing test, then the fixFull test suite must pass
  4. Draft pull requestProblem link on the first line
  5. In recovery, then ResolvedInterfere watches production

1. Connect Interfere’s MCP server

Use the read-only endpoint, so an unattended run can’t resolve or dismiss a problem by mistake, and sign in before the first scheduled run, since nobody will be there to finish a browser sign-in. The Codex MCP guide has the steps.

Bash
1codex mcp add interfere --url https://mcp.interfere.com/mcp/readonly

2. Let git and gh run outside the sandbox

Add these to ~/.codex/rules/default.rules, then restart Codex:

Python
1prefix_rule(2    pattern = ["git", ["fetch", "switch", "add", "commit"]],3    decision = "allow",4    justification = "Branch and commit an Interfere fix",5)67prefix_rule(8    pattern = ["git", "push", "-u", "origin"],9    decision = "allow",10    justification = "Push the fix branch",11    match = ["git push -u origin HEAD"],12)1314prefix_rule(15    pattern = ["gh", "pr", "list"],16    decision = "allow",17    justification = "Look for an existing pull request",18)1920prefix_rule(21    pattern = ["gh", "pr", "create", "--draft"],22    decision = "allow",23    justification = "Open draft pull requests only",24    match = ["gh pr create --draft --title t --body b"],25    not_match = ["gh pr create --title t --body b"],26)

gh pr create without --draft still needs approval, so it fails. Test with codex execpolicy check --pretty --rules ~/.codex/rules/default.rules -- gh pr create --draft --title test --body test. The push rule doesn’t care about the branch name, so keep branch protection on your default branch.

3. Save the method as a skill

Create .agents/skills/interfere-scheduled-fix/SKILL.md:

Markdown
1---2name: interfere-scheduled-fix3description: Open a draft pull request with a regression test for each new Active, High priority Interfere problem. Use in scheduled runs.4---56Work through new Interfere problems for this repository. Handle at most 2.781. If the Interfere MCP tools aren't available, stop and reply9   "Interfere MCP not connected. Run codex mcp login interfere."102. Use the Interfere MCP search tool to find how to list production11   problems, then list those with status Active and priority High.123. For each one, run `gh pr list --state all --search "<problem link>"`.13   If a pull request already mentions the link, skip the problem.144. Read the problem, then at least two occurrences and their logs,15   before you change code.165. If the cause is outside this repository (an expired key, a provider17   outage), note it and skip.186. Run `git fetch origin`, then19   `git switch -c interfere/<problem-id> origin/main`.207. Write a test that fails before your change and passes after it. Make21   the smallest fix and run the full test suite. If anything fails, skip.228. Commit, run `git push -u origin HEAD`, then23   `gh pr create --draft --title "<cause>" --body "<body>"`. The body's24   first line is the Interfere problem link. Never merge.259. Reply with each problem and its pull request, or why you skipped it.

Steps 3 and 5 matter most: one stops a second PR for the same problem, the other stops Codex patching around a config or vendor issue.

4. Create the automation

In Scheduled, choose the repository, Worktree and a daily cadence:

Plain Text
1Run $interfere-scheduled-fix on this repository. If there are no new2problems, reply "No new Interfere problems" and stop.

The cap of two problems per run keeps the review queue readable.

After the fix deploys, the problem moves to In recovery while Interfere watches for new occurrences, then to Resolved once they stop. If a later deploy brings it back, the problem reopens and Interfere looks for the release that brought it back.

Troubleshooting

What happensWhat to do
The automation didn’t runDesktop automations need the computer on, the app running and the project still on disk.
The run says Interfere isn’t connectedRun codex mcp login interfere, or select Authenticate under Settings > MCP servers.
git commit or git push failsThe sandbox blocks it. Check the rules file loaded: restart Codex and run codex execpolicy check.
Tests fail in the worktree but pass in your checkoutThe worktree is missing dependencies or ignored files. Add a setup script and a .worktreeinclude file.
Runs stop at an approvalYour admins may disallow approval_policy = "never". Ask them, or narrow what the skill does.

Where Interfere fits

We make Interfere, so weigh this part accordingly. Coding agents like Codex write code faster than most teams can review it. The slow part now is knowing what broke in production, who it hit and whether the fix held. That’s why we built Interfere, and why the automation above gets a short list of problems that matter instead of a raw error feed.

It’s narrower than a full monitoring suite. Interfere has SDKs for Next.js, React with Vite and TanStack Start, and takes OpenTelemetry from everything else. It has no mobile SDKs, profiling, uptime or cron checks, or self-hosting. If you need those, an all-in-one monitoring tool is the better choice.

Set up Interfere and run the skill by hand once before you schedule it. The Grok Bot guide shows the same loop on another agent.