DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

Capability failures render as blank assistant messages and persist completed status

Open dongyu-will opened this issue 4 months ago • 1 comments

Summary

When a chat capability raises before producing assistant content (for example, an LLM provider returns HTTP 401), the web UI renders an empty assistant message instead of the existing terminal-error card. The persisted turn is also incorrectly marked as completed.

Steps to reproduce

  1. Start DeepTutor from the current dev branch.
  2. Leave the LLM catalog without a valid API key, or otherwise make the selected capability raise before emitting content.
  3. Send a chat message.
  4. Reload the session.

Actual behavior

  • The assistant message has empty content.
  • The provider error is persisted as an error event with empty metadata.
  • The orchestrator still emits DONE without a failure status.
  • The turn runtime writes the turn status as completed.
  • The frontend only renders terminal errors carrying metadata.turn_terminal, so the user sees a blank assistant area.

Expected behavior

  • Capability exceptions emit a terminal error with turn_terminal: true and status: failed.
  • The matching DONE event carries status: failed.
  • The persisted turn status is failed, including the error text.
  • The existing error card is visible both live and after reloading the session.

Root cause

ChatOrchestrator.handle() converts capability exceptions into ordinary error events and unconditionally emits a status-less DONE. TurnRuntimeManager then unconditionally persists completed, ignoring terminal error and done metadata. ChatMessages correctly avoids showing non-terminal errors, which leaves an empty message for this protocol shape.

Environment

  • DeepTutor v1.5.7
  • Base branch: dev
  • Reproduced through the real WebSocket chat flow and persisted session API

dongyu-will avatar Jul 31 '26 02:07 dongyu-will

Thanks for your comments~ feel free to check v1.5.9

pancacake avatar Aug 04 '26 07:08 pancacake