Skip to content

disable pager if agent detected#14192

Open
krlvi wants to merge 1 commit into
masterfrom
kv-branch-16
Open

disable pager if agent detected#14192
krlvi wants to merge 1 commit into
masterfrom
kv-branch-16

Conversation

@krlvi

@krlvi krlvi commented Jun 11, 2026

Copy link
Copy Markdown
Member

Apparently Codex spawns a real terminal

Apparently Codex spawns a real terminal
Copilot AI review requested due to automatic review settings June 11, 2026 19:22
@github-actions github-actions Bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/but/src/lib.rs
Comment on lines +143 to +144
let use_pager = agent.is_none()
&& match args.cmd {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants