-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
This ticket has been created by ECA. There is currently no known way how to reproduce this bug. It just randomly appears (with no error) so I asked Claude to find out what is going on ;-)
Describe the bug
When an LLM provider's streaming response stalls (server keeps connection open but stops sending data), the chat gets
stuck on "Waiting model" indefinitely. Clicking STOP does not recover the chat. Attempting to shut down ECA also
fails with "Timeout while waiting for response. Method: shutdown".
Root cause: .readLine() on the response InputStream blocks forever. STOP sets a :stopping flag, but this flag is only
checked in callbacks that fire after .readLine() returns. Since it never returns, the flag is never checked.
Thread.interrupt() does not work on blocking java.io streams.
Affects all streaming providers (openai_chat, anthropic, ollama, openai).
To Reproduce (not sure if possible)
Steps to reproduce the behavior:
- Start a chat with any streaming LLM provider
- Send a message
- Have the LLM server stall mid-stream (keep connection open, stop sending data)
- Observe chat stuck on "Waiting model"
- Click STOP - chat remains stuck
- Try to stop ECA - get "Timeout while waiting for response. Method: shutdown"
Expected behavior
- Clicking STOP should immediately cancel the request and return chat to idle state, allowing new messages to be sent.
- There should be some timeout (180s?) on streaming response
Additional context
Proposed fix: Store the response InputStream when streaming starts, close it when STOP is pressed. Closing the stream
causes .readLine() to throw IOException, which is already handled via on-error.
Implementation:
- Add cancel-stream* atom to callbacks, store in chat state
- Each provider stores body (InputStream) in the atom before reading
- prompt-stop closes the stream via the atom
~10 lines across chat.clj, llm_api.clj, and each provider file.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status