fix(backend/copilot): set skip_transcript_upload before await delete

Move flag assignment before the await to prevent re-upload if
cancellation interrupts delete_transcript.
This commit is contained in:
Zamil Majdy
2026-03-13 17:16:09 +07:00
parent 6baeb117f7
commit 152f54f33d

View File

@@ -1059,6 +1059,9 @@ async def stream_chat_completion_sdk(
and use_resume
and user_id
):
# Set before await so cancellation during delete
# cannot allow re-upload of an oversized transcript.
skip_transcript_upload = True
logger.warning(
"%s Prompt too long with --resume — deleting "
"oversized transcript for session %s",
@@ -1073,9 +1076,6 @@ async def stream_chat_completion_sdk(
log_prefix,
del_err,
)
# Prevent the finally block from re-uploading the
# same oversized transcript.
skip_transcript_upload = True
yield StreamError(
errorText=f"SDK stream error: {stream_err}",