Skip to content

fix(client): wire timeoutMs to fetch when caller passes a signal#1553

Merged
esengine merged 1 commit into
mainfrom
fix/sse-stream-stuck-1535
May 22, 2026
Merged

fix(client): wire timeoutMs to fetch when caller passes a signal#1553
esengine merged 1 commit into
mainfrom
fix/sse-stream-stuck-1535

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

  • opts.signal ?? ctrl.signal in chat() and stream() orphaned the timeout controller whenever the loop forwarded its _turnAbort.signal — i.e. every real call — so timeoutMs was dead code on the hot path.
  • A genuinely stalled SSE body (TCP open, no [DONE], no close) then sat on reader.read() forever and the TUI hung in "…waiting for response…" until the user restarted it, even though the DeepSeek dashboard already showed the request as completed.
  • Combine the caller's signal with the timer's controller via AbortSignal.any and abort with a reason so the loop's error path surfaces "timed out after Xms" instead of a silent stall.

Test plan

  • new tests/client-stream-timeout.test.ts — stream() and chat() both abort on timeout when caller passes a signal, and the caller's own signal still aborts the stream
  • npm run verify passes (3544 tests)

Closes #1535

`opts.signal ?? ctrl.signal` orphaned the timer's controller whenever the
loop forwarded its `_turnAbort.signal` — i.e. every real call. A genuinely
stalled SSE body (TCP open, no `[DONE]`, no close) then sat on
`reader.read()` forever and the TUI hung in "…waiting for response…"
until the user restarted it, even though the server-side request had
already completed.

Combine both signals with `AbortSignal.any` and have the timer abort with
a reason so the loop's error path surfaces "timed out after Xms" instead
of a silent stall.

Closes #1535
@esengine esengine merged commit 4de6321 into main May 22, 2026
4 checks passed
@esengine esengine deleted the fix/sse-stream-stuck-1535 branch May 22, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

在TUI中进行分条列点的任务时,会卡住,但是在网页端后台是显示完成的,TUI重开一下就好了

1 participant