The algorithm (I had to look in the dictionary to spell it
) used in a TCAS system to indicate which way the crew should fly the airplane includes the following. (This is only part of the algorithm). The ceiling of the airplane (altitude), the airplane registration number, which antenna on both airplanes is receiving the signal (top, bottom, or both), the closure rate of the planes, and whether the airplanes are decending or climbing.
If the airplanes are approaching in level flight at the same altitude, the registration number code is used to determine which airplane will receive the climb indication and which will receive the descend. If one plane is close to its ceiling, it will receive the descend indication and also signal the other airplane what it is doing.
With the TU-154 descending, it was a combination of criteria in the 757 that gave the crew a descend indication. Later TCAS software will also give a go left or right indication, I thought it would be out by now, but it may not have been installed or did not provide an indication in this instance.
A few years ago, a F-16 was trying to intercept a 727 from behind, off the coast of the US. The 727 crew flew all over the place based on its TCAS indications trying to avoid what they thought was an impending mid-air.