Skip to content

Disable pagers in non-interactive code execution shells#1705

Open
TriTechAI wants to merge 1 commit into
agent0ai:mainfrom
TriTechAI:fix/git-pager-cpu-spin
Open

Disable pagers in non-interactive code execution shells#1705
TriTechAI wants to merge 1 commit into
agent0ai:mainfrom
TriTechAI:fix/git-pager-cpu-spin

Conversation

@TriTechAI

Copy link
Copy Markdown

The code execution tool runs commands inside TTY-backed shells (local PTY and remote SSH). Commands like git diff/git log detect the TTY and pipe output through a pager (more/less). These shells never receive interactive input, so the pager blocks forever and spins at 100% CPU per process — on a 16-core host 5 pager processes pegged 5 cores for 8+ hours (#1697).

Disable pagers in both session types:

  • LocalInteractiveSession: inject PAGER=cat / GIT_PAGER=cat into the TTY env
  • SSHInteractiveSession: export the same in the initial shell command

cat streams the output through instead of blocking, and also covers other pager-using tools (man, systemctl, journalctl). Adds regression tests.

Fixes #1697

The code execution tool runs commands inside TTY-backed shells (local PTY and
remote SSH). Commands like `git diff`/`git log` detect the TTY and pipe output
through a pager (more/less). These shells never receive interactive input, so
the pager blocks forever and spins at 100% CPU per process — on a 16-core host
5 pager processes pegged 5 cores for 8+ hours (agent0ai#1697).

Disable pagers in both session types:
- LocalInteractiveSession: inject PAGER=cat / GIT_PAGER=cat into the TTY env
- SSHInteractiveSession: export the same in the initial shell command

`cat` streams the output through instead of blocking, and also covers other
pager-using tools (man, systemctl, journalctl). Adds regression tests.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Git pager processes spin at 100% CPU indefinitely in non-interactive terminal sessions

1 participant