Being in somewhat similar position and knowing few people who have been in chokehold.
Only specific, decisive action will.
Your boyfriend need to tell Y
That ship has sailed, the train have left the station, the goose is cooked. The things have changed in the last 6 years and I'm no longer interested.
Y don't care about your boyfriend or yours comfort or state of mind. She cares what she can get from the relationship. You also need to remove any consideration of how she she "might feel". That also include not thinking what she might tell to your common friends. You don't have to tell anything about X mental.
Y is hitting on your boyfriends. Whatever history they might have (especially if it was one way, not-repricocated) don't give her any right to act that way and it's not only in bad taste but create unnecessary tensions.
- It should be your boyfriend who tell her that he don't want anything. Without saying sorry, without trying to cushion the "blow". Accepting that this might cost some friends. He should not take care for others. He should think about himself.
- If, after the initial refusal, Y will be persistent then you might act as a "deflector". Harsh talk, public outing (as in informing common friends about her doing and informing you won't attend meeting where all of you are present)
You don't have to mention, or treat this, mental issues. As I wrote before, trying to snatch someone else partner is, in most cultures, a big No-No.