Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions tests/test_tui_gateway_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8091,9 +8091,18 @@ def run_conversation(


def test_prompt_submit_preserves_empty_response_without_error(monkeypatch):
"""An empty final_response with NO backend error must stay empty — do not
synthesize an error string. Preserves the existing None/empty-sentinel
semantics owned by downstream handlers."""
"""An empty final_response must stay empty — do not synthesize an error
string. Preserves the existing None/empty-sentinel semantics owned by
downstream handlers.

Since #270 the turn-outcome classifier owns ``status``: a turn that ends
with no visible response is terminal-classified ``failed`` ("turn ended
without a visible response"), which _freeze_turn_outcome maps onto
``status: "error"``. That is the deliberate contract — see the
``final_response: ""`` -> ``failed`` case in
tests/tui_gateway/test_turn_outcomes.py. What this test still guards is the
payload text: classifying the turn must not fabricate an "Error:" string.
"""

class _Agent:
def run_conversation(
Expand Down Expand Up @@ -8130,8 +8139,8 @@ def run_conversation(
complete_events = [e for e in emitted if e[0] == "message.complete"]
assert complete_events, "expected message.complete to be emitted"
payload = complete_events[-1][2]
# Status stays "complete" because no error flag was set
assert payload.get("status") == "complete"
# No visible response => the turn-outcome classifier reports it (#270).
assert payload.get("status") == "error"
# Text stays empty — we did NOT fabricate an "Error:" string
text = payload.get("text", "")
assert text in {"", None}, f"expected empty text, got {text!r}"
Expand Down
Loading