Skip to content

test(gateway): empty turns are classified failed since #270 - #294

Merged
OmarB97 merged 1 commit into
mainfrom
fix/tui-empty-response-status
Aug 2, 2026
Merged

test(gateway): empty turns are classified failed since #270#294
OmarB97 merged 1 commit into
mainfrom
fix/tui-empty-response-status

Conversation

@OmarB97

@OmarB97 OmarB97 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

Fixes test_prompt_submit_preserves_empty_response_without_error, which fails
on main with assert 'error' == 'complete'.

This is a stale expectation, not a regression — and #270 says so in its own
tests, which is how I confirmed it rather than guessing.

#270 ("guarantee terminal turn outcomes") made the turn-outcome classifier the
owner of message.complete's status. _derive_turn_outcome() classifies a
turn that ends with no visible response as failed:

else:
    status = "failed"
    reason = fallback_notice or error or raw or "turn ended without a visible response"

and _freeze_turn_outcome() then overrides the locally computed status
(tui_gateway/server.py:10930), mapping failed onto status: "error". So the
old result.get("error")-based computation no longer decides the outcome.

That this is deliberate is settled by #270's own test file:

# tests/tui_gateway/test_turn_outcomes.py
(
    {"completed": True, "final_response": "", "messages": [...]},
    "failed",
    "without a visible response",
),

#270 added tests/tui_gateway/test_turn_outcomes.py (800 lines) but never
touched tests/test_tui_gateway_server.py, so this pre-#270 expectation stayed
red — invisible in CI because the uv sync --locked install step had been
failing since 2026-07-10 (see #286).

The half of this test that still guards real behavior is the payload text:
classifying a turn as failed must not fabricate an "Error: ..." string. That
assertion is unchanged and still passes.

Related Issue

No filed issue — surfaced once #286 unblocked the Python test slices.

Type of Change

  • ✅ Tests (adding or improving test coverage)

Changes Made

  • tests/test_tui_gateway_server.py — expect status == "error" for a turn with no visible response, and document in the docstring that fix(runtime): guarantee terminal turn outcomes #270's classifier owns this, with a pointer to the authoritative parametrized case.

How to Test

pytest tests/test_tui_gateway_server.py -p no:randomly -q -k test_prompt_submit_preserves_empty_response_without_error

Before: assert 'error' == 'complete'. After: 1 passed.

⚠️ Run with an isolated HERMES_HOME. The suite reads the developer's real
~/.hermes/config.yaml; a local fallback_policy: 'off' reds 5 unrelated
tests in this same file that pass on CI.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run the affected test and it passes
  • I've added tests for my changes — N/A, this PR repairs an existing test
  • I've tested on my platform: macOS 15 (Darwin 25.6.0), Python 3.11.15

Documentation & Housekeeping

  • I've updated relevant documentation — N/A
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — N/A, test-only
  • I've updated tool descriptions/schemas — N/A

#270 made the turn-outcome classifier the owner of message.complete's
status. _derive_turn_outcome() treats a turn with no visible response as
terminal status "failed" ("turn ended without a visible response"), and
_freeze_turn_outcome() overrides the locally computed status with it, so
the payload ships status="error".

That is the deliberate contract, not a regression: #270's own
tests/tui_gateway/test_turn_outcomes.py parametrizes
{"completed": True, "final_response": ""} -> "failed" /
"without a visible response". #270 added that file but never updated this
one, so the pre-#270 expectation stayed red.

The half of this test that still guards real behavior is the payload text:
classifying the turn must not fabricate an "Error:" string. That assertion
is unchanged and still passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@OmarB97
OmarB97 merged commit d752353 into main Aug 2, 2026
29 of 31 checks passed
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