Skip to content

Fix codex-home input for safety-strategy: unprivileged-user#100

Open
WKBae wants to merge 1 commit intoopenai:mainfrom
WKBae:sudo-preserve-env
Open

Fix codex-home input for safety-strategy: unprivileged-user#100
WKBae wants to merge 1 commit intoopenai:mainfrom
WKBae:sudo-preserve-env

Conversation

@WKBae
Copy link
Copy Markdown

@WKBae WKBae commented May 8, 2026

sudo resets the environment by default.

When the codex-home input is set, runCodexExec adds CODEX_HOME to the environment passed to spawn(). For unprivileged-user, however, the spawned process is sudo, which then runs codex exec as the target user. Without preserving the environment, CODEX_HOME is not propagated to the Codex process, so the CLI may read configuration from the target user's default Codex home instead.

This change passes -E (--preserve-env) to sudo so the unprivileged Codex process receives the environment prepared by the action.

Fixes #99

`sudo` resets the environment by default.

When the `codex-home` input is set, `runCodexExec` adds `CODEX_HOME` to the
environment passed to `spawn()`. For `unprivileged-user`, however, the spawned
process is `sudo`, which then runs `codex exec` as the target user. Without
preserving the environment, `CODEX_HOME` is not propagated to the Codex process,
so the CLI may read configuration from the target user's default Codex home
instead.

This change passes `-E` (`--preserve-env`) to `sudo` so the unprivileged Codex
process receives the environment prepared by the action.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@WKBae
Copy link
Copy Markdown
Author

WKBae commented May 8, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant