feat(doctor): report editor and pager environment#27081
Merged
Conversation
canvrno-oai
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 doctoris 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
VISUALoverEDITOR, 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 tocat.These variables can contain arbitrary command arguments or inline environment assignments. The human report is local, but
codex doctor --jsonmay be attached to feedback, so the machine-readable report should not include their raw contents.What Changed
VISUALandEDITORin the system environment details, usingnot setwhen either variable is absent.PAGER,GIT_PAGER,GH_PAGER, andLESSvalues when present.setornot setin redacted JSON output.How to Test
From
codex-rs, run Codex with explicit editor and pager variables:Confirm the
systemdetails show the full values for all six variables.Unset the pager variables and rerun the command. Confirm pager rows are omitted while missing editor variables are shown as
not set.Run the same configured environment with
doctor --json. Confirm each configured editor or pager field is reported assetand none of the raw commands or arguments appear in the JSON.Targeted tests:
just test -p codex-cli(279 tests passed)