openai / openai/codex-action

`codex-home` input is ignored when `safety-strategy` is `unprivileged-user`

Open Beginner friendly
#99 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

codex-home is passed via environment variables of subprocess.spawn.
https://github.com/openai/codex-action/blob/e0fdf01220eb9a88167c4898839d273e3f2609d1/src/runCodexExec.ts#L167-L170

However, if safety-strategy: unprivileged-user is set, the command is prefixed with sudo -u ${codexUser} --:
https://github.com/openai/codex-action/blob/e0fdf01220eb9a88167c4898839d273e3f2609d1/src/runCodexExec.ts#L117

The problem is, sudo does not pass enviroment variables unless -E(--preserve-env) flag is set.
This causes configuration mismatch, usually leading to 401 Unauthorized because proxy config is not applied:

ERROR codex_api::endpoint::responses_websocket: failed to connect to websocket: HTTP error: 401 Unauthorized, url: wss://api.openai.com/v1/responses
...
ERROR: Reconnecting... 5/5
ERROR: unexpected status 401 Unauthorized: Missing bearer or basic authentication in header, url: https://api.openai.com/v1/responses, cf-ray: ..., request id: ...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The command setup is in src/runCodexExec.ts, especially the environment passed to subprocess.spawn and the sudo prefix around lines 117 and 167-170. Trace both safety-strategy paths and verify that codex-home remains available to the unprivileged command; finish by running the repository’s existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.