@@ -496,7 +496,7 @@ function planContextRecovery(params: JsonObject, row: JsonObject, current: JsonO
496496 || ! [ "context_window_exceeded" , "host_gate" , "upstream_transport_failure" , "server_overloaded" ] . includes ( String ( failed . error_code ) )
497497 || typeof failed . upstream_turn_id !== "string" || ! failed . upstream_turn_id ) return no ;
498498 const previous = row . context_recovery == null ? null : requireJsonObject ( row . context_recovery , "reserved context recovery" ) ;
499- if ( recovery . admitted_turn != null && previous ? .failed_turn_id === failed . turn_id
499+ if ( recovery . admitted_turn != null && previous !== null && previous . failed_turn_id === failed . turn_id
500500 && Number . isSafeInteger ( previous . routing_attempt ) && Number ( previous . routing_attempt ) >= 1
501501 && Number ( previous . routing_attempt ) <= 3 && previous . version === version ) {
502502 // A crash after queue admission must adopt that exact canonical Turn,
@@ -560,7 +560,7 @@ function planRoutingRecovery(recovery: JsonObject, row: JsonObject, current: Jso
560560 failed : JsonObject , previous : JsonObject | null , version : number ) : JsonObject | null {
561561 if ( ! [ "host_gate" , "upstream_transport_failure" ] . includes ( String ( failed . error_code ) ) ) return null ;
562562 // An unfinished older reservation must finish under its original identity.
563- if ( previous ? .failed_turn_id === failed . turn_id && previous . routing_attempt === undefined ) return null ;
563+ if ( previous !== null && previous . failed_turn_id === failed . turn_id && previous . routing_attempt === undefined ) return null ;
564564 const observed = recovery . native_observation == null ? null
565565 : requireJsonObject ( recovery . native_observation , "native failure readback" ) ;
566566 if ( observed && observed . pre_execution_routing_timeout !== true ) return null ;
0 commit comments