Codex cloud agent unable to install pnpm dependencies

Codex cloud agent is unable to install my project dependencies in order to test the code it is changing locally.

Clarification (from the agent)

The project’s dependencies could not be installed because pnpm install attempted to download packages from the network, resulting in connection errors. Consequently, running Jest was also impossible.

Logs

root@4fa4fef00af7:/workspace/agent-platform# pnpm install > /tmp/pnpm-install.lo
g && tail -n 20 /tmp/pnpm-install.log

/root/.nvm/versions/node/v22.15.1/lib/node_modules/corepack/dist/lib/corepack.cj
s:22051
    throw new Error(
          ^

Error: Error when performing the request to https://registry.npmjs.org/pnpm/-/pn
pm-9.3.0.tgz; for troubleshooting help, see https://github.com/nodejs/corepack#t
roubleshooting
    at fetch (/root/.nvm/versions/node/v22.15.1/lib/node_modules/corepack/dist/l
ib/corepack.cjs:22051:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:
5)

Agent: The network issue keeps pnpm install from finishing, but I’ll try running jest anyway.

2 Likes

I’m having the same issue. I want Codex to be able to run ‘npm test’ and fix the failing tests in the cloud. Is this even possible?

1 Like

it looks like you have to go to codex settings/environments then edit the environment you setup. Go to advanced settings then ‘setup script’ and input the command to install the necessary packages for your specific project e.g. ‘npm install’

3 Likes

Nice find @Jahonny, I didn’t know about that.
I still now get errors with onnxruntime-node when installing packages but I am trying to investigate it. It hard because I cannot interractively use the terminal nor do I know the underlying container image.

1 Like

Here’s the documentation for Codex:

https://platform.openai.com/docs/codex

It should help you move faster.

1 Like

Thank you, that definitely helps.
Unfortunately not much documentation about the environment setup. I saw that they have a link to a docker image that is meant to be very similar to the one used in the cloud, but on the image dependencies install fine, on the cloud they do not.

2 Likes

What about the set-up script option?
Can you use it to customize the environment needed for your project?

Regarding custom container images:

Custom images coming soon

Since this is a research preview, some bumps along the way are expected. I’ll follow up to see if there’s an estimated timeline.

1 Like

The docs don’t explain the environment setup well. You need to specify the installation script in on the web interface in the Environments → Edit → Advanced.

I set up a bootstrap github repo that shows minimal setup that has worked for me in case it’s helpful to anyone out there. I can’t put links in comments here, but user name is knavillus1 and the repo is codex_bootstrap.

In this setup, AGENTS.md tells the codex agent to update requirements.txt and install.sh accordingly if any dependencies are added. The install.sh script needs to be updated manually from the web application by editing the Environment config if changes are made.

4 Likes

You should be able to once your account is a little older.

This the one?

Hope you stick around. We’ve got a really solid dev community here!

3 Likes

@PaulBellow thats the repo, thanks! it’s barebones, but I’ll add linting, testing and PR/CI instructions as I progress through my testing. I urge everyone to give this tool a solid run because it has been remarkably good for me so far once I got past the break-in period. Such exciting stuff. Thanks for the welcome :slight_smile:

3 Likes

I am not entirely sure why you can’t just install the required dependencies via the set-up script.
But the agents.md is not intended to carry information for the environment set-up because this will be read every time you fire of a task and not just during environment set-up. I think you want to update dependencies on the fly?

Here’s the simple setup that worked for me:
I’m using the Setup script to install Godot Engine and verifying the installation by printing the Godot version to the terminal.

Click to expand the Set-Up script

#!/usr/bin/env bash
set -euo pipefail
apt-get update -qq
apt-get install -yqq wget unzip

GODOT_ZIP_URL=“https://github.com/godotengine/godot-builds/releases/download/4.3-stable/Godot_v4.3-stable_linux.x86_64.zip
wget -q “${GODOT_ZIP_URL}” -O /tmp/godot.zip

unzip -q /tmp/godot.zip -d /usr/local/bin
rm /tmp/godot.zip

mv /usr/local/bin/Godot_v4.3-stable_linux.x86_64 /usr/local/bin/godot
chmod +x /usr/local/bin/godot

godot --version

I can then run this script in the terminal where it will print the version as fortunately (!) expected. It’s just a sanity check at this point and can be removed later.

Results from the test in the Terminal

Starting test Configuring container Downloading repo Running setup scripts Configuring language runtimes... # Python: 3.12 # Node.js: 20 default -> 20 (-> v20.19.2) Now using node v20.19.2 (npm v10.8.2) Installing pnpm@10.11.0... Installing yarn@4.9.1... Installing npm@11.4.0... # Rust: 1.87.0 (default: 1.87.0) # Go: go1.23.8 (default: go1.23.8) # Swift: 6.1 (default: 6.1) → set -euo pipefail → apt-get update -qq → apt-get install -yqq wget unzip → GODOT_ZIP_URL=https://github.com/godotengine/godot-builds/releases/download/4.3-stable/Godot_v4.3-stable_linux.x86_64.zip → wget -q https://github.com/godotengine/godot-builds/releases/download/4.3-stable/Godot_v4.3-stable_linux.x86_64.zip -O /tmp/godot.zip → unzip -q /tmp/godot.zip -d /usr/local/bin → rm /tmp/godot.zip → mv /usr/local/bin/Godot_v4.3-stable_linux.x86_64 /usr/local/bin/godot → chmod +x /usr/local/bin/godot → godot --version 4.3.stable.official.77dcf97d8

1 Like

Same, bun install is unable to establish connection to registry. Even on basic Next.js starter repos it cannot get set up. So far none of my JS/TS repos have worked in Codex :confused:

1 Like

Whatever dependencies you need will have to be installed in the setup script. There is no internet connection from the container after the setup script runs.

1 Like

i am having the same issue as @andrewbierman, bun install just prints “failed to resolve” for every package

I ended up just skipping postinstall scripts entirely:

# Install deps
pnpm install --frozen-lockfile --ignore-scripts

Not ideal but it gets things working for now. Just have to eliminate anything that makes network requests outside of the setup step

yes, facing the same issue.

1 Like

I can’t even start an environment. Zero logs as well. Fails after 17s.

We just enabled user-configurable network access. Curious if that helps you folks.
https://help.openai.com/en/articles/11428266-codex-changelog

2 Likes

Try having nothing in the setup script, enabling Internet, then just prompt it to run the first command, such as npm install. You get much better output on the issue this way.