CLI: set JJ_PAGER=cat for shell commands so jj output does not page

Open 💬 2 comments Opened May 14, 2026 by joshka

What version of Codex CLI is running?

codex-cli 0.130.0

What subscription do you have?

Pro

Which model were you using?

Any

What platform is your computer?

Darwin 24.6.0 arm64 arm

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

Any terminal.

Codex doctor report

N/A

What issue are you seeing?

Codex shell commands should avoid invoking pagers, but jj commands can still page because jj intentionally does not honor generic PAGER.

Codex already sets pager-related environment defaults such as PAGER=cat, GIT_PAGER=cat, and GH_PAGER=cat for unified exec commands. That works for many tools, but not for jj.

jj recently added a dedicated pager override, JJ_PAGER, in jj 0.41:

https://github.com/jj-vcs/jj/pull/9395

That PR explains why jj uses a jj-specific override instead of restoring generic $PAGER handling. So Codex needs to set JJ_PAGER=cat explicitly if it wants jj commands to behave like other non-interactive shell commands.

What steps can reproduce the bug?

  1. Use a jj version that supports JJ_PAGER (jj 0.41 or newer).
  2. Run Codex in a jj repository.
  3. Ask Codex to run jj commands that can produce paged output, such as:

``sh
jj log
jj diff
jj show
``

  1. Observe that jj may invoke its configured pager even though Codex already disables common pagers via PAGER=cat, GIT_PAGER=cat, and GH_PAGER=cat.

What is the expected behavior?

Codex should set JJ_PAGER=cat in the same default shell-command environment where it sets other pager-disabling variables.

That would make jj commands behave consistently with git/GitHub CLI commands in Codex: output should be emitted directly to the command stream, not captured by an interactive pager.

Additional information

This should be a low-risk addition:

  • JJ_PAGER is jj-specific and only affects jj.
  • Older jj versions should ignore it.
  • jj 0.41+ intentionally supports it as the correct tool-specific override.
  • This is consistent with Codex already setting GIT_PAGER=cat and GH_PAGER=cat.

Workaround for users waiting on this, or if the Codex team decides this is too niche:

[shell_environment_policy.set]
JJ_PAGER = "cat"

Users do not need to repeat the existing pager variables in config. shell_environment_policy.set overlays specific variables on top of the inherited/default shell environment.

View original on GitHub ↗

2 Comments

jbetala7 · 3 months ago

I checked current main, and this looks like a narrow unified-exec environment default gap.

Root cause / code path:

  • Unified exec injects non-interactive shell defaults in codex-rs/core/src/unified_exec/process_manager.rs via UNIFIED_EXEC_ENV.
  • The current list has PAGER=cat, GIT_PAGER=cat, and GH_PAGER=cat, but not JJ_PAGER=cat.
  • Existing coverage for this behavior is unified_exec_env_injects_defaults in codex-rs/core/src/unified_exec/process_manager_tests.rs.

Minimal fix I verified locally:

  • Add ("JJ_PAGER", "cat") to UNIFIED_EXEC_ENV.
  • Update the expected defaults map in unified_exec_env_injects_defaults.

Verification from a fresh checkout:

  • cargo test -p codex-core unified_exec_env --lib -> 2 passed
  • cargo fmt --check -> passed; it emitted repeated stable-rustfmt warnings about the repo's imports_granularity = Item setting
  • git diff --check -> passed

I am leaving this as issue analysis rather than opening a PR because docs/contributing.md says external code PRs are invitation-only. I can open the patch if the Codex team wants it.

joshka · 3 months ago

Hey @jbetala7 no need to dig into the details on this one. If the Codex team wants this in the product, they have the tooling to complete this in a one shot with much less effort than it would take to handle an external PR (e.g. codex implement https://github.com/openai/codex/issues/22604). The hardest part of this is not the code / analysis, it's deciding whether it's useful enough to do, and whether they want to spend time testing it.