Skip to content

emrg: remove non-stream dead code — _run_chat_once / TaskRequest.stream (rant 2026-08-10T21:20:38) - #654

Merged
argszero merged 1 commit into
masterfrom
feature/remove-nonstream-dead-code
Aug 10, 2026
Merged

emrg: remove non-stream dead code — _run_chat_once / TaskRequest.stream (rant 2026-08-10T21:20:38)#654
argszero merged 1 commit into
masterfrom
feature/remove-nonstream-dead-code

Conversation

@argszero

Copy link
Copy Markdown
Owner

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:

  • GUI sendTask always defaults stream=true (emrg/gui/daemon_client.js)
  • TUI always sends stream=True (emrg/client/app.py)
  • No client ever uses the non-stream branch

Host confirmed: delete dead code, do not keep unused code.

Changes

  1. Delete _run_chat_once (daemon.py) — non-streaming single-turn chat
  2. Delete _run_chat_once_locked (daemon.py) — its lock wrapper
  3. Task handling always routes through _run_tool_loop_locked — removed the if req.stream: branch
  4. Drop TaskRequest.stream field (emrg/protocol.py) — field + to_dict() entry removed
  5. Client sync:
    • GUI sendTask: removed stream param + payload field; ownStream lock now set unconditionally
    • TUI send_task: removed stream param; call site cleaned
  6. Tests updated: test_protocol.py, test_daemon_manager.py, test_daemon_manager_e2e.py, GUI daemon_client.test.js (payload assertions now verify stream is absent)

Notes

  • allow_tools param of _run_tool_loop_locked kept — Ask mode (mode=ask) still uses the tool loop with an empty toolset
  • TaskRequest other fields (id/session_id/cwd/prompt/timestamp/images) untouched
  • Client and daemon ship in the same release — no compatibility window needed

Verification

  • pytest: 681 passed
  • GUI tests: 179 passed
  • grep confirms zero remaining _run_chat_once / task-request stream references (excluding node_modules)

…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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@argszero
argszero merged commit b648686 into master Aug 10, 2026
1 check passed
@argszero
argszero deleted the feature/remove-nonstream-dead-code branch August 10, 2026 13:33
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.

1 participant