Skip to content

Commit 2593f3f

Browse files
committed
Align reasoning e2e with protocol passthrough
The protocol handlers now surface reasoning_content when the model output contains it, independent of MODEL_PARAMETER_RULES. Keep the e2e contract aligned with that behavior so the false thinking flag case verifies passthrough instead of suppression. Constraint: Requirement moved env thinking control to model invocation, while protocol conversion follows actual returned reasoning_content. Rejected: Restore protocol-level env gating | It would contradict the current reasoning_content passthrough requirement. Confidence: high Scope-risk: narrow Directive: Do not reintroduce protocol-level MODEL_PARAMETER_RULES gating for reasoning_content without a new product decision. Tested: uv sync --python 3.10 --dev --all-extras; uv run --python 3.10 pytest tests/e2e/test_reasoning_protocol.py -q; git diff --check Change-Id: I806b351980a716b4e0395414b0896ddd603747bc Not-tested: Full cloud-backed e2e suite locally; waiting for GitHub Actions E2E.
1 parent 5f0d6b2 commit 2593f3f

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

tests/e2e/test_reasoning_protocol.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,13 @@ async def test_openai_stream_reasoning_content_gate(
7171
assert response.status_code == 200
7272
events = _parse_sse_events(response.text)
7373
deltas = [
74-
(event.get("choices") or [{}])[0].get("delta") or {}
75-
for event in events
74+
(event.get("choices") or [{}])[0].get("delta") or {} for event in events
7675
]
7776
reasoning = "".join(delta.get("reasoning_content", "") for delta in deltas)
7877
content = "".join(delta.get("content", "") for delta in deltas)
7978

8079
assert content == "answer"
81-
assert reasoning == ("thinking" if thinking_enabled else "")
80+
assert reasoning == "thinking"
8281
assert all("additional_kwargs" not in delta for delta in deltas)
8382

8483

@@ -104,10 +103,7 @@ async def test_openai_non_stream_reasoning_content_gate(
104103
assert response.status_code == 200
105104
message = response.json()["choices"][0]["message"]
106105
assert message["content"] == "answer"
107-
if thinking_enabled:
108-
assert message["reasoning_content"] == "thinking"
109-
else:
110-
assert "reasoning_content" not in message
106+
assert message["reasoning_content"] == "thinking"
111107

112108

113109
@pytest.mark.parametrize("thinking_enabled", [True, False])
@@ -140,14 +136,7 @@ async def test_agui_reasoning_events_gate(
140136
)
141137

142138
assert content == "answer"
143-
if thinking_enabled:
144-
assert reasoning == "thinking"
145-
assert event_types.index("REASONING_MESSAGE_CONTENT") < event_types.index(
146-
"TEXT_MESSAGE_START"
147-
)
148-
else:
149-
assert reasoning == ""
150-
assert all(
151-
not event_type.startswith("REASONING")
152-
for event_type in event_types
153-
)
139+
assert reasoning == "thinking"
140+
assert event_types.index("REASONING_MESSAGE_CONTENT") < event_types.index(
141+
"TEXT_MESSAGE_START"
142+
)

0 commit comments

Comments
 (0)