Codex unusable for Laravel projects

Resolved 💬 4 comments Opened Aug 24, 2025 by larskoole Closed Nov 27, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.23.0

Which model were you using?

gpt-5 (any)

What platform is your computer?

Darwin 24.6.0 x86_64 i386

What steps can reproduce the bug?

// web.php

Route::put('/', function () { return 'works!'; });
// Default Pest v4 test

<?php

test('returns a successful response', function () {
    $response = $this->put('/');

    $response->assertStatus(200);
});

Then run php artisan test

What is the expected behavior?

Codex runs php artisan test.
Output should be the test passing.

What do you see instead?

The test ends up failing with a 419 error.
This indicates that the put it tried to do was missing a CSRF token.
But this shouldn't happen because the env key APP_ENV is testing which disables CSRF.

Its also talking about MacOS seatbelt, no clue what that means.

<img width="1679" height="428" alt="Image" src="https://github.com/user-attachments/assets/7a36fc5e-c72c-435a-b7b3-c8f4e05e1a4e" />

Additional information

It does work with Gemini CLI, Claude Code, and Junie.
It doesn't work with Codex CLI or Copilot in agent mode on PHPStorm.

My expectations are this just works out of the box but it cant even run my test suite.

View original on GitHub ↗

4 Comments

bolinfest collaborator · 1 year ago

@larskoole I just wrote up a lengthy response to a comparable issue here:

https://github.com/openai/codex/issues/2641#issuecomment-3218285379

Here are some additional docs about our sandboxing:

https://github.com/openai/codex?tab=readme-ov-file#platform-sandboxing-details

larskoole · 1 year ago

@bolinfest thanks for the response. I've run every possible command and config imaginable to try and make this work but I cant.

I've tried the following:

  1. codex debug seatbelt --full-auto -- php artisan test
  2. codex --dangerously-bypass-approvals-and-sandbox debug seatbelt -- php artisan test
  3. Edited the config to allow network access (just to be sure, it's all local but who knows):

```
[sandbox_workspace_write]
network_access = true

[sandbox_danger_full_access]
network_access = true
``
Then ran these commands:
codex --sandbox workspace-write debug seatbelt -- php artisan test
codex --sandbox danger-full-access debug seatbelt -- php artisan test`

All these commands resulted either of 2 things:

  1. The tests fail
  2. Codex couldn't read any terminal output after it runs a command

I'm willing to try and get this working. Do you have anything else left for me to try?

adsqx · 1 year ago

Some tools run their code in a separate process or container with its own environment, so variables from your shell don’t carry over. In Laravel, the test environment loads from .env.testing or phpunit.xml, not from .env. If configuration is cached (bootstrap/cache/config.php), that cache must be cleared for changes to take effect.

larskoole · 1 year ago

Running php artisan optimize:clear (clears all possible caches including bootstrap/cache) doesn't have any effect on the issue.

When codex runs php artisan test it does make it so bootstrap/cache gets filled with packages.php and services.php, but I fail to see how that would have an effect on the tests failing.