# How to run harness refinement with the Codex executor with harness2

Repo: [google-research/harness2](https://github.com/google-research/harness2) | Difficulty: Advanced | Time: 1 hour 30 minutes | Basis: From the README

Switch from the default OpenCode executor to Codex to see how the executor changes refined-harness results.

**Who it is for:** Developer who already uses Codex as a coding agent and wants harness improvements tuned to that executor

**The problem:** Harness edits that help one executor may not carry over to another, and you have no way to check without a controlled run.

**The outcome:** A refinement run on Codex whose results are stored separately so you can compare it against an OpenCode run.

## Steps

1. Read the Codex executor section in docs/SETUP.md and finish its prerequisites.
2. Install a benchmark: harness2-setup jb
3. Run with Codex: harness2 --bench jb --k 1 --mode parallel --substrate cx --max-tasks 1
4. Use a fresh HARNESS2_RUNS_DIR when changing models or task selection.
5. Judge and report with matching flags: harness2-judge --bench jb --k 1 --mode parallel --substrate cx

## Prompt to paste into your agent

```text
In google-research/harness2, run one JobBench task with --substrate cx and --k 1 --mode parallel, then judge it with matching flags. Verify the run completes under its own runs directory and that network restrictions are configured first.
```

## Caveat

Codex runs with its sandbox disabled and executors get open web access, so run it only in an isolated environment, and confirm whether judge and report also need the substrate flag in the experiment guide.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/google-research-harness2/swap-codex-executor-into-agent-loop/
