DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

Fix terminal capability error handling

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

Summary

  • mark capability exceptions and unknown capabilities as terminal failures
  • emit DONE with the matching failed status
  • persist terminal turns as failed with their error text instead of completed
  • skip post-turn title generation for failed turns
  • add regression coverage for terminal and non-terminal errors

Root cause

Capability exceptions were converted into ordinary error events without turn_terminal metadata, followed by a status-less DONE. The turn runtime then unconditionally persisted completed. Because the existing frontend error card intentionally renders only terminal errors, the saved assistant message appeared blank.

User impact

Provider and capability failures now display the existing inline error card both during the live stream and after a session reload. Failed turns also retain the correct persisted status.

Validation

  • pytest -q tests/runtime/test_orchestrator.py tests/services/session/test_turn_runtime_subscribe.py — 14 passed
  • pytest -q tests/api/test_unified_ws_turn_runtime.py — 10 passed
  • ruff check and ruff format --check on all changed files
  • real local WebSocket flow emitted error(status=failed, turn_terminal=true) followed by done(status=failed)
  • session API persisted status=failed and the terminal error event
  • browser reload rendered the error message instead of a blank assistant area

Closes #731

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