Skip to content

Fix a failing test with Codex

Your VM runs a signed-in Codex that fixes a failing test in your repository. The diff of that fix appears in your terminal.

  • An account on the dashboard. New accounts need approval first; the dashboard shows your status.
  • A Codex account that allows device sign-in. The Codex authentication guide covers the other options. Model usage follows your provider’s terms and billing.
  • A repository with a failing test that you can clone. A public repository needs nothing else. For a private one, follow Open pull requests first.
  • si for the CLI tab. Install it as shown in From your terminal.

Every VM has Codex installed, so you install nothing.

  1. Open SVMs.
  2. Select Create SVM.
  3. Enter a name, such as codex-example, and keep the other fields.
  4. Select Create SVM.
  5. Select Open terminal on the new row.
  1. In the terminal, run:

    Terminal window
    codex login --device-auth
  2. Open the link it prints in your browser and enter the one-time code.

  3. Run the command below to confirm the sign-in.

    Terminal window
    codex login status
  4. Run:

    Terminal window
    exit

Your SlashInfra sign-in does not sign Codex in. Codex keeps its own login inside the VM.

  1. In the terminal, run:

    Terminal window
    git clone https://github.com/your-org/your-repo.git /home/user/app

Use an HTTPS URL. Git over SSH does not receive the GitHub credential.

  1. Open Companion.
  2. Choose Codex as the agent.
  3. Choose your VM in the SVM menu.
  4. Choose Other folder, and enter ~/app.
  5. Enter Run the tests, fix the failing test and explain the change. in Task.
  6. Select Start agent. The agent may ask for approval while it works. Answer in Companion.
  1. In the terminal, run:

    Terminal window
    cd /home/user/app && git diff
    Output
    diff --git a/<path> b/<path>
    ...

The diff should change the code under test and leave the test file as it was.

You should now see the diff of the fix in your terminal. Run your project’s test command in the terminal. The test that failed passes.

Symptom Cause Fix
Repository not found on clone The repository is private and not connected, or the URL uses SSH. Use an https://github.com/ URL. For a private repository, follow Open pull requests.
codex login --device-auth fails Your account does not allow device sign-in. Allow device sign-in for your account, or use another method in the Codex authentication guide.
The test still fails The agent stopped early or changed another file. Read the output, then ask again with the error text.

Scroll horizontally to see all columns.

  1. Open SVMs.
  2. Select Delete on the row of the VM.