qwen-code/packages
ComplexSimply 13059e0796
fix(core): short-circuit the flush wait when the output stream cannot flush (#7905)
* fix(core): short-circuit the flush wait when the output stream cannot flush

Review follow-up on the settle flush wait:

- A destroyed stream (autoDestroy after an earlier EIO/ENOSPC write
  error) or an already-finished one emits neither 'finish' nor 'error',
  and .end() on it is a silent no-op — the settle stalled for the full
  10s timeout with nothing left to flush, and an abortAll() landing in
  that window (/clear, shutdown) would mark the entry cancelled.
  Short-circuit before arming the timer. writableFinished, not
  writableEnded: the latter is already true mid-flush.

- Hoist clearTimeout into runOnce so the synchronous-throw path no
  longer leaves the timer armed to log a misleading flush-timeout
  warning for a shell that settled long ago.

- Drop the vacuous duplicate-'finish' assertion (once semantics already
  drained the handler; the guard is pinned by the 'error' emit and the
  timeout test's late finish) and cover both short-circuit states with
  deferred-stream tests asserting the immediate transition and that
  .end() is never called.

* test(core): pin the mid-flush wait and the throw-path timer disarm

Closes the two coverage gaps from the verification review on #7905 —
both mutations previously survived the full suite:

- guard mutated to include writableEnded (short-circuit mid-flush, the
  exact truncation the flush wait prevents) — killed by a deferred
  stream with { writableEnded: true, writableFinished: false }
  asserting the transition still waits for 'finish';
- hoisted clearTimeout dropped from runOnce — killed by a throwing
  end() plus fake timers asserting no flush-timeout warning fires
  after the timeout elapses.

---------

Co-authored-by: ComplexSimply <rudy.arrowsong@gmail.com>
2026-07-28 11:56:24 +00:00
..
acp-bridge fix(serve): Release managed session writer locks on shutdown (#7812) 2026-07-28 10:18:35 +00:00
audio-capture chore(release): v0.21.0 (#7675) 2026-07-24 13:47:34 +00:00
channels fix(daemon): harden Todo Stop Guard continuations (#7821) 2026-07-28 06:51:40 +00:00
chrome-extension chore(release): v0.21.0 (#7675) 2026-07-24 13:47:34 +00:00
cli fix(safe-mode): preserve caller-supplied top-tier MCP servers (#7827) 2026-07-28 11:29:53 +00:00
core fix(core): short-circuit the flush wait when the output stream cannot flush (#7905) 2026-07-28 11:56:24 +00:00
cua-driver fix(mcp): add opt-in model payload filtering (#7413) 2026-07-21 09:49:04 +00:00
desktop fix(daemon): harden Todo Stop Guard continuations (#7821) 2026-07-28 06:51:40 +00:00
mobile-mcp chore(release): v0.20.1 (#7461) 2026-07-22 02:00:22 +00:00
sdk-java fix(sdk-java): Harden daemon transport reliability (#7603) 2026-07-24 04:22:05 +00:00
sdk-python fix(sdk-python): validate max_tool_calls and max_subagent_depth as integers (#7548) 2026-07-23 08:45:13 +00:00
sdk-typescript feat(web-shell): add native workspace folder picker (#7849) 2026-07-28 05:58:13 +00:00
vscode-ide-companion feat(core): add ARMS session user ID (#7921) 2026-07-28 11:10:38 +00:00
web-shell feat(web-shell): add Channel configuration flows (#7893) 2026-07-28 05:58:26 +00:00
web-templates fix(cli): measure insight days and hours in local time everywhere (#7670) 2026-07-24 15:41:13 +00:00
webui feat(web-shell): add native workspace folder picker (#7849) 2026-07-28 05:58:13 +00:00
zed-extension