zai-org / zai-org/feedback

Stop button doesn't terminate streaming responses (all providers, all formats)

Open
#102 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

What happens

Pressing Stop during a streaming response does not stop the generation. The UI stays in "thinking" mode. It shows "Cannot rewind while a prompt is running." Pressing Stop repeatedly has no effect.

If I close and reopen the session, ZCode resumes the incomplete generation. It hangs again.

What I expected

Stop should terminate the current request immediately. Then I can rewind or edit. Claude Code behaves this way.

How to reproduce

  1. Use any streaming provider. I tested with:
    • DeepSeek-V4-Pro (custom anthropic kind, direct)
    • Custom Anthropic-compatible LiteLLM proxy (custom anthropic kind)
    • The same proxy with openai kind and /v1/chat/completions
  2. Send a prompt that generates a multi-second streaming response.
  3. Press Stop during the generation.

All three fail the same way.

What I investigated

I instrumented my proxy with TCP-level logging. When I press Stop, ZCode closes the TCP connection within 1-4 seconds. I see EOF on the socket immediately. The proxy detects the disconnect and cancels the upstream request. Everything works on the proxy side.

The problem is ZCode does not transition its internal state to "done" when the connection closes. ZCode seems to wait for a stream termination event that never arrives, because the connection is already dead.

Environment

  • ZCode 3.3.0 (Windows 10)
  • Also reproduced on 3.2.5

Possibly related

  • #89 - another case where ZCode does not clean up after itself (MCP processes)
  • #93 - another issue with OpenAI-compatible provider handling (token stats)
  • #96 - another custom provider config issue

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named. Start by tracing the Stop action and streaming request lifecycle for the tested Anthropic-compatible and OpenAI-compatible provider paths, then verify that a connection close reaches a terminal state and permits rewind or editing. Done means Stop immediately ends generation without leaving the UI in thinking mode.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.