Skip to content

[Bug]: gemini - opencli times out even though the response is already reached in Chrome #1908

@uzqw

Description

@uzqw

Description

Root cause: the response has already arrived in Chrome, but background tabs stop rendering because of Chrome's battery optimization mechanism.

Steps to Reproduce

Reproduction Steps

  1. Run the following command twice:
opencli gemini ask "hello, return 114" --window foreground -f json
  1. Alternatively, switch between ChatGPT and Gemini requests:
opencli chatgpt ask "hello, return 114" --window foreground -f json

Then run Gemini again.

  1. Observe the timeout error.

Example

[uzqw@uzqw-lenovo25 opencli]$ opencli gemini ask "hello, return 114" --window foreground -f json
[
  {
    "response": "💬 [NO RESPONSE] No Gemini response within 60s."
  }
]

[uzqw@uzqw-lenovo25 opencli]$ opencli gemini ask "hello, return 115" --window foreground -f json
[
  {
    "response": "💬 [NO RESPONSE] No Gemini response within 60s."
  }
]

Expected Behavior

If the network is functioning normally, this request should not time out. The timeout appears to be caused by Chrome's battery optimization behavior.

If I manually click the tab and keep it in the foreground, opencli does not time out. However, when opencli is controlled by another program and the tab stays in the background, timeouts occur much more frequently.

Also, --window foreground does not fully work, because it only activates the tab during the initial launch.

OpenCLI Version

1.8.3

Node.js Version

22.x

Operating System

Linux

Logs / Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions