Codex CLI: add pre-apply interactive diff approval for every file edit

Open 💬 2 comments Opened Aug 21, 2026 by g-i-o-r-g-i-o

What variant of Codex are you using?

Codex CLI in the terminal, editing local workspace files.

What feature would you like to see?

Add a native pre-apply interactive edit-review mode to Codex CLI, comparable to the edit dialog in Claude Code CLI.

Before modifying any local file, Codex CLI should:

  1. Show the exact proposed diff.
  2. Keep the edit pending without writing it to disk.
  3. Wait for an explicit user decision.
  4. Offer native choices equivalent to Yes, Yes and accept edits for this session, and No.
  5. Keep terminal chat input available so the user can request corrections or additional changes while reviewing the pending edit.
  6. Apply only the exact diff that was approved.
  7. Request approval again whenever feedback causes the proposed diff to change.

This should work for every local file, including LaTeX, Markdown and configuration files, without requiring an IDE or a Git repository.

Reference behavior in Claude Code CLI

Do you want to make this edit to file.tex?
 ❯ 1. Yes
   2. Yes, and switch to accept edits (auto-approve file edits and common file commands) for this session (shift+tab)
   3. No

The proposed diff uses line-level and intraline highlighting. An added line is green, while the exact new words or characters within it use a stronger green. Removed content receives the corresponding red treatment. While this edit dialog is pending, the user can type instructions in the terminal chat and ask for a revised edit.

Current behavior

Codex CLI can apply local patches directly. A user can ask the agent to print a diff in ordinary chat and wait for a typed yes or no, but this is only a conversational convention. There is no native pending-edit state binding the displayed diff, the user decision and the exact patch eventually applied.

Post-apply Git diff inspection or Undo is not equivalent because the workspace file has already been modified.

Expected behavior

No file should change before the user accepts the exact pending diff through the native Codex CLI interface. If the user gives corrective feedback, Codex should replace the pending proposal with a revised diff and request approval again.

Why this matters

For controlled document editing, every generated change may require human review before it reaches the working file. Conversational approval is ambiguous and error-prone during long sessions.

A native pre-apply edit-review loop would provide:

  • a clear pending, applied or rejected state;
  • assurance that the applied patch matches the reviewed patch;
  • precise line-level and word-level review;
  • safer editing of documents and sensitive files;
  • support outside IDEs and Git repositories.

View original on GitHub ↗

2 Comments

g-i-o-r-g-i-o · 6 days ago

Concrete reference UI from Claude Code CLI:

Do you want to make this edit to file.tex?
 ❯ 1. Yes
   2. Yes, and switch to accept edits (auto-approve file edits and common file commands) for this session (shift+tab)
   3. No

This is specifically an interactive review of a proposed file edit in a terminal CLI, not merely a generic tool-permission request, not a Git dialog, and not an IDE workflow.

While reviewing the proposed edit, the user can also type feedback or additional instructions in the terminal input, for example to request further changes instead of accepting the current proposal as-is. The agent can then revise the proposed edit while the original file remains unchanged.

The requested Codex CLI behavior is therefore:

  1. Hold the proposed edit as pending without writing it to disk.
  2. Display the exact diff in the terminal together with native Yes / accept-edits-for-session / No choices.
  3. Keep the terminal input available during review so the user can explain what should be changed.
  4. Replace the pending proposal with a revised diff after that feedback.
  5. Write only the exact version eventually accepted by the user.

The important feature is an interactive, pre-apply edit-review loop in Codex CLI, not post-apply diff inspection and not general command authorization.

g-i-o-r-g-i-o · 6 days ago

Additional clarification about the requested diff UI:

The reference is specifically the proposed-edit diff rendered inside Claude Code CLI. The requested implementation is for Codex CLI in the terminal, not Codex App and not an IDE diff viewer.

Claude Code CLI uses both line-level and intraline highlighting. For example, an added line is shown with a green background, while the exact characters or words newly introduced within that line are shown with a stronger or brighter green. Deleted lines and the exact removed segments receive the corresponding red treatment.

Codex CLI should preserve this distinction in the pending pre-apply diff:

  • line-level color identifies an added or removed line;
  • stronger intraline color identifies the exact changed text inside that line;
  • unchanged portions of a modified line remain visually distinguishable;
  • the diff is displayed in the terminal before the file is written;
  • the interaction must not require Codex App, VS Code, another IDE, or a Git repository.

This word-level or intraline highlighting is important for reviewing prose, LaTeX and configuration files, where a one-word change inside a long line can otherwise be difficult to notice.