3481
return;
3482
}
3484
>
// complete a turn:
3485
>
// - if `turn` is the aborted (running) turn, the client-dispatched
3486
>
// `ChatTurnCancelled` finalizes the protocol turn; drop our handle
3487
>
// so a later idle can't complete it.
3488
>
// - if `turn` is still `pending`, a queued message started it after
3489
>
// the abort and the SDK has not run it yet; completing it would
3490
>
// emit an empty `ChatTurnComplete` and orphan its real response.
3491
>
// Leave it open for its own (non-abort) idle.
3492
>
// The structural `pending` guard below already protects the
3493
>
// queued-message case; reading `e.data.aborted` is the authoritative
3494
>
// SDK signal that lets us also tear down the aborted running turn.
3495
>
if (e.data.aborted) {
3496
this._cancelActiveRepoInfoTelemetry();
3497
if (turn.isRunning) {