Skip to content

Critical: VS Code Codex extension ignores approval_policy="never" and randomly asks for approval, even for identical shell commands in the same chat #5038

@alfonsoalongi

Description

@alfonsoalongi

What version of Codex is running?

official VS Code extension only (CLI not installed) version 0.4.19 latest stable

Which model were you using?

gpt-5-codex

What platform is your computer?

Linux 5.14.0-570.49.1.el9_6.x86_64 x86_64 x86_64

What steps can reproduce the bug?

Summary

The official VS Code extension "Codex – OpenAI’s coding agent" (identifier openai.chatgpt, v0.4.19) repeatedly asks for "Approve session" when executing shell commands, even with approval_policy="never" and sandbox_mode="danger-full-access" enabled.

File edits inside the workspace usually work after the first approval, but shell command execution is random and inconsistent. Even within the same chat session, identical or similar commands sometimes run silently and sometimes trigger another approval prompt.

This makes Codex unreliable for automation, scripting, and CI/CD workflows.


Environment

  • Extension: Codex – OpenAI’s coding agent
    Identifier: openai.chatgpt
    Version: 0.4.19 (VS Code Marketplace)
    Published: 2025-03-06
    Last Updated: 2025-10-07
  • Codex CLI: Not installed (codex --version = N/A)
  • VS Code: latest stable from Microsoft RPM repo
  • OS: AlmaLinux 9 (x86_64)
  • ChatGPT plan: Plus
  • Model: gpt-5-codex
  • Configuration file: ~/.codex/config.toml
approval_policy = "never"
sandbox_mode = "danger-full-access"
model = "gpt-5-codex"
model_reasoning_effort = "medium"

[sandbox_workspace_write]
network_access = true

Actual behavior

  • Workspace file operations behave correctly after the first approval.
  • Shell commands executed via bash -lc '<command>' behave inconsistently.
  • Identical commands in the same chat may randomly trigger new "Approve session" dialogs.
  • Starting a new chat resets all approvals, and every command must be re-approved.
  • I keep getting responses like:
    Operation not permitted, sandbox restriction issues, network inaccessibility, interaction with MCP server configured in config.toml even if they use STDIO because I read limitations in the HTTP extension.

Example commands:

bash -lc 'grep -n "PATTERN" path/to/file'
bash -lc 'rg "SOME_REGEX" path/to/source'
bash -lc 'curl -s -w '\n%{time_total}' http://127.0.0.1:8888/health'

Persistent sandbox and network errors

I keep getting responses like:
Operation not permitted, sandbox restriction issues, network inaccessibility, interaction with MCP server configured in config.toml even if they use STDIO because I read limitations in the HTTP extension.

These errors occur continuously, not occasionally, and appear even when sandbox_mode="danger-full-access" and approval_policy="never" are active. They indicate that the sandbox and MCP integration layers are inconsistently enforcing restrictions, causing blocked shell and network operations.


Expected behavior

With approval_policy="never" and sandbox_mode="danger-full-access", all commands should run automatically without any manual approval, regardless of repetition or session state.


Impact

  • Blocks non-interactive automation and CI/CD jobs.
  • Breaks reproducibility because identical commands may behave differently.
  • Resets approval state when a new chat starts.
  • Continuous sandbox restriction or network errors even under full danger access.

This is a critical usability and reliability issue that makes Codex unsuitable for automated or trusted workflows.


Request

Please confirm whether this is a known bug in the shell execution layer (bash -lc) or a regression in approval state handling.
If unintentional, restoring consistent and persistent behavior for approval_policy="never" is essential for stable use.

What is the expected behavior?

Codex inconsistently requests "Approve session" dialogs when executing shell commands, even when the configuration explicitly disables confirmations.

  • In the same chat session, identical commands sometimes run without approval and sometimes require it again.
  • The pattern is completely random and does not depend on command content.
  • When starting a new chat, all approvals reset and every command requires confirmation again.
  • Workspace file edits generally work after the first approval.
  • Some shell commands fail with failed in sandbox: even when full danger access is enabled.

This inconsistent and random approval behavior makes Codex unreliable and unusable for continuous or scripted workflows.

What do you see instead?

Environment

  • VS Code extension: "Codex – OpenAI’s coding agent" (openai.chatgpt)
  • Version: 0.4.19 (VS Code Marketplace)
  • OS: AlmaLinux 9 (x86_64)
  • VS Code: latest stable (Microsoft RPM repo)
  • ChatGPT plan: Plus
  • Model: gpt-5-codex
  • CLI: Not installed
  • Config file: ~/.codex/config.toml (shown below)
approval_policy = "never"
sandbox_mode = "danger-full-access"
model = "gpt-5-codex"
model_reasoning_effort = "medium"

[sandbox_workspace_write]
network_access = true

Behavioral notes

  • File editing behaves correctly after initial approval.
  • Shell commands behave randomly, even for identical inputs in the same chat.
  • Approval state resets completely when a new chat is started.
  • I keep getting responses like: Operation not permitted, sandbox restriction issues, network inaccessibility, interaction with MCP server configured in config.toml even if they use STDIO because I read limitations in the HTTP extension.
  • CLI not installed, issue reproducible using only the VS Code extension.

Additional information

Environment

  • VS Code extension: "Codex – OpenAI’s coding agent" (openai.chatgpt)
  • Version: 0.4.19 (VS Code Marketplace)
  • OS: AlmaLinux 9 (x86_64)
  • VS Code: latest stable (Microsoft RPM repo)
  • ChatGPT plan: Plus
  • Model: gpt-5-codex
  • CLI: Not installed
  • Config file: ~/.codex/config.toml (shown below)
approval_policy = "never"
sandbox_mode = "danger-full-access"
model = "gpt-5-codex"
model_reasoning_effort = "medium"

[sandbox_workspace_write]
network_access = true

Behavioral notes

  • File editing behaves correctly after initial approval.
  • Shell commands behave randomly, even for identical inputs in the same chat.
  • Approval state resets completely when a new chat is started.
  • I keep getting responses like: Operation not permitted, sandbox restriction issues, network inaccessibility, interaction with MCP server configured in config.toml even if they use STDIO because I read limitations in the HTTP extension.
  • CLI not installed, issue reproducible using only the VS Code extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingextensionIssues related to the VS Code extension

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions