Skip to content

feat(doctor): report editor and pager environment#27081

Merged
fcoury-oai merged 1 commit into
mainfrom
codex/doctor-editor-env
Jun 8, 2026
Merged

feat(doctor): report editor and pager environment#27081
fcoury-oai merged 1 commit into
mainfrom
codex/doctor-editor-env

Conversation

@fcoury-oai

@fcoury-oai fcoury-oai commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Background

This was prompted by #26858, where the attached doctor report did not include the editor selection and I had to ask which editor was in use before investigating the external-editor newline issue. Capturing these variables in doctor makes that context available up front in future reports.

codex doctor is intended to capture enough local context to diagnose startup and terminal behavior, but it did not report the environment variables that select an external editor or configure command pagers.

The TUI prefers VISUAL over EDITOR, so missing or unexpected values can explain why the external-editor shortcut fails or launches the wrong command. Pager values are also useful inherited-shell context even though unified exec normalizes its effective pager variables to cat.

These variables can contain arbitrary command arguments or inline environment assignments. The human report is local, but codex doctor --json may be attached to feedback, so the machine-readable report should not include their raw contents.

What Changed

  • Report VISUAL and EDITOR in the system environment details, using not set when either variable is absent.
  • Report inherited PAGER, GIT_PAGER, GH_PAGER, and LESS values when present.
  • Preserve full values in local human output while reducing these fields to set or not set in redacted JSON output.
  • Add structured check, JSON-redaction, rendered-output, and snapshot coverage.

How to Test

  1. From codex-rs, run Codex with explicit editor and pager variables:

    env VISUAL='code --wait' EDITOR=vim PAGER='less -R' GIT_PAGER=delta GH_PAGER=less LESS=-FRX \
      cargo run -p codex-cli --bin codex -- doctor --no-color
  2. Confirm the system details show the full values for all six variables.

  3. Unset the pager variables and rerun the command. Confirm pager rows are omitted while missing editor variables are shown as not set.

  4. Run the same configured environment with doctor --json. Confirm each configured editor or pager field is reported as set and none of the raw commands or arguments appear in the JSON.

Targeted tests:

  • just test -p codex-cli (279 tests passed)

@fcoury-oai fcoury-oai merged commit 0473a5c into main Jun 8, 2026
31 checks passed
@fcoury-oai fcoury-oai deleted the codex/doctor-editor-env branch June 8, 2026 22:43
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants