openai / openai/codex

"Yes, and don't ask again" remembers exact command instead of command/executable

Open
#38,328 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI enhancement sandbox TUI
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.147.0

What subscription do you have?

plus

Which model were you using?

gpt-5.6-terra

What platform is your computer?

Linux 6.8.0-136-generic x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

Tabby

Codex doctor report

What issue are you seeing?

When Codex CLI asks for approval to run a shell command, selecting “Yes, and don’t ask again” appears to whitelist the entire exact command string rather than the underlying command/tool being used.

This makes the option much less useful for commands containing dynamic arguments, file names, paths, search terms, IDs, etc.

For example, if Codex asks to run:

grep "foo" /some/path/file1.log

and I select “Yes, and don’t ask again”, I would expect future uses of grep (or at least similar grep commands) to no longer require approval.

Instead, Codex seems to remember only that exact command. If it later runs:

grep "bar" /some/path/file2.log

I am prompted for approval again.

What steps can reproduce the bug?

Have Codex execute a command with arguments, such as: grep "foo" file1.txt

When prompted for permission, select “Yes, and don’t ask again.”

Have Codex execute another command using the same executable but different arguments: grep "bar" file2.txt

Codex asks for permission again.

What is the expected behavior?

Selecting “Yes, and don’t ask again” should create a reusable permission rule based on the underlying executable or a sensible command prefix.

For example, approving: grep "foo" file1.txt

could allow future commands matching:

grep *

rather than only allowing the exact original command string.

Alternatively, Codex could make the scope explicit when approving a command, such as:

Allow this exact command
Allow commands starting with grep
Allow grep for this session
Allow grep permanently

Additional information

No response

Contributor guide

Open the contributing guide

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

Reproduce the approval flow with the two grep commands described, then trace the Codex CLI permission-handling entry point that records the “Yes, and don’t ask again” choice. Determine how the rule is matched and update it so approval scope is reusable for the executable or an explicitly defined prefix; verify that different arguments no longer trigger an unexpected prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
authorization, cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.