Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion app/modules/proxy/_service/http_bridge/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ def _http_bridge_eventless_precreated_deadline(
or sent_at is None
or request_state.response_id is not None
or request_state.latency_response_created_ms is not None
or request_state.response_event_count != 0
or request_state.downstream_visible
or request_state.last_downstream_sequence_number is not None
):
Expand Down
21 changes: 19 additions & 2 deletions tests/unit/test_proxy_http_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def test_http_bridge_eventless_precreated_deadline_uses_current_send_and_client_
[
("response_id", "resp-created"),
("latency_response_created_ms", 12),
("response_event_count", 1),
("downstream_visible", True),
("last_downstream_sequence_number", 0),
("awaiting_response_created", False),
Expand All @@ -186,6 +185,21 @@ def test_http_bridge_eventless_precreated_deadline_requires_narrow_owner_evidenc
)


def test_http_bridge_eventless_precreated_deadline_survives_reasoning_prelude_without_created() -> None:
request_state = _make_eventless_http_bridge_owner()
request_state.response_event_count = 3
request_state.upstream_model_output_seen = True
request_state.deferred_reasoning_downstream_texts.append(
'data: {"type":"response.output_item.added","item":{"type":"reasoning"}}\n\n'
)
client_safe_cap_seconds = http_bridge_helpers_module._HTTP_BRIDGE_EVENTLESS_RESPONSE_CREATED_MAX_SECONDS

assert http_bridge_helpers_module._http_bridge_eventless_precreated_deadline(
request_state,
stuck_gate_retire_after_seconds=300.0,
) == 100.0 + min(300.0, client_safe_cap_seconds)


@pytest.mark.asyncio
async def test_http_bridge_send_replaces_timestamp_and_wakes_existing_reader(
monkeypatch: pytest.MonkeyPatch,
Expand Down Expand Up @@ -18390,6 +18404,9 @@ async def close(self) -> None:
owner.request_text = '{"type":"response.create","model":"gpt-5.6-sol","input":"hello"}'
owner.preferred_account_id = "acc-bridge"
owner.excluded_account_ids.add("acc-excluded")
if leading_telemetry:
owner.response_event_count = 1
owner.upstream_model_output_seen = True
sibling_queue: asyncio.Queue[str | None] = asyncio.Queue()
sibling = proxy_service._WebSocketRequestState(
request_id="req-created-sibling",
Expand Down Expand Up @@ -18441,7 +18458,7 @@ async def close(self) -> None:
assert owner.preferred_account_id == "acc-bridge"
assert owner.excluded_account_ids == {"acc-excluded"}
assert owner.replay_count == 0
assert owner.response_event_count == 0
assert owner.response_event_count == (1 if leading_telemetry else 0)
if leading_telemetry:
assert owner.latency_first_upstream_event_ms is not None
retry_precreated.assert_not_awaited()
Expand Down
Loading