gemini-cli - ✅(Solved) Fix [Bug] Auto exiting while performing tasks. [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25908Fetched 2026-04-24 10:43:19
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×1renamed ×1

Error Message

  • complete the task without any error.

Fix Action

Fixed

PR fix notes

PR #25920: fix(cli): debounce TTY loss check to prevent false-positive exits

Description (problem / solution / changelog)

Summary

On Windows terminals (PowerShell, Windows Terminal), process.stdin.isTTY and process.stdout.isTTY can momentarily flicker to false during:

  • Window resize
  • Focus changes
  • Terminal buffer flushes
  • Windows Terminal multiplexer behavior

The TTY check interval (setupTtyCheck) would immediately trigger gracefulShutdown() upon detecting this, causing the CLI agent to unexpectedly exit mid-task with no error — exactly as reported in this issue.

Fix

Add a 1-second confirmation delay before triggering shutdown. When TTY loss is first detected:

  1. A 1s timer starts instead of immediately shutting down
  2. When the timer fires, TTY state is re-checked
  3. If TTY was restored → it was a transient flicker, monitoring restarts
  4. If TTY is still lost → it's a real terminal closure, shutdown proceeds

Changes

  • packages/cli/src/utils/cleanup.ts — refactored setupTtyCheck to use a named checkTty function with confirmation delay
  • packages/cli/src/utils/cleanup.test.ts — updated existing test timing, added test for transient flicker recovery

Fixes #25908

Changed files

  • packages/cli/src/utils/cleanup.test.ts (modified, +33/-1)
  • packages/cli/src/utils/cleanup.ts (modified, +29/-5)

Code Example

> /about
About Gemini CLI│                                                                                                                      │
CLI Version                              0.39.1Git Commit                               4d73f3413                                                                   │
Model                                    Auto (Gemini 3)Sandbox                                  no sandbox                                                                  │
OS                                       win32                                                                       │
Auth Method                              Signed in with Google (goldlion123.rp@gmail.com)Tier                                     Gemini Code Assist in Google One AI Pro
RAW_BUFFERClick to expand / collapse

What happened?

<img width="1115" height="628" alt="Image" src="https://github.com/user-attachments/assets/93dc35dd-bdad-4e0c-93eb-661c80c428fe" />
  • While the CLI agent was performing tasks in YOLO mode, it suddenly exited after a few steps and threw a nonsense bug. Check the bottom line (the last line) of that terminal.
<img width="1115" height="650" alt="Image" src="https://github.com/user-attachments/assets/8dbe746a-3218-430c-9d8c-191c8bcff7ce" />

What did you expect to happen?

  • complete the task without any error.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
About Gemini CLI                                                                                                     │
│                                                                                                                      │
│ CLI Version                              0.39.1                                                                      │
│ Git Commit                               4d73f3413                                                                   │
│ Model                                    Auto (Gemini 3)                                                             │
│ Sandbox                                  no sandbox                                                                  │
│ OS                                       win32                                                                       │
│ Auth Method                              Signed in with Google ([email protected])                            │
│ Tier                                     Gemini Code Assist in Google One AI Pro
</details>

Login information

I logged in via Google App account.

Anything else we need to know?

There are also certain bugs when performing multiple parallel agents simultaneously. There was a glitch as well.

extent analysis

TL;DR

The issue may be related to the CLI agent's interaction with the YOLO mode, and checking the terminal output for specific error messages or running the /about command for more information could provide clues.

Guidance

  • Review the terminal output, especially the last line, for any error messages or hints about what caused the CLI agent to exit.
  • Run the /about command to ensure the CLI version, Git commit, and model are as expected, which could help identify potential version-related issues.
  • Consider testing the CLI agent with a single task to see if the issue persists, which might help determine if the problem is related to parallel agent execution.
  • If possible, try running the CLI agent without YOLO mode to see if the issue is specific to that mode.

Notes

The provided information lacks specific technical details about the error message or the exact steps taken before the issue occurred, making it challenging to provide a precise solution.

Recommendation

Apply workaround: Given the uncertainty around the cause, a safe approach would be to try running the CLI agent with a single task or without YOLO mode to mitigate potential issues related to parallel execution or mode-specific bugs.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - ✅(Solved) Fix [Bug] Auto exiting while performing tasks. [1 pull requests, 1 participants]