emrg: remove non-stream dead code — _run_chat_once / TaskRequest.stream (rant 2026-08-10T21:20:38) - #654
Conversation
…am (rant 2026-08-10T21:20:38) No client uses the non-stream path: GUI sendTask defaults stream=true, TUI always passes stream=True. Delete _run_chat_once / _run_chat_once_locked, drop TaskRequest.stream field + payload, route every task through _run_tool_loop_locked (allow_tools kept for Ask mode). Protocol tightened: task frames no longer carry stream.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (2nd). Diff re-verified: dead code removal matches the rant checklist; protocol payload no longer carries stream; ownStream set unconditionally; tests assert stream absence (negative-state). CI green.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Reviewed the full diff (10 files, 407 lines): TaskRequest.stream removed from protocol (dataclass + to_dict); daemon no longer branches on stream — _run_chat_once/_run_chat_once_locked deleted, all tasks route through the tool loop; TUI/GUI send paths drop the stream param; GUI ownStream set unconditionally (all tasks are streaming, G65 lock semantics preserved). Tests updated with negative-state assertion ("stream" not in sent). CI green (run 31392657761). 3rd LGTM from a different cycle — merging.
Remove the non-streaming single-turn chat path, which no client uses (host-confirmed dead code).
Background
While designing the queue-injection feature (tool loop in progress + new message), the daemon's non-stream path (
req.stream=False→_run_chat_once) was found to be unused:sendTaskalways defaultsstream=true(emrg/gui/daemon_client.js)stream=True(emrg/client/app.py)Host confirmed: delete dead code, do not keep unused code.
Changes
_run_chat_once(daemon.py) — non-streaming single-turn chat_run_chat_once_locked(daemon.py) — its lock wrapper_run_tool_loop_locked— removed theif req.stream:branchTaskRequest.streamfield (emrg/protocol.py) — field +to_dict()entry removedsendTask: removedstreamparam + payload field;ownStreamlock now set unconditionallysend_task: removedstreamparam; call site cleanedtest_protocol.py,test_daemon_manager.py,test_daemon_manager_e2e.py, GUIdaemon_client.test.js(payload assertions now verifystreamis absent)Notes
allow_toolsparam of_run_tool_loop_lockedkept — Ask mode (mode=ask) still uses the tool loop with an empty toolsetTaskRequestother fields (id/session_id/cwd/prompt/timestamp/images) untouchedVerification
grepconfirms zero remaining_run_chat_once/ task-requeststreamreferences (excluding node_modules)