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
11 changes: 11 additions & 0 deletions tests/engine/duplex/test_duplex_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def test_error_event_maps_codes_to_openai_error_types_and_echoes_client_event_id
assert REALTIME_ERROR_TYPES_BY_CODE["resource_exhausted"] == "rate_limit_error"
assert REALTIME_ERROR_TYPES_BY_CODE["internal_error"] == "server_error"
assert REALTIME_ERROR_TYPES_BY_CODE["bad_event"] == "invalid_request_error"
# A control timeout is the server failing to answer, not a bad request.
assert REALTIME_ERROR_TYPES_BY_CODE["timeout"] == "server_error"

error = ErrorEvent(
code="resource_exhausted",
Expand All @@ -177,6 +179,15 @@ def test_error_event_maps_codes_to_openai_error_types_and_echoes_client_event_id
assert wire["error"] == error.error
# The server event id and the echoed client event id are distinct.
assert wire["event_id"] != "evt_client"

# The bucket must survive the envelope serialization, not only the lookup:
# a control timeout is the server failing to answer, not a bad request.
timeout_wire = ErrorEvent(code="timeout", message="handshake timed out").to_realtime()
assert timeout_wire["error"]["type"] == "server_error"
assert timeout_wire["error"]["code"] == "timeout"
# ``config_timeout`` is the caller's own budget and stays a client error.
assert REALTIME_ERROR_TYPES_BY_CODE["config_timeout"] == "invalid_request_error"

assert ErrorEvent(code="never-seen-code").error_type == "invalid_request_error"


Expand Down
6 changes: 6 additions & 0 deletions vllm_omni/protocol/duplex/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
"tool_result_retirement_failed": "server_error",
"server_vad_unavailable": "server_error",
"semantic_vad_unavailable": "server_error",
# A bare ``timeout`` is the engine failing to answer a control RPC, not the
# caller sending a malformed request: ``duplex_omni_engine.py`` raises
# ``DuplexSessionError(code="timeout")`` when the open (or an in-session
# RPC) runs out of budget. ``config_timeout`` above is the caller's own
# config budget and stays a client error.
"timeout": "server_error",
}


Expand Down
Loading