fix(copilot): exclude heartbeat events from _events_yielded retry guard

StreamHeartbeat events are non-substantive keep-alive signals that
clients ignore. Counting them in _events_yielded incorrectly prevented
the retry-with-compaction logic from running when a tool call took
longer than 10 seconds before a prompt-too-long error.
This commit is contained in:
Zamil Majdy
2026-03-15 00:17:08 +07:00
parent c4a51d2804
commit bca314cfbe

View File

@@ -1519,7 +1519,8 @@ async def stream_chat_completion_sdk(
try:
async for event in _run_stream_attempt(state):
_events_yielded += 1
if not isinstance(event, StreamHeartbeat):
_events_yielded += 1
yield event
break # Stream completed — exit retry loop
except asyncio.CancelledError: