fix(router): annotate _stream_chunks_have_generated_content with Sequence, not list

The type_discipline_gate LIT001 check flags mutable-collection parameter
annotations. chunks is only iterated, never mutated, so Sequence is the
correct read-only annotation and clears the ratcheted budget ceiling.
This commit is contained in:
Deepanshu 2026-08-04 14:04:25 -04:00
parent 3f0f1380a4
commit ebc3845dac

View file

@ -19,7 +19,7 @@ import threading
import time
import traceback
from collections import defaultdict
from collections.abc import AsyncGenerator, Callable, Generator, Mapping
from collections.abc import AsyncGenerator, Callable, Generator, Mapping, Sequence
from functools import lru_cache
from typing import (
TYPE_CHECKING,
@ -308,7 +308,7 @@ def model_info_is_active_for_environment(model_info: Mapping[str, object] | None
_PreRoutingStrategyT = TypeVar("_PreRoutingStrategyT")
def _stream_chunks_have_generated_content(chunks: list[ModelResponseStream]) -> bool:
def _stream_chunks_have_generated_content(chunks: Sequence[ModelResponseStream]) -> bool:
for chunk in chunks:
if not chunk.choices:
continue