disable pager if agent detected#14192
Conversation
Apparently Codex spawns a real terminal
There was a problem hiding this comment.
Pull request overview
This PR adjusts the but CLI’s pager-selection logic to avoid spawning a pager when the process is being driven by an AI agent (as detected via known agent environment variables). This prevents agent harnesses running inside a PTY from hanging on interactive pagers like less.
Changes:
- Cache agent detection once (
let agent = utils::detect_agent::detect()) and reuse it for multiple decisions. - Disable pager usage unconditionally when an agent is detected, even if stdout is a TTY.
- Keep existing command-based pager enabling logic for human invocations.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f710a2962b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let use_pager = agent.is_none() | ||
| && match args.cmd { |
There was a problem hiding this comment.
Preserve untruncated status output for agents
When an agent runs but status in the default human/TTY mode, this forces use_pager to false, and OutputChannel::is_paged() then becomes false. The legacy status renderer uses that value in truncation_policy() to pre-truncate oneshot status text, so the same agent scenarios this change targets now lose full commit/branch/status details instead of only avoiding less; consider separating “do not spawn a pager” from “treat output as unpaged for truncation.”
Useful? React with 👍 / 👎.
Apparently Codex spawns a real terminal