What happened?
Describe the Bug
We have identified three critical issues in the ShellExecutionService that affect stability, correctness, and security in automated or non-interactive environments (such as agent loops):
- Hangs in Non-Interactive Loops: When
enableInteractiveShell: false is set, the terminal environment is not fully restricted. Pagers (like less) and terminal colorizers can still trigger and block execution indefinitely waiting for manual user keypresses.
- Native Bridge Crashes / OOM on Large Outputs: When a command produces a high-volume telemetry surge (e.g., >10MB), converting the massive buffer to string all at once in the native TTY bridge or child process stream triggers process-level segmentation faults or heap overflows.
- Security Leak (GIT_CONFIG_ Bypass)*: In non-interactive mode,
GIT_CONFIG_* environment variables are bypassed and restored directly from raw process.env even if they were correctly redacted by the sanitization layer due to sensitive content (e.g., GitHub OAuth tokens).
Expected Behavior
- Non-interactive configuration should strictly enforce
TERM=dumb, PAGER=cat, and GIT_PAGER=cat to prevent blocking pagers.
- Output streams should be processed incrementally in stable 1MB chunks (without truncating or discarding data) to maintain native bridge stability and prevent OOMs.
- Environment variable sanitization should be respected for all variables, including
GIT_CONFIG_*, without any bypass loops.
Additional Context
We have prepared a complete fix for this including robust unit tests for chunking and split UTF-8 boundary decoding, and a native PTY integration test harness. I will link a Pull Request shortly.
What did you expect to happen?
Expected Behavior
- Non-interactive configuration should strictly enforce
TERM=dumb, PAGER=cat, and GIT_PAGER=cat to prevent blocking pagers.
- Output streams should be processed incrementally in stable 1MB chunks (without truncating or discarding data) to maintain native bridge stability and prevent OOMs.
- Environment variable sanitization should be respected for all variables, including
GIT_CONFIG_*, without any bypass loops.
Client information
\u2502 About Gemini CLI \u2502
\u2502 \u2502
\u2502 CLI Version 0.45.0-nightly.20260521.g854f811be-git.3cc7e5b \u2502
\u2502 Git Commit 3cc7e5b \u2502
\u2502 Model Auto (Gemini 3) \u2502
\u2502 Sandbox no sandbox \u2502
\u2502 OS linux
Login information
No response
Anything else we need to know?
No response
What happened?
Describe the Bug
We have identified three critical issues in the
ShellExecutionServicethat affect stability, correctness, and security in automated or non-interactive environments (such as agent loops):enableInteractiveShell: falseis set, the terminal environment is not fully restricted. Pagers (likeless) and terminal colorizers can still trigger and block execution indefinitely waiting for manual user keypresses.GIT_CONFIG_*environment variables are bypassed and restored directly from rawprocess.enveven if they were correctly redacted by the sanitization layer due to sensitive content (e.g., GitHub OAuth tokens).Expected Behavior
TERM=dumb,PAGER=cat, andGIT_PAGER=catto prevent blocking pagers.GIT_CONFIG_*, without any bypass loops.Additional Context
We have prepared a complete fix for this including robust unit tests for chunking and split UTF-8 boundary decoding, and a native PTY integration test harness. I will link a Pull Request shortly.
What did you expect to happen?
Expected Behavior
TERM=dumb,PAGER=cat, andGIT_PAGER=catto prevent blocking pagers.GIT_CONFIG_*, without any bypass loops.Client information
Login information
No response
Anything else we need to know?
No response