Just shippedBest skills for each job.See the picks →

CodexCI failureNot executed· 1 caveat

Codex autofix when CI fails

When CI fails, Codex reads the failure, makes a fix, and opens a pull request with it.

workflow_run: CI completed (failure)

How it works

From event to result

1
Trigger
GitHub starts a run when the workflow named CI finishes.
2
Agent
Codex, via openai/codex-action.
3
What it does
When CI fails, Codex reads the failure, makes a fix, and opens a pull request with it.
4
What you get
This listing does not state a pull request or a comment. Read the prompt, and treat the result as not executed.

Setup

Where to paste this

  1. Create .github/workflows/prpm-codex-autofix.yml
  2. Paste the workflow below into that file. The notes beside the YAML are not part of the file.
  3. Add this repository secret: OPENAI_API_KEY. The file reads it as secrets.NAME. Do not paste the key into the YAML.

Let your agent do it

Copy a prompt for Claude Code, Codex, or Cursor.

Paste it into your coding agent in this repo. It does the setup and asks before anything leaves your machine.

Runs the same job in your agent session, on the plan you are signed in with. No API key, no Action.

Do the job of the "Codex autofix when CI fails" workflow from AgentFlows (https://agentflows.sh/flows/prpm-codex-autofix) right here, in this session, using the plan I'm signed in with. No API key and no GitHub Action.

Install these agent skills first. Download each SKILL.md from its source (respect its license) into .claude/skills/<name>/SKILL.md, or wherever this agent loads skills from:
- Debug: https://github.com/anthropics/knowledge-work-plugins/blob/main/engineering/skills/debug/SKILL.md (Apache-2.0), notes at https://agentflows.sh/skills/debug

What it does: When CI fails, Codex reads the failure, makes a fix, and opens a pull request with it.

The workflow normally runs on: workflow_run: CI completed (failure). Instead, ask me which pull request, issue, or branch to work on, then follow these instructions:

```text
You are contributing to the PRPM monorepo. Read the repository contents, rerun the Jest and workspace tests that fail in CI, and implement the smallest possible change to fix the failure. Do not refactor unrelated code. Only modify files when necessary to get CI passing again.
```

Use the gh CLI for anything on GitHub, and show me what you plan to post or change before you do it.

The file

Workflow YAML

Copy the file as-is. The notes beside each block explain it.

.github/workflows/prpm-codex-autofix.yml

Name

The name GitHub shows in the Actions tab. The file path is under Where to paste this.

name: Codex Autofix

Trigger

GitHub starts a run when the workflow named CI finishes.

on:  workflow_run:    workflows: ["CI"]    types:      - completed

Permissions

This token may push commits, and comment on pull requests and open them. Anything not listed is not granted.

permissions:  contents: write  pull-requests: write

Jobs

Each job is one runner. The steps inside it run top to bottom.

jobs:  auto-fix:    if: ${{ github.event.workflow_run.conclusion == 'failure' }}    runs-on: ubuntu-latest    env:      OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}      FAILED_WORKFLOW_NAME: ${{ github.event.workflow_run.name }}      FAILED_RUN_URL: ${{ github.event.workflow_run.html_url }}      FAILED_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}      FAILED_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}

Steps

These steps run in order on that job.

    steps:      - name: Ensure OpenAI API key is set        run: |          if [ -z "$OPENAI_API_KEY" ]; then            echo "OPENAI_API_KEY secret is not set. Skipping Codex autofix." >&2            exit 1          fi      - name: Checkout failing commit        uses: actions/checkout@v4        with:          ref: ${{ env.FAILED_HEAD_SHA }}          fetch-depth: 0      - name: Setup Node.js        uses: actions/setup-node@v4        with:          node-version: '20'          cache: npm      - name: Install dependencies        run: |          if [ -f package-lock.json ]; then            npm ci          else            npm install          fi      - name: Run Codex autofix        id: codex

Agent

Runs Codex with openai/codex-action@main. Inputs: openai-api-key (the OpenAI API key secret); prompt (the task); codex-args.

        uses: openai/codex-action@main        with:          openai-api-key: ${{ secrets.OPENAI_API_KEY }}          prompt: |            You are contributing to the PRPM monorepo. Read the repository contents, rerun the Jest and workspace tests that fail in CI, and implement the smallest possible change to fix the failure. Do not refactor unrelated code. Only modify files when necessary to get CI passing again.          codex-args: '["--config","sandbox_mode=\"workspace-write\""]'      - name: Verify tests        run: npm test --silent        continue-on-error: true      - name: Create pull request with fixes        if: success()        uses: peter-evans/create-pull-request@v6        with:          commit-message: "fix(ci): auto-fix failing tests via Codex"          branch: codex/auto-fix-${{ github.event.workflow_run.run_id }}          base: ${{ env.FAILED_HEAD_BRANCH }}          title: "Auto-fix failing CI via Codex"          body: |            Codex automatically generated this PR in response to a CI failure on workflow `${{ env.FAILED_WORKFLOW_NAME }}`.            Failed run: ${{ env.FAILED_RUN_URL }}            Head branch: `${{ env.FAILED_HEAD_BRANCH }}`            This PR contains minimal changes intended solely to make the CI pass.

Keep going

More workflows

All workflows
  • CodexPull request
    12

    Codex PR review posted as a comment

    Two-job split keeps the API key job read-only (README example pattern). `:read-only` profile per README Permission profiles.

    pull_request: opened

    Est. cost per run~$0.03 runner + OpenAI tokens (UNVERIFIED)Checked Oct 16, 2026

    Not executed· 3 caveats
  • CodexLabel
    13

    Codex implements an issue on label

    `:workspace` profile lets Codex edit the checkout (README). PR creation is plain git/gh, not an action input.

    issues: labeled == codex

    Est. cost per run~$0.09 runner + OpenAI tokens (UNVERIFIED)Checked Oct 16, 2026

    Not executed· 2 caveats
  • CodexIssue opened
    14

    Codex triage with JSON output schema

    `output-schema` is forwarded to `codex exec --output-schema` (README inputs table).

    issues: opened

    Est. cost per run~$0.01 runner + OpenAI tokens (UNVERIFIED)Checked Oct 16, 2026

    Not executed· 3 caveats