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.
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’
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.
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.
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.
@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
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.
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.
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
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.
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.