I sit in a office with 2 co-workers (software developers) who stopped talking to each other after one of them made a HR complain about the other one. So now when X needs to communicate or ask a question to Y, they come to me. So far I managed asking X to send an email to Y if the don't want to talk to them, possibly CC'ing the whole team (including our embedded HR supervisor) for transparency. The situation started over a triviality (at least in my opinion),and even HR dismissed it and no action was taken. Yet it's getting annoying and the environment is not really the most inviting. Is there any smart way I can communicate to X and Y, or HR, that the behavior is childish and 2 adults should do better than this?
Mention to your manager that X and Y are asking you to mediate communication and that it is hurting your effectiveness on the job. That is the manager's responsibility to deal with. If the manager does nothing, ask again and copy HR.
Insist on email for all communications that you have to mediate. Do not accept verbal requests. Forward emails once a day. This will also give you a paper-trail for your manager to see should the situation not resolve itself.
You need not play the "nice guy" all the time. Sometimes you need to push back firmly but politely. For trivial issues like these, I wouldn't go running to the manager and HR. I don't want my manager to perceive me as the guy who brings trivial issues to his notice, instead of the more pressing problems at hand.
If X approached me with a request to be the "messenger" between him and Y, I would tell him this, with a neutral (if not deadpan) tone, and leave it at that. (Switch X and Y, if Y approached with the request.)
I am afraid you will have to either ask Y yourself, or figure out a way to avoid taking Y's help.
This would give X the right message, that you are not obliged to help X work around his ego issue with Y. He will have to deal with it himself.
That said though, in this case, I honestly don't see any problem with telling X that he is an adult professional and should behave like one.