Description
What happened?
The current implementation of submitQuery
can cause messages or prompts to be silently dropped if they are triggered in rapid succession. This can happen when multiple events attempt to call submitQuery
concurrently.
- An event triggers
submitQuery
to process a prompt. submitQuery
begins processing, and thestreamingState
is set toResponding
.- While Gemini is still generating a response, a second event triggers
submitQuery
. - The guard condition in
useGeminiStream.ts
checksstreamingState
and, because it'sResponding
, it immediately returns. - This second prompt is silently dropped, and the user never sees a response for it.
What did you expect to happen?
All prompts and commands should be processed. If a request arrives while another is being processed, it should be queued and handled sequentially, rather than being silently discarded.
Client information
About Gemini CLI
CLI Version 0.1.5
Git Commit bf873a1
Model gemini-2.5-pro
Sandbox no sandbox
OS darwin
Login information
Google account
Anything else we need to know?
I ran into this while working on a feature with simultaneous instances communicating via A2A. When one instance sent a message while the other was still processing, the second message would get dropped. While this might not be a common scenario for a single user, it points to a concurrency issue that could affect other features down the line. A potential solution could involve implementing a queue for incoming requests to ensure they are processed sequentially.