codex can not auto run go test with chromedp
Resolved 💬 3 comments Opened Jan 28, 2026 by bronze1man Closed Feb 6, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.92.0
What subscription do you have?
ChatGPT Business
Which model were you using?
gpt-5.2-codex
What platform is your computer?
Darwin 24.1.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
iTerm2
What issue are you seeing?
In a Codex CLI session running a Go test that uses chromedp, Chrome fails to start. A minimal chromedp smoke test in tests/chromedp_test fails with chromedp run
failed: chrome failed to start. In the same repo, go test -v -count=1 ./tests/reflect_test fails with a panic from chromedp startup.
What steps can reproduce the bug?
- Start Codex CLI in repo xxx.
- Ask Codex to run: go test -v -count=1 ./tests/chromedp_test.
- Observe failure: chromedp run failed: chrome failed to start.
content of tests/chromedp_test/chromedp_smoke_test.go
package chromedp_test
import (
"context"
"testing"
"time"
"github.com/chromedp/chromedp"
)
func TestChromeDpSmoke(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()
allocCtx, allocCancel := chromedp.NewExecAllocator(ctx, chromedp.DefaultExecAllocatorOptions[:]...)
defer allocCancel()
bctx, bcancel := chromedp.NewContext(allocCtx)
defer bcancel()
var title string
err := chromedp.Run(
bctx,
chromedp.Navigate("data:text/html,<html><head><title>ok</title></head><body>ok</body></html>"),
chromedp.Title(&title),
)
if err != nil {
t.Fatalf("chromedp run failed: %v", err)
}
if title != "ok" {
t.Fatalf("unexpected title: %q", title)
}
}
chromedp version. (part of go.mod)
github.com/chromedp/cdproto v0.0.0-20240202021202-6d0b6a386732 // indirect
github.com/chromedp/chromedp v0.9.5 // indirect
github.com/chromedp/sysutil v1.0.0 // indirect
What is the expected behavior?
Chromedp should launch Chrome and the smoke test should pass (title is ‘ok’). The test completes successfully when run outside of Codex on my machine.
Additional information
_No response_
3 Comments
It looks like you're hitting a sandbox policy violation. Codex’s macOS Seatbelt sandbox restricts writes to the workspace and temp dirs, while chromedp writes to
~/Library/*by default, which can cause “chrome failed to start.”As a workaround, try
--sandbox danger-full-accessor set chromedp.UserDataDir(...) to a path under /tmp or the repo.but claude cli works by default without any config.(ask me to confirm to run cmd of go test)
so I use claude when I need chromedp auto test.
i want to use codex too. (claude token limits is too low)
gpt-5.3-code + codex-cli 0.98.0 looks like fix this problem.
Just ask ai to run test outside sandbox in project prompt.