shell_environment_policy.filters exclusion ignored by spawned shell
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of Codex CLI is running?
0.149.1 (standalone)
What subscription do you have?
ChatGPT Business
Which model were you using?
No response
What platform is your computer?
Linux 6.18.33.2-microsoft-standard-WSL2 x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
Windows Terminal Preview
Codex doctor report
{
"schemaVersion": 1,
"generatedAt": "<redacted timestamp>",
"overallStatus": "warning",
"codexVersion": "0.149.1",
"checks": {
"app_server.status": {
"id": "app_server.status",
"category": "app-server",
"status": "ok",
"summary": "background server is not running",
"details": {
"control socket": "/home/<user>/.codex-<profile>/app-server-control/app-server-control.sock",
"daemon state dir": "/home/<user>/.codex-<profile>/app-server-daemon",
"mode": "ephemeral",
"pid file": "/home/<user>/.codex-<profile>/app-server-daemon/app-server.pid (missing)",
"settings": "/home/<user>/.codex-<profile>/app-server-daemon/settings.json (missing)",
"status": "not running",
"update-loop pid file": "/home/<user>/.codex-<profile>/app-server-daemon/app-server-updater.pid (missing)"
},
"remediation": null,
"durationMs": 0
},
"auth.credentials": {
"id": "auth.credentials",
"category": "auth",
"status": "ok",
"summary": "auth is configured",
"details": {
"auth file": "/home/<user>/.codex-<profile>/auth.json",
"auth storage mode": "File",
"stored API key": "false",
"stored ChatGPT tokens": "true",
"stored agent identity": "false",
"stored auth mode": "chatgpt"
},
"remediation": null,
"durationMs": 0
},
"config.load": {
"id": "config.load",
"category": "config",
"status": "ok",
"summary": "config loaded",
"details": {
"CODEX_HOME": "/home/<user>/.codex-<profile>",
"config.toml": "/home/<user>/.codex-<profile>/config.toml",
"config.toml parse": "ok",
"cwd": "/home/<user>/projects/<company>/<repo>",
"enabled feature flags": "shell_tool, view_image, unified_exec, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, hooks, enable_request_compression, unbounded_connection_retries, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, in_app_chat, in_app_dictation, in_app_updates, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, item_ids, skill_mcp_dependency_install, skill_search, mentions_v2, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, fast_mode, tui_app_server, remote_compaction_v2, workspace_dependencies",
"feature flag overrides": "none",
"feature flags enabled": "42",
"log dir": "/home/<user>/.codex-<profile>/log",
"mcp servers": "2",
"model": "<default>",
"model provider": "openai",
"sqlite home": "/home/<user>/.codex-<profile>"
},
"remediation": null,
"durationMs": 0
},
"git.environment": {
"id": "git.environment",
"category": "git",
"status": "ok",
"summary": "git version 2.40.1",
"details": {
".git entry": "file -> /home/<user>/projects/<company>/<main-repo>/.git/worktrees/<worktree>",
"PATH git #1": "/usr/bin/git",
"PATH git #2": "/bin/git",
"PATH git entries": "2",
"git branch": "<redacted>",
"git build options": "git version 2.40.1; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh",
"git exec path": "/usr/lib/git-core",
"git version": "git version 2.40.1",
"repo detected": "true",
"repo root": "/home/<user>/projects/<company>/<repo>",
"selected git": "/usr/bin/git"
},
"remediation": null,
"durationMs": 129
},
"installation": {
"id": "installation",
"category": "install",
"status": "ok",
"summary": "installation looks consistent",
"details": {
"PATH codex #1": "/home/<user>/.local/bin/codex",
"PATH codex #2": "/home/<user>/.local/bin/codex",
"PATH codex #3": "/home/<user>/.local/bin/codex",
"PATH codex #4": "/home/<user>/.local/bin/codex",
"PATH codex #5": "/home/<user>/.local/bin/codex",
"PATH codex entries": "5",
"current executable": "/home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/bin/codex",
"install context": "standalone (unix, package /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl, bin /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/bin, resources /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/codex-resources, path /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/codex-path)",
"managed by bun": "false",
"managed by npm": "false",
"managed by pnpm": "false",
"managed package root": "not set"
},
"remediation": null,
"durationMs": 62
},
"mcp.config": {
"id": "mcp.config",
"category": "mcp",
"status": "ok",
"summary": "MCP configuration is locally consistent",
"details": {
"configured servers": "2",
"disabled servers": "0",
"streamable_http servers": "2"
},
"remediation": null,
"durationMs": 242
},
"network.env": {
"id": "network.env",
"category": "network",
"status": "ok",
"summary": "network-related environment looks readable",
"details": {
"managed proxy": "not configured",
"proxy env vars": "none",
"respect system proxy": "disabled"
},
"remediation": null,
"durationMs": 0
},
"network.provider_reachability": {
"id": "network.provider_reachability",
"category": "reachability",
"status": "ok",
"summary": "active provider endpoints are reachable over HTTP",
"details": {
"ChatGPT inference URL": "https://chatgpt.com/backend-api/<redacted> reachable (HTTP 405)",
"reachability mode": "ChatGPT auth"
},
"remediation": null,
"durationMs": 147
},
"network.websocket_reachability": {
"id": "network.websocket_reachability",
"category": "websocket",
"status": "ok",
"summary": "Responses WebSocket handshake succeeded",
"details": {
"DNS": "2 IPv4, 2 IPv6, first IPv4",
"auth mode": "chatgpt",
"connect timeout": "15000 ms",
"endpoint": "wss://chatgpt.com/backend-api/<redacted>",
"handshake result": "HTTP 101 Switching Protocols",
"model provider": "openai",
"provider name": "OpenAI",
"proxy env vars": "none",
"reasoning header": "false",
"server model present": "false",
"supports websockets": "true",
"wire API": "responses"
},
"remediation": null,
"durationMs": 809
},
"runtime.provenance": {
"id": "runtime.provenance",
"category": "runtime",
"status": "ok",
"summary": "running standalone on linux-x86_64",
"details": {
"commit": "unknown",
"current executable": "/home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/bin/codex",
"install method": "standalone (unix, package /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl, bin /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/bin, resources /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/codex-resources, path /home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/codex-path)",
"platform": "linux-x86_64",
"version": "0.149.1"
},
"remediation": null,
"durationMs": 0
},
"runtime.search": {
"id": "runtime.search",
"category": "search",
"status": "ok",
"summary": "search is OK (bundled)",
"details": {
"search command": "/home/<user>/.codex-<profile>/packages/standalone/releases/0.149.1-x86_64-unknown-linux-musl/codex-path/rg",
"search command readiness": "file exists",
"search provider": "bundled"
},
"remediation": null,
"durationMs": 0
},
"sandbox.helpers": {
"id": "sandbox.helpers",
"category": "sandbox",
"status": "ok",
"summary": "sandbox configuration is readable",
"details": {
"approval policy": "OnRequest",
"codex-linux-sandbox helper": "/home/<user>/.codex-<profile>/tmp/arg0/<temporary>/codex-linux-sandbox",
"execve wrapper helper": "/home/<user>/.codex-<profile>/tmp/arg0/<temporary>/codex-execve-wrapper",
"filesystem sandbox": "restricted",
"network sandbox": "restricted"
},
"remediation": null,
"durationMs": 0
},
"security.endpoint": {
"id": "security.endpoint",
"category": "security",
"status": "ok",
"summary": "endpoint protection is not inspected on this platform",
"details": {
"endpoint products": "not inspected on this platform"
},
"remediation": null,
"durationMs": 0
},
"state.paths": {
"id": "state.paths",
"category": "state",
"status": "ok",
"summary": "state paths and databases are inspectable",
"details": {
"CODEX_HOME": "/home/<user>/.codex-<profile> (dir)",
"active rollout files": "71 files, 109911384 total bytes, 1548047 average bytes",
"archived rollout files": "0 files, 0 total bytes, 0 average bytes",
"goals DB": "/home/<user>/.codex-<profile>/goals_1.sqlite (file)",
"goals DB integrity": "ok",
"log DB": "/home/<user>/.codex-<profile>/logs_2.sqlite (file)",
"log DB integrity": "ok",
"log dir": "/home/<user>/.codex-<profile>/log (dir)",
"memories DB": "/home/<user>/.codex-<profile>/memories_1.sqlite (file)",
"memories DB integrity": "ok",
"queue DB": "/home/<user>/.codex-<profile>/queue_1.sqlite (file)",
"queue DB integrity": "ok",
"sqlite home": "/home/<user>/.codex-<profile> (dir)",
"standalone release cache": "1 entries in /home/<user>/.codex-<profile>/packages/standalone/releases",
"state DB": "/home/<user>/.codex-<profile>/state_5.sqlite (file)",
"state DB integrity": "ok",
"thread history DB": "/home/<user>/.codex-<profile>/thread_history_1.sqlite (file)",
"thread history DB integrity": "ok"
},
"remediation": null,
"durationMs": 1030
},
"state.rollout_db_parity": {
"id": "state.rollout_db_parity",
"category": "threads",
"status": "ok",
"summary": "rollout files and state DB thread inventory agree",
"details": {
"default model provider": "openai",
"rollout DB active files": "71",
"rollout DB active rows": "71",
"rollout DB archive mismatches": "0",
"rollout DB archived files": "0",
"rollout DB archived rows": "0",
"rollout DB duplicate DB paths": "0",
"rollout DB duplicate rollout thread ids": "0",
"rollout DB malformed file names": "0",
"rollout DB missing active rows": "0",
"rollout DB missing archived rows": "0",
"rollout DB model providers": "openai=71",
"rollout DB rows": "71",
"rollout DB scan cap reached": "false",
"rollout DB scan errors": "0",
"rollout DB sources": "cli=71",
"rollout DB stale rows": "0"
},
"remediation": null,
"durationMs": 157
},
"system.disk": {
"id": "system.disk",
"category": "disk",
"status": "ok",
"summary": "sufficient free disk space (77.4 GiB)",
"details": {
"CODEX_HOME available": "77.4 GiB",
"failure threshold": "1.0 GiB",
"warning threshold": "5.0 GiB",
"worktree available": "77.4 GiB"
},
"remediation": null,
"durationMs": 0
},
"system.environment": {
"id": "system.environment",
"category": "system",
"status": "ok",
"summary": "OS language C",
"details": {
"EDITOR": "not set",
"LANG": "C.UTF-8",
"VISUAL": "not set",
"os": "Ubuntu 22.4.0 (jammy) [64-bit]",
"os language": "C",
"os type": "Ubuntu",
"os version": "22.4.0"
},
"remediation": null,
"durationMs": 32
},
"terminal.env": {
"id": "terminal.env",
"category": "terminal",
"status": "warning",
"summary": "width 73 cols - output may wrap (recommended >=80)",
"details": {
"DISPLAY": "present",
"WAYLAND_DISPLAY": "present",
"WSL_DISTRO_NAME": "present",
"WSL_INTEROP": "present",
"WT_SESSION": "present",
"color output": "enabled",
"effective locale": "C.UTF-8",
"stderr is terminal": "true",
"stdin is terminal": "true",
"stdout is terminal": "true",
"terminal": "Windows Terminal",
"terminal size": "73x62"
},
"issues": [
{
"severity": "warning",
"cause": "width 73 cols - output may wrap (recommended >=80)",
"measured": "73 x 62",
"expected": ">= 80 columns",
"remedy": "resize the window to at least 80 columns",
"fields": [
"terminal size"
]
}
],
"remediation": null,
"durationMs": 0
},
"terminal.title": {
"id": "terminal.title",
"category": "title",
"status": "ok",
"summary": "terminal title default",
"details": {
"terminal title activity": "true",
"terminal title items": "activity, project-name",
"terminal title project source": "git repo root",
"terminal title project value": "<repo>",
"terminal title source": "default"
},
"remediation": null,
"durationMs": 0
},
"updates.status": {
"id": "updates.status",
"category": "updates",
"status": "ok",
"summary": "update configuration is locally consistent",
"details": {
"cached latest version": "0.149.1",
"check for update on startup": "true",
"last checked at": "<redacted timestamp>",
"latest version": "0.149.1",
"latest version status": "current version is not older",
"update action": "standalone installer",
"version cache": "/home/<user>/.codex-<profile>/version.json"
},
"remediation": null,
"durationMs": 129
}
}
}
What issue are you seeing?
The configured shell environment policy does not exclude NO_COLOR from spawned shells.
Configuration:
[shell_environment_policy.filters]
NO_COLOR = "exclude"
Despite this, spawned shell commands still see:
NO_COLOR=1
codex --strict-config doctor --json reports that the configuration loaded successfully. NO_COLOR is not configured in my shell profiles, Windows environment, or Codex shell snapshot.
The issue also reproduces using the legacy supported syntax:
[shell_environment_policy]
exclude = ["NO_COLOR"]
This appears to be specific to the spawned/unified shell execution path, which seems to inject or retain NO_COLOR after the environment policy is applied.
Impact: Nx sets FORCE_COLOR=true for task children, causing Node to warn:
Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
Current workaround:
env -u NO_COLOR pnpm nx run :typecheck
What steps can reproduce the bug?
- Configure Codex with:
[shell_environment_policy.filters]
NO_COLOR = "exclude"
-
Restart Codex.
-
Run:
env | grep '^NO_COLOR='
- Observe that the command outputs:
NO_COLOR=1
The same behavior also reproduces with:
[shell_environment_policy]
exclude = ["NO_COLOR"]
What is the expected behavior?
NO_COLOR should be excluded from the environment of spawned shell commands.
Running:
env | grep '^NO_COLOR='
should produce no output.
Additional information
might be related to https://github.com/openai/codex/issues/22124
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how shell_environment_policy.filters is parsed and applied when launching a spawned shell, then reproduce the exclusion behavior on the reported Linux WSL2 setup. Done means an excluded environment entry is absent from the spawned shell while other policy behavior remains unchanged, with regression coverage for the configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100